aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-06-08 14:37:40 -0500
committerTed Gould <ted@canonical.com>2009-06-08 14:37:40 -0500
commit95ed5305c6ea74655085c70b413de68391226a1b (patch)
tree02baa2b388a8498c70a6e2f71ddae32a9c530364 /src
parenta36493af4afb4e46d307291c896faf6409c94019 (diff)
downloadayatana-indicator-session-95ed5305c6ea74655085c70b413de68391226a1b.tar.gz
ayatana-indicator-session-95ed5305c6ea74655085c70b413de68391226a1b.tar.bz2
ayatana-indicator-session-95ed5305c6ea74655085c70b413de68391226a1b.zip
Changing the build stuff for ye ol' fusa indicator
Diffstat (limited to 'src')
-rw-r--r--src/dbus-shared-names.h3
-rw-r--r--src/indicator-fusa.c54
2 files changed, 42 insertions, 15 deletions
diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h
new file mode 100644
index 0000000..35839a4
--- /dev/null
+++ b/src/dbus-shared-names.h
@@ -0,0 +1,3 @@
+
+#define INDICATOR_FUSA_DBUS_NAME "org.indicators.fusa"
+#define INDICATOR_FUSA_DBUS_OBJECT "/org/fusa"
diff --git a/src/indicator-fusa.c b/src/indicator-fusa.c
index 21c0817..8815fb5 100644
--- a/src/indicator-fusa.c
+++ b/src/indicator-fusa.c
@@ -1,26 +1,50 @@
#include <gtk/gtk.h>
+#include <libdbusmenu-gtk/menu.h>
-GtkWidget *
-get_menu_item (void)
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-bindings.h>
+
+#include <libindicator/indicator.h>
+INDICATOR_SET_VERSION
+INDICATOR_SET_NAME("users-status-shutdown")
+
+#include "dbus-shared-names.h"
+
+GtkLabel *
+get_label (void)
{
- GtkWidget * mainmenu = gtk_menu_item_new();
+ GtkLabel * returnval = gtk_label_new("Ted Gould");
+ return returnval;
+}
- GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
+GtkImage *
+get_icon (void)
+{
+ return NULL;
+}
+
+GtkMenu *
+get_menu (void)
+{
+ guint returnval = 0;
+ GError * error = NULL;
- GtkWidget * label = gtk_label_new("Ted Gould");
- gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 3);
- gtk_widget_show(label);
+ DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
- GtkWidget * icon = gtk_image_new_from_icon_name("gnome-logout",
- GTK_ICON_SIZE_MENU);
- gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0);
- gtk_widget_show(icon);
+ if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_FUSA_DBUS_NAME, 0, &returnval, &error)) {
+ g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" );
+ g_error_free(error);
+ return NULL;
+ }
- gtk_container_add(GTK_CONTAINER(mainmenu), hbox);
- gtk_widget_show(hbox);
+ if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) {
+ g_error("Return value isn't indicative of success: %d", returnval);
+ return NULL;
+ }
- gtk_widget_show(mainmenu);
- return mainmenu;
+ return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_FUSA_DBUS_NAME, INDICATOR_FUSA_DBUS_OBJECT));
}
+