Merge lp:~bratsche/xsplash/daemon-0.7 into lp:~bratsche/xsplash/release-0.7

Proposed by Cody Russell on 2009-09-15
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bratsche/xsplash/daemon-0.7
Merge into: lp:~bratsche/xsplash/release-0.7
Diff against target: None lines
To merge this branch: bzr merge lp:~bratsche/xsplash/daemon-0.7
Reviewer Review Type Date Requested Status
Ted Gould (community) 2009-09-15 Approve on 2009-09-16
Review via email: mp+11808@code.launchpad.net
To post a comment you must log in.
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/xsplash.c'
--- src/xsplash.c 2009-09-10 17:23:19 +0000
+++ src/xsplash.c 2009-09-15 16:55:47 +0000
@@ -73,6 +73,7 @@
73 PROP_DBUS_PROXY73 PROP_DBUS_PROXY
74};74};
7575
76static void start_daemon_mode (void);
76static AnimContext * anim_context_new (XsplashServer *server,77static AnimContext * anim_context_new (XsplashServer *server,
77 GtyTimeline *timeline,78 GtyTimeline *timeline,
78 gpointer id);79 gpointer id);
@@ -127,6 +128,7 @@
127static guint throbber_frames = 50;128static guint throbber_frames = 50;
128static gboolean ping_pong = FALSE;129static gboolean ping_pong = FALSE;
129static gboolean have_xcomposite = FALSE;130static gboolean have_xcomposite = FALSE;
131static gboolean daemon_mode = FALSE;
130static gboolean is_composited = FALSE;132static gboolean is_composited = FALSE;
131static gboolean redirected = FALSE;133static gboolean redirected = FALSE;
132static GSList *signal_list = NULL;134static GSList *signal_list = NULL;
@@ -143,6 +145,11 @@
143 "Filename for background image", NULL145 "Filename for background image", NULL
144 },146 },
145 {147 {
148 "daemon", 'd', 0,
149 G_OPTION_ARG_NONE, &daemon_mode,
150 "Run in daemon mode", NULL
151 },
152 {
146 "logo", 'l', 0,153 "logo", 'l', 0,
147 G_OPTION_ARG_FILENAME, &logo_image,154 G_OPTION_ARG_FILENAME, &logo_image,
148 "Filename for logo image", NULL155 "Filename for logo image", NULL
@@ -446,6 +453,8 @@
446453
447 gtk_container_add (GTK_CONTAINER (priv->window), fixed);454 gtk_container_add (GTK_CONTAINER (priv->window), fixed);
448455
456 start_daemon_mode ();
457
449 gtk_widget_show_all (priv->window);458 gtk_widget_show_all (priv->window);
450}459}
451460
@@ -696,6 +705,27 @@
696 gtk_main_quit ();705 gtk_main_quit ();
697}706}
698707
708static void
709start_daemon_mode (void)
710{
711 pid_t pid, sid;
712
713 if (daemon_mode)
714 {
715 /* fork from our parent process */
716 pid = fork ();
717
718 if (pid < 0)
719 exit (EXIT_FAILURE);
720
721 if (pid > 0)
722 exit (EXIT_SUCCESS);
723
724 sid = setsid ();
725 if (sid < 0)
726 exit (EXIT_FAILURE);
727 }
728}
699729
700#define XSPLASH_LOG "/var/log/gdm/xsplash.log"730#define XSPLASH_LOG "/var/log/gdm/xsplash.log"
701731

Subscribers

People subscribed via source and target branches

to all changes: