aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-17 16:24:00 -0500
committerTed Gould <ted@gould.cx>2010-03-17 16:24:00 -0500
commit23b8dc273347c6782667869e3de8f1dff059937d (patch)
tree14034fc1f39b9dcc470b2ea873e1a1a09338992a
parent7ddf670002a548fd7eb980b88e9f1b2fbf1c9eeb (diff)
downloadayatana-indicator-session-23b8dc273347c6782667869e3de8f1dff059937d.tar.gz
ayatana-indicator-session-23b8dc273347c6782667869e3de8f1dff059937d.tar.bz2
ayatana-indicator-session-23b8dc273347c6782667869e3de8f1dff059937d.zip
Building an icon based on teh icon props
-rw-r--r--src/indicator-session.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c
index c21579a..e3444c0 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -28,6 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <libdbusmenu-gtk/menu.h>
#include <dbus/dbus-glib.h>
@@ -223,6 +224,23 @@ new_user_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuCl
GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_menu_item_new());
GtkWidget * hbox = gtk_hbox_new(FALSE, 0);
+ GtkWidget * usericon = NULL;
+ const gchar * icon_name = dbusmenu_menuitem_property_get(newitem, USER_ITEM_PROP_ICON);
+ if (icon_name != NULL && icon_name[0] != '\0') {
+ if (g_strcmp0(icon_name, USER_ITEM_ICON_DEFAULT) == 0) {
+ GIcon * gicon = g_themed_icon_new_with_default_fallbacks("stock-user-panel");
+ usericon = gtk_image_new_from_gicon(gicon, GTK_ICON_SIZE_MENU);
+ g_object_unref(gicon);
+ } else {
+ usericon = gtk_image_new_from_file(icon_name);
+ }
+ }
+ if (usericon != NULL) {
+ gtk_misc_set_alignment(GTK_MISC(usericon), 0.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), usericon, FALSE, FALSE, 0);
+ gtk_widget_show(usericon);
+ }
+
GtkWidget * label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, USER_ITEM_PROP_NAME));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);