aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-11 22:48:04 -0600
committerTed Gould <ted@gould.cx>2010-02-11 22:48:04 -0600
commita2cf14bc54d903dbc51557ff6d06e38f92714010 (patch)
tree6fbcd22d7c2110d43d3fb4e795b1073b849e0d29
parent93c4617240197202846fd9305f2154f885d17224 (diff)
downloadayatana-indicator-session-a2cf14bc54d903dbc51557ff6d06e38f92714010.tar.gz
ayatana-indicator-session-a2cf14bc54d903dbc51557ff6d06e38f92714010.tar.bz2
ayatana-indicator-session-a2cf14bc54d903dbc51557ff6d06e38f92714010.zip
Adding in the ability to monitor style changes and re-evaluate.
-rw-r--r--src/indicator-session.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c
index 9a5385e..4dc3d11 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -219,6 +219,20 @@ switch_property_change (DbusmenuMenuitem * item, const gchar * property, const G
return;
}
+static const gchar * dbusmenu_item_data = "dbusmenu-item";
+
+/* Callback for when the style changes so we can reevaluate the
+ size of the user name with the potentially new font. */
+static void
+switch_style_set (GtkWidget * widget, GtkStyle * prev_style, gpointer user_data)
+{
+ DbusmenuGtkClient * client = DBUSMENU_GTKCLIENT(user_data);
+ DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(g_object_get_data(G_OBJECT(widget), dbusmenu_item_data));
+
+ switch_property_change(mi, MENU_SWITCH_USER, dbusmenu_menuitem_property_get_value(mi, MENU_SWITCH_USER), client);
+ return;
+}
+
/* This function checks to see if the user name is short enough
to not need ellipsing itself, or if, it will get ellipsed by
@@ -230,11 +244,12 @@ build_menu_switch (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusme
if (gmi == NULL) {
return FALSE;
}
- /* TODO: Setup style update */
+ g_object_set_data(G_OBJECT(gmi), dbusmenu_item_data, newitem);
dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent);
g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(switch_property_change), client);
+ g_signal_connect(G_OBJECT(gmi), "style-set", G_CALLBACK(switch_style_set), client);
switch_property_change(newitem, MENU_SWITCH_USER, dbusmenu_menuitem_property_get_value(newitem, MENU_SWITCH_USER), client);
return TRUE;