]> Dogcows Code - chaz/openbox/blobdiff - openbox/openbox.c
the session properties are not set on the group leader, they are set on the "client...
[chaz/openbox] / openbox / openbox.c
index 633796418f26c499c49a9153ec0108f4a295178a..53299873dfc7b94b6d7cf079a5ffae0b45eb4bad 100644 (file)
@@ -109,7 +109,7 @@ gint main(gint argc, gchar **argv)
 
     /* initialize the locale */
     if (!setlocale(LC_ALL, ""))
-        g_message(_("Couldn't set locale from environment."));
+        g_message("Couldn't set locale from environment.");
     bindtextdomain(PACKAGE_NAME, LOCALEDIR);
     bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
     textdomain(PACKAGE_NAME);
@@ -379,19 +379,27 @@ gint main(gint argc, gchar **argv)
         }
 
         /* we remove the session arguments from argv, so put them back */
-        if (ob_sm_save_file != NULL) {
-            guint l = g_strv_length(argv);
-            argv = g_renew(gchar*, argv, l+2);
-            argv[l] = g_strdup("--sm-save-file");
-            argv[l+1] = ob_sm_save_file;
-            argv[l+2] = NULL;
-        }
-        if (ob_sm_id != NULL) {
-            guint l = g_strv_length(argv);
-            argv = g_renew(gchar*, argv, l+2);
-            argv[l] = g_strdup("--sm-client-id");
-            argv[l+1] = ob_sm_id;
-            argv[l+2] = NULL;
+        if (ob_sm_save_file != NULL || ob_sm_id != NULL) {
+            gchar **nargv;
+            gint i, l;
+
+            l = argc +
+                (ob_sm_save_file != NULL ? 2 : 0) +
+                (ob_sm_id != NULL ? 2 : 0);
+            nargv = g_new0(gchar*, l+1);
+            for (i = 0; i < argc; ++i)
+                nargv[i] = argv[i];
+
+            if (ob_sm_save_file != NULL) {
+                nargv[i++] = g_strdup("--sm-save-file");
+                nargv[i++] = ob_sm_save_file;
+            }
+            if (ob_sm_id != NULL) {
+                nargv[i++] = g_strdup("--sm-client-id");
+                nargv[i++] = ob_sm_id;
+            }
+            g_assert(i == l);
+            argv = nargv;
         }
 
         /* re-run me */
This page took 0.025091 seconds and 4 git commands to generate.