aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--src/ephy-tab.c60
-rw-r--r--src/ephy-tab.h3
-rw-r--r--src/ephy-tabs-menu.c5
4 files changed, 76 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c8365a2e1..84952a3d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-04-25 Christian Persch <chpe@cvs.gnome.org>
+
+ * src/ephy-tab.c: (ephy_tab_finalize), (ephy_tab_init),
+ (ephy_tab_get_zoom), (_ephy_tab_get_id):
+ * src/ephy-tab.h:
+ * src/ephy-tabs-menu.c: (notebook_page_added_cb),
+ (sync_active_tab):
+
+ Make sure each tab has its own unique ID, so accel paths don't
+ conflict between windows. Fixes bug #339548.
+
2006-04-24 Christian Perhristian Persch <chpe@cvs.gnome.org>
* configure.ac:
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 0b4a904dc..a793c167a 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -78,6 +78,8 @@
struct _EphyTabPrivate
{
+ guint id;
+
char *status_message;
char *link_message;
char *address;
@@ -146,7 +148,15 @@ typedef struct
char *features;
} PopupInfo;
-static GObjectClass *parent_class = NULL;
+static GObjectClass *parent_class;
+
+/* We need to assign unique IDs to tabs, otherwise accels get confused in the
+ * tabs menu (bug #339548). We could use a serial #, but the ID is used in the
+ * action name which is stored in a GQuark and so we should use them sparingly.
+ */
+
+static GArray *tabs_id_array = NULL;
+static guint n_tabs = 0;
/* internal functions, accessible only from this file */
static void ephy_tab_set_load_status (EphyTab *tab,
@@ -821,6 +831,7 @@ ephy_tab_finalize (GObject *object)
{
EphyTab *tab = EPHY_TAB (object);
EphyTabPrivate *priv = tab->priv;
+ guint id = priv->id;
if (priv->icon != NULL)
{
@@ -844,6 +855,14 @@ ephy_tab_finalize (GObject *object)
#endif
LOG ("EphyTab finalized %p", tab);
+
+ /* Remove the ID */
+ g_array_index (tabs_id_array, gpointer, id) = NULL;
+ if (--n_tabs == 0)
+ {
+ g_array_free (tabs_id_array, TRUE);
+ tabs_id_array = NULL;
+ }
}
static gboolean
@@ -2039,11 +2058,41 @@ ephy_tab_init (EphyTab *tab)
EphyTabPrivate *priv;
GObject *embed;
EphyFaviconCache *cache;
+ guint id;
LOG ("EphyTab initialising %p", tab);
priv = tab->priv = EPHY_TAB_GET_PRIVATE (tab);
+ /* Make tab ID */
+ ++n_tabs;
+
+ if (tabs_id_array == NULL)
+ {
+ tabs_id_array = g_array_sized_new (FALSE /* zero-terminate */,
+ TRUE /* clear */,
+ sizeof (gpointer),
+ 64 /* initial size */);
+ }
+
+ for (id = 0; id < tabs_id_array->len; ++id)
+ {
+ if (g_array_index (tabs_id_array, gpointer, id) == NULL) break;
+ }
+
+ priv->id = id;
+
+ /* Grow array if necessary */
+ if (id >= tabs_id_array->len)
+ {
+ g_array_append_val (tabs_id_array, tab);
+ g_assert (g_array_index (tabs_id_array, gpointer, id) == tab);
+ }
+ else
+ {
+ g_array_index (tabs_id_array, gpointer, id) = tab;
+ }
+
tab->priv->total_requests = 0;
tab->priv->cur_requests = 0;
tab->priv->width = -1;
@@ -2466,3 +2515,12 @@ ephy_tab_get_zoom (EphyTab *tab)
return tab->priv->zoom;
}
+
+/* private */
+guint
+_ephy_tab_get_id (EphyTab *tab)
+{
+ g_return_val_if_fail (EPHY_IS_TAB (tab), (guint) -1);
+
+ return tab->priv->id;
+}
diff --git a/src/ephy-tab.h b/src/ephy-tab.h
index 0c34d97dd..92274d293 100644
--- a/src/ephy-tab.h
+++ b/src/ephy-tab.h
@@ -121,6 +121,9 @@ gboolean ephy_tab_get_visibility (EphyTab *tab);
float ephy_tab_get_zoom (EphyTab *tab);
+/* private */
+guint _ephy_tab_get_id (EphyTab *tab);
+
G_END_DECLS
#endif
diff --git a/src/ephy-tabs-menu.c b/src/ephy-tabs-menu.c
index c79220719..553f8c033 100644
--- a/src/ephy-tabs-menu.c
+++ b/src/ephy-tabs-menu.c
@@ -54,7 +54,6 @@ struct _EphyTabsMenuPrivate
GtkActionGroup *action_group;
GtkAction *anchor_action;
guint ui_id;
- guint num;
};
enum
@@ -142,7 +141,8 @@ notebook_page_added_cb (EphyNotebook *notebook,
LOG ("tab_added_cb tab=%p", tab);
- g_snprintf (verb, sizeof (verb), ACTION_VERB_FORMAT, priv->num++);
+ g_snprintf (verb, sizeof (verb), ACTION_VERB_FORMAT,
+ _ephy_tab_get_id (tab));
action = g_object_new (GTK_TYPE_RADIO_ACTION,
"name", verb,
@@ -250,6 +250,7 @@ sync_active_tab (EphyWindow *window,
/* happens initially, since the ::active-tab comes before
* the ::tab-added signal
*/
+ /* FIXME that's not true with gtk+ 2.9 anymore */
if (action == NULL) return;
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);