Merge lp:~ted/unity/upstart-event into lp:unity

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: no longer in the source branch.
Merged at revision: 3351
Proposed branch: lp:~ted/unity/upstart-event
Merge into: lp:unity
Diff against target: 90 lines (+48/-0)
2 files modified
debian/control (+1/-0)
services/panel-service.c (+47/-0)
To merge this branch: bzr merge lp:~ted/unity/upstart-event
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
Mathieu Trudel-Lapierre Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+160421@code.launchpad.net

Commit message

Upstart event for when the indicators are loaded by the panel service.

Description of the change

Adds an upstart event for when the indicators are loaded by the panel service. Allows us to start moving to much smarter startup.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Why not just using g_app_info_create_from_commandline ?

It internally does the same things, and it's nicer to read.

Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2013-04-23 at 17:57 +0000, Marco Trevisan (Treviño) wrote:

> Why not just using g_app_info_create_from_commandline ?
>
> It internally does the same things, and it's nicer to read.

Because initctl isn't an application with a desktop file. It's just a
commandline utility, so there isn't really any app_info. Plus then I'd
also have an object to track instead of just being able to "fire and
forget" about the command line utility.

Revision history for this message
Ted Gould (ted) wrote :

Okay, tested this with an indicator-network job and it works! Cool.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Upstart has DBus methods to do this (EmitEvent). I feel it would be better to use them rather than spawning processes from indicators or from the shell.

review: Needs Fixing
Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2013-04-30 at 23:07 +0000, Mathieu Trudel-Lapierre wrote:

> Upstart has DBus methods to do this (EmitEvent). I feel it would be
> better to use them rather than spawning processes from indicators or
> from the shell.

Can you work with James to get a library building to export that method?
He seems to be willing to entertain the idea.

Revision history for this message
Stephen M. Webb (bregma) wrote :

I think this is OK as a stopgap measure, and maybe should be queued for replacement when full upstart session management is in place.

review: Approve
Revision history for this message
Ted Gould (ted) wrote :

Is there any reason to not top-approve this? Was it forgotten or on purpos?

Revision history for this message
Ted Gould (ted) wrote :

No objections.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2013-04-10 22:17:15 +0000
+++ debian/control 2013-04-23 21:10:33 +0000
@@ -97,6 +97,7 @@
97Architecture: any97Architecture: any
98Depends: ${shlibs:Depends},98Depends: ${shlibs:Depends},
99 ${misc:Depends},99 ${misc:Depends},
100 upstart,
100Description: Services for the Unity interface101Description: Services for the Unity interface
101 Unity is a desktop experience that sings. Designed by Canonical and the Ayatana102 Unity is a desktop experience that sings. Designed by Canonical and the Ayatana
102 community, Unity is all about the combination of familiarity and the future. We103 community, Unity is all about the combination of familiarity and the future. We
103104
=== modified file 'services/panel-service.c'
--- services/panel-service.c 2013-03-07 16:02:10 +0000
+++ services/panel-service.c 2013-04-23 21:10:33 +0000
@@ -54,6 +54,7 @@
54 GHashTable *panel2entries_hash;54 GHashTable *panel2entries_hash;
5555
56 guint initial_sync_id;56 guint initial_sync_id;
57 guint ready_signal_id;
57 gint32 timeouts[N_TIMEOUT_SLOTS];58 gint32 timeouts[N_TIMEOUT_SLOTS];
5859
59 IndicatorObjectEntry *last_entry;60 IndicatorObjectEntry *last_entry;
@@ -179,6 +180,12 @@
179 priv->initial_sync_id = 0;180 priv->initial_sync_id = 0;
180 }181 }
181182
183 if (priv->ready_signal_id)
184 {
185 g_source_remove (priv->ready_signal_id);
186 priv->ready_signal_id = 0;
187 }
188
182 for (i = 0; i < N_TIMEOUT_SLOTS; i++)189 for (i = 0; i < N_TIMEOUT_SLOTS; i++)
183 {190 {
184 if (priv->timeouts[i] > 0)191 if (priv->timeouts[i] > 0)
@@ -473,6 +480,45 @@
473 return FALSE;480 return FALSE;
474}481}
475482
483static gboolean
484ready_signal (PanelService *self)
485{
486 if (PANEL_IS_SERVICE (self))
487 {
488 GError * error = NULL;
489 gchar * argv[] = {
490 "initctl",
491 "--session",
492 "--user",
493 "emit",
494 "--no-wait",
495 "indicators-loaded",
496 NULL,
497 };
498
499 g_spawn_async(NULL, /* Working Directory */
500 argv,
501 NULL, /* environment */
502 G_SPAWN_SEARCH_PATH,
503 NULL, NULL, /* child setup function */
504 NULL, /* Pid */
505 &error);
506
507 if (error != NULL)
508 {
509 /* NOTE: When we get to the point where we can start
510 assuming upstart user sessions this can be escillated
511 to a warning or higher */
512 g_debug("Unable to signal indicators-loaded to upstart: %s", error->message);
513 g_error_free(error);
514 }
515
516 self->priv->ready_signal_id = 0;
517 }
518
519 return FALSE;
520}
521
476static void522static void
477panel_service_update_menu_keybinding (PanelService *self)523panel_service_update_menu_keybinding (PanelService *self)
478{524{
@@ -570,6 +616,7 @@
570 panel_service_update_menu_keybinding (self);616 panel_service_update_menu_keybinding (self);
571617
572 priv->initial_sync_id = g_idle_add ((GSourceFunc)initial_resync, self);618 priv->initial_sync_id = g_idle_add ((GSourceFunc)initial_resync, self);
619 priv->ready_signal_id = g_idle_add ((GSourceFunc)ready_signal, self);
573}620}
574621
575static gboolean622static gboolean