r1277 - trunk/src/target/OM-2007/applications/openmoko-today/src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Thu Mar 8 17:14:02 CET 2007


Author: thomas
Date: 2007-03-08 17:14:00 +0100 (Thu, 08 Mar 2007)
New Revision: 1277

Modified:
   trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c
Log:
* Connect signal to launcher buttons in openmoko-today
* Add some comments


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-03-08 15:22:07 UTC (rev 1276)
+++ trunk/src/target/OM-2007/applications/openmoko-today/src/today-main.c	2007-03-08 16:14:00 UTC (rev 1277)
@@ -180,6 +180,18 @@
   return result;
 }
 
+/* information lines */
+
+/**
+ * today_infoline_new:
+ * @stock_id: name of the stock icon to use
+ * @message: string containing the message
+ *
+ * Utility function to create new info lines
+ *
+ * Return value: The parent widget of the new widgets
+ */
+
 static GtkWidget *
 today_infoline_new (gchar * stock_id, gchar * message)
 {
@@ -202,6 +214,37 @@
   return eventbox;
 }
 
+
+/* launcher buttons */
+
+/**
+ * callback for luncher buttons
+ */
+static void
+today_launcher_clicked_cb (GtkWidget *button, gchar *command)
+{
+  GError *error;
+
+  g_spawn_command_line_async (command, &error);
+
+  if (error)
+  {
+    LOG_ERROR;
+    g_error_free (error);
+  }
+
+  /* TODO: should we hide or quit after launching an application? */
+}
+
+/**
+ * today_launcher_button_new:
+ * @icon: stock name to use as the icon in the button
+ * @exec: command to execute when the button is clicked
+ *
+ * Utility function to create new launcher buttons
+ *
+ * Return value: The parent widget of the new widgets
+ */
 static GtkWidget *
 today_launcher_button_new (gchar * icon, gchar * exec)
 {
@@ -212,6 +255,11 @@
 
   gtk_widget_set_name (button, "today-launcher-button");
 
+  g_signal_connect (G_OBJECT (button),
+                    "clicked",
+                    G_CALLBACK (today_launcher_clicked_cb),
+                    exec);
+
   return button;
 }
 
@@ -324,7 +372,7 @@
   gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 0);
 
   gtk_container_add (GTK_CONTAINER (button_box),
-                     today_launcher_button_new (GTK_STOCK_EXECUTE, ""));
+                     today_launcher_button_new (GTK_STOCK_EXECUTE, "contacts"));
   gtk_container_add (GTK_CONTAINER (button_box),
                      today_launcher_button_new (GTK_STOCK_EXECUTE, ""));
   gtk_container_add (GTK_CONTAINER (button_box),





More information about the commitlog mailing list