diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-17 19:24:51 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-17 19:24:51 +0100 |
commit | 66cdfa18d909ad66f376b217047664235ccfc6f8 (patch) | |
tree | e1e1aa2b20a583a22b3986ffd8aaab1641587205 /src | |
parent | 8ce897a37ffe58051684fba7478a2f076aeec57d (diff) | |
parent | 8e95494fc099e27de74fe365f1aba30c6fc83659 (diff) | |
download | ayatana-indicator-printers-66cdfa18d909ad66f376b217047664235ccfc6f8.tar.gz ayatana-indicator-printers-66cdfa18d909ad66f376b217047664235ccfc6f8.tar.bz2 ayatana-indicator-printers-66cdfa18d909ad66f376b217047664235ccfc6f8.zip |
Import upstream version 0.1.3
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); |