]> Dogcows Code - chaz/openbox/blobdiff - openbox/startupnotify.c
Merge branch 'master' into chaz
[chaz/openbox] / openbox / startupnotify.c
index e9bb8310a0433989bac5254a8bbc07073a3e944d..e249002b106bd4299b1eb60227b7e0de54331e39 100644 (file)
 #include "startupnotify.h"
 #include "gettext.h"
 #include "event.h"
+#include "obt/xqueue.h"
 
-#include <stdlib.h>
+#ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+#endif
 
 #ifndef USE_LIBSN
 
@@ -41,7 +44,6 @@ void sn_spawn_cancel() {}
 #else
 
 #include "openbox.h"
-#include "mainloop.h"
 #include "screen.h"
 
 #define SN_API_NOT_YET_FROZEN
@@ -61,12 +63,12 @@ void sn_startup(gboolean reconfig)
 {
     if (reconfig) return;
 
-    sn_display = sn_display_new(ob_display, NULL, NULL);
+    sn_display = sn_display_new(obt_display, NULL, NULL);
     sn_context = sn_monitor_context_new(sn_display, ob_screen,
                                         sn_event_func, NULL, NULL);
     sn_launcher = sn_launcher_context_new(sn_display, ob_screen);
 
-    ob_main_loop_x_add(ob_main_loop, sn_handler, NULL, NULL);
+    xqueue_add_callback(sn_handler, NULL);
 }
 
 void sn_shutdown(gboolean reconfig)
@@ -75,7 +77,7 @@ void sn_shutdown(gboolean reconfig)
 
     if (reconfig) return;
 
-    ob_main_loop_x_remove(ob_main_loop, sn_handler);
+    xqueue_remove_callback(sn_handler, NULL);
 
     for (it = sn_waits; it; it = g_slist_next(it))
         sn_startup_sequence_unref((SnStartupSequence*)it->data);
@@ -138,10 +140,9 @@ static void sn_event_func(SnMonitorEvent *ev, gpointer data)
         sn_waits = g_slist_prepend(sn_waits, seq);
         /* 20 second timeout for apps to start if the launcher doesn't
            have a timeout */
-        ob_main_loop_timeout_add(ob_main_loop, 20 * G_USEC_PER_SEC,
-                                 sn_wait_timeout, seq,
-                                 g_direct_equal,
-                                 (GDestroyNotify)sn_startup_sequence_unref);
+        g_timeout_add_full(G_PRIORITY_DEFAULT,
+                           20 * 1000, sn_wait_timeout, seq,
+                           (GDestroyNotify)sn_startup_sequence_unref);
         change = TRUE;
         break;
     case SN_MONITOR_EVENT_CHANGED:
@@ -152,8 +153,7 @@ static void sn_event_func(SnMonitorEvent *ev, gpointer data)
     case SN_MONITOR_EVENT_CANCELED:
         if ((seq = sequence_find(sn_startup_sequence_get_id(seq)))) {
             sn_waits = g_slist_remove(sn_waits, seq);
-            ob_main_loop_timeout_remove_data(ob_main_loop, sn_wait_timeout,
-                                             seq, FALSE);
+            g_source_remove_by_user_data(seq);
             change = TRUE;
         }
         break;
@@ -238,7 +238,7 @@ void sn_setup_spawn_environment(const gchar *program, const gchar *name,
     gchar *desc;
     const char *id;
 
-    desc = g_strdup_printf(_("Running %s\n"), program);
+    desc = g_strdup_printf(_("Running %s"), program);
 
     if (sn_launcher_context_get_initiated(sn_launcher)) {
         sn_launcher_context_unref(sn_launcher);
@@ -254,17 +254,16 @@ void sn_setup_spawn_environment(const gchar *program, const gchar *name,
     if (desktop >= 0 && (unsigned) desktop < screen_num_desktops)
         sn_launcher_context_set_workspace(sn_launcher, (signed) desktop);
     sn_launcher_context_initiate(sn_launcher, "openbox", program,
-                                 event_curtime);
+                                 event_time());
     id = sn_launcher_context_get_startup_id(sn_launcher);
 
     /* 20 second timeout for apps to start */
     sn_launcher_context_ref(sn_launcher);
-    ob_main_loop_timeout_add(ob_main_loop, 20 * G_USEC_PER_SEC,
-                             sn_launch_wait_timeout, sn_launcher,
-                             g_direct_equal,
-                             (GDestroyNotify)sn_launcher_context_unref);
+    g_timeout_add_full(G_PRIORITY_DEFAULT,
+                       20 * 1000, sn_launch_wait_timeout, sn_launcher,
+                       (GDestroyNotify)sn_launcher_context_unref);
 
-    putenv(g_strdup_printf("DESKTOP_STARTUP_ID=%s", id));
+    g_setenv("DESKTOP_STARTUP_ID", id, TRUE);
 
     g_free(desc);
 }
This page took 0.022423 seconds and 4 git commands to generate.