aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-01-16 20:09:15 +0800
committerChristian Persch <chpe@src.gnome.org>2004-01-16 20:09:15 +0800
commit55e65021a475b00569ea4d1b058086c4dbab4568 (patch)
tree96e6a905e8d6cb50dc0c32552d6a915912ec9905
parent7e36f13518cf3e2dac0e2df970a8dcd3f06e6a11 (diff)
downloadgsoc2013-epiphany-55e65021a475b00569ea4d1b058086c4dbab4568.tar
gsoc2013-epiphany-55e65021a475b00569ea4d1b058086c4dbab4568.tar.gz
gsoc2013-epiphany-55e65021a475b00569ea4d1b058086c4dbab4568.tar.bz2
gsoc2013-epiphany-55e65021a475b00569ea4d1b058086c4dbab4568.tar.lz
gsoc2013-epiphany-55e65021a475b00569ea4d1b058086c4dbab4568.tar.xz
gsoc2013-epiphany-55e65021a475b00569ea4d1b058086c4dbab4568.tar.zst
gsoc2013-epiphany-55e65021a475b00569ea4d1b058086c4dbab4568.zip
Show help for menu items in the statusbar.
2004-01-16 Christian Persch <chpe@cvs.gnome.org> * src/ephy-window.c: (menu_item_select_cb), (menu_item_deselect_cb), (disconnect_proxy_cb), (connect_proxy_cb), (setup_ui_manager), (ephy_window_init): Show help for menu items in the statusbar.
-rw-r--r--ChangeLog8
-rw-r--r--src/ephy-window.c66
2 files changed, 74 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c2ab4e71b..39f7d2199 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-16 Christian Persch <chpe@cvs.gnome.org>
+
+ * src/ephy-window.c: (menu_item_select_cb),
+ (menu_item_deselect_cb), (disconnect_proxy_cb), (connect_proxy_cb),
+ (setup_ui_manager), (ephy_window_init):
+
+ Show help for menu items in the statusbar.
+
2004-01-15 Christian Persch <chpe@cvs.gnome.org>
* embed/ephy-embed-event.c: (ephy_embed_event_get_type),
diff --git a/src/ephy-window.c b/src/ephy-window.c
index f2c0479ae..e33de91d5 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -328,6 +328,7 @@ struct EphyWindowPrivate
gboolean has_size;
guint num_tabs;
guint tab_message_cid;
+ guint help_message_cid;
guint disable_js_chrome_notifier_id;
guint show_toolbars_notifier_id;
@@ -860,6 +861,63 @@ init_menu_updaters (EphyWindow *window)
}
static void
+menu_item_select_cb (GtkMenuItem *proxy,
+ EphyWindow *window)
+{
+ GtkAction *action;
+ char *message;
+
+ action = g_object_get_data (G_OBJECT (proxy), "gtk-action");
+ g_return_if_fail (action != NULL);
+
+ g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
+ if (message)
+ {
+ gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar),
+ window->priv->help_message_cid, message);
+ g_free (message);
+ }
+}
+
+static void
+menu_item_deselect_cb (GtkMenuItem *proxy,
+ EphyWindow *window)
+{
+ gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar),
+ window->priv->help_message_cid);
+}
+
+static void
+disconnect_proxy_cb (GtkUIManager *manager,
+ GtkAction *action,
+ GtkWidget *proxy,
+ EphyWindow *window)
+{
+ if (GTK_IS_MENU_ITEM (proxy))
+ {
+ g_signal_handlers_disconnect_by_func
+ (proxy, G_CALLBACK (menu_item_select_cb), window);
+ g_signal_handlers_disconnect_by_func
+ (proxy, G_CALLBACK (menu_item_deselect_cb), window);
+ }
+}
+
+static void
+connect_proxy_cb (GtkUIManager *manager,
+ GtkAction *action,
+ GtkWidget *proxy,
+ EphyWindow *window)
+{
+ if (GTK_IS_MENU_ITEM (proxy))
+ {
+ g_signal_connect (proxy, "select",
+ G_CALLBACK (menu_item_select_cb), window);
+ g_signal_connect (proxy, "deselect",
+ G_CALLBACK (menu_item_deselect_cb), window);
+ }
+}
+
+static void
setup_ui_manager (EphyWindow *window)
{
GtkActionGroup *action_group;
@@ -880,6 +938,11 @@ setup_ui_manager (EphyWindow *window)
merge = gtk_ui_manager_new ();
+ g_signal_connect (merge, "connect_proxy",
+ G_CALLBACK (connect_proxy_cb), window);
+ g_signal_connect (merge, "disconnect_proxy",
+ G_CALLBACK (disconnect_proxy_cb), window);
+
action_group = gtk_action_group_new ("WindowActions");
gtk_action_group_set_translation_domain (action_group, NULL);
gtk_action_group_add_actions (action_group, ephy_menu_entries,
@@ -1877,6 +1940,9 @@ ephy_window_init (EphyWindow *window)
window->priv->tab_message_cid = gtk_statusbar_get_context_id
(GTK_STATUSBAR (window->priv->statusbar), "tab_message");
+ window->priv->help_message_cid = gtk_statusbar_get_context_id
+ (GTK_STATUSBAR (window->priv->statusbar), "help_message");
+
/* Initialize the menus */
window->priv->tabs_menu = ephy_tabs_menu_new (window);
window->priv->fav_menu = ephy_favorites_menu_new (window);