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

Proposed by Cody Russell
Status: Rejected
Rejected by: Cody Russell
Proposed branch: lp://qastaging/~bratsche/xsplash/configurable-signals
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
Reviewer Review Type Date Requested Status
Cody Russell Disapprove
Review via email: mp+11530@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Cody Russell (bratsche) wrote :

We need to merge this into release-0.7 branch (it's already been reviewed and merged into master).

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

That pulled in all the new assets. Let me create a new branch to do this.

review: Disapprove

Unmerged revisions

66. By Cody Russell

Remove some old info from help output

65. By Cody Russell

Remove SetSignals from dbus xml, replace with AddWaitSignal

64. By Cody Russell

remove configure_signals()

63. By Cody Russell

set_signals

62. By Cody Russell

fixes

61. By Cody Russell

small fixes

60. By Cody Russell

merge up with master

59. By Cody Russell

read /etc/xsplash for signals

58. By Cody Russell

merge from master

57. By Cody Russell

configurable signals

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-08 15:05:37 +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 'images/Makefile.am'
16--- images/Makefile.am 2009-08-20 11:07:58 +0000
17+++ images/Makefile.am 2009-08-31 19:11:01 +0000
18@@ -2,6 +2,20 @@
19
20 imagesdir = $(datadir)/images/xsplash
21
22-images_DATA = xsplash-background.png xsplash-throbber.png
23+images_DATA = bg_800x600.jpg \
24+ bg_1024x768.jpg \
25+ bg_1280x1024.jpg \
26+ bg_1440x900.jpg \
27+ bg_1680x1050.jpg \
28+ bg_1920x1200.jpg \
29+ bg_2560x1600.jpg \
30+ logo_small.png \
31+ logo_medium.png \
32+ logo_large.png \
33+ logo_xtra_large.png \
34+ throbber_small.png \
35+ throbber_medium.png \
36+ throbber_large.png \
37+ throbber_xtra-large.png
38
39 EXTRA_DIST = $(images_DATA)
40
41=== added file 'images/bg_1024x768.jpg'
42Binary files images/bg_1024x768.jpg 1970-01-01 00:00:00 +0000 and images/bg_1024x768.jpg 2009-08-31 18:47:10 +0000 differ
43=== added file 'images/bg_1280x1024.jpg'
44Binary files images/bg_1280x1024.jpg 1970-01-01 00:00:00 +0000 and images/bg_1280x1024.jpg 2009-08-31 18:47:10 +0000 differ
45=== added file 'images/bg_1440x900.jpg'
46Binary files images/bg_1440x900.jpg 1970-01-01 00:00:00 +0000 and images/bg_1440x900.jpg 2009-08-31 18:47:10 +0000 differ
47=== added file 'images/bg_1680x1050.jpg'
48Binary files images/bg_1680x1050.jpg 1970-01-01 00:00:00 +0000 and images/bg_1680x1050.jpg 2009-08-31 18:47:10 +0000 differ
49=== added file 'images/bg_1920x1200.jpg'
50Binary files images/bg_1920x1200.jpg 1970-01-01 00:00:00 +0000 and images/bg_1920x1200.jpg 2009-08-31 18:47:10 +0000 differ
51=== added file 'images/bg_2560x1600.jpg'
52Binary files images/bg_2560x1600.jpg 1970-01-01 00:00:00 +0000 and images/bg_2560x1600.jpg 2009-08-31 18:47:10 +0000 differ
53=== added file 'images/bg_800x600.jpg'
54Binary files images/bg_800x600.jpg 1970-01-01 00:00:00 +0000 and images/bg_800x600.jpg 2009-08-31 18:47:10 +0000 differ
55=== added file 'images/logo_large.png'
56Binary files images/logo_large.png 1970-01-01 00:00:00 +0000 and images/logo_large.png 2009-08-31 18:47:10 +0000 differ
57=== added file 'images/logo_medium.png'
58Binary files images/logo_medium.png 1970-01-01 00:00:00 +0000 and images/logo_medium.png 2009-08-31 18:47:10 +0000 differ
59=== added file 'images/logo_small.png'
60Binary files images/logo_small.png 1970-01-01 00:00:00 +0000 and images/logo_small.png 2009-08-31 18:47:10 +0000 differ
61=== added file 'images/logo_xtra_large.png'
62Binary files images/logo_xtra_large.png 1970-01-01 00:00:00 +0000 and images/logo_xtra_large.png 2009-08-31 18:47:10 +0000 differ
63=== added file 'images/throbber_large.png'
64Binary files images/throbber_large.png 1970-01-01 00:00:00 +0000 and images/throbber_large.png 2009-08-31 18:47:10 +0000 differ
65=== added file 'images/throbber_medium.png'
66Binary files images/throbber_medium.png 1970-01-01 00:00:00 +0000 and images/throbber_medium.png 2009-08-31 18:47:10 +0000 differ
67=== added file 'images/throbber_small.png'
68Binary files images/throbber_small.png 1970-01-01 00:00:00 +0000 and images/throbber_small.png 2009-08-31 18:47:10 +0000 differ
69=== added file 'images/throbber_xtra-large.png'
70Binary files images/throbber_xtra-large.png 1970-01-01 00:00:00 +0000 and images/throbber_xtra-large.png 2009-08-31 18:47:10 +0000 differ
71=== removed file 'images/xsplash-background.png'
72Binary files images/xsplash-background.png 2009-08-06 14:42:39 +0000 and images/xsplash-background.png 1970-01-01 00:00:00 +0000 differ
73=== removed file 'images/xsplash-throbber.png'
74Binary files images/xsplash-throbber.png 2009-08-19 00:44:34 +0000 and images/xsplash-throbber.png 1970-01-01 00:00:00 +0000 differ
75=== modified file 'src/xsplash-dbus.xml'
76--- src/xsplash-dbus.xml 2009-08-06 11:24:01 +0000
77+++ src/xsplash-dbus.xml 2009-09-08 15:05:37 +0000
78@@ -2,6 +2,9 @@
79
80 <node name="/">
81 <interface name="com.ubuntu.BootCurtain">
82+ <method name="AddWaitSignal">
83+ <arg type="s" name="wait" direction="in" />
84+ </method>
85 <method name="SignalLoaded">
86 <arg type="s" name="app" direction="in" />
87 </method>
88
89=== modified file 'src/xsplash.c'
90--- src/xsplash.c 2009-08-31 20:21:47 +0000
91+++ src/xsplash.c 2009-09-08 15:57:16 +0000
92@@ -22,6 +22,7 @@
93 #include <string.h>
94 #include <unistd.h>
95 #include <pwd.h>
96+#include <dirent.h>
97
98 #include <gtk/gtk.h>
99 #include <gdk/gdkkeysyms.h>
100@@ -61,9 +62,6 @@
101
102 GdkWindow *cow;
103 GdkScreen *screen;
104-
105- gboolean nautilus_done;
106- gboolean panel_done;
107 };
108
109 enum {
110@@ -73,29 +71,6 @@
111 PROP_DBUS_PROXY
112 };
113
114-#define XSPLASH_DBUS_NAME "com.ubuntu.BootCurtain"
115-#define XSPLASH_DBUS_OBJECT "/com/ubuntu/BootCurtain"
116-
117-static gboolean gdm_session = FALSE;
118-static gchar *background_image = NULL;
119-static gchar *logo_image = NULL;
120-static gchar *throbber_image = NULL;
121-static guint throbber_frames = 50;
122-static gboolean ping_pong = FALSE;
123-static gboolean have_xcomposite = FALSE;
124-static gboolean is_composited = FALSE;
125-static gboolean redirected = FALSE;
126-
127-static GOptionEntry entries[] = {
128- { "gdm-session", 'g', 0, G_OPTION_ARG_NONE, &gdm_session, "Run in gdm session", NULL },
129- { "background", 'b', 0, G_OPTION_ARG_FILENAME, &background_image, "Filename for background image", NULL },
130- { "logo", 'l', 0, G_OPTION_ARG_FILENAME, &logo_image, "Filename for logo image", NULL },
131- { "throbber", 't', 0, G_OPTION_ARG_FILENAME, &throbber_image, "Filename for throbber image", NULL },
132- { "frames", 'f', 0, G_OPTION_ARG_INT, &throbber_frames, "Number of frames for the throbber (default 50)", NULL },
133- { "pingpong", 'p', 0, G_OPTION_ARG_NONE, &ping_pong, "Whether to reverse throbber directions", NULL },
134- { NULL }
135-};
136-
137 static AnimContext * anim_context_new (XsplashServer *server,
138 GtyTimeline *timeline,
139 gpointer id);
140@@ -123,6 +98,9 @@
141
142 static void xsplash_server_dispose (GObject *object);
143
144+gboolean xsplash_server_add_wait_signal (XsplashServer *server,
145+ gchar *waitfor,
146+ GError **error);
147 gboolean xsplash_server_signal_loaded (XsplashServer *server,
148 gchar *app,
149 GError **error);
150@@ -131,6 +109,65 @@
151 gdouble progress,
152 gpointer user_data);
153
154+static void add_signal (gchar *name);
155+static void xsplash_add_signal (const gchar *option_name,
156+ const gchar *value,
157+ gpointer data,
158+ GError **error);
159+
160+#define XSPLASH_DBUS_NAME "com.ubuntu.BootCurtain"
161+#define XSPLASH_DBUS_OBJECT "/com/ubuntu/BootCurtain"
162+
163+static gboolean gdm_session = FALSE;
164+static gchar *background_image = NULL;
165+static gchar *logo_image = NULL;
166+static gchar *throbber_image = NULL;
167+static guint throbber_frames = 50;
168+static gboolean ping_pong = FALSE;
169+static gboolean have_xcomposite = FALSE;
170+static gboolean is_composited = FALSE;
171+static gboolean redirected = FALSE;
172+static GSList *signal_list = NULL;
173+
174+static GOptionEntry entries[] = {
175+ {
176+ "gdm-session", 'g', 0,
177+ G_OPTION_ARG_NONE, &gdm_session,
178+ "Run in gdm session", NULL
179+ },
180+ {
181+ "background", 'b', 0,
182+ G_OPTION_ARG_FILENAME, &background_image,
183+ "Filename for background image", NULL
184+ },
185+ {
186+ "logo", 'l', 0,
187+ G_OPTION_ARG_FILENAME, &logo_image,
188+ "Filename for logo image", NULL
189+ },
190+ {
191+ "throbber", 't', 0,
192+ G_OPTION_ARG_FILENAME, &throbber_image,
193+ "Filename for throbber image", NULL
194+ },
195+ {
196+ "frames", 'f', 0,
197+ G_OPTION_ARG_INT, &throbber_frames,
198+ "Number of frames for the throbber (default 50)", NULL
199+ },
200+ {
201+ "pingpong", 'p', 0,
202+ G_OPTION_ARG_NONE, &ping_pong,
203+ "Whether to reverse throbber directions", NULL
204+ },
205+ {
206+ "add-signal", 's', 0,
207+ G_OPTION_ARG_CALLBACK, (GOptionArgFunc) xsplash_add_signal,
208+ "Add a signal to listen for.", NULL
209+ },
210+ { NULL }
211+};
212+
213 #include "dbus-xsplash-server.h"
214
215 G_DEFINE_TYPE (XsplashServer, xsplash_server, G_TYPE_OBJECT);
216@@ -145,7 +182,7 @@
217
218 g_type_class_add_private (class, sizeof (XsplashServerPrivate));
219
220- object_class->dispose = xsplash_server_dispose;
221+ object_class->dispose = xsplash_server_dispose;
222 object_class->set_property = set_property;
223 object_class->get_property = get_property;
224
225@@ -219,8 +256,6 @@
226 g_return_if_reached ();
227 break;
228 }
229-
230- return;
231 }
232
233 static void
234@@ -245,8 +280,6 @@
235 g_return_if_reached ();
236 break;
237 }
238-
239- return;
240 }
241
242 static GdkPixbuf *
243@@ -267,6 +300,114 @@
244 return gdk_pixbuf_scale_simple (src, new_width, new_height, GDK_INTERP_BILINEAR);
245 }
246
247+static gchar *
248+get_background_filename (void)
249+{
250+ gint widths[] = { 2560, 1920, 1680, 1440, 1280, 1024, 800 };
251+ gint heights[] = { 1600, 1200, 1050, 900, 1024, 768, 600 };
252+ gint width, height;
253+ gint i;
254+ gint last_good = 0;
255+ gchar *ret;
256+ GdkScreen *screen;
257+
258+ screen = gdk_screen_get_default ();
259+ width = gdk_screen_get_width (screen);
260+ height = gdk_screen_get_height (screen);
261+
262+ g_debug ("get_background_filename(): looking for appropriate resolution...");
263+ for (i = 0; i < (sizeof (widths) / sizeof (gint)); i++)
264+ {
265+ if (widths[i] > width && heights[i] && height)
266+ {
267+ g_debug (" ** %dx%d will work.", widths[i], heights[i]);
268+ last_good = i;
269+ }
270+ else
271+ {
272+ g_debug (" ** %dx%d is too small, using last good size.", widths[i], heights[i]);
273+ break;
274+ }
275+ }
276+
277+ g_debug (" ** Found a resolution: %dx%d", widths[last_good], heights[last_good]);
278+
279+ ret = g_strdup_printf (DATADIR "/images/xsplash/bg_%dx%d.jpg", widths[last_good], heights[last_good]);
280+
281+ g_debug (" ** filename: %s", ret);
282+
283+ return ret;
284+}
285+
286+static const gchar *
287+get_filename_size_modifier (gint width)
288+{
289+ if (width < 1280)
290+ return "small";
291+ else if (width < 1600)
292+ return "medium";
293+ else if (width < 2560)
294+ return "large";
295+ else
296+ return "xtra_large";
297+}
298+
299+static gchar *
300+get_throbber_filename (void)
301+{
302+ gchar *ret;
303+ GdkScreen *screen;
304+ gint width;
305+
306+ screen = gdk_screen_get_default ();
307+ width = gdk_screen_get_width (screen);
308+
309+ if (throbber_image != NULL)
310+ {
311+ g_debug ("get_throbber_filename(): user provided a throbber on the command line; using that");
312+
313+ return g_strdup (throbber_image);
314+ }
315+
316+ g_debug ("get_throbber_filename(): looking for the best throbber for screen width...");
317+
318+ ret = g_strdup_printf (DATADIR "/images/xsplash/throbber_%s.png",
319+ get_filename_size_modifier (width));
320+
321+ g_debug (" ** Chose `%s'", get_filename_size_modifier (width));
322+ g_debug (" ** throbber filename is: %s", ret);
323+
324+ return ret;
325+}
326+
327+static gchar *
328+get_logo_filename ()
329+{
330+ gchar *ret;
331+ GdkScreen *screen;
332+ gint width;
333+
334+ screen = gdk_screen_get_default ();
335+ width = gdk_screen_get_width (screen);
336+
337+ if (logo_image != NULL)
338+ {
339+ g_debug ("get_logo_filename(): user provided a logo on the command line; using that");
340+
341+ return g_strdup (logo_image);
342+ }
343+
344+ g_debug ("get_logo_filename(): looking for the best logo for screen width...");
345+
346+ ret = g_strdup_printf (DATADIR "/images/xsplash/logo_%s.png",
347+ get_filename_size_modifier (width));
348+
349+ g_debug (" ** Chose `%s'", get_filename_size_modifier (width));
350+ g_debug (" ** logo filename is: %s", ret);
351+
352+ return ret;
353+}
354+
355 static GdkPixbuf *
356 get_pixbuf (gint width, gint height)
357 {
358@@ -276,7 +417,8 @@
359
360 pixbuf = gdk_pixbuf_new_from_file (background_image, NULL);
361 scaled = scale_to_min (pixbuf,
362- width, height);
363+ width,
364+ height);
365
366 w = gdk_pixbuf_get_width (scaled);
367 h = gdk_pixbuf_get_height (scaled);
368@@ -325,6 +467,8 @@
369 GdkPixbuf *logo;
370 GtkWidget *image;
371 GtkWidget *fixed;
372+ gchar *logo_filename;
373+ gchar *throbber_filename;
374
375 priv->dbusobject = NULL;
376 priv->system_bus = NULL;
377@@ -373,9 +517,13 @@
378 G_CALLBACK (key_press_event),
379 server);
380
381+ logo_filename = get_logo_filename (gdk_screen_get_width (priv->screen));
382+ throbber_filename = get_throbber_filename ();
383+
384 pixbuf = get_pixbuf (gdk_screen_get_width (priv->screen),
385 gdk_screen_get_height (priv->screen));
386- logo = gdk_pixbuf_new_from_file (logo_image, NULL);
387+
388+ logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
389
390 fixed = gtk_fixed_new ();
391
392@@ -387,9 +535,9 @@
393 gdk_screen_get_width (priv->screen) / 2 - gdk_pixbuf_get_width (logo) / 2,
394 gdk_screen_get_height (priv->screen) / 3 - gdk_pixbuf_get_height (logo) / 2);
395
396- if (throbber_image && throbber_frames)
397+ if (throbber_filename && throbber_frames)
398 {
399- priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_image, NULL);
400+ priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_filename, NULL);
401
402 if (priv->throbber_pixbuf != NULL)
403 {
404@@ -411,6 +559,12 @@
405 gtk_container_add (GTK_CONTAINER (priv->window), fixed);
406
407 gtk_widget_show_all (priv->window);
408+
409+ if (logo_filename)
410+ g_free (logo_filename);
411+
412+ if (throbber_filename)
413+ g_free (throbber_filename);
414 }
415
416 static void
417@@ -567,7 +721,7 @@
418 opacity = progress;
419 }
420
421- gtk_window_set_opacity (context->window, 1.0 - progress);
422+ gtk_window_set_opacity (context->window, opacity);
423 }
424
425 static void
426@@ -622,6 +776,37 @@
427 return FALSE;
428 }
429
430+static void
431+add_signal (gchar *name)
432+{
433+ GSList *tmp = NULL;
434+
435+ if ((strcmp (name, ".") == 0) || strcmp (name, "..") == 0)
436+ return;
437+
438+ g_debug ("adding signal `%s'", name);
439+
440+ for (tmp = signal_list; tmp != NULL; tmp = g_slist_next (signal_list))
441+ {
442+ if (strcmp (tmp->data, name) == 0)
443+ {
444+ g_debug (" ** that signal is already being listened for; skipping");
445+ return;
446+ }
447+ }
448+
449+ signal_list = g_slist_prepend (signal_list, g_strdup (name));
450+}
451+
452+static void
453+xsplash_add_signal (const gchar *option_name,
454+ const gchar *value,
455+ gpointer data,
456+ GError **error)
457+{
458+ add_signal (g_strdup (value));
459+}
460+
461 void
462 sig_handler (int signum)
463 {
464@@ -674,19 +859,20 @@
465 signal (SIGTERM, sig_handler);
466
467 if (background_image == NULL)
468- background_image = g_strdup ("/usr/share/backgrounds/warty-final-ubuntu.png");
469+ background_image = get_background_filename ();
470
471 if (logo_image == NULL)
472- logo_image = g_strdup ("/usr/share/images/C/ubuntuheader.png");
473+ logo_image = get_logo_filename ();
474
475 if (throbber_image == NULL)
476- throbber_image = g_strdup (DATADIR "/images/xsplash/xsplash-throbber.png");
477+ throbber_image = get_throbber_filename ();
478
479 g_debug ("background_image = %s", background_image);
480 g_debug ("logo_image = %s", logo_image);
481 g_debug ("throbber_image = %s", throbber_image);
482
483 system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
484+
485 bus_proxy = dbus_g_proxy_new_for_name (system_bus,
486 DBUS_SERVICE_DBUS,
487 DBUS_PATH_DBUS,
488@@ -729,16 +915,36 @@
489 if (throbber_image != NULL)
490 g_free (throbber_image);
491
492+ if (signal_list != NULL)
493+ {
494+ g_slist_foreach (signal_list, (GFunc)g_free, NULL);
495+ g_slist_free (signal_list);
496+ signal_list = NULL;
497+ }
498+
499 return 0;
500 }
501
502 gboolean
503+xsplash_server_add_wait_signal (XsplashServer *server,
504+ gchar *waitfor,
505+ GError **error)
506+{
507+ g_debug ("received a new signal to wait for: %s", waitfor);
508+
509+ if (waitfor)
510+ {
511+ add_signal (waitfor);
512+ }
513+
514+ return TRUE;
515+}
516+
517+gboolean
518 xsplash_server_signal_loaded (XsplashServer *server,
519 gchar *app,
520 GError **error)
521 {
522- XsplashServerPrivate *priv = XSPLASH_SERVER_GET_PRIVATE (server);
523-
524 g_debug ("received signal: %s", app);
525
526 if (gdm_session)
527@@ -748,19 +954,24 @@
528 }
529 else
530 {
531- if (strcmp (app, "nautilus") == 0)
532- {
533- priv->nautilus_done = TRUE;
534- }
535- else if (strcmp (app, "gnome-panel") == 0)
536- {
537- priv->panel_done = TRUE;
538- }
539-
540- if (priv->nautilus_done && priv->panel_done)
541- {
542- g_debug ("received both \"nautilus\" and \"panel\" signals: fading out");
543- begin_fade (server, TRUE);
544+ GSList *l = NULL;
545+
546+ /* Remove this signal if it's in our list; if the list is empty, begin fading */
547+ for (l = signal_list; l != NULL; l = l->next)
548+ {
549+ if (strcmp (app, (gchar *)l->data) == 0)
550+ {
551+ g_debug ("received signal %s", (gchar*)l->data);
552+
553+ g_free (l->data);
554+ signal_list = g_slist_delete_link (signal_list, l);
555+
556+ /* There are no more signals we are listening for */
557+ if (signal_list == NULL)
558+ {
559+ begin_fade (server, TRUE);
560+ }
561+ }
562 }
563 }
564

Subscribers

People subscribed via source and target branches

to all changes: