aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am5
-rw-r--r--src/libappindicator/app-indicator.c65
-rw-r--r--src/libappindicator/appindicator-0.1.pc.in14
3 files changed, 79 insertions, 5 deletions
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@
+