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/application-service-watcher.c | 8 ++++---- src/dbus-shared.h | 8 ++++---- src/libappindicator/app-indicator.c | 6 ++++-- src/notification-item.xml | 4 ++-- src/notification-watcher.xml | 8 ++++---- 5 files changed, 18 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c index 984b9d4..81fae36 100644 --- a/src/application-service-watcher.c +++ b/src/application-service-watcher.c @@ -29,8 +29,8 @@ with this program. If not, see . #include "application-service-watcher.h" #include "dbus-shared.h" -static gboolean _notification_watcher_server_register_service (ApplicationServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method); -static gboolean _notification_watcher_server_registered_services (ApplicationServiceWatcher * appwatcher, GArray ** apps); +static gboolean _notification_watcher_server_register_status_notifier_item (ApplicationServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method); +static gboolean _notification_watcher_server_registered_status_notifier_items (ApplicationServiceWatcher * appwatcher, GArray ** apps); static gboolean _notification_watcher_server_protocol_version (ApplicationServiceWatcher * appwatcher, char ** version); static gboolean _notification_watcher_server_register_notification_host (ApplicationServiceWatcher * appwatcher, const gchar * host); static gboolean _notification_watcher_server_is_notification_host_registered (ApplicationServiceWatcher * appwatcher, gboolean * haveHost); @@ -165,7 +165,7 @@ application_service_watcher_new (ApplicationServiceAppstore * appstore) } static gboolean -_notification_watcher_server_register_service (ApplicationServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method) +_notification_watcher_server_register_status_notifier_item (ApplicationServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method) { ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(appwatcher); @@ -176,7 +176,7 @@ _notification_watcher_server_register_service (ApplicationServiceWatcher * appwa } static gboolean -_notification_watcher_server_registered_services (ApplicationServiceWatcher * appwatcher, GArray ** apps) +_notification_watcher_server_registered_status_notifier_items (ApplicationServiceWatcher * appwatcher, GArray ** apps) { return FALSE; diff --git a/src/dbus-shared.h b/src/dbus-shared.h index f888e02..da9dfef 100644 --- a/src/dbus-shared.h +++ b/src/dbus-shared.h @@ -20,12 +20,12 @@ with this program. If not, see . */ -#define INDICATOR_APPLICATION_DBUS_ADDR "org.ayatana.indicator.application" +#define INDICATOR_APPLICATION_DBUS_ADDR "org.freedesktop.StatusNotifierWatcher" #define INDICATOR_APPLICATION_DBUS_OBJ "/org/ayatana/indicator/application/service" #define INDICATOR_APPLICATION_DBUS_IFACE "org.ayatana.indicator.application.service" -#define NOTIFICATION_WATCHER_DBUS_OBJ "/org/ayatana/indicator/application/NotificationWatcher" -#define NOTIFICATION_WATCHER_DBUS_IFACE "org.ayatana.indicator.application.NotificationWatcher" +#define NOTIFICATION_WATCHER_DBUS_OBJ "/StatusNotifierWatcher" +#define NOTIFICATION_WATCHER_DBUS_IFACE "org.freedesktop.StatusNotifierWatcher" -#define NOTIFICATION_ITEM_DBUS_IFACE "org.ayatana.indicator.application.NotificationItem" +#define NOTIFICATION_ITEM_DBUS_IFACE "org.freedesktop.StatusNotifierItem" 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; } diff --git a/src/notification-item.xml b/src/notification-item.xml index c28cc54..93ff903 100644 --- a/src/notification-item.xml +++ b/src/notification-item.xml @@ -1,6 +1,6 @@ - - + + diff --git a/src/notification-watcher.xml b/src/notification-watcher.xml index 2ef54a0..22ada5f 100644 --- a/src/notification-watcher.xml +++ b/src/notification-watcher.xml @@ -1,16 +1,16 @@ - - + + - + - + -- 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') 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') 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') 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 199f3d22a194b89241a2d29519aae587f5c4b5a8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 7 Jan 2010 12:29:33 -0600 Subject: Allowing for the default path if one is not given. --- src/application-service-watcher.c | 8 +++++++- src/dbus-shared.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c index 81fae36..f2823dd 100644 --- a/src/application-service-watcher.c +++ b/src/application-service-watcher.c @@ -169,7 +169,13 @@ _notification_watcher_server_register_status_notifier_item (ApplicationServiceWa { ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(appwatcher); - application_service_appstore_application_add(priv->appstore, dbus_g_method_get_sender(method), service); + const gchar * finalservice = NOTIFICATION_ITEM_DEFAULT_OBJ; + + if (service[0] == '/') { + finalservice = service; + } + + application_service_appstore_application_add(priv->appstore, dbus_g_method_get_sender(method), finalservice); dbus_g_method_return(method, G_TYPE_NONE); return TRUE; diff --git a/src/dbus-shared.h b/src/dbus-shared.h index da9dfef..efc57a4 100644 --- a/src/dbus-shared.h +++ b/src/dbus-shared.h @@ -28,4 +28,5 @@ with this program. If not, see . #define NOTIFICATION_WATCHER_DBUS_IFACE "org.freedesktop.StatusNotifierWatcher" #define NOTIFICATION_ITEM_DBUS_IFACE "org.freedesktop.StatusNotifierItem" +#define NOTIFICATION_ITEM_DEFAULT_OBJ "/StatusNotifierItem" -- 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') 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 From 69f4b95cf0a66d6fc58090b7e2f007c3b00ef651 Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Fri, 8 Jan 2010 12:08:51 +0100 Subject: Use correct status syntax in the api description (lp: #504700) --- src/libappindicator/app-indicator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libappindicator/app-indicator.h b/src/libappindicator/app-indicator.h index e966a49..fa3e301 100644 --- a/src/libappindicator/app-indicator.h +++ b/src/libappindicator/app-indicator.h @@ -128,8 +128,8 @@ typedef enum { /*< prefix=APP_INDICATOR_CATEGORY >*/ These are the states that the indicator can be on in the user's panel. The indicator by default starts - in the state @APP_INDICATOR_STATUS_OFF and can be - shown by setting it to @APP_INDICATOR_STATUS_ON. + in the state @APP_INDICATOR_STATUS_PASSIVE and can be + shown by setting it to @APP_INDICATOR_STATUS_ACTIVE. */ typedef enum { /*< prefix=APP_INDICATOR_STATUS >*/ APP_INDICATOR_STATUS_PASSIVE, -- cgit v1.2.3 From 83b4f68c5a188d3826beefbe2adddecc0f0a4668 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 8 Jan 2010 08:04:07 -0600 Subject: Changing the property to 'IconThemePath' to make it more clear about what it adjusts. --- src/application-service-appstore.c | 2 +- src/libappindicator/app-indicator.c | 16 ++++++++-------- src/notification-item.xml | 4 +++- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 1ac309a..f76bbe2 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -40,7 +40,7 @@ static gboolean _application_service_server_get_applications (ApplicationService #define NOTIFICATION_ITEM_PROP_STATUS "Status" #define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName" #define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName" -#define NOTIFICATION_ITEM_PROP_ICON_PATH "IconPath" +#define NOTIFICATION_ITEM_PROP_ICON_PATH "IconThemePath" #define NOTIFICATION_ITEM_PROP_MENU "Menu" /* Private Stuff */ diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index d22161c..f9a7c88 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -92,7 +92,7 @@ enum { PROP_STATUS, PROP_ICON_NAME, PROP_ATTENTION_ICON_NAME, - PROP_ICON_PATH, + PROP_ICON_THEME_PATH, PROP_MENU, PROP_CONNECTED }; @@ -103,7 +103,7 @@ enum { #define PROP_STATUS_S "status" #define PROP_ICON_NAME_S "icon-name" #define PROP_ATTENTION_ICON_NAME_S "attention-icon-name" -#define PROP_ICON_PATH_S "icon-path" +#define PROP_ICON_THEME_PATH_S "icon-theme-path" #define PROP_MENU_S "menu" #define PROP_CONNECTED_S "connected" @@ -183,8 +183,8 @@ app_indicator_class_init (AppIndicatorClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property(object_class, - PROP_ICON_PATH, - g_param_spec_string (PROP_ICON_PATH_S, + PROP_ICON_THEME_PATH, + g_param_spec_string (PROP_ICON_THEME_PATH_S, "An additional path for custom icons.", "An additional place to look for icon names that may be installed by the application.", NULL, @@ -440,7 +440,7 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu g_value_get_string (value)); break; - case PROP_ICON_PATH: + case PROP_ICON_THEME_PATH: if (priv->icon_path != NULL) { g_free(priv->icon_path); } @@ -486,7 +486,7 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_string (value, priv->attention_icon_name); break; - case PROP_ICON_PATH: + case PROP_ICON_THEME_PATH: g_value_set_string (value, priv->icon_path); break; @@ -610,7 +610,7 @@ app_indicator_new (const gchar *id, Creates a new #AppIndicator setting the properties: #AppIndicator::id with @id, #AppIndicator::category with @category, #AppIndicator::icon-name with - @icon_name and #AppIndicator::icon-path with @icon_path. + @icon_name and #AppIndicator::icon-theme-path with @icon_path. Return value: A pointer to a new #AppIndicator object. */ @@ -624,7 +624,7 @@ app_indicator_new_with_path (const gchar *id, "id", id, "category", category_from_enum (category), "icon-name", icon_name, - "icon-path", icon_path, + "icon-theme-path", icon_path, NULL); return indicator; diff --git a/src/notification-item.xml b/src/notification-item.xml index b671e38..f95db31 100644 --- a/src/notification-item.xml +++ b/src/notification-item.xml @@ -8,7 +8,9 @@ - + + -- cgit v1.2.3 From 8226d6c8f8870be9d2902fcd2137b242f2559da8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 8 Jan 2010 08:07:24 -0600 Subject: Using the #defines for the property names instead of strings. Define them once. --- src/libappindicator/app-indicator.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index f9a7c88..739a7e6 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -592,9 +592,9 @@ app_indicator_new (const gchar *id, AppIndicatorCategory category) { AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE, - "id", id, - "category", category_from_enum (category), - "icon-name", icon_name, + PROP_ID_S, id, + PROP_CATEGORY_S, category_from_enum (category), + PROP_ICON_NAME_S, icon_name, NULL); return indicator; @@ -621,10 +621,10 @@ app_indicator_new_with_path (const gchar *id, const gchar *icon_path) { AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE, - "id", id, - "category", category_from_enum (category), - "icon-name", icon_name, - "icon-theme-path", icon_path, + PROP_ID_S, id, + PROP_CATEGORY_S, category_from_enum (category), + PROP_ICON_NAME_S, icon_name, + PROP_ICON_THEME_PATH_S, icon_path, NULL); return indicator; -- cgit v1.2.3 From 0c8cf85f9e6aa2120a7616f0aacb8f3993894687 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 8 Jan 2010 09:25:17 -0600 Subject: Adjusting so that we use the parameter if it's not an object but a path. --- src/application-service-watcher.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c index f2823dd..1ad59d4 100644 --- a/src/application-service-watcher.c +++ b/src/application-service-watcher.c @@ -169,14 +169,16 @@ _notification_watcher_server_register_status_notifier_item (ApplicationServiceWa { ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(appwatcher); - const gchar * finalservice = NOTIFICATION_ITEM_DEFAULT_OBJ; - if (service[0] == '/') { - finalservice = service; + application_service_appstore_application_add(priv->appstore, + dbus_g_method_get_sender(method), + service); + } else { + application_service_appstore_application_add(priv->appstore, + service, + NOTIFICATION_ITEM_DEFAULT_OBJ); } - application_service_appstore_application_add(priv->appstore, dbus_g_method_get_sender(method), finalservice); - dbus_g_method_return(method, G_TYPE_NONE); return TRUE; } -- cgit v1.2.3