diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2012-02-17 21:17:39 +0100 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2012-02-17 21:17:39 +0100 |
commit | fedc01b2b53b17cc2cdaca81e4dccfcb8d963f7a (patch) | |
tree | e1e1aa2b20a583a22b3986ffd8aaab1641587205 /src/indicator-printers.c | |
parent | 6962983a99989042c371748efbfb48587a38e7b5 (diff) | |
parent | 66cdfa18d909ad66f376b217047664235ccfc6f8 (diff) | |
download | ayatana-indicator-printers-fedc01b2b53b17cc2cdaca81e4dccfcb8d963f7a.tar.gz ayatana-indicator-printers-fedc01b2b53b17cc2cdaca81e4dccfcb8d963f7a.tar.bz2 ayatana-indicator-printers-fedc01b2b53b17cc2cdaca81e4dccfcb8d963f7a.zip |
Prepared upstream tree for merging into target branch.
Diffstat (limited to 'src/indicator-printers.c')
-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); |