From 95b5ea90de66f465398fbdf9779e342395ea327a Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Wed, 23 Dec 2009 16:48:54 +0100 Subject: Make it work on KDE --- src/libappindicator/app-indicator.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index bb68cb2..4baf4ef 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -32,6 +32,7 @@ License version 3 and version 2.1 along with this program. If not, see #endif #include +#include #include #include @@ -293,7 +294,7 @@ app_indicator_init (AppIndicator *self) } dbus_g_connection_register_g_object(priv->connection, - "/need/a/path", + "/StatusNotifierItem", G_OBJECT(self)); self->priv = priv; @@ -513,7 +514,8 @@ check_connect (AppIndicator *self) return; } - org_ayatana_indicator_application_NotificationWatcher_register_service_async(priv->watcher_proxy, "/need/a/path", register_service_cb, self); + const char * name = dbus_bus_get_unique_name(dbus_g_connection_get_connection(priv->connection)); + org_kde_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, name, register_service_cb, self); return; } -- cgit v1.2.3 From dd2ed951b8aeb16671bebd2ea104953252ab54a5 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Wed, 23 Dec 2009 17:00:30 +0100 Subject: Previous commit was not meant to be pushed to trunk Revert my mess --- src/libappindicator/app-indicator.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 4baf4ef..bb68cb2 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -32,7 +32,6 @@ License version 3 and version 2.1 along with this program. If not, see #endif #include -#include #include #include @@ -294,7 +293,7 @@ app_indicator_init (AppIndicator *self) } dbus_g_connection_register_g_object(priv->connection, - "/StatusNotifierItem", + "/need/a/path", G_OBJECT(self)); self->priv = priv; @@ -514,8 +513,7 @@ check_connect (AppIndicator *self) return; } - const char * name = dbus_bus_get_unique_name(dbus_g_connection_get_connection(priv->connection)); - org_kde_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, name, register_service_cb, self); + org_ayatana_indicator_application_NotificationWatcher_register_service_async(priv->watcher_proxy, "/need/a/path", register_service_cb, self); return; } -- cgit v1.2.3 From 0aaa6a25ab78a044e1b004a6943d2b6f07598c17 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Thu, 7 Jan 2010 13:29:50 +0100 Subject: Use org.freedesktop namespace --- src/libappindicator/app-indicator.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index bb68cb2..b4a4ed6 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -32,6 +32,7 @@ License version 3 and version 2.1 along with this program. If not, see #endif #include +#include #include #include @@ -293,7 +294,7 @@ app_indicator_init (AppIndicator *self) } dbus_g_connection_register_g_object(priv->connection, - "/need/a/path", + "/StatusNotifierItem", G_OBJECT(self)); self->priv = priv; @@ -513,7 +514,8 @@ check_connect (AppIndicator *self) return; } - org_ayatana_indicator_application_NotificationWatcher_register_service_async(priv->watcher_proxy, "/need/a/path", register_service_cb, self); + const char * name = dbus_bus_get_unique_name(dbus_g_connection_get_connection(priv->connection)); + org_freedesktop_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, name, register_service_cb, self); return; } -- cgit v1.2.3 From bf0be373898c44e6e9898aeac5813704fca7889e Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Thu, 7 Jan 2010 09:27:01 -0600 Subject: Checkmark support --- src/libappindicator/app-indicator.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index bb68cb2..8e03e07 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -686,15 +686,29 @@ container_iterate (GtkWidget *widget, if (GTK_IS_SEPARATOR_MENU_ITEM (widget)) { + label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); + dbusmenu_menuitem_property_set (child, "type", DBUSMENU_CLIENT_TYPES_SEPARATOR); } else { - label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); + if (GTK_IS_CHECK_MENU_ITEM (widget)) + { + label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); + + dbusmenu_menuitem_property_set (child, + "type", + DBUSMENU_MENUITEM_TOGGLE_CHECK); - if (GTK_IS_IMAGE_MENU_ITEM (widget)) + dbusmenu_menuitem_property_set (child, + DBUSMENU_MENUITEM_PROP_LABEL, + label); + + label_set = TRUE; + } + else if (GTK_IS_IMAGE_MENU_ITEM (widget)) { GtkWidget *image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget)); -- cgit v1.2.3 From 6bde6a4be29ba003b483b9db76226a95419ce115 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Thu, 7 Jan 2010 10:26:42 -0600 Subject: More checkbox related updates. --- src/libappindicator/app-indicator.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 8e03e07..ee3fd7c 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -686,8 +686,6 @@ container_iterate (GtkWidget *widget, if (GTK_IS_SEPARATOR_MENU_ITEM (widget)) { - label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); - dbusmenu_menuitem_property_set (child, "type", DBUSMENU_CLIENT_TYPES_SEPARATOR); @@ -699,13 +697,17 @@ container_iterate (GtkWidget *widget, label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); dbusmenu_menuitem_property_set (child, - "type", + DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE, DBUSMENU_MENUITEM_TOGGLE_CHECK); dbusmenu_menuitem_property_set (child, DBUSMENU_MENUITEM_PROP_LABEL, label); + dbusmenu_menuitem_property_set (child, + DBUSMENU_MENUITEM_PROP_TOGGLE_CHECKED, + "checked"); + label_set = TRUE; } else if (GTK_IS_IMAGE_MENU_ITEM (widget)) -- cgit v1.2.3 From 17476bdd4ceaf0b3ecc279a555ac82838e2d8016 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Thu, 7 Jan 2010 18:10:44 +0100 Subject: Revert part of previous revision: pass the path, not the service name to register_status_item --- src/libappindicator/app-indicator.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index b4a4ed6..52c5f46 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -32,7 +32,6 @@ License version 3 and version 2.1 along with this program. If not, see #endif #include -#include #include #include @@ -294,7 +293,7 @@ app_indicator_init (AppIndicator *self) } dbus_g_connection_register_g_object(priv->connection, - "/StatusNotifierItem", + "/need/a/path", G_OBJECT(self)); self->priv = priv; @@ -514,8 +513,7 @@ check_connect (AppIndicator *self) return; } - const char * name = dbus_bus_get_unique_name(dbus_g_connection_get_connection(priv->connection)); - org_freedesktop_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, name, register_service_cb, self); + org_freedesktop_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, "/need/a/path", register_service_cb, self); return; } -- cgit v1.2.3 From a60f25e5ca657a7c781bed90fd67020c7caa2320 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Thu, 7 Jan 2010 13:01:01 -0600 Subject: Toggle events --- src/libappindicator/app-indicator.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index ee3fd7c..ec598db 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -659,6 +659,14 @@ activate_menuitem (DbusmenuMenuitem *mi, gpointer user_data) gtk_menu_item_activate (GTK_MENU_ITEM (widget)); } +static void +widget_toggled (GtkWidget *widget, DbusmenuMenuitem *mi) +{ + dbusmenu_menuitem_property_set (mi, + DBUSMENU_MENUITEM_PROP_TOGGLE_CHECKED, + gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED); +} + static void menuitem_iterate (GtkWidget *widget, gpointer data) @@ -694,21 +702,29 @@ container_iterate (GtkWidget *widget, { if (GTK_IS_CHECK_MENU_ITEM (widget)) { + GtkCheckMenuItem *check; + + check = GTK_CHECK_MENU_ITEM (widget); label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget)); dbusmenu_menuitem_property_set (child, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE, - DBUSMENU_MENUITEM_TOGGLE_CHECK); + GTK_IS_RADIO_MENU_ITEM (widget) ? DBUSMENU_MENUITEM_TOGGLE_RADIO : DBUSMENU_MENUITEM_TOGGLE_CHECK); dbusmenu_menuitem_property_set (child, DBUSMENU_MENUITEM_PROP_LABEL, label); + label_set = TRUE; + dbusmenu_menuitem_property_set (child, DBUSMENU_MENUITEM_PROP_TOGGLE_CHECKED, - "checked"); + gtk_check_menu_item_get_active (check) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED); - label_set = TRUE; + g_signal_connect (widget, + "toggled", + G_CALLBACK (widget_toggled), + child); } else if (GTK_IS_IMAGE_MENU_ITEM (widget)) { -- cgit v1.2.3