diff options
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/libappindicator/app-indicator.c | 65 | ||||
-rw-r--r-- | src/libappindicator/appindicator-0.1.pc.in | 14 |
5 files changed, 81 insertions, 6 deletions
@@ -9,4 +9,4 @@ which gnome-autogen.sh || { USE_GNOME2_MACROS=1 \ USE_COMMON_DOC_BUILD=yes \ -gnome-autogen.sh --enable-gtk-doc +. gnome-autogen.sh --enable-gtk-doc diff --git a/configure.ac b/configure.ac index b795e93..74cef75 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,7 @@ AC_SUBST(DBUSSERVICEDIR) AC_OUTPUT([ Makefile src/Makefile +src/libappindicator/appindicator-0.1.pc data/Makefile tests/Makefile example/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 1c19d91..ee4b7a7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ CLEANFILES = DISTCLEANFILES = BUILT_SOURCES = -EXTRA_DIST = +EXTRA_DIST = libappindicator/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 ab95ee5..5c04819 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -658,17 +658,74 @@ activate_menuitem (DbusmenuMenuitem *mi, gpointer user_data) } 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))); - g_signal_connect (G_OBJECT(child), + + 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@ + |