]> Dogcows Code - chaz/openbox/commitdiff
move the startup command launching into a helper function
authorDana Jansens <danakj@orodu.net>
Wed, 17 Feb 2010 21:15:08 +0000 (16:15 -0500)
committerDana Jansens <danakj@orodu.net>
Wed, 17 Feb 2010 21:15:08 +0000 (16:15 -0500)
openbox/openbox.c

index 1b39b40478b2a03cc387a4e12966f5e9069aa453..40b614a9e8211ffad913dd42bcc7cec6f8fce827 100644 (file)
@@ -109,6 +109,7 @@ static void remove_args(gint *argc, gchar **argv, gint index, gint num);
 static void parse_env();
 static void parse_args(gint *argc, gchar **argv);
 static Cursor load_cursor(const gchar *name, guint fontval);
+static void run_startup_cmd(void);
 
 gint main(gint argc, gchar **argv)
 {
@@ -343,28 +344,7 @@ gint main(gint argc, gchar **argv)
 
             ob_set_state(OB_STATE_RUNNING);
 
-            if (startup_cmd) {
-                gchar **argv = NULL;
-                GError *e = NULL;
-                gboolean ok;
-
-                if (!g_shell_parse_argv(startup_cmd, NULL, &argv, &e)) {
-                    g_message("Error parsing startup command: %s",
-                              e->message);
-                    g_error_free(e);
-                    e = NULL;
-                }
-                ok = g_spawn_async(NULL, argv, NULL,
-                                   G_SPAWN_SEARCH_PATH |
-                                   G_SPAWN_DO_NOT_REAP_CHILD,
-                                   NULL, NULL, NULL, &e);
-                if (!g_shell_parse_argv(startup_cmd, NULL, &argv, &e)) {
-                    g_message("Error launching startup command: %s",
-                              e->message);
-                    g_error_free(e);
-                    e = NULL;
-                }
-            }
+            if (startup_cmd) run_startup_cmd();
 
             /* look for parsing errors */
             {
@@ -562,6 +542,30 @@ static void remove_args(gint *argc, gchar **argv, gint index, gint num)
     *argc -= num;
 }
 
+static void run_startup_cmd(void)
+{
+    gchar **argv = NULL;
+    GError *e = NULL;
+    gboolean ok;
+
+    if (!g_shell_parse_argv(startup_cmd, NULL, &argv, &e)) {
+        g_message("Error parsing startup command: %s",
+                  e->message);
+        g_error_free(e);
+        e = NULL;
+    }
+    ok = g_spawn_async(NULL, argv, NULL,
+                       G_SPAWN_SEARCH_PATH |
+                       G_SPAWN_DO_NOT_REAP_CHILD,
+                       NULL, NULL, NULL, &e);
+    if (!g_shell_parse_argv(startup_cmd, NULL, &argv, &e)) {
+        g_message("Error launching startup command: %s",
+                  e->message);
+        g_error_free(e);
+        e = NULL;
+    }
+}
+
 static void parse_env(void)
 {
     const gchar *id;
This page took 0.024965 seconds and 4 git commands to generate.