diff options
author | Ted Gould <ted@gould.cx> | 2009-12-09 12:02:20 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2009-12-09 12:02:20 -0600 |
commit | b67737d41f7c55e5d440e2eebd6d6adca05fb419 (patch) | |
tree | 34d9a0493282c6764cad571a5b6563df9c5bec9f /src | |
parent | ec3c1bee24ce4da8bef326e8f2b659c846ff35b7 (diff) | |
parent | bae74eff1707ab9abac1f6122506ff1b7cc20098 (diff) | |
download | libayatana-appindicator-b67737d41f7c55e5d440e2eebd6d6adca05fb419.tar.gz libayatana-appindicator-b67737d41f7c55e5d440e2eebd6d6adca05fb419.tar.bz2 libayatana-appindicator-b67737d41f7c55e5d440e2eebd6d6adca05fb419.zip |
* Upstream update
* Adding in documentation
* Adding a pkg-config .pc file for libappindicator
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/libappindicator/app-indicator.c | 74 | ||||
-rw-r--r-- | src/libappindicator/appindicator-0.1.pc.in | 14 |
3 files changed, 89 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 1c19d91..f1878a4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ CLEANFILES = DISTCLEANFILES = BUILT_SOURCES = -EXTRA_DIST = +EXTRA_DIST = appindicator-0.1.pc.in include $(top_srcdir)/Makefile.am.enum include $(top_srcdir)/Makefile.am.marshal @@ -57,6 +57,9 @@ glib_marshal_prefix = _application_service_marshal # Library ################################## +pkgconfig_DATA = libappindicator/appindicator-0.1.pc +pkgconfigdir = $(libdir)/pkgconfig + glib_enum_h = libappindicator/app-indicator-enum-types.h glib_enum_c = libappindicator/app-indicator-enum-types.c glib_enum_headers = $(libappindicator_headers) diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index f61723d..6f4a6fd 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -633,16 +633,84 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) } static void +activate_menuitem (DbusmenuMenuitem *mi, gpointer user_data) +{ + GtkWidget *widget = (GtkWidget *)user_data; + + gtk_menu_item_activate (GTK_MENU_ITEM (widget)); +} + +static void +menuitem_iterate (GtkWidget *widget, + gpointer data) +{ + if (GTK_IS_LABEL (widget)) + { + DbusmenuMenuitem *child = (DbusmenuMenuitem *)data; + + dbusmenu_menuitem_property_set (child, + DBUSMENU_MENUITEM_PROP_LABEL, + gtk_label_get_text (GTK_LABEL (widget))); + } +} + +static void container_iterate (GtkWidget *widget, gpointer data) { DbusmenuMenuitem *root = (DbusmenuMenuitem *)data; DbusmenuMenuitem *child; + const gchar *label; + gboolean label_set = FALSE; + + label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); child = dbusmenu_menuitem_new (); - dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_LABEL, - gtk_menu_item_get_label (GTK_MENU_ITEM (widget))); + + if (GTK_IS_IMAGE_MENU_ITEM (widget)) + { + GtkWidget *image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget)); + + if (gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_STOCK) + { + GtkStockItem stock; + + gtk_stock_lookup (GTK_IMAGE (image)->data.stock.stock_id, &stock); + + dbusmenu_menuitem_property_set (child, + DBUSMENU_MENUITEM_PROP_ICON, + GTK_IMAGE (image)->data.stock.stock_id); + + if (stock.label != NULL) + { + dbusmenu_menuitem_property_set (child, + DBUSMENU_MENUITEM_PROP_LABEL, + stock.label); + label_set = TRUE; + } + } + } + + if (!label_set) + { + if (label != NULL) + { + dbusmenu_menuitem_property_set (child, + DBUSMENU_MENUITEM_PROP_LABEL, + label); + } + else + { + /* find label child widget */ + gtk_container_forall (GTK_CONTAINER (widget), + menuitem_iterate, + child); + } + } + + g_signal_connect (G_OBJECT (child), + DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, + G_CALLBACK (activate_menuitem), widget); dbusmenu_menuitem_child_append (root, child); } diff --git a/src/libappindicator/appindicator-0.1.pc.in b/src/libappindicator/appindicator-0.1.pc.in new file mode 100644 index 0000000..b80fded --- /dev/null +++ b/src/libappindicator/appindicator-0.1.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +bindir=@bindir@ +includedir=@includedir@ + +Cflags: -I${includedir}/libappindicator-0.1 +Requires: dbusmenu-glib gtk+-2.0 +Libs: -L${libdir} -lappindicator + +Name: appindicator-0.1 +Description: Application indicators +Version: @VERSION@ + |