Merge lp:~bratsche/xsplash/daemon into lp:xsplash

Proposed by Cody Russell
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bratsche/xsplash/daemon
Merge into: lp:xsplash
Diff against target: None lines
To merge this branch: bzr merge lp:~bratsche/xsplash/daemon
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Scott James Remnant (Canonical) (community) Approve
Review via email: mp+11734@code.launchpad.net

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

To post a comment you must log in.
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) :
review: Approve
Revision history for this message
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-08 16:11:32 +0000
+++ src/xsplash.c 2009-09-14 20:25:30 +0000
@@ -71,6 +71,7 @@
71 PROP_DBUS_PROXY71 PROP_DBUS_PROXY
72};72};
7373
74static void start_daemon_mode (void);
74static AnimContext * anim_context_new (XsplashServer *server,75static AnimContext * anim_context_new (XsplashServer *server,
75 GtyTimeline *timeline,76 GtyTimeline *timeline,
76 gpointer id);77 gpointer id);
@@ -125,6 +126,7 @@
125static guint throbber_frames = 50;126static guint throbber_frames = 50;
126static gboolean ping_pong = FALSE;127static gboolean ping_pong = FALSE;
127static gboolean have_xcomposite = FALSE;128static gboolean have_xcomposite = FALSE;
129static gboolean daemon_mode = FALSE;
128static gboolean is_composited = FALSE;130static gboolean is_composited = FALSE;
129static gboolean redirected = FALSE;131static gboolean redirected = FALSE;
130static GSList *signal_list = NULL;132static GSList *signal_list = NULL;
@@ -141,6 +143,11 @@
141 "Filename for background image", NULL143 "Filename for background image", NULL
142 },144 },
143 {145 {
146 "daemon", 'd', 0,
147 G_OPTION_ARG_NONE, &daemon_mode,
148 "Run in daemon mode", NULL
149 },
150 {
144 "logo", 'l', 0,151 "logo", 'l', 0,
145 G_OPTION_ARG_FILENAME, &logo_image,152 G_OPTION_ARG_FILENAME, &logo_image,
146 "Filename for logo image", NULL153 "Filename for logo image", NULL
@@ -558,6 +565,8 @@
558565
559 gtk_container_add (GTK_CONTAINER (priv->window), fixed);566 gtk_container_add (GTK_CONTAINER (priv->window), fixed);
560567
568 start_daemon_mode ();
569
561 gtk_widget_show_all (priv->window);570 gtk_widget_show_all (priv->window);
562571
563 if (logo_filename)572 if (logo_filename)
@@ -814,6 +823,27 @@
814 gtk_main_quit ();823 gtk_main_quit ();
815}824}
816825
826static void
827start_daemon_mode (void)
828{
829 pid_t pid, sid;
830
831 if (daemon_mode)
832 {
833 /* fork from our parent process */
834 pid = fork ();
835
836 if (pid < 0)
837 exit (EXIT_FAILURE);
838
839 if (pid > 0)
840 exit (EXIT_SUCCESS);
841
842 sid = setsid ();
843 if (sid < 0)
844 exit (EXIT_FAILURE);
845 }
846}
817847
818#define XSPLASH_LOG "/var/log/gdm/xsplash.log"848#define XSPLASH_LOG "/var/log/gdm/xsplash.log"
819849

Subscribers

People subscribed via source and target branches