[mutter/bilelmoussaoui/drop-zenity: 11/11] core: Drop zenity show_dialog
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/bilelmoussaoui/drop-zenity: 11/11] core: Drop zenity show_dialog
- Date: Tue, 19 Apr 2022 14:23:21 +0000 (UTC)
commit 88bd76e2dab7dab88222e7bf3ddef959020c1845
Author: Bilal Elmoussaoui <belmouss redhat com>
Date: Tue Apr 19 16:17:22 2022 +0200
core: Drop zenity show_dialog
src/core/util.c | 151 --------------------------------------------------------
src/meta/util.h | 12 -----
2 files changed, 163 deletions(-)
---
diff --git a/src/core/util.c b/src/core/util.c
index 1f1048ca37..cbc5eba807 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -500,157 +500,6 @@ meta_external_binding_name_for_action (guint keybinding_action)
return g_strdup_printf ("external-grab-%u", keybinding_action);
}
-/* Command line arguments are passed in the locale encoding; in almost
- * all cases, we'd hope that is UTF-8 and no conversion is necessary.
- * If it's not UTF-8, then it's possible that the message isn't
- * representable in the locale encoding.
- */
-static void
-append_argument (GPtrArray *args,
- const char *arg)
-{
- char *locale_arg = g_locale_from_utf8 (arg, -1, NULL, NULL, NULL);
-
- /* This is cheesy, but it's better to have a few ???'s in the dialog
- * for an unresponsive application than no dialog at all appear */
- if (!locale_arg)
- locale_arg = g_strdup ("???");
-
- g_ptr_array_add (args, locale_arg);
-}
-
-static void
-child_setup (gpointer user_data)
-{
- MetaDisplay *display = meta_get_display ();
- MetaContext *context = meta_display_get_context (display);
-
- meta_context_restore_rlimit_nofile (context, NULL);
-}
-
-/**
- * meta_show_dialog: (skip)
- * @type: type of dialog
- * @message: message
- * @timeout: timeout
- * @display: display
- * @ok_text: text for Ok button
- * @cancel_text: text for Cancel button
- * @icon_name: icon name
- * @transient_for: window XID of parent
- * @columns: columns
- * @entries: entries
- *
- */
-GPid
-meta_show_dialog (const char *type,
- const char *message,
- const char *timeout,
- const char *display,
- const char *ok_text,
- const char *cancel_text,
- const char *icon_name,
- const int transient_for,
- GSList *columns,
- GSList *entries)
-{
- GError *error = NULL;
- GSList *tmp;
- GPid child_pid;
- GPtrArray *args;
-
- args = g_ptr_array_new ();
-
- append_argument (args, "zenity");
- append_argument (args, type);
-
- if (display)
- {
- append_argument (args, "--display");
- append_argument (args, display);
- }
-
- append_argument (args, "--class");
- append_argument (args, "mutter-dialog");
- append_argument (args, "--title");
- append_argument (args, "");
- append_argument (args, "--text");
- append_argument (args, message);
-
- if (timeout)
- {
- append_argument (args, "--timeout");
- append_argument (args, timeout);
- }
-
- if (ok_text)
- {
- append_argument (args, "--ok-label");
- append_argument (args, ok_text);
- }
-
- if (cancel_text)
- {
- append_argument (args, "--cancel-label");
- append_argument (args, cancel_text);
- }
-
- if (icon_name)
- {
- append_argument (args, "--icon-name");
- append_argument (args, icon_name);
- }
-
- tmp = columns;
- while (tmp)
- {
- append_argument (args, "--column");
- append_argument (args, tmp->data);
- tmp = tmp->next;
- }
-
- tmp = entries;
- while (tmp)
- {
- append_argument (args, tmp->data);
- tmp = tmp->next;
- }
-
- if (transient_for)
- {
- gchar *env = g_strdup_printf("%d", transient_for);
- setenv ("WINDOWID", env, 1);
- g_free (env);
-
- append_argument (args, "--modal");
- }
-
- g_ptr_array_add (args, NULL); /* NULL-terminate */
-
- g_spawn_async (
- "/",
- (gchar**) args->pdata,
- NULL,
- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
- child_setup, NULL,
- &child_pid,
- &error
- );
-
- if (transient_for)
- unsetenv ("WINDOWID");
-
- g_ptr_array_free (args, TRUE);
-
- if (error)
- {
- meta_warning ("%s", error->message);
- g_error_free (error);
- }
-
- return child_pid;
-}
-
MetaLocaleDirection
meta_get_locale_direction (void)
{
diff --git a/src/meta/util.h b/src/meta/util.h
index c44a63fc87..7db7805719 100644
--- a/src/meta/util.h
+++ b/src/meta/util.h
@@ -153,18 +153,6 @@ char* meta_external_binding_name_for_action (guint keybinding_action);
META_EXPORT
char* meta_g_utf8_strndup (const gchar *src, gsize n);
-META_EXPORT
-GPid meta_show_dialog (const char *type,
- const char *message,
- const char *timeout,
- const char *display,
- const char *ok_text,
- const char *cancel_text,
- const char *icon_name,
- const int transient_for,
- GSList *columns,
- GSList *entries);
-
/* To disable verbose mode, we make these functions into no-ops */
#ifdef WITH_VERBOSE_MODE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]