[anjuta] bgo#577924 – Fixing AnjutaStatusbar for displaying menu tags
- From: Johannes Schmid <jhs src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjuta] bgo#577924 – Fixing AnjutaStatusbar for displaying menu tags
- Date: Sun, 21 Jun 2009 15:12:12 -0400 (EDT)
commit 500f62ad65544b59aecc6a8429cd5210ba48790d
Author: Johannes Schmid <jhs gnome org>
Date: Sun Jun 21 21:10:41 2009 +0200
bgo#577924 â?? Fixing AnjutaStatusbar for displaying menu tags
Code "stolen" from gedit to display the "tooltip" property of the menu item in the status bar.
src/anjuta-app.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 0 deletions(-)
---
diff --git a/src/anjuta-app.c b/src/anjuta-app.c
index 0e293d6..e1d4aae 100644
--- a/src/anjuta-app.c
+++ b/src/anjuta-app.c
@@ -57,6 +57,63 @@ static gpointer parent_class = NULL;
static GtkToolbarStyle style = -1;
static void
+menu_item_select_cb (GtkMenuItem *proxy,
+ AnjutaApp *app)
+{
+ GtkAction *action;
+ char *message;
+
+ action = gtk_widget_get_action (GTK_WIDGET (proxy));
+ g_return_if_fail (action != NULL);
+
+ g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
+ if (message)
+ {
+ anjuta_status_push (app->status, "%s", message);
+ g_free (message);
+ }
+}
+
+static void
+menu_item_deselect_cb (GtkMenuItem *proxy,
+ AnjutaApp *app)
+{
+ anjuta_status_pop (app->status);
+}
+
+
+static void
+connect_proxy_cb (GtkUIManager *manager,
+ GtkAction *action,
+ GtkWidget *proxy,
+ AnjutaApp *app)
+{
+ if (GTK_IS_MENU_ITEM (proxy))
+ {
+ g_signal_connect (proxy, "select",
+ G_CALLBACK (menu_item_select_cb), app);
+ g_signal_connect (proxy, "deselect",
+ G_CALLBACK (menu_item_deselect_cb), app);
+ }
+}
+
+static void
+disconnect_proxy_cb (GtkUIManager *manager,
+ GtkAction *action,
+ GtkWidget *proxy,
+ AnjutaApp *app)
+{
+ if (GTK_IS_MENU_ITEM (proxy))
+ {
+ g_signal_handlers_disconnect_by_func
+ (proxy, G_CALLBACK (menu_item_select_cb), app);
+ g_signal_handlers_disconnect_by_func
+ (proxy, G_CALLBACK (menu_item_deselect_cb), app);
+ }
+}
+
+
+static void
on_toolbar_style_changed (AnjutaPreferences* prefs,
const gchar* key,
const gchar* tb_style,
@@ -393,6 +450,15 @@ anjuta_app_instance_init (AnjutaApp *app)
/* UI engine */
app->ui = anjuta_ui_new ();
g_object_add_weak_pointer (G_OBJECT (app->ui), (gpointer)&app->ui);
+ /* show tooltips in the statusbar */
+ g_signal_connect (app->ui,
+ "connect_proxy",
+ G_CALLBACK (connect_proxy_cb),
+ app);
+ g_signal_connect (app->ui,
+ "disconnect_proxy",
+ G_CALLBACK (disconnect_proxy_cb),
+ app);
/* Plugin Manager */
plugins_dirs = g_list_prepend (plugins_dirs, PACKAGE_PLUGIN_DIR);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]