summaryrefslogtreecommitdiff
path: root/tests/testmountoperation.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-10-04 21:25:26 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-10-04 21:26:07 -0400
commite1f69ea278b8fa48d0963d9bcd29559fc9206d5e (patch)
tree88870ac83977c46e2f66898a31ab799725bd34d2 /tests/testmountoperation.c
parent6a76fe41c6d278c097e40f689b55194e7688d90d (diff)
downloadgtk+-e1f69ea278b8fa48d0963d9bcd29559fc9206d5e.tar.gz
testmountoperation: Test process dialog
Without this, it is hard to trigger the dialog. Event with this, we have to force GtkMountOperation to use its own dialog.
Diffstat (limited to 'tests/testmountoperation.c')
-rw-r--r--tests/testmountoperation.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/testmountoperation.c b/tests/testmountoperation.c
index d6222c622d..4c908a7c64 100644
--- a/tests/testmountoperation.c
+++ b/tests/testmountoperation.c
@@ -20,6 +20,7 @@
#include <gtk/gtk.h>
static gboolean ask_question = FALSE;
+static gboolean show_processes = FALSE;
static gboolean anonymous = FALSE;
static gboolean dont_ask_username = FALSE;
static gboolean dont_ask_domain = FALSE;
@@ -100,6 +101,7 @@ main (int argc, char *argv[])
GError *error = NULL;
GOptionEntry options[] = {
{ "ask-question", 'q', 0, G_OPTION_ARG_NONE, &ask_question, "Ask a question not a password.", NULL },
+ { "show-processes", 0, 0, G_OPTION_ARG_NONE, &show_processes, "Show (pretend) processes.", NULL },
{ "right-to-left", 'r', 0, G_OPTION_ARG_NONE, &force_rtl, "Force right-to-left layout.", NULL },
{ "anonymous", 'a', 0, G_OPTION_ARG_NONE, &anonymous, "Anonymous login allowed.", NULL },
{ "no-username", 'u', 0, G_OPTION_ARG_NONE, &dont_ask_username, "Don't ask for the username.", NULL },
@@ -137,6 +139,26 @@ main (int argc, char *argv[])
g_signal_emit_by_name (op, "ask_question", "Foo\nbar", choices);
}
+ else if (show_processes)
+ {
+ static const char *choices[] = {
+ "Yes", "No", "Sauerkraut", NULL
+ };
+ GArray *pids;
+ GPid pid;
+
+ pids = g_array_new (TRUE, FALSE, sizeof (GPid));
+ pid = 1000;
+ g_array_append_val (pids, pid);
+ pid = 2000;
+ g_array_append_val (pids, pid);
+ pid = 3000;
+ g_array_append_val (pids, pid);
+
+ g_signal_emit_by_name (op, "show-processes", "Foo\nbar", pids, choices);
+
+ g_array_unref (pids);
+ }
else
{
GAskPasswordFlags flags;