From 4ec15094555e5bc71a46f16ea9bf101e41e59631 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 8 Feb 2010 17:04:25 -0600 Subject: First pass, get the string. --- src/session-service.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/session-service.c b/src/session-service.c index e89a9a0..3cbb29c 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -481,7 +481,9 @@ rebuild_items (DbusmenuMenuitem *root, ensure_gconf_client (); switch_menuitem = dbusmenu_menuitem_new (); - dbusmenu_menuitem_property_set (switch_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, _("Switch User...")); + gchar * switchlabel = g_strdup_printf(_("Switch from %s..."), g_get_user_name()); + dbusmenu_menuitem_property_set (switch_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, switchlabel); + g_free(switchlabel); dbusmenu_menuitem_child_append (root, switch_menuitem); g_signal_connect (G_OBJECT (switch_menuitem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_new_session), NULL); -- cgit v1.2.3 From b1d66f9d77fa960d7e59353e1e33250060493ec6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 13:16:32 -0600 Subject: Refactoring so the menu is created in init. --- src/indicator-session.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index dda8c76..2017fff 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -51,6 +51,8 @@ struct _IndicatorSessionClass { struct _IndicatorSession { IndicatorObject parent; IndicatorServiceManager * service; + GtkImage * status_image; + GtkMenu * menu; }; GType indicator_session_get_type (void); @@ -96,6 +98,9 @@ indicator_session_init (IndicatorSession *self) /* Now let's fire these guys up. */ self->service = indicator_service_manager_new_version(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_VERSION); + self->status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU)); + self->menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); + return; } @@ -130,9 +135,8 @@ get_label (IndicatorObject * io) static GtkImage * get_icon (IndicatorObject * io) { - GtkImage * status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU)); - gtk_widget_show(GTK_WIDGET(status_image)); - return status_image; + gtk_widget_show(GTK_WIDGET(INDICATOR_SESSION(io)->status_image)); + return INDICATOR_SESSION(io)->status_image; } /* Indicator based function to get the menu for the whole @@ -141,7 +145,7 @@ get_icon (IndicatorObject * io) static GtkMenu * get_menu (IndicatorObject * io) { - return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); + return INDICATOR_SESSION(io)->menu; } -- cgit v1.2.3 From 70d29699c60a2507e457357a72eb484644f67dfd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 13:18:17 -0600 Subject: Woot, a dbusmenu, much better. --- src/indicator-session.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index 2017fff..840965e 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -52,7 +52,7 @@ struct _IndicatorSession { IndicatorObject parent; IndicatorServiceManager * service; GtkImage * status_image; - GtkMenu * menu; + DbusmenuGtkMenu * menu; }; GType indicator_session_get_type (void); @@ -99,7 +99,7 @@ indicator_session_init (IndicatorSession *self) self->service = indicator_service_manager_new_version(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_VERSION); self->status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU)); - self->menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); + self->menu = dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT); return; } @@ -145,7 +145,7 @@ get_icon (IndicatorObject * io) static GtkMenu * get_menu (IndicatorObject * io) { - return INDICATOR_SESSION(io)->menu; + return GTK_MENU(INDICATOR_SESSION(io)->menu); } -- cgit v1.2.3 From 51ac202d7332f31df4912290bb180e2b4a7d413d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 13:26:17 -0600 Subject: Building shared names for dbusmenu objects. --- src/Makefile.am | 2 ++ src/dbusmenu-shared.h | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 src/dbusmenu-shared.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 2c607f5..fdbf466 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,6 +11,7 @@ sessionlib_LTLIBRARIES = libsession.la libsession_la_SOURCES = \ indicator-session.c \ dbus-shared-names.h \ + dbusmenu-shared.h \ users-service-client.h libsession_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror libsession_la_LIBADD = $(APPLET_LIBS) @@ -42,6 +43,7 @@ indicator_session_service_SOURCES = \ lock-helper.c \ lock-helper.h \ session-service.c \ + dbusmenu-shared.h \ gtk-dialog/gconf-helper.c \ users-service-dbus.h \ users-service-dbus.c \ diff --git a/src/dbusmenu-shared.h b/src/dbusmenu-shared.h new file mode 100644 index 0000000..1ef179b --- /dev/null +++ b/src/dbusmenu-shared.h @@ -0,0 +1,4 @@ + +#define MENU_SWITCH_TYPE "x-canonical-switch-from" +#define MENU_SWITCH_USER "x-canonical-switch-username" + -- cgit v1.2.3 From a36272659c9dbcff0c083a2083417ac65d876c3b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 14:53:20 -0600 Subject: Setting up the type handler --- src/indicator-session.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index 840965e..a1f83d1 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -33,6 +33,7 @@ with this program. If not, see . #include #include "dbus-shared-names.h" +#include "dbusmenu-shared.h" #define INDICATOR_SESSION_TYPE (indicator_session_get_type ()) #define INDICATOR_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_SESSION_TYPE, IndicatorSession)) @@ -65,6 +66,7 @@ INDICATOR_SET_TYPE(INDICATOR_SESSION_TYPE) static GtkLabel * get_label (IndicatorObject * io); static GtkImage * get_icon (IndicatorObject * io); static GtkMenu * get_menu (IndicatorObject * io); +static gboolean build_menu_switch (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); static void indicator_session_class_init (IndicatorSessionClass *klass); static void indicator_session_init (IndicatorSession *self); @@ -101,6 +103,9 @@ indicator_session_init (IndicatorSession *self) self->status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU)); self->menu = dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT); + DbusmenuClient * client = DBUSMENU_CLIENT(dbusmenu_gtkmenu_get_client(self->menu)); + dbusmenu_client_add_type_handler(client, MENU_SWITCH_TYPE, build_menu_switch); + return; } @@ -148,4 +153,13 @@ get_menu (IndicatorObject * io) return GTK_MENU(INDICATOR_SESSION(io)->menu); } +/* This function checks to see if the user name is short enough + to not need ellipsing itself, or if, it will get ellipsed by + the standard label processor. */ +static gboolean +build_menu_switch (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) +{ + + return FALSE; +} -- cgit v1.2.3 From 2398976ff0152f8cdbd1c2ec84663b33598abd7d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 16:08:36 -0600 Subject: Fleshing out the menu_switch function with a function that looks at the length of the label and sees if we need to ellipsize it or not. --- src/indicator-session.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index a1f83d1..7e9bb45 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -22,6 +22,7 @@ with this program. If not, see . #include #include +#include #include #include @@ -153,13 +154,81 @@ get_menu (IndicatorObject * io) return GTK_MENU(INDICATOR_SESSION(io)->menu); } +static void +switch_property_change (DbusmenuMenuitem * item, const gchar * property, const GValue * value, gpointer user_data) +{ + if (g_strcmp0(property, MENU_SWITCH_USER) != 0) { + return; + } + + gchar * finalstring = NULL; + gboolean set_ellipsize = FALSE; + + /* If there's a NULL string of some type, then we want to + go back to our old 'Switch User' which isn't great but + eh, this error condition should never happen. */ + if (value == NULL || g_value_get_string(value) == NULL || g_value_get_string(value)[0] == '\0') { + finalstring = _("Switch User..."); + set_ellipsize = FALSE; + } + + if (finalstring == NULL) { + const gchar * username = g_value_get_string(value); + GtkWidget * off = gtk_offscreen_window_new(); + GtkWidget * label = gtk_label_new(username); + gtk_container_add(GTK_CONTAINER(off), label); + GdkPixmap * pixmap = gtk_offscreen_window_get_pixmap(GTK_OFFSCREEN_WINDOW(off)); + + gint width, height; + gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &width, &height); + + GtkStyle * style = gtk_widget_get_style(label); /* TODO: Switch to menuitem label */ + gint point = pango_font_description_get_size(style->font_desc); + + gdouble dpi = gdk_screen_get_resolution(gdk_screen_get_default()); + + gdouble pixels_per_em = point * dpi / 72.0f; + gdouble ems = width / pixels_per_em; + + /* TODO: We need some way to remove the elipsis from appearing + twice in the label. Not sure how to do that yet. */ + finalstring = g_strdup_printf(_("Switch from %s..."), username); + if (ems >= 20.0f) { + set_ellipsize = TRUE; + } else { + set_ellipsize = FALSE; + } + } + + GtkMenuItem * gmi = dbusmenu_gtkclient_menuitem_get(DBUSMENU_GTKCLIENT(user_data), item); + gtk_menu_item_set_label(gmi, finalstring); + + GtkLabel * label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(gmi))); + if (label != NULL) { + if (set_ellipsize) { + gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_NONE); + } else { + gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_END); + } + } + + 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 the standard label processor. */ static gboolean build_menu_switch (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) { + GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_menu_item_new()); + /* TODO: Setup style update */ + + 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); + switch_property_change(newitem, MENU_SWITCH_USER, dbusmenu_menuitem_property_get_value(newitem, MENU_SWITCH_USER), client); return FALSE; } -- cgit v1.2.3 From ccaa76fac008a5de7b8eacf3f70dfe96dd15ce16 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 16:12:01 -0600 Subject: Switching the menu item that we're creating. --- src/session-service.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/session-service.c b/src/session-service.c index 3cbb29c..b414328 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -38,6 +38,7 @@ with this program. If not, see . #include #include "dbus-shared-names.h" +#include "dbusmenu-shared.h" #include "gtk-dialog/gconf-helper.h" @@ -481,9 +482,8 @@ rebuild_items (DbusmenuMenuitem *root, ensure_gconf_client (); switch_menuitem = dbusmenu_menuitem_new (); - gchar * switchlabel = g_strdup_printf(_("Switch from %s..."), g_get_user_name()); - dbusmenu_menuitem_property_set (switch_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, switchlabel); - g_free(switchlabel); + dbusmenu_menuitem_property_set (switch_menuitem, DBUSMENU_MENUITEM_PROP_TYPE, MENU_SWITCH_TYPE); + dbusmenu_menuitem_property_set (switch_menuitem, MENU_SWITCH_USER, g_get_user_name()); dbusmenu_menuitem_child_append (root, switch_menuitem); g_signal_connect (G_OBJECT (switch_menuitem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_new_session), NULL); -- cgit v1.2.3 From 54cd89f665c38244b811508d5995010c9a9d08e0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 16:17:54 -0600 Subject: Get returns in better shape --- src/indicator-session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index 7e9bb45..f0ec5a4 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -223,6 +223,9 @@ static gboolean build_menu_switch (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) { GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_menu_item_new()); + if (gmi == NULL) { + return FALSE; + } /* TODO: Setup style update */ dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent); @@ -230,5 +233,5 @@ build_menu_switch (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusme g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(switch_property_change), client); switch_property_change(newitem, MENU_SWITCH_USER, dbusmenu_menuitem_property_get_value(newitem, MENU_SWITCH_USER), client); - return FALSE; + return TRUE; } -- cgit v1.2.3 From d2bc464709c47d37d110179c291a914fc989f148 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 16:22:51 -0600 Subject: Make sure to realize the offscreen window --- src/indicator-session.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index f0ec5a4..81453f2 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -177,6 +177,7 @@ switch_property_change (DbusmenuMenuitem * item, const gchar * property, const G GtkWidget * off = gtk_offscreen_window_new(); GtkWidget * label = gtk_label_new(username); gtk_container_add(GTK_CONTAINER(off), label); + gtk_widget_realize(off); GdkPixmap * pixmap = gtk_offscreen_window_get_pixmap(GTK_OFFSCREEN_WINDOW(off)); gint width, height; -- cgit v1.2.3 From 5540e6c1c6321ec9c9d10060dc5917d842bcf08a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 20:37:28 -0600 Subject: Switching to using Pango to get the width --- src/indicator-session.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index 81453f2..c685203 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -161,6 +161,7 @@ switch_property_change (DbusmenuMenuitem * item, const gchar * property, const G return; } + GtkMenuItem * gmi = dbusmenu_gtkclient_menuitem_get(DBUSMENU_GTKCLIENT(user_data), item); gchar * finalstring = NULL; gboolean set_ellipsize = FALSE; @@ -174,22 +175,25 @@ switch_property_change (DbusmenuMenuitem * item, const gchar * property, const G if (finalstring == NULL) { const gchar * username = g_value_get_string(value); - GtkWidget * off = gtk_offscreen_window_new(); - GtkWidget * label = gtk_label_new(username); - gtk_container_add(GTK_CONTAINER(off), label); - gtk_widget_realize(off); - GdkPixmap * pixmap = gtk_offscreen_window_get_pixmap(GTK_OFFSCREEN_WINDOW(off)); + GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(gmi)); /* TODO: Switch to menuitem label */ + + PangoLayout * layout = pango_layout_new(gtk_widget_get_pango_context(GTK_WIDGET(gmi))); + pango_layout_set_text(layout, username, -1); + pango_layout_set_font_description(layout, style->font_desc); gint width, height; - gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &width, &height); + pango_layout_get_pixel_size(layout, &width, &height); + g_debug("Username width %dpx", width); - GtkStyle * style = gtk_widget_get_style(label); /* TODO: Switch to menuitem label */ gint point = pango_font_description_get_size(style->font_desc); + g_debug("Font size %d pt", point); gdouble dpi = gdk_screen_get_resolution(gdk_screen_get_default()); + g_debug("Screen DPI %f", dpi); gdouble pixels_per_em = point * dpi / 72.0f; gdouble ems = width / pixels_per_em; + g_debug("Username width %fem", ems); /* TODO: We need some way to remove the elipsis from appearing twice in the label. Not sure how to do that yet. */ @@ -201,7 +205,6 @@ switch_property_change (DbusmenuMenuitem * item, const gchar * property, const G } } - GtkMenuItem * gmi = dbusmenu_gtkclient_menuitem_get(DBUSMENU_GTKCLIENT(user_data), item); gtk_menu_item_set_label(gmi, finalstring); GtkLabel * label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(gmi))); -- cgit v1.2.3 From 78fa67257e72eb43d2a4f4d82d51f881af8ad91c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 20:44:35 -0600 Subject: Calculating font size with PANGO_SCALE getting involved --- src/indicator-session.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index c685203..f0232c6 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -181,17 +181,17 @@ switch_property_change (DbusmenuMenuitem * item, const gchar * property, const G pango_layout_set_text(layout, username, -1); pango_layout_set_font_description(layout, style->font_desc); - gint width, height; - pango_layout_get_pixel_size(layout, &width, &height); + gint width; + pango_layout_get_pixel_size(layout, &width, NULL); g_debug("Username width %dpx", width); gint point = pango_font_description_get_size(style->font_desc); - g_debug("Font size %d pt", point); + g_debug("Font size %f pt", (gfloat)point / PANGO_SCALE); gdouble dpi = gdk_screen_get_resolution(gdk_screen_get_default()); g_debug("Screen DPI %f", dpi); - gdouble pixels_per_em = point * dpi / 72.0f; + gdouble pixels_per_em = ((point * dpi) / 72.0f) / PANGO_SCALE; gdouble ems = width / pixels_per_em; g_debug("Username width %fem", ems); -- cgit v1.2.3 From 93c4617240197202846fd9305f2154f885d17224 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 20:45:09 -0600 Subject: Fixing a value --- src/indicator-session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index f0232c6..9a5385e 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -210,9 +210,9 @@ switch_property_change (DbusmenuMenuitem * item, const gchar * property, const G GtkLabel * label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(gmi))); if (label != NULL) { if (set_ellipsize) { - gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_NONE); - } else { gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_END); + } else { + gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_NONE); } } -- cgit v1.2.3 From a2cf14bc54d903dbc51557ff6d06e38f92714010 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 22:48:04 -0600 Subject: Adding in the ability to monitor style changes and re-evaluate. --- src/indicator-session.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3 From c6661b02cfede0afff6102d7ebff656a166e0b29 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Feb 2010 22:48:43 -0600 Subject: Removing comment. --- src/indicator-session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/indicator-session.c b/src/indicator-session.c index 4dc3d11..1b9629b 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -175,7 +175,7 @@ switch_property_change (DbusmenuMenuitem * item, const gchar * property, const G if (finalstring == NULL) { const gchar * username = g_value_get_string(value); - GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(gmi)); /* TODO: Switch to menuitem label */ + GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(gmi)); PangoLayout * layout = pango_layout_new(gtk_widget_get_pango_context(GTK_WIDGET(gmi))); pango_layout_set_text(layout, username, -1); -- cgit v1.2.3