aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-11-01 22:48:55 +0800
committerChristian Persch <chpe@src.gnome.org>2004-11-01 22:48:55 +0800
commit748a94321a69d4220b97d75cc5e64aa15a2112c7 (patch)
tree26d0d208de9f4206e6c9d1baf3ad7a1ef26e0fc0
parent57730e8161a159fdb5a38b9dd0d19dda3bdde8e5 (diff)
downloadgsoc2013-epiphany-748a94321a69d4220b97d75cc5e64aa15a2112c7.tar.gz
gsoc2013-epiphany-748a94321a69d4220b97d75cc5e64aa15a2112c7.tar.zst
gsoc2013-epiphany-748a94321a69d4220b97d75cc5e64aa15a2112c7.zip
Don't deactivate the toolbar when another item in the same toolbar gains
2004-11-01 Christian Persch <chpe@cvs.gnome.org> * lib/widgets/ephy-location-entry.c: (ephy_location_entry_init), (ephy_location_entry_activate): * src/ephy-location-action.c: (ephy_location_action_class_init): * src/ephy-window.c: (ephy_window_init): * src/toolbar.c: (toolbar_class_init), (toolbar_finalize), (maybe_finish_activation_cb), (toolbar_activate_location), (toolbar_update_zoom), (toolbar_new): * src/toolbar.h: Don't deactivate the toolbar when another item in the same toolbar gains focus. Fixes bug #155650.
-rw-r--r--ChangeLog14
-rw-r--r--lib/widgets/ephy-location-entry.c36
-rw-r--r--src/ephy-location-action.c15
-rw-r--r--src/ephy-window.c3
-rwxr-xr-xsrc/toolbar.c98
-rw-r--r--src/toolbar.h3
6 files changed, 109 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index ead73d540..cd3d985de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2004-11-01 Christian Persch <chpe@cvs.gnome.org>
+ * lib/widgets/ephy-location-entry.c: (ephy_location_entry_init),
+ (ephy_location_entry_activate):
+ * src/ephy-location-action.c: (ephy_location_action_class_init):
+ * src/ephy-window.c: (ephy_window_init):
+ * src/toolbar.c: (toolbar_class_init), (toolbar_finalize),
+ (maybe_finish_activation_cb), (toolbar_activate_location),
+ (toolbar_update_zoom), (toolbar_new):
+ * src/toolbar.h:
+
+ Don't deactivate the toolbar when another item in the same toolbar
+ gains focus. Fixes bug #155650.
+
+2004-11-01 Christian Persch <chpe@cvs.gnome.org>
+
* embed/downloader-view.c: (update_status_icon):
Remove seconds remaining display from tooltip of tray icon.
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 6a491b82d..451efb507 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -46,7 +46,6 @@ struct _EphyLocationEntryPrivate
GtkWidget *entry;
char *before_completion;
gboolean user_changed;
- GtkWidget *shown_widget;
guint text_col;
guint action_col;
@@ -161,24 +160,6 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
}
static void
-ephy_location_entry_activation_finished (EphyLocationEntry *entry)
-{
- if (entry->priv->shown_widget)
- {
- gtk_widget_hide (entry->priv->shown_widget);
- entry->priv->shown_widget = NULL;
- }
-}
-
-static gboolean
-location_focus_out_cb (GtkWidget *leidget, GdkEventFocus *event, EphyLocationEntry *le)
-{
- ephy_location_entry_activation_finished (le);
-
- return FALSE;
-}
-
-static void
editable_changed_cb (GtkEditable *editable, EphyLocationEntry *e)
{
EphyLocationEntryPrivate *p = e->priv;
@@ -381,15 +362,10 @@ ephy_location_entry_init (EphyLocationEntry *le)
le->priv = p;
p->user_changed = TRUE;
- p->shown_widget = NULL;
ephy_location_entry_construct_contents (le);
gtk_tool_item_set_expand (GTK_TOOL_ITEM (le), TRUE);
-
- g_signal_connect (le->priv->entry,
- "focus_out_event",
- G_CALLBACK (location_focus_out_cb), le);
}
GtkWidget *
@@ -479,17 +455,7 @@ ephy_location_entry_get_location (EphyLocationEntry *le)
void
ephy_location_entry_activate (EphyLocationEntry *le)
{
- GtkWidget *toplevel, *widget;
-
- for (widget = GTK_WIDGET (le); widget != NULL; widget = widget->parent)
- {
- if (!GTK_WIDGET_VISIBLE (widget))
- {
- le->priv->shown_widget = widget;
- gtk_widget_show (le->priv->shown_widget);
- break;
- }
- }
+ GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (le->priv->entry);
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index eae9a6a6b..505a82b7e 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -328,20 +328,6 @@ ephy_location_action_get_property (GObject *object,
}
static void
-ephy_location_action_activate (GtkAction *action)
-{
- GSList *proxies;
-
- /* Note: this makes sense only for a single proxy */
- proxies = gtk_action_get_proxies (action);
-
- if (proxies && EPHY_IS_LOCATION_ENTRY (proxies->data))
- {
- ephy_location_entry_activate (EPHY_LOCATION_ENTRY (proxies->data));
- }
-}
-
-static void
ephy_location_action_class_init (EphyLocationActionClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
@@ -356,7 +342,6 @@ ephy_location_action_class_init (EphyLocationActionClass *class)
action_class->toolbar_item_type = EPHY_TYPE_LOCATION_ENTRY;
action_class->connect_proxy = connect_proxy;
action_class->disconnect_proxy = disconnect_proxy;
- action_class->activate = ephy_location_action_activate;
signals[GO_LOCATION] =
g_signal_new ("go_location",
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 4be634d05..bb5f7ad33 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2391,6 +2391,9 @@ ephy_window_init (EphyWindow *window)
window->priv->toolbar = toolbar_new (window);
window->priv->bookmarksbar = ephy_bookmarksbar_new (window);
+ g_signal_connect_swapped (window->priv->toolbar, "activation-finished",
+ G_CALLBACK (sync_chromes_visibility), window);
+
/* forward the toolbar's action_request signal to the bookmarks toolbar,
* so the user can also have bookmarks on the normal toolbar
*/
diff --git a/src/toolbar.c b/src/toolbar.c
index 67f7edb4f..2b8ffd3b7 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -63,6 +63,14 @@ enum
PROP_WINDOW
};
+enum
+{
+ ACTIVATION_FINISHED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
static GObjectClass *parent_class = NULL;
#define CONF_LOCKDOWN_DISABLE_ARBITRARY_URL "/apps/epiphany/lockdown/disable_arbitrary_url"
@@ -76,6 +84,7 @@ struct ToolbarPrivate
gboolean updating_address;
GtkWidget *spinner;
guint disable_arbitrary_url_notifier_id;
+ gulong set_focus_handler;
};
GType
@@ -250,6 +259,16 @@ toolbar_class_init (ToolbarClass *klass)
widget_class->realize = toolbar_realize;
widget_class->unrealize = toolbar_unrealize;
+ signals[ACTIVATION_FINISHED] =
+ g_signal_new ("activation-finished",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ToolbarClass, activation_finished),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
g_object_class_install_property (object_class,
PROP_WINDOW,
g_param_spec_object ("window",
@@ -454,6 +473,12 @@ toolbar_finalize (GObject *object)
Toolbar *t = EPHY_TOOLBAR (object);
EggEditableToolbar *eggtoolbar = EGG_EDITABLE_TOOLBAR (object);
+ if (t->priv->set_focus_handler != 0)
+ {
+ g_signal_handler_disconnect (t->priv->window,
+ t->priv->set_focus_handler);
+ }
+
eel_gconf_notification_remove
(t->priv->disable_arbitrary_url_notifier_id);
@@ -470,26 +495,70 @@ toolbar_finalize (GObject *object)
LOG ("Toolbar finalized")
}
-Toolbar *
-toolbar_new (EphyWindow *window)
+static void
+maybe_finish_activation_cb (EphyWindow *window,
+ GtkWidget *widget,
+ Toolbar *toolbar)
{
- return EPHY_TOOLBAR (g_object_new (EPHY_TYPE_TOOLBAR,
- "window", window,
- "ui-manager", ephy_window_get_ui_manager (window),
- NULL));
+ GtkWidget *wtoolbar = GTK_WIDGET (toolbar);
+
+ while (widget != NULL && widget != wtoolbar)
+ {
+ widget = widget->parent;
+ }
+
+ /* if widget == toolbar, the new focus widget is in the toolbar, so we
+ * don't deactivate.
+ */
+ if (widget != wtoolbar)
+ {
+ g_signal_handler_disconnect (window,
+ toolbar->priv->set_focus_handler);
+ toolbar->priv->set_focus_handler = 0;
+
+ g_signal_emit (toolbar, signals[ACTIVATION_FINISHED], 0);
+ }
}
void
-toolbar_activate_location (Toolbar *t)
+toolbar_activate_location (Toolbar *toolbar)
{
GtkActionGroup *action_group;
GtkAction *action;
+ GSList *proxies;
+ GtkWidget *entry = NULL;
+ gboolean visible;
- action_group = t->priv->action_group;
+ action_group = toolbar->priv->action_group;
action = gtk_action_group_get_action (action_group, "Location");
- gtk_action_activate (action);
-}
+ proxies = gtk_action_get_proxies (action);
+
+ if (proxies != NULL && EPHY_IS_LOCATION_ENTRY (proxies->data))
+ {
+ entry = GTK_WIDGET (proxies->data);
+ }
+
+ if (entry == NULL)
+ {
+ /* happens when the user has removed the location entry from
+ * the toolbars.
+ */
+ return;
+ }
+
+ ephy_location_entry_activate (EPHY_LOCATION_ENTRY (entry));
+
+ g_object_get (G_OBJECT (toolbar), "visible", &visible, NULL);
+ if (visible == FALSE)
+ {
+ gtk_widget_show (GTK_WIDGET (toolbar));
+ toolbar->priv->set_focus_handler =
+ g_signal_connect (toolbar->priv->window, "set-focus",
+ G_CALLBACK (maybe_finish_activation_cb),
+ toolbar);
+ }
+}
void
toolbar_spinner_start (Toolbar *t)
@@ -572,3 +641,12 @@ toolbar_update_zoom (Toolbar *t, float zoom)
action = gtk_action_group_get_action (action_group, "Zoom");
g_object_set (action, "zoom", zoom, NULL);
}
+
+Toolbar *
+toolbar_new (EphyWindow *window)
+{
+ return EPHY_TOOLBAR (g_object_new (EPHY_TYPE_TOOLBAR,
+ "window", window,
+ "ui-manager", ephy_window_get_ui_manager (window),
+ NULL));
+}
diff --git a/src/toolbar.h b/src/toolbar.h
index 8ed3a52a3..dc9cb5271 100644
--- a/src/toolbar.h
+++ b/src/toolbar.h
@@ -53,6 +53,9 @@ struct Toolbar
struct ToolbarClass
{
EggEditableToolbarClass parent_class;
+
+ /* Signals */
+ void (* activation_finished) (Toolbar *toolbar);
};
GType toolbar_get_type (void);