aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-09-03 15:06:41 -0500
committerTed Gould <ted@canonical.com>2009-09-03 15:06:41 -0500
commit05c10a122d33628420b9926fed96d2c53e8f535e (patch)
treea35b068d257ce3e6350a4e53927aa5523447a309 /src
parent41f1b3206ab13b008aed6670dc42636049c9590d (diff)
parentcdfa53bdefc312410ca350972eee33f0091edbbe (diff)
downloadayatana-indicator-session-05c10a122d33628420b9926fed96d2c53e8f535e.tar.gz
ayatana-indicator-session-05c10a122d33628420b9926fed96d2c53e8f535e.tar.bz2
ayatana-indicator-session-05c10a122d33628420b9926fed96d2c53e8f535e.zip
Merging in fixes related to the dbusmenu 0.1.1 release
Diffstat (limited to 'src')
-rw-r--r--src/session-service.c18
-rw-r--r--src/status-service.c22
-rw-r--r--src/users-service.c4
3 files changed, 24 insertions, 20 deletions
diff --git a/src/session-service.c b/src/session-service.c
index ad160e9..bea26ba 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -82,7 +82,7 @@ suspend_prop_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata)
g_debug("Got Suspend: %s", g_value_get_boolean(&candoit) ? "true" : "false");
if (suspend_mi != NULL) {
- dbusmenu_menuitem_property_set(suspend_mi, "visible", g_value_get_boolean(&candoit) ? "true" : "false");
+ dbusmenu_menuitem_property_set(suspend_mi, DBUSMENU_MENUITEM_PROP_VISIBLE, g_value_get_boolean(&candoit) ? "true" : "false");
}
return;
@@ -105,7 +105,7 @@ hibernate_prop_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata)
g_debug("Got Hibernate: %s", g_value_get_boolean(&candoit) ? "true" : "false");
if (suspend_mi != NULL) {
- dbusmenu_menuitem_property_set(hibernate_mi, "visible", g_value_get_boolean(&candoit) ? "true" : "false");
+ dbusmenu_menuitem_property_set(hibernate_mi, DBUSMENU_MENUITEM_PROP_VISIBLE, g_value_get_boolean(&candoit) ? "true" : "false");
}
return;
@@ -223,29 +223,29 @@ create_items (DbusmenuMenuitem * root) {
DbusmenuMenuitem * mi = NULL;
mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, "label", _("Log Out"));
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Log Out"));
dbusmenu_menuitem_child_append(root, mi);
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(show_dialog), "logout");
suspend_mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(suspend_mi, "visible", "false");
- dbusmenu_menuitem_property_set(suspend_mi, "label", _("Suspend"));
+ dbusmenu_menuitem_property_set(suspend_mi, DBUSMENU_MENUITEM_PROP_VISIBLE, "false");
+ dbusmenu_menuitem_property_set(suspend_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Suspend"));
dbusmenu_menuitem_child_append(root, suspend_mi);
g_signal_connect(G_OBJECT(suspend_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(sleep), "Suspend");
hibernate_mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(hibernate_mi, "visible", "false");
- dbusmenu_menuitem_property_set(hibernate_mi, "label", _("Hibernate"));
+ dbusmenu_menuitem_property_set(hibernate_mi, DBUSMENU_MENUITEM_PROP_VISIBLE, "false");
+ dbusmenu_menuitem_property_set(hibernate_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Hibernate"));
dbusmenu_menuitem_child_append(root, hibernate_mi);
g_signal_connect(G_OBJECT(hibernate_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(sleep), "Hibernate");
mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, "label", _("Restart"));
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Restart"));
dbusmenu_menuitem_child_append(root, mi);
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(show_dialog), "restart");
mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, "label", _("Shutdown"));
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Shutdown"));
dbusmenu_menuitem_child_append(root, mi);
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(show_dialog), "shutdown");
diff --git a/src/status-service.c b/src/status-service.c
index 14d8a34..b210dcd 100644
--- a/src/status-service.c
+++ b/src/status-service.c
@@ -30,6 +30,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-bindings.h>
+#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/server.h>
#include <libdbusmenu-glib/menuitem.h>
@@ -88,7 +89,7 @@ status_update (void) {
if (global_status != oldglobal) {
g_debug("Global status changed to: %s", _(status_strings[global_status]));
- dbusmenu_menuitem_property_set(status_menuitem, "label", _(status_strings[global_status]));
+ dbusmenu_menuitem_property_set(status_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, _(status_strings[global_status]));
status_service_dbus_set_status(dbus_interface, status_icons[global_status]);
}
@@ -165,10 +166,12 @@ build_user_item (DbusmenuMenuitem * root)
while (*walker != '\0' && *walker != ',') { walker++; }
*walker = '\0';
- DbusmenuMenuitem * useritem = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(useritem, "label", name);
- dbusmenu_menuitem_property_set(useritem, "sensitive", "false");
- dbusmenu_menuitem_child_append(root, useritem);
+ if (name[0] != '\0') {
+ DbusmenuMenuitem * useritem = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_LABEL, name);
+ dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "false");
+ dbusmenu_menuitem_child_append(root, useritem);
+ }
g_free(name);
} else {
@@ -187,15 +190,16 @@ build_menu (gpointer data)
build_user_item(root);
status_menuitem = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(status_menuitem, "label", _(status_strings[global_status]));
+ dbusmenu_menuitem_property_set(status_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, _(status_strings[global_status]));
dbusmenu_menuitem_child_append(root, status_menuitem);
StatusProviderStatus i;
for (i = STATUS_PROVIDER_STATUS_ONLINE; i < STATUS_PROVIDER_STATUS_LAST; i++) {
DbusmenuMenuitem * mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, "label", _(status_strings[i]));
- dbusmenu_menuitem_property_set(mi, "icon", status_icons[i]);
+ dbusmenu_menuitem_property_set(mi, "type", DBUSMENU_CLIENT_TYPES_IMAGE);
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _(status_strings[i]));
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_ICON, status_icons[i]);
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(status_menu_click), GINT_TO_POINTER(i));
dbusmenu_menuitem_child_append(status_menuitem, mi);
@@ -204,7 +208,7 @@ build_menu (gpointer data)
}
DbusmenuMenuitem * mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, "label", _("Lock Screen"));
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Lock Screen"));
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(lock_screen), GINT_TO_POINTER(i));
dbusmenu_menuitem_child_append(root, mi);
diff --git a/src/users-service.c b/src/users-service.c
index 9ada91f..5db832b 100644
--- a/src/users-service.c
+++ b/src/users-service.c
@@ -113,14 +113,14 @@ create_items (DbusmenuMenuitem * root) {
if (check_guest_session()) {
mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, "label", _("Guest Session"));
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Guest Session"));
dbusmenu_menuitem_child_append(root, mi);
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_guest_session), NULL);
}
if (check_new_session()) {
mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, "label", _("New Session..."));
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("New Session..."));
dbusmenu_menuitem_child_append(root, mi);
g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_new_session), NULL);
}