[maemo-commits] [maemo-commits] r13880 - in projects/haf/trunk/hildon-desktop: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Sep 18 11:09:18 EEST 2007
Author: jobi
Date: 2007-09-18 11:09:15 +0300 (Tue, 18 Sep 2007)
New Revision: 13880

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/src/main.c
Log:

2007-09-18 Johan Bilien  <johan.bilien at nokia.com>

	* src/main.c: add a signal handler for SIGTERM, in which
	desktop sends a SIGTERM to all watched applications.
	Fixes: NB#69408



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-17 20:14:13 UTC (rev 13879)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-18 08:09:15 UTC (rev 13880)
@@ -1,3 +1,9 @@
+2007-09-18 Johan Bilien  <johan.bilien at nokia.com>
+
+	* src/main.c: add a signal handler for SIGTERM, in which
+	desktop sends a SIGTERM to all watched applications.
+	Fixes: NB#69408
+
 2007-09-17  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildonwm/hd-keys.c: (hd_keys_shortcut_new):

Modified: projects/haf/trunk/hildon-desktop/src/main.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/main.c	2007-09-17 20:14:13 UTC (rev 13879)
+++ projects/haf/trunk/hildon-desktop/src/main.c	2007-09-18 08:09:15 UTC (rev 13880)
@@ -1,9 +1,10 @@
 /*
  * This file is part of hildon-desktop
  *
- * Copyright (C) 2006 Nokia Corporation.
+ * Copyright (C) 2006, 2007 Nokia Corporation.
  *
  * Author:  Lucas Rocha <lucas.rocha at nokia.com>
+ *          Johan Bilien <johan.bilien at nokia.com>
  * Contact: Karoliina Salminen <karoliina.t.salminen at nokia.com>
  *
  * This library is free software; you can redistribute it and/or
@@ -33,6 +34,8 @@
 #include <gtk/gtk.h>
 #include <libgnomevfs/gnome-vfs.h>
 
+#include <libhildonwm/hd-wm-memory.h>
+
 /* getpriority, setpriority */
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -46,6 +49,12 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+/* signal */
+#include <signal.h>
+
+/* exit */
+#include <stdlib.h>
+
 #include <errno.h>
 
 #include "hd-desktop.h"
@@ -102,6 +111,18 @@
   return pid;
 }
 
+/* signal handler, hildon-desktop sends SIGTERM to all tracked applications
+ * when it receives SIGTEM itselgf */
+static void
+signal_handler (int signal)
+{
+  if (signal == SIGTERM)
+  {
+    hd_wm_memory_kill_all_watched (FALSE);
+    exit (0);
+  }
+}
+
 int main (int argc, char **argv)
 {
   GObject *desktop;
@@ -117,11 +138,11 @@
   textdomain (GETTEXT_PACKAGE);
 
   /* Read the maemo-af-desktop gtkrc file */
-  gtkrc = g_build_filename (g_get_home_dir (), 
+  gtkrc = g_build_filename (g_get_home_dir (),
                             OSSO_USER_DIR,
                             HILDON_DESKTOP_GTKRC,
                             NULL);
-  
+
   if (gtkrc && g_file_test ((gtkrc), G_FILE_TEST_EXISTS))
   {
     gtk_rc_add_default_file (gtkrc);
@@ -141,7 +162,9 @@
   gtk_init (&argc, &argv);
 
   gnome_vfs_init ();
-  
+
+  signal (SIGTERM, signal_handler);
+
   desktop = hd_desktop_new ();
 
   hd_desktop_run (HD_DESKTOP (desktop));


More information about the maemo-commits mailing list