Merge lp://qastaging/~bratsche/xsplash/configurable-signals-backport-release-0.7 into lp://qastaging/~bratsche/xsplash/release-0.7

Proposed by Cody Russell
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~bratsche/xsplash/configurable-signals-backport-release-0.7
Merge into: lp://qastaging/~bratsche/xsplash/release-0.7
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~bratsche/xsplash/configurable-signals-backport-release-0.7

This proposal supersedes a proposal from 2009-09-10.

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) wrote : Posted in a previous version of this proposal

Cool. This is is the signal branch merged on the right branch.

review: Approve
Revision history for this message
Cody Russell (bratsche) wrote :

Resubmitting because I added timer resetting as Neil suggested, and changed the timeout from 15s to 25s as seb128 requested.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build/autotools/libtool.m4'
2--- build/autotools/libtool.m4 2009-08-26 15:11:53 +0000
3+++ build/autotools/libtool.m4 2009-09-10 17:15:12 +0000
4@@ -4261,9 +4261,6 @@
5 openbsd*)
6 with_gnu_ld=no
7 ;;
8- linux* | k*bsd*-gnu)
9- _LT_TAGVAR(link_all_deplibs, $1)=no
10- ;;
11 esac
12
13 _LT_TAGVAR(ld_shlibs, $1)=yes
14
15=== modified file 'src/xsplash-dbus.xml'
16--- src/xsplash-dbus.xml 2009-08-06 11:24:01 +0000
17+++ src/xsplash-dbus.xml 2009-09-10 15:40:58 +0000
18@@ -2,6 +2,9 @@
19
20 <node name="/">
21 <interface name="com.ubuntu.BootCurtain">
22+ <method name="AddWaitSignal">
23+ <arg type="s" name="wait" direction="in" />
24+ </method>
25 <method name="SignalLoaded">
26 <arg type="s" name="app" direction="in" />
27 </method>
28
29=== modified file 'src/xsplash.c'
30--- src/xsplash.c 2009-08-31 20:21:47 +0000
31+++ src/xsplash.c 2009-09-10 17:15:12 +0000
32@@ -38,6 +38,8 @@
33 #include "xsplash.h"
34 #include "log.h"
35
36+#define XSPLASH_FALLBACK_TIME 25000
37+
38 typedef struct _AnimContext AnimContext;
39 typedef struct _XsplashServerPrivate XsplashServerPrivate;
40
41@@ -58,12 +60,10 @@
42 GdkPixbuf *throbber_pixbuf;
43 DBusGConnection *system_bus;
44 DBusGProxy *bus_proxy;
45+ guint timeout;
46
47 GdkWindow *cow;
48 GdkScreen *screen;
49-
50- gboolean nautilus_done;
51- gboolean panel_done;
52 };
53
54 enum {
55@@ -73,29 +73,6 @@
56 PROP_DBUS_PROXY
57 };
58
59-#define XSPLASH_DBUS_NAME "com.ubuntu.BootCurtain"
60-#define XSPLASH_DBUS_OBJECT "/com/ubuntu/BootCurtain"
61-
62-static gboolean gdm_session = FALSE;
63-static gchar *background_image = NULL;
64-static gchar *logo_image = NULL;
65-static gchar *throbber_image = NULL;
66-static guint throbber_frames = 50;
67-static gboolean ping_pong = FALSE;
68-static gboolean have_xcomposite = FALSE;
69-static gboolean is_composited = FALSE;
70-static gboolean redirected = FALSE;
71-
72-static GOptionEntry entries[] = {
73- { "gdm-session", 'g', 0, G_OPTION_ARG_NONE, &gdm_session, "Run in gdm session", NULL },
74- { "background", 'b', 0, G_OPTION_ARG_FILENAME, &background_image, "Filename for background image", NULL },
75- { "logo", 'l', 0, G_OPTION_ARG_FILENAME, &logo_image, "Filename for logo image", NULL },
76- { "throbber", 't', 0, G_OPTION_ARG_FILENAME, &throbber_image, "Filename for throbber image", NULL },
77- { "frames", 'f', 0, G_OPTION_ARG_INT, &throbber_frames, "Number of frames for the throbber (default 50)", NULL },
78- { "pingpong", 'p', 0, G_OPTION_ARG_NONE, &ping_pong, "Whether to reverse throbber directions", NULL },
79- { NULL }
80-};
81-
82 static AnimContext * anim_context_new (XsplashServer *server,
83 GtyTimeline *timeline,
84 gpointer id);
85@@ -122,6 +99,9 @@
86 gpointer user_data);
87
88 static void xsplash_server_dispose (GObject *object);
89+gboolean xsplash_server_add_wait_signal (XsplashServer *server,
90+ gchar *waitfor,
91+ GError **error);
92
93 gboolean xsplash_server_signal_loaded (XsplashServer *server,
94 gchar *app,
95@@ -131,6 +111,65 @@
96 gdouble progress,
97 gpointer user_data);
98
99+static void add_signal (gchar *name);
100+static void xsplash_add_signal (const gchar *option_name,
101+ const gchar *value,
102+ gpointer data,
103+ GError **error);
104+
105+#define XSPLASH_DBUS_NAME "com.ubuntu.BootCurtain"
106+#define XSPLASH_DBUS_OBJECT "/com/ubuntu/BootCurtain"
107+
108+static gboolean gdm_session = FALSE;
109+static gchar *background_image = NULL;
110+static gchar *logo_image = NULL;
111+static gchar *throbber_image = NULL;
112+static guint throbber_frames = 50;
113+static gboolean ping_pong = FALSE;
114+static gboolean have_xcomposite = FALSE;
115+static gboolean is_composited = FALSE;
116+static gboolean redirected = FALSE;
117+static GSList *signal_list = NULL;
118+
119+static GOptionEntry entries[] = {
120+ {
121+ "gdm-session", 'g', 0,
122+ G_OPTION_ARG_NONE, &gdm_session,
123+ "Run in gdm session", NULL
124+ },
125+ {
126+ "background", 'b', 0,
127+ G_OPTION_ARG_FILENAME, &background_image,
128+ "Filename for background image", NULL
129+ },
130+ {
131+ "logo", 'l', 0,
132+ G_OPTION_ARG_FILENAME, &logo_image,
133+ "Filename for logo image", NULL
134+ },
135+ {
136+ "throbber", 't', 0,
137+ G_OPTION_ARG_FILENAME, &throbber_image,
138+ "Filename for throbber image", NULL
139+ },
140+ {
141+ "frames", 'f', 0,
142+ G_OPTION_ARG_INT, &throbber_frames,
143+ "Number of frames for the throbber (default 50)", NULL
144+ },
145+ {
146+ "pingpong", 'p', 0,
147+ G_OPTION_ARG_NONE, &ping_pong,
148+ "Whether to reverse throbber directions", NULL
149+ },
150+ {
151+ "add-signal", 's', 0,
152+ G_OPTION_ARG_CALLBACK, (GOptionArgFunc) xsplash_add_signal,
153+ "Add a signal to listen for.", NULL
154+ },
155+ { NULL }
156+};
157+
158 #include "dbus-xsplash-server.h"
159
160 G_DEFINE_TYPE (XsplashServer, xsplash_server, G_TYPE_OBJECT);
161@@ -145,7 +184,7 @@
162
163 g_type_class_add_private (class, sizeof (XsplashServerPrivate));
164
165- object_class->dispose = xsplash_server_dispose;
166+ object_class->dispose = xsplash_server_dispose;
167 object_class->set_property = set_property;
168 object_class->get_property = get_property;
169
170@@ -219,8 +258,6 @@
171 g_return_if_reached ();
172 break;
173 }
174-
175- return;
176 }
177
178 static void
179@@ -245,8 +282,6 @@
180 g_return_if_reached ();
181 break;
182 }
183-
184- return;
185 }
186
187 static GdkPixbuf *
188@@ -328,7 +363,8 @@
189
190 priv->dbusobject = NULL;
191 priv->system_bus = NULL;
192- priv->bus_proxy = NULL;
193+ priv->bus_proxy = NULL;
194+ priv->timeout = 0;
195
196 if (gdk_display_supports_composite (gdk_display_get_default ()))
197 {
198@@ -622,6 +658,37 @@
199 return FALSE;
200 }
201
202+static void
203+add_signal (gchar *name)
204+{
205+ GSList *tmp = NULL;
206+
207+ if ((strcmp (name, ".") == 0) || strcmp (name, "..") == 0)
208+ return;
209+
210+ g_debug ("adding signal `%s'", name);
211+
212+ for (tmp = signal_list; tmp != NULL; tmp = g_slist_next (signal_list))
213+ {
214+ if (strcmp (tmp->data, name) == 0)
215+ {
216+ g_debug (" ** that signal is already being listened for; skipping");
217+ return;
218+ }
219+ }
220+
221+ signal_list = g_slist_prepend (signal_list, g_strdup (name));
222+}
223+
224+static void
225+xsplash_add_signal (const gchar *option_name,
226+ const gchar *value,
227+ gpointer data,
228+ GError **error)
229+{
230+ add_signal (g_strdup (value));
231+}
232+
233 void
234 sig_handler (int signum)
235 {
236@@ -636,6 +703,7 @@
237 main (int argc, char *argv[])
238 {
239 XsplashServer *server;
240+ XsplashServerPrivate *priv;
241 GError *error = NULL;
242 GOptionContext *context;
243 DBusGConnection *system_bus;
244@@ -712,9 +780,11 @@
245 "dbus-proxy", bus_proxy,
246 NULL);
247
248- g_timeout_add (15000,
249- temporary_hack_for_initial_fade,
250- server);
251+ priv = XSPLASH_SERVER_GET_PRIVATE (server);
252+
253+ priv->timeout = g_timeout_add (XSPLASH_FALLBACK_TIME,
254+ temporary_hack_for_initial_fade,
255+ server);
256
257 gtk_main ();
258
259@@ -729,16 +799,48 @@
260 if (throbber_image != NULL)
261 g_free (throbber_image);
262
263+ if (signal_list != NULL)
264+ {
265+ g_slist_foreach (signal_list, (GFunc)g_free, NULL);
266+ g_slist_free (signal_list);
267+ signal_list = NULL;
268+ }
269+
270 return 0;
271 }
272
273 gboolean
274+xsplash_server_add_wait_signal (XsplashServer *server,
275+ gchar *waitfor,
276+ GError **error)
277+{
278+ XsplashServerPrivate *priv;
279+
280+ g_debug ("received a new signal to wait for: %s", waitfor);
281+
282+ priv = XSPLASH_SERVER_GET_PRIVATE (server);
283+
284+ if (waitfor)
285+ {
286+ add_signal (waitfor);
287+ }
288+
289+ if (priv->timeout)
290+ {
291+ g_source_remove (priv->timeout);
292+ priv->timeout = g_timeout_add (XSPLASH_FALLBACK_TIME,
293+ temporary_hack_for_initial_fade,
294+ server);
295+ }
296+
297+ return TRUE;
298+}
299+
300+gboolean
301 xsplash_server_signal_loaded (XsplashServer *server,
302 gchar *app,
303 GError **error)
304 {
305- XsplashServerPrivate *priv = XSPLASH_SERVER_GET_PRIVATE (server);
306-
307 g_debug ("received signal: %s", app);
308
309 if (gdm_session)
310@@ -748,19 +850,24 @@
311 }
312 else
313 {
314- if (strcmp (app, "nautilus") == 0)
315- {
316- priv->nautilus_done = TRUE;
317- }
318- else if (strcmp (app, "gnome-panel") == 0)
319- {
320- priv->panel_done = TRUE;
321- }
322-
323- if (priv->nautilus_done && priv->panel_done)
324- {
325- g_debug ("received both \"nautilus\" and \"panel\" signals: fading out");
326- begin_fade (server, TRUE);
327+ GSList *l = NULL;
328+
329+ /* Remove this signal if it's in our list; if the list is empty, begin fading */
330+ for (l = signal_list; l != NULL; l = l->next)
331+ {
332+ if (strcmp (app, (gchar *)l->data) == 0)
333+ {
334+ g_debug ("received signal %s", (gchar*)l->data);
335+
336+ g_free (l->data);
337+ signal_list = g_slist_delete_link (signal_list, l);
338+
339+ /* There are no more signals we are listening for */
340+ if (signal_list == NULL)
341+ {
342+ begin_fade (server, TRUE);
343+ }
344+ }
345 }
346 }
347

Subscribers

People subscribed via source and target branches

to all changes: