From f7c8fd69d50dca92656c8b21396143ea9f0cfcea Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 09:42:15 -0600 Subject: Moving the binary to the package directory --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 40fd228..064efc8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,7 +28,7 @@ $(cups_notifier_sources): org.cups.cupsd.Notifier.xml $^ -libexec_PROGRAMS = indicator-printers-service +pkglibexec_PROGRAMS = indicator-printers-service indicator_printers_service_SOURCES = \ indicator-printers-service.c \ indicator-printers-menu.c \ -- cgit v1.2.3 From c3f0838047da8d2e7f9eb3b96008f0b07c91562c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 09:46:00 -0600 Subject: Drop the DBus service file --- data/Makefile.am | 9 --------- data/indicator-printers.service.in | 3 --- 2 files changed, 12 deletions(-) delete mode 100644 data/indicator-printers.service.in diff --git a/data/Makefile.am b/data/Makefile.am index 133a853..139597f 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,11 +1,2 @@ -dbus_servicesdir = $(DBUSSERVICEDIR) -dbus_services_DATA = indicator-printers.service - -%.service: %.service.in - sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ - -EXTRA_DIST = indicator-printers.service.in - -CLEANFILES = $(dbus_services_DATA) diff --git a/data/indicator-printers.service.in b/data/indicator-printers.service.in deleted file mode 100644 index d89bcd2..0000000 --- a/data/indicator-printers.service.in +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=com.canonical.indicator.printers -Exec=@libexecdir@/indicator-printers-service -- cgit v1.2.3 From 3bcbc85d8cda75d56101123ee9daf261b15c90fb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 10:04:19 -0600 Subject: Adding in XDG autostart and Upstart job files --- data/Makefile.am | 32 ++++++++++++++++++++++++++++++++ data/indicator-printers.conf.in | 9 +++++++++ data/indicator-printers.desktop.in | 8 ++++++++ 3 files changed, 49 insertions(+) create mode 100644 data/indicator-printers.conf.in create mode 100644 data/indicator-printers.desktop.in diff --git a/data/Makefile.am b/data/Makefile.am index 139597f..de18ae7 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,2 +1,34 @@ +BUILT_SOURCES= +CLEANFILES= +EXTRA_DIST= + +#SUBDIRS = upstart + +# +# the upstart job file +# + +upstart_jobsdir = $(datadir)/upstart/sessions +upstart_jobs_DATA = indicator-printers.conf +upstart_jobs_in = $(upstart_jobs_DATA:.conf=.conf.in) +$(upstart_jobs_DATA): $(upstart_jobs_in) + $(AM_V_GEN) $(SED) -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ +BUILT_SOURCES += $(upstart_jobs_DATA) +CLEANFILES += $(upstart_jobs_DATA) +EXTRA_DIST += $(upstart_jobs_in) + +# +# the xdg autostart job file +# + +xdg_autostartdir = /etc/xdg/autostart +xdg_autostart_DATA = indicator-printers.desktop +xdg_autostart_in = $(xdg_autostart_DATA:.desktop=.desktop.in) +$(xdg_autostart_DATA): $(xdg_autostart_in) + $(AM_V_GEN) $(SED) -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ +BUILT_SOURCES += $(xdg_autostart_DATA) +CLEANFILES += $(xdg_autostart_DATA) +EXTRA_DIST += $(xdg_autostart_in) + diff --git a/data/indicator-printers.conf.in b/data/indicator-printers.conf.in new file mode 100644 index 0000000..665fb35 --- /dev/null +++ b/data/indicator-printers.conf.in @@ -0,0 +1,9 @@ +description "Indicator Power Service" + +start on indicator-services-start +stop on desktop-end or indicator-services-end + +respawn +respawn limit 2 10 + +exec @pkglibexecdir@/indicator-power-service diff --git a/data/indicator-printers.desktop.in b/data/indicator-printers.desktop.in new file mode 100644 index 0000000..3b93d08 --- /dev/null +++ b/data/indicator-printers.desktop.in @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Indicator Power +Exec=@pkglibexecdir@/indicator-power-service +OnlyShowIn=Unity; +NoDisplay=true +StartupNotify=false +Terminal=false -- cgit v1.2.3 From d75744cc260d74e7ef010ca355b4051496a8ed9b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 10:06:20 -0600 Subject: Adding in Upstart XDG override --- configure.ac | 1 + data/upstart/Makefile.am | 17 +++++++++++++++++ data/upstart/indicator-printers.desktop.in | 9 +++++++++ 3 files changed, 27 insertions(+) create mode 100644 data/upstart/Makefile.am create mode 100644 data/upstart/indicator-printers.desktop.in diff --git a/configure.ac b/configure.ac index 78211c2..23ce342 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,7 @@ AC_CONFIG_FILES([ Makefile src/Makefile data/Makefile + data/upstart/Makefile test/Makefile po/Makefile.in ]) diff --git a/data/upstart/Makefile.am b/data/upstart/Makefile.am new file mode 100644 index 0000000..8eb41e9 --- /dev/null +++ b/data/upstart/Makefile.am @@ -0,0 +1,17 @@ +BUILT_SOURCES= +CLEANFILES= +EXTRA_DIST= + +# +# the upstart xdg autostart override +# + +xdg_autostartdir = $(datadir)/upstart/xdg/autostart +xdg_autostart_DATA = indicator-printers.desktop +xdg_autostart_in = $(xdg_autostart_DATA:.desktop=.desktop.in) +$(xdg_autostart_DATA): $(xdg_autostart_in) + $(AM_V_GEN) $(SED) -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ +BUILT_SOURCES += $(xdg_autostart_DATA) +CLEANFILES += $(xdg_autostart_DATA) +EXTRA_DIST += $(xdg_autostart_in) + diff --git a/data/upstart/indicator-printers.desktop.in b/data/upstart/indicator-printers.desktop.in new file mode 100644 index 0000000..08ce2fa --- /dev/null +++ b/data/upstart/indicator-printers.desktop.in @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=Indicator Power +Exec=@pkglibexecdir@/indicator-power-service +OnlyShowIn=Unity; +NoDisplay=true +StartupNotify=false +Terminal=false +Hidden=true -- cgit v1.2.3 From 45e7973d2a058819d6b563160cb2261667b40907 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 10:08:19 -0600 Subject: Cut and paste errors --- data/Makefile.am | 2 +- data/indicator-printers.conf.in | 4 ++-- data/indicator-printers.desktop.in | 4 ++-- data/upstart/indicator-printers.desktop.in | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/Makefile.am b/data/Makefile.am index de18ae7..51ed2dd 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -3,7 +3,7 @@ BUILT_SOURCES= CLEANFILES= EXTRA_DIST= -#SUBDIRS = upstart +SUBDIRS = upstart # # the upstart job file diff --git a/data/indicator-printers.conf.in b/data/indicator-printers.conf.in index 665fb35..1bd4e65 100644 --- a/data/indicator-printers.conf.in +++ b/data/indicator-printers.conf.in @@ -1,4 +1,4 @@ -description "Indicator Power Service" +description "Indicator Printers Service" start on indicator-services-start stop on desktop-end or indicator-services-end @@ -6,4 +6,4 @@ stop on desktop-end or indicator-services-end respawn respawn limit 2 10 -exec @pkglibexecdir@/indicator-power-service +exec @pkglibexecdir@/indicator-printers-service diff --git a/data/indicator-printers.desktop.in b/data/indicator-printers.desktop.in index 3b93d08..a4b6908 100644 --- a/data/indicator-printers.desktop.in +++ b/data/indicator-printers.desktop.in @@ -1,7 +1,7 @@ [Desktop Entry] Type=Application -Name=Indicator Power -Exec=@pkglibexecdir@/indicator-power-service +Name=Indicator Printers +Exec=@pkglibexecdir@/indicator-printers-service OnlyShowIn=Unity; NoDisplay=true StartupNotify=false diff --git a/data/upstart/indicator-printers.desktop.in b/data/upstart/indicator-printers.desktop.in index 08ce2fa..8c011a9 100644 --- a/data/upstart/indicator-printers.desktop.in +++ b/data/upstart/indicator-printers.desktop.in @@ -1,7 +1,7 @@ [Desktop Entry] Type=Application -Name=Indicator Power -Exec=@pkglibexecdir@/indicator-power-service +Name=Indicator Printers +Exec=@pkglibexecdir@/indicator-printers-service OnlyShowIn=Unity; NoDisplay=true StartupNotify=false -- cgit v1.2.3 From 329107ab34c4613ce4e59bb563762af53bc1287a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 10:59:28 -0600 Subject: Limit to Unity 7 --- data/indicator-printers.conf.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/indicator-printers.conf.in b/data/indicator-printers.conf.in index 1bd4e65..3e892fb 100644 --- a/data/indicator-printers.conf.in +++ b/data/indicator-printers.conf.in @@ -1,6 +1,9 @@ description "Indicator Printers Service" -start on indicator-services-start +# NOTE: Limiting only to Unity 7 right now as it's still using +# dbusmenu. That can be lifted after it is ported to GMenu + +start on indicator-services-start and xsession SESSION=ubuntu stop on desktop-end or indicator-services-end respawn -- cgit v1.2.3 From b7a1e10a2e2a8cffba37a271ae0c44002dcab837 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 14:53:24 -0600 Subject: Drop the indicator service --- src/indicator-printers-service.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/indicator-printers-service.c b/src/indicator-printers-service.c index 737fed4..086ca0c 100644 --- a/src/indicator-printers-service.c +++ b/src/indicator-printers-service.c @@ -132,19 +132,6 @@ cancel_subscription (int id) ippDelete (resp); } - -static void -service_shutdown (IndicatorService *service, gpointer user_data) -{ - int subscription_id = GPOINTER_TO_INT (user_data); - - g_debug("Shutting down indicator-printers-service"); - - cancel_subscription (subscription_id); - gtk_main_quit (); -} - - int main (int argc, char *argv[]) { /* Init i18n */ @@ -153,7 +140,6 @@ int main (int argc, char *argv[]) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - IndicatorService *service; DbusmenuServer *menuserver; CupsNotifier *cups_notifier; IndicatorPrintersMenu *menu; @@ -168,13 +154,6 @@ int main (int argc, char *argv[]) renew_subscription_timeout, &subscription_id); - service = indicator_service_new_version (INDICATOR_PRINTERS_DBUS_NAME, - INDICATOR_PRINTERS_DBUS_VERSION); - g_signal_connect (service, - "shutdown", - G_CALLBACK (service_shutdown), - GINT_TO_POINTER (subscription_id)); - cups_notifier = cups_notifier_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, 0, NULL, @@ -184,7 +163,6 @@ int main (int argc, char *argv[]) if (error) { g_warning ("Error creating cups notify handler: %s", error->message); g_error_free (error); - g_object_unref (service); return 1; } @@ -206,7 +184,6 @@ int main (int argc, char *argv[]) g_object_unref (menuserver); g_object_unref (state_notifier); g_object_unref (cups_notifier); - g_object_unref (service); return 0; } -- cgit v1.2.3 From 2fa7d7ac75aabdb501c700679a995d0a32691b80 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Feb 2014 16:16:42 -0600 Subject: Remove the service manager --- src/indicator-printers.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/indicator-printers.c b/src/indicator-printers.c index 7acfdce..56e91d4 100644 --- a/src/indicator-printers.c +++ b/src/indicator-printers.c @@ -24,10 +24,10 @@ #include #include +#include #include #include -#include #include #include @@ -42,8 +42,8 @@ G_DEFINE_TYPE (IndicatorPrinters, indicator_printers, INDICATOR_OBJECT_TYPE) struct _IndicatorPrintersPrivate { - IndicatorServiceManager *service; IndicatorObjectEntry entry; + guint name_watch; }; @@ -51,7 +51,10 @@ static void dispose (GObject *object) { IndicatorPrinters *self = INDICATOR_PRINTERS (object); - g_clear_object (&self->priv->service); + if (self->priv->name_watch != 0) { + g_bus_unwatch_name(self->priv->name_watch); + self->priv->name_watch = 0; + } g_clear_object (&self->priv->entry.menu); g_clear_object (&self->priv->entry.image); G_OBJECT_CLASS (indicator_printers_parent_class)->dispose (object); @@ -81,14 +84,13 @@ indicator_printers_class_init (IndicatorPrintersClass *klass) static void -connection_changed (IndicatorServiceManager *service, - gboolean connected, +name_vanished (GDBusConnection * con, + const gchar * name, gpointer user_data) { IndicatorPrinters *self = INDICATOR_PRINTERS (user_data); - if (!connected) - indicator_object_set_visible (INDICATOR_OBJECT (self), FALSE); + indicator_object_set_visible (INDICATOR_OBJECT (self), FALSE); } @@ -273,10 +275,12 @@ 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); + priv->name_watch = g_bus_watch_name(G_BUS_TYPE_SESSION, + INDICATOR_PRINTERS_DBUS_NAME, + G_BUS_NAME_WATCHER_FLAGS_NONE, + NULL, /* appeared */ + name_vanished, + self, NULL); menu = dbusmenu_gtkmenu_new(INDICATOR_PRINTERS_DBUS_NAME, INDICATOR_PRINTERS_DBUS_OBJECT_PATH); -- cgit v1.2.3