diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-17 19:14:02 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-17 19:14:02 +0100 |
commit | 72a38572117eb68dfa138ad7b10a98a2b0fd35de (patch) | |
tree | 03218967fcb981b591f387a93e1b4b43385d401d /src | |
parent | 6aa8774c5f187531b448dee3a8bd3973738d748a (diff) | |
download | ayatana-indicator-printers-72a38572117eb68dfa138ad7b10a98a2b0fd35de.tar.gz ayatana-indicator-printers-72a38572117eb68dfa138ad7b10a98a2b0fd35de.tar.bz2 ayatana-indicator-printers-72a38572117eb68dfa138ad7b10a98a2b0fd35de.zip |
Create an IndicatorServiceManager in libprintersmenu.so
Diffstat (limited to 'src')
-rw-r--r-- | src/indicator-printers.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/indicator-printers.c b/src/indicator-printers.c index bcb0579..b69c093 100644 --- a/src/indicator-printers.c +++ b/src/indicator-printers.c @@ -26,6 +26,7 @@ #include <libindicator/indicator.h> #include <libindicator/indicator-image-helper.h> +#include <libindicator/indicator-service-manager.h> #include <libdbusmenu-gtk/menu.h> #include <libdbusmenu-gtk/menuitem.h> @@ -40,6 +41,7 @@ G_DEFINE_TYPE (IndicatorPrinters, indicator_printers, INDICATOR_OBJECT_TYPE) struct _IndicatorPrintersPrivate { + IndicatorServiceManager *service; IndicatorObjectEntry entry; }; @@ -48,6 +50,7 @@ static void dispose (GObject *object) { IndicatorPrinters *self = INDICATOR_PRINTERS (object); + g_clear_object (&self->priv->service); g_clear_object (&self->priv->entry.menu); g_clear_object (&self->priv->entry.image); G_OBJECT_CLASS (indicator_printers_parent_class)->dispose (object); @@ -76,6 +79,18 @@ indicator_printers_class_init (IndicatorPrintersClass *klass) } +static void +connection_changed (IndicatorServiceManager *service, + gboolean connected, + gpointer user_data) +{ + IndicatorPrinters *self = INDICATOR_PRINTERS (user_data); + + if (!connected) + indicator_object_set_visible (INDICATOR_OBJECT (self), FALSE); +} + + static GdkPixbuf * gdk_pixbuf_new_from_encoded_data (guchar *data, gsize length) @@ -254,6 +269,11 @@ indicator_printers_init (IndicatorPrinters *self) IndicatorPrintersPrivate); self->priv = priv; + priv->service = indicator_service_manager_new_version (INDICATOR_PRINTERS_DBUS_NAME, + INDICATOR_PRINTERS_DBUS_VERSION); + g_signal_connect (priv->service, "connection-change", + G_CALLBACK (connection_changed), self); + menu = dbusmenu_gtkmenu_new(INDICATOR_PRINTERS_DBUS_NAME, INDICATOR_PRINTERS_DBUS_OBJECT_PATH); |