summaryrefslogtreecommitdiff
path: root/src/core/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/util.c')
-rw-r--r--src/core/util.c79
1 files changed, 65 insertions, 14 deletions
diff --git a/src/core/util.c b/src/core/util.c
index bcfcb7f4..af4b8dd8 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -37,6 +37,8 @@
#include <X11/Xlib.h> /* must explicitly be included for Solaris; #326746 */
#include <X11/Xutil.h> /* Just for the definition of the various gravities */
+MetaNexus *sigchld_nexus;
+
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
void
@@ -538,11 +540,14 @@ meta_gravity_to_string (int gravity)
}
}
-void
+GPid
meta_show_dialog (const char *type,
const char *message,
const char *timeout,
const gint screen_number,
+ const char *ok_text,
+ const char *cancel_text,
+ const int transient_for,
const char **columns,
const char **entries)
{
@@ -561,12 +566,11 @@ zenity --display X --screen S --title Metacity --list --timeout 240 --text "Thes
*/
const char **argvl;
+ char **envl;
int i=0;
GPid child_pid;
- argvl = g_malloc(sizeof (char*) *
- (9 + (timeout?2:0))
- );
+ argvl = g_malloc(sizeof (char*) * 15);
argvl[i++] = "zenity";
argvl[i++] = type;
@@ -584,18 +588,38 @@ zenity --display X --screen S --title Metacity --list --timeout 240 --text "Thes
argvl[i++] = timeout;
}
+ if (ok_text)
+ {
+ argvl[i++] = "--ok-label";
+ argvl[i++] = ok_text;
+ }
+
+ if (cancel_text)
+ {
+ argvl[i++] = "--cancel-label";
+ argvl[i++] = cancel_text;
+ }
+
argvl[i] = NULL;
- g_spawn_async_with_pipes (
- "/",
- (char**) argvl, /* ugh */
- NULL,
- G_SPAWN_SEARCH_PATH,
- NULL, NULL,
- &child_pid,
- NULL, NULL, NULL,
- &error
- );
+ if (transient_for)
+ {
+ gchar *env = g_strdup_printf("%d", transient_for);
+ setenv ("WINDOWID", env, 1);
+ g_free (env);
+ }
+ else
+ envl = NULL;
+
+ g_spawn_async (
+ "/",
+ (gchar**) argvl, /* ugh */
+ NULL,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
+ NULL, NULL,
+ &child_pid,
+ &error
+ );
g_free (argvl);
g_free (screen_number_text);
@@ -605,6 +629,33 @@ zenity --display X --screen S --title Metacity --list --timeout 240 --text "Thes
meta_warning ("%s\n", error->message);
g_error_free (error);
}
+
+ return child_pid;
+}
+
+GType
+meta_nexus_get_type (void)
+{
+ static GType nexus_type = 0;
+
+ if (!nexus_type)
+ {
+ static const GTypeInfo nexus_info =
+ {
+ sizeof (MetaNexusClass),
+ NULL, NULL, NULL, NULL, NULL,
+ sizeof (MetaNexus),
+ 0,
+ NULL, NULL
+ };
+
+ nexus_type = g_type_register_static (G_TYPE_OBJECT,
+ "MetaNexus",
+ &nexus_info,
+ 0);
+ }
+
+ return nexus_type;
}
/* eof util.c */