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

Proposed by Cody Russell
Status: Superseded
Proposed branch: lp:~bratsche/xsplash/configurable-signals-backport-release-0.7
Merge into: lp:~bratsche/xsplash/release-0.7
Diff against target: None lines
To merge this branch: bzr merge lp:~bratsche/xsplash/configurable-signals-backport-release-0.7
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Review via email: mp+11538@code.launchpad.net

This proposal has been superseded by a proposal from 2009-09-10.

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

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

review: Approve
61. By Cody Russell

change timeout to 25s, add timer resetting when the waitfor signal adds somethign new

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/xsplash-dbus.xml'
2--- src/xsplash-dbus.xml 2009-08-06 11:24:01 +0000
3+++ src/xsplash-dbus.xml 2009-09-10 15:40:58 +0000
4@@ -2,6 +2,9 @@
5
6 <node name="/">
7 <interface name="com.ubuntu.BootCurtain">
8+ <method name="AddWaitSignal">
9+ <arg type="s" name="wait" direction="in" />
10+ </method>
11 <method name="SignalLoaded">
12 <arg type="s" name="app" direction="in" />
13 </method>
14
15=== modified file 'src/xsplash.c'
16--- src/xsplash.c 2009-08-31 20:21:47 +0000
17+++ src/xsplash.c 2009-09-10 15:40:58 +0000
18@@ -61,9 +61,6 @@
19
20 GdkWindow *cow;
21 GdkScreen *screen;
22-
23- gboolean nautilus_done;
24- gboolean panel_done;
25 };
26
27 enum {
28@@ -73,29 +70,6 @@
29 PROP_DBUS_PROXY
30 };
31
32-#define XSPLASH_DBUS_NAME "com.ubuntu.BootCurtain"
33-#define XSPLASH_DBUS_OBJECT "/com/ubuntu/BootCurtain"
34-
35-static gboolean gdm_session = FALSE;
36-static gchar *background_image = NULL;
37-static gchar *logo_image = NULL;
38-static gchar *throbber_image = NULL;
39-static guint throbber_frames = 50;
40-static gboolean ping_pong = FALSE;
41-static gboolean have_xcomposite = FALSE;
42-static gboolean is_composited = FALSE;
43-static gboolean redirected = FALSE;
44-
45-static GOptionEntry entries[] = {
46- { "gdm-session", 'g', 0, G_OPTION_ARG_NONE, &gdm_session, "Run in gdm session", NULL },
47- { "background", 'b', 0, G_OPTION_ARG_FILENAME, &background_image, "Filename for background image", NULL },
48- { "logo", 'l', 0, G_OPTION_ARG_FILENAME, &logo_image, "Filename for logo image", NULL },
49- { "throbber", 't', 0, G_OPTION_ARG_FILENAME, &throbber_image, "Filename for throbber image", NULL },
50- { "frames", 'f', 0, G_OPTION_ARG_INT, &throbber_frames, "Number of frames for the throbber (default 50)", NULL },
51- { "pingpong", 'p', 0, G_OPTION_ARG_NONE, &ping_pong, "Whether to reverse throbber directions", NULL },
52- { NULL }
53-};
54-
55 static AnimContext * anim_context_new (XsplashServer *server,
56 GtyTimeline *timeline,
57 gpointer id);
58@@ -122,6 +96,9 @@
59 gpointer user_data);
60
61 static void xsplash_server_dispose (GObject *object);
62+gboolean xsplash_server_add_wait_signal (XsplashServer *server,
63+ gchar *waitfor,
64+ GError **error);
65
66 gboolean xsplash_server_signal_loaded (XsplashServer *server,
67 gchar *app,
68@@ -131,6 +108,65 @@
69 gdouble progress,
70 gpointer user_data);
71
72+static void add_signal (gchar *name);
73+static void xsplash_add_signal (const gchar *option_name,
74+ const gchar *value,
75+ gpointer data,
76+ GError **error);
77+
78+#define XSPLASH_DBUS_NAME "com.ubuntu.BootCurtain"
79+#define XSPLASH_DBUS_OBJECT "/com/ubuntu/BootCurtain"
80+
81+static gboolean gdm_session = FALSE;
82+static gchar *background_image = NULL;
83+static gchar *logo_image = NULL;
84+static gchar *throbber_image = NULL;
85+static guint throbber_frames = 50;
86+static gboolean ping_pong = FALSE;
87+static gboolean have_xcomposite = FALSE;
88+static gboolean is_composited = FALSE;
89+static gboolean redirected = FALSE;
90+static GSList *signal_list = NULL;
91+
92+static GOptionEntry entries[] = {
93+ {
94+ "gdm-session", 'g', 0,
95+ G_OPTION_ARG_NONE, &gdm_session,
96+ "Run in gdm session", NULL
97+ },
98+ {
99+ "background", 'b', 0,
100+ G_OPTION_ARG_FILENAME, &background_image,
101+ "Filename for background image", NULL
102+ },
103+ {
104+ "logo", 'l', 0,
105+ G_OPTION_ARG_FILENAME, &logo_image,
106+ "Filename for logo image", NULL
107+ },
108+ {
109+ "throbber", 't', 0,
110+ G_OPTION_ARG_FILENAME, &throbber_image,
111+ "Filename for throbber image", NULL
112+ },
113+ {
114+ "frames", 'f', 0,
115+ G_OPTION_ARG_INT, &throbber_frames,
116+ "Number of frames for the throbber (default 50)", NULL
117+ },
118+ {
119+ "pingpong", 'p', 0,
120+ G_OPTION_ARG_NONE, &ping_pong,
121+ "Whether to reverse throbber directions", NULL
122+ },
123+ {
124+ "add-signal", 's', 0,
125+ G_OPTION_ARG_CALLBACK, (GOptionArgFunc) xsplash_add_signal,
126+ "Add a signal to listen for.", NULL
127+ },
128+ { NULL }
129+};
130+
131 #include "dbus-xsplash-server.h"
132
133 G_DEFINE_TYPE (XsplashServer, xsplash_server, G_TYPE_OBJECT);
134@@ -145,7 +181,7 @@
135
136 g_type_class_add_private (class, sizeof (XsplashServerPrivate));
137
138- object_class->dispose = xsplash_server_dispose;
139+ object_class->dispose = xsplash_server_dispose;
140 object_class->set_property = set_property;
141 object_class->get_property = get_property;
142
143@@ -219,8 +255,6 @@
144 g_return_if_reached ();
145 break;
146 }
147-
148- return;
149 }
150
151 static void
152@@ -245,8 +279,6 @@
153 g_return_if_reached ();
154 break;
155 }
156-
157- return;
158 }
159
160 static GdkPixbuf *
161@@ -622,6 +654,37 @@
162 return FALSE;
163 }
164
165+static void
166+add_signal (gchar *name)
167+{
168+ GSList *tmp = NULL;
169+
170+ if ((strcmp (name, ".") == 0) || strcmp (name, "..") == 0)
171+ return;
172+
173+ g_debug ("adding signal `%s'", name);
174+
175+ for (tmp = signal_list; tmp != NULL; tmp = g_slist_next (signal_list))
176+ {
177+ if (strcmp (tmp->data, name) == 0)
178+ {
179+ g_debug (" ** that signal is already being listened for; skipping");
180+ return;
181+ }
182+ }
183+
184+ signal_list = g_slist_prepend (signal_list, g_strdup (name));
185+}
186+
187+static void
188+xsplash_add_signal (const gchar *option_name,
189+ const gchar *value,
190+ gpointer data,
191+ GError **error)
192+{
193+ add_signal (g_strdup (value));
194+}
195+
196 void
197 sig_handler (int signum)
198 {
199@@ -729,16 +792,36 @@
200 if (throbber_image != NULL)
201 g_free (throbber_image);
202
203+ if (signal_list != NULL)
204+ {
205+ g_slist_foreach (signal_list, (GFunc)g_free, NULL);
206+ g_slist_free (signal_list);
207+ signal_list = NULL;
208+ }
209+
210 return 0;
211 }
212
213 gboolean
214+xsplash_server_add_wait_signal (XsplashServer *server,
215+ gchar *waitfor,
216+ GError **error)
217+{
218+ g_debug ("received a new signal to wait for: %s", waitfor);
219+
220+ if (waitfor)
221+ {
222+ add_signal (waitfor);
223+ }
224+
225+ return TRUE;
226+}
227+
228+gboolean
229 xsplash_server_signal_loaded (XsplashServer *server,
230 gchar *app,
231 GError **error)
232 {
233- XsplashServerPrivate *priv = XSPLASH_SERVER_GET_PRIVATE (server);
234-
235 g_debug ("received signal: %s", app);
236
237 if (gdm_session)
238@@ -748,19 +831,24 @@
239 }
240 else
241 {
242- if (strcmp (app, "nautilus") == 0)
243- {
244- priv->nautilus_done = TRUE;
245- }
246- else if (strcmp (app, "gnome-panel") == 0)
247- {
248- priv->panel_done = TRUE;
249- }
250-
251- if (priv->nautilus_done && priv->panel_done)
252- {
253- g_debug ("received both \"nautilus\" and \"panel\" signals: fading out");
254- begin_fade (server, TRUE);
255+ GSList *l = NULL;
256+
257+ /* Remove this signal if it's in our list; if the list is empty, begin fading */
258+ for (l = signal_list; l != NULL; l = l->next)
259+ {
260+ if (strcmp (app, (gchar *)l->data) == 0)
261+ {
262+ g_debug ("received signal %s", (gchar*)l->data);
263+
264+ g_free (l->data);
265+ signal_list = g_slist_delete_link (signal_list, l);
266+
267+ /* There are no more signals we are listening for */
268+ if (signal_list == NULL)
269+ {
270+ begin_fade (server, TRUE);
271+ }
272+ }
273 }
274 }
275

Subscribers

People subscribed via source and target branches

to all changes: