Merge lp:~ted/indicator-application/startup-cleanup into lp:indicator-application/14.04

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 254
Merged at revision: 246
Proposed branch: lp:~ted/indicator-application/startup-cleanup
Merge into: lp:indicator-application/14.04
Diff against target: 343 lines (+96/-65)
9 files modified
configure.ac (+1/-0)
data/Makefile.am (+6/-3)
data/indicator-application.conf.in (+3/-2)
data/indicator-application.desktop.in (+2/-4)
data/upstart/Makefile.am (+9/-0)
data/upstart/indicator-application.desktop.in (+8/-0)
src/Makefile.am (+1/-1)
src/application-service.c (+42/-26)
src/indicator-application.c (+24/-29)
To merge this branch: bzr merge lp:~ted/indicator-application/startup-cleanup
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+207774@code.launchpad.net

Commit message

Synchronize process management across indicators

Description of the change

This merge goes along with all of the other "startup-cleanup" merges to create a consistent startup for all indicators.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

I built debs for all the startup-cleanup branches and tested them out; WfM

Revision history for this message
Charles Kerr (charlesk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2013-05-29 16:43:45 +0000
+++ configure.ac 2014-02-22 04:22:05 +0000
@@ -96,6 +96,7 @@
96Makefile96Makefile
97src/Makefile97src/Makefile
98data/Makefile98data/Makefile
99data/upstart/Makefile
99tests/Makefile100tests/Makefile
100])101])
101102
102103
=== modified file 'data/Makefile.am'
--- data/Makefile.am 2013-10-29 00:01:19 +0000
+++ data/Makefile.am 2014-02-22 04:22:05 +0000
@@ -1,15 +1,17 @@
11
2SUBDIRS = upstart
3
2upstart_jobsdir = $(datadir)/upstart/sessions/4upstart_jobsdir = $(datadir)/upstart/sessions/
3upstart_jobs_DATA = indicator-application.conf5upstart_jobs_DATA = indicator-application.conf
46
5%.conf: %.conf.in7%.conf: %.conf.in
6 sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@8 $(AM_V_GEN) sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@
79
8xdg_autostartdir = /etc/xdg/autostart10xdg_autostartdir = /etc/xdg/autostart
9xdg_autostart_DATA = indicator-application.desktop11xdg_autostart_DATA = indicator-application.desktop
1012
11%.desktop: %.desktop.in13%.desktop: %.desktop.in
12 sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@14 $(AM_V_GEN) sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@
1315
14overridedir = $(pkgdatadir)16overridedir = $(pkgdatadir)
15override_DATA = ordering-override.keyfile17override_DATA = ordering-override.keyfile
@@ -20,5 +22,6 @@
20 ordering-override.keyfile22 ordering-override.keyfile
2123
22CLEANFILES = \24CLEANFILES = \
23 indicator-application.conf25 indicator-application.conf \
26 indicator-application.desktop
2427
2528
=== modified file 'data/indicator-application.conf.in'
--- data/indicator-application.conf.in 2013-08-27 20:15:52 +0000
+++ data/indicator-application.conf.in 2014-02-22 04:22:05 +0000
@@ -3,13 +3,14 @@
3# NOTE: Limiting only to Unity 7 right now as it's still using3# NOTE: Limiting only to Unity 7 right now as it's still using
4# dbusmenu. That can be lifted after it is ported to GMenu4# dbusmenu. That can be lifted after it is ported to GMenu
55
6start on (indicators-loaded or indicator-services-start) and xsession SESSION=ubuntu6start on indicator-services-start and xsession SESSION=ubuntu
7stop on desktop-end or indicator-services-end7stop on desktop-end or indicator-services-end
88
9emits appindicators-start appindicators-end9emits appindicators-start appindicators-end
1010
11respawn11respawn
12respawn limit 2 10
1213
13exec @libexecdir@/indicator-application-service14exec @pkglibexecdir@/indicator-application-service
1415
15pre-stop exec initctl emit appindicators-end16pre-stop exec initctl emit appindicators-end
1617
=== modified file 'data/indicator-application.desktop.in'
--- data/indicator-application.desktop.in 2013-10-29 00:01:19 +0000
+++ data/indicator-application.desktop.in 2014-02-22 04:22:05 +0000
@@ -1,9 +1,7 @@
1[Desktop Entry]1[Desktop Entry]
2Type=Application2Type=Application
3Name=Indicator Application3Name=Indicator Application
4Exec=@libexecdir@/indicator-application-service4Exec=@pkglibexecdir@/indicator-application-service
5NotShowIn=Unity;
6NoDisplay=true
7StartupNotify=false5StartupNotify=false
8Terminal=false6Terminal=false
97OnlyShowIn=Unity;XFCE;
108
=== added directory 'data/upstart'
=== added file 'data/upstart/Makefile.am'
--- data/upstart/Makefile.am 1970-01-01 00:00:00 +0000
+++ data/upstart/Makefile.am 2014-02-22 04:22:05 +0000
@@ -0,0 +1,9 @@
1
2xdg_autostartdir = $(pkgdatadir)/upstart/xdg/autostart
3xdg_autostart_DATA = indicator-application.desktop
4
5%.desktop: %.desktop.in
6 sed -e "s|\@libexecdir\@|$(pkglibexecdir)|" $< > $@
7
8EXTRA_DIST = \
9 indicator-application.desktop.in
010
=== added file 'data/upstart/indicator-application.desktop.in'
--- data/upstart/indicator-application.desktop.in 1970-01-01 00:00:00 +0000
+++ data/upstart/indicator-application.desktop.in 2014-02-22 04:22:05 +0000
@@ -0,0 +1,8 @@
1[Desktop Entry]
2Type=Application
3Name=Indicator Application
4Exec=@pkglibexecdir@/indicator-application-service
5StartupNotify=false
6Terminal=false
7OnlyShowIn=Unity;XFCE;
8Hidden=true
09
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2014-01-16 19:31:25 +0000
+++ src/Makefile.am 2014-02-22 04:22:05 +0000
@@ -31,7 +31,7 @@
31# Service31# Service
32##################################32##################################
3333
34libexec_PROGRAMS = indicator-application-service34pkglibexec_PROGRAMS = indicator-application-service
3535
36BUILT_SOURCES += \36BUILT_SOURCES += \
37 application-service-marshal.h \37 application-service-marshal.h \
3838
=== modified file 'src/application-service.c'
--- src/application-service.c 2013-01-22 20:32:18 +0000
+++ src/application-service.c 2014-02-22 04:22:05 +0000
@@ -21,7 +21,7 @@
21*/21*/
2222
2323
24#include "libindicator/indicator-service.h"24#include <gio/gio.h>
25#include "application-service-appstore.h"25#include "application-service-appstore.h"
26#include "application-service-watcher.h"26#include "application-service-watcher.h"
27#include "dbus-shared.h"27#include "dbus-shared.h"
@@ -32,44 +32,60 @@
32static ApplicationServiceAppstore * appstore = NULL;32static ApplicationServiceAppstore * appstore = NULL;
33/* Interface for applications */33/* Interface for applications */
34static ApplicationServiceWatcher * watcher = NULL;34static ApplicationServiceWatcher * watcher = NULL;
35/* The service management interface */35
36static IndicatorService * service = NULL;36/* Make sure we can set up all our objects before we get the name */
3737static void
38/* Recieves the disonnection signal from the service38bus_acquired (GDBusConnection * con, const gchar * name, gpointer user_data)
39 object and closes the mainloop. */39{
40static void40 g_debug("Bus Acquired, building objects");
41service_disconnected (IndicatorService * service, gpointer data)41
42{42 /* Building our app store */
43 g_debug("Service disconnected");43 appstore = application_service_appstore_new();
44 if (mainloop != NULL) {44
45 g_main_loop_quit(mainloop);45 /* Adding a watcher for the Apps coming up */
46 }46 watcher = application_service_watcher_new(appstore);
47 return;47}
48}48
49 49/* Nice to know, but we're not doing anything special */
50static void
51name_acquired (GDBusConnection * con, const gchar * name, gpointer user_data)
52{
53 g_debug("Name Acquired");
54}
55
56/* Shouldn't happen under normal usage */
57static void
58name_lost (GDBusConnection * con, const gchar * name, gpointer user_data)
59{
60 g_warning("Name Lost");
61 g_main_loop_quit(mainloop);
62}
63
50/* Builds up the core objects and puts us spinning into64/* Builds up the core objects and puts us spinning into
51 a main loop. */65 a main loop. */
52int66int
53main (int argc, char ** argv)67main (int argc, char ** argv)
54{68{
55 /* Bring us up as a basic indicator service */69 guint nameownership = g_bus_own_name(G_BUS_TYPE_SESSION,
56 service = indicator_service_new_version(INDICATOR_APPLICATION_DBUS_ADDR, INDICATOR_APPLICATION_SERVICE_VERSION);70 INDICATOR_APPLICATION_DBUS_ADDR,
57 g_signal_connect(G_OBJECT(service), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_disconnected), NULL);71 G_BUS_NAME_OWNER_FLAGS_NONE,
5872 bus_acquired,
59 /* Building our app store */73 name_acquired,
60 appstore = application_service_appstore_new();74 name_lost,
6175 NULL, NULL);
62 /* Adding a watcher for the Apps coming up */
63 watcher = application_service_watcher_new(appstore);
6476
65 /* Building and executing our main loop */77 /* Building and executing our main loop */
66 mainloop = g_main_loop_new(NULL, FALSE);78 mainloop = g_main_loop_new(NULL, FALSE);
67 g_main_loop_run(mainloop);79 g_main_loop_run(mainloop);
6880
81 g_debug("Finishing Main Loop");
82
83 g_bus_unown_name(nameownership);
84
69 /* Unref'ing all the objects */85 /* Unref'ing all the objects */
86 g_main_loop_unref(mainloop);
70 g_object_unref(G_OBJECT(watcher));87 g_object_unref(G_OBJECT(watcher));
71 g_object_unref(G_OBJECT(appstore));88 g_object_unref(G_OBJECT(appstore));
72 g_object_unref(G_OBJECT(service));
7389
74 return 0;90 return 0;
75}91}
7692
=== modified file 'src/indicator-application.c'
--- src/indicator-application.c 2012-04-11 17:22:39 +0000
+++ src/indicator-application.c 2014-02-22 04:22:05 +0000
@@ -37,7 +37,6 @@
37/* Indicator Stuff */37/* Indicator Stuff */
38#include <libindicator/indicator.h>38#include <libindicator/indicator.h>
39#include <libindicator/indicator-object.h>39#include <libindicator/indicator-object.h>
40#include <libindicator/indicator-service-manager.h>
41#include <libindicator/indicator-image-helper.h>40#include <libindicator/indicator-image-helper.h>
4241
43/* Local Stuff */42/* Local Stuff */
@@ -76,13 +75,13 @@
7675
77typedef struct _IndicatorApplicationPrivate IndicatorApplicationPrivate;76typedef struct _IndicatorApplicationPrivate IndicatorApplicationPrivate;
78struct _IndicatorApplicationPrivate {77struct _IndicatorApplicationPrivate {
79 IndicatorServiceManager * sm;
80 GCancellable * service_proxy_cancel;78 GCancellable * service_proxy_cancel;
81 GDBusProxy * service_proxy;79 GDBusProxy * service_proxy;
82 GList * applications;80 GList * applications;
83 GHashTable * theme_dirs;81 GHashTable * theme_dirs;
84 guint disconnect_kill;82 guint disconnect_kill;
85 GCancellable * get_apps_cancel;83 GCancellable * get_apps_cancel;
84 guint watch;
86};85};
8786
88typedef struct _ApplicationEntry ApplicationEntry;87typedef struct _ApplicationEntry ApplicationEntry;
@@ -107,9 +106,8 @@
107static guint get_location (IndicatorObject * io, IndicatorObjectEntry * entry);106static guint get_location (IndicatorObject * io, IndicatorObjectEntry * entry);
108static void entry_scrolled (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction);107static void entry_scrolled (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction);
109static void entry_secondary_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint time, gpointer data);108static void entry_secondary_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint time, gpointer data);
110void connection_changed (IndicatorServiceManager * sm, gboolean connected, IndicatorApplication * application);109static void connected (GDBusConnection * con, const gchar * name, const gchar * owner, gpointer user_data);
111static void connected (IndicatorApplication * application);110static void disconnected (GDBusConnection * con, const gchar * name, gpointer user_data);
112static void disconnected (IndicatorApplication * application);
113static void disconnected_helper (gpointer data, gpointer user_data);111static void disconnected_helper (gpointer data, gpointer user_data);
114static gboolean disconnected_kill (gpointer user_data);112static gboolean disconnected_kill (gpointer user_data);
115static void disconnected_kill_helper (gpointer data, gpointer user_data);113static void disconnected_kill_helper (gpointer data, gpointer user_data);
@@ -159,8 +157,13 @@
159 priv->theme_dirs = NULL;157 priv->theme_dirs = NULL;
160 priv->disconnect_kill = 0;158 priv->disconnect_kill = 0;
161159
162 priv->sm = indicator_service_manager_new_version(INDICATOR_APPLICATION_DBUS_ADDR, INDICATOR_APPLICATION_SERVICE_VERSION); 160 priv->watch = g_bus_watch_name(G_BUS_TYPE_SESSION,
163 g_signal_connect(G_OBJECT(priv->sm), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_changed), self);161 INDICATOR_APPLICATION_DBUS_ADDR,
162 G_BUS_NAME_WATCHER_FLAGS_NONE,
163 connected,
164 disconnected,
165 self,
166 NULL);
164167
165 priv->applications = NULL;168 priv->applications = NULL;
166169
@@ -191,11 +194,6 @@
191 0);194 0);
192 }195 }
193196
194 if (priv->sm != NULL) {
195 g_object_unref(priv->sm);
196 priv->sm = NULL;
197 }
198
199 if (priv->service_proxy != NULL) {197 if (priv->service_proxy != NULL) {
200 g_object_unref(G_OBJECT(priv->service_proxy));198 g_object_unref(G_OBJECT(priv->service_proxy));
201 priv->service_proxy = NULL;199 priv->service_proxy = NULL;
@@ -218,6 +216,11 @@
218 priv->theme_dirs = NULL;216 priv->theme_dirs = NULL;
219 }217 }
220218
219 if (priv->watch != 0) {
220 g_bus_unwatch_name(priv->watch);
221 priv->watch = 0;
222 }
223
221 G_OBJECT_CLASS (indicator_application_parent_class)->dispose (object);224 G_OBJECT_CLASS (indicator_application_parent_class)->dispose (object);
222 return;225 return;
223}226}
@@ -230,25 +233,14 @@
230 return;233 return;
231}234}
232235
233/* Responds to connection change event from the service manager and
234 splits it into two. */
235void
236connection_changed (IndicatorServiceManager * sm, gboolean connect, IndicatorApplication * application)
237{
238 g_return_if_fail(IS_INDICATOR_APPLICATION(application));
239 if (connect) {
240 connected(application);
241 } else {
242 disconnected(application);
243 }
244 return;
245}
246
247/* Brings up the connection to a service that has just come onto the236/* Brings up the connection to a service that has just come onto the
248 bus, or is atleast new to us. */237 bus, or is atleast new to us. */
249void238static void
250connected (IndicatorApplication * application)239connected (GDBusConnection * con, const gchar * name, const gchar * owner, gpointer user_data)
251{240{
241 IndicatorApplication * application = INDICATOR_APPLICATION(user_data);
242 g_return_if_fail(application != NULL);
243
252 IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application);244 IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application);
253 g_debug("Connected to Application Indicator Service.");245 g_debug("Connected to Application Indicator Service.");
254246
@@ -323,8 +315,11 @@
323 service so that we can delete it if it doesn't come back.315 service so that we can delete it if it doesn't come back.
324 Also, sets up a timeout on comming back. */316 Also, sets up a timeout on comming back. */
325static void317static void
326disconnected (IndicatorApplication * application)318disconnected (GDBusConnection * con, const gchar * name, gpointer user_data)
327{319{
320 IndicatorApplication * application = INDICATOR_APPLICATION(user_data);
321 g_return_if_fail(application != NULL);
322
328 IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application);323 IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application);
329 g_list_foreach(priv->applications, disconnected_helper, application);324 g_list_foreach(priv->applications, disconnected_helper, application);
330 /* I'll like this to be a little shorter, but it's a bit325 /* I'll like this to be a little shorter, but it's a bit

Subscribers

People subscribed via source and target branches