r2109 - in trunk/src/target/OM-2007/applications/openmoko-today: . src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Thu May 31 15:44:19 CEST 2007


Author: thomas
Date: 2007-05-31 15:44:17 +0200 (Thu, 31 May 2007)
New Revision: 2109

Modified:
   trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog
   trunk/src/target/OM-2007/applications/openmoko-today/configure.ac
   trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c
Log:
* configure.ac:
* src/today-main.c: (today_infoline_new): Add startup-notification support


Modified: trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog	2007-05-31 10:39:10 UTC (rev 2108)
+++ trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog	2007-05-31 13:44:17 UTC (rev 2109)
@@ -1,3 +1,8 @@
+2007-05-31  Thomas Wood  <thomas at openedhand.com>
+
+	* configure.ac:
+	* src/today-main.c: (today_infoline_new): Add startup-notification support
+
 2007-05-30  Thomas Wood  <thomas at openedhand.com>
 
 	* src/today-main.c: (today_infoline_new),

Modified: trunk/src/target/OM-2007/applications/openmoko-today/configure.ac
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/configure.ac	2007-05-31 10:39:10 UTC (rev 2108)
+++ trunk/src/target/OM-2007/applications/openmoko-today/configure.ac	2007-05-31 13:44:17 UTC (rev 2109)
@@ -22,6 +22,7 @@
 
 PKG_CHECK_MODULES(TODAY,
                   openmoko-libs
+                  libstartup-notification-1.0
                   libebook-1.2 >= $LIBEBOOK_VERSION
                   libecal-1.2 >= $LIBEBOOK_VERSION)
 

Modified: trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c	2007-05-31 10:39:10 UTC (rev 2108)
+++ trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c	2007-05-31 13:44:17 UTC (rev 2109)
@@ -24,10 +24,14 @@
 
 #include <string.h>
 #include <glib.h>
-#include <glib/gprintf.h>
 #include <gtk/gtk.h>
-#include <libmokoui/moko-window.h>
-#include <libmokoui/moko-pixmap-button.h>
+#include <unistd.h>
+#include <libmokoui/moko-ui.h>
+
+#define SN_API_NOT_YET_FROZEN 1
+#include <libsn/sn-launcher.h>
+#include <gdk/gdkx.h>
+
 #include "today-events-area.h"
 #include "today-utils.h"
 #include "xutil.h"
@@ -131,20 +135,42 @@
 /**
  * callback for luncher buttons
  */
+
 void
-today_launcher_clicked_cb (GtkWidget *button, gchar *command)
+today_launcher_clicked_cb (GtkWidget *widget, gchar *command)
 {
-  GError *error = NULL;
+  /* The following code is a modified version of code from launcher-util.c in
+   * matchbox-desktop-2 and is copyright (C) 2007 OpenedHand Ltd, made available
+   * under the GNU General Public License.
+   */
+  pid_t child_pid = 0;
+  SnLauncherContext *context;
+  SnDisplay *sn_dpy;
+  Display *display;
+  int screen;
 
-  g_spawn_command_line_async (command, &error);
+  display = gdk_x11_display_get_xdisplay (gtk_widget_get_display (widget));
+  sn_dpy = sn_display_new (display, NULL, NULL);
 
-  if (error)
-  {
-    LOG_ERROR;
-    g_error_free (error);
+  screen = gdk_screen_get_number (gtk_widget_get_screen (widget));
+  context = sn_launcher_context_new (sn_dpy, screen);
+  sn_display_unref (sn_dpy);
+
+  /* sn_launcher_context_set_name (context, data->name); */
+  sn_launcher_context_set_binary_name (context, command);
+  sn_launcher_context_initiate (context, "openmoko-today", command, CurrentTime);
+  switch ((child_pid = fork ())) {
+  case -1:
+    g_warning ("Fork failed");
+    break;
+  case 0:
+    sn_launcher_context_setup_child_process (context);
+    execlp (command, NULL);
+    g_warning ("Failed to execlp() %s", command);
+    _exit (1);
+    break;
   }
-
-  /* TODO: should we hide or quit after launching an application? */
+  sn_launcher_context_unref (context);
 }
 
 /**





More information about the commitlog mailing list