[gtk+/multiroot-filechooser-2-20] testfilechooser - Add test buttons for rooting the file chooser
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/multiroot-filechooser-2-20] testfilechooser - Add test buttons for rooting the file chooser
- Date: Tue, 5 Oct 2010 23:08:54 +0000 (UTC)
commit 32f9d5bef1f35e1b280f84aff0457ba2b508c531
Author: Federico Mena Quintero <federico novell com>
Date: Tue Oct 5 17:42:03 2010 -0500
testfilechooser - Add test buttons for rooting the file chooser
Signed-off-by: Federico Mena Quintero <federico novell com>
tests/testfilechooser.c | 61 ++++++++++++++++++++++++++++------------------
1 files changed, 37 insertions(+), 24 deletions(-)
---
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index 443f5c3..a4db10c 100644
--- a/tests/testfilechooser.c
+++ b/tests/testfilechooser.c
@@ -407,6 +407,26 @@ unmap_and_remap_cb (GtkButton *button,
}
static void
+root_to_home_and_tmp_cb (GtkButton *button,
+ GtkFileChooser *chooser)
+{
+ char *root_uris[] = { "",
+ "file:///tmp",
+ NULL };
+
+ root_uris[0] = g_strconcat ("file://", g_get_home_dir (), NULL);
+ gtk_file_chooser_set_root_uris (chooser, (const char **) root_uris);
+ g_free (root_uris[0]);
+}
+
+static void
+unroot_cb (GtkButton *button,
+ GtkFileChooser *chooser)
+{
+ gtk_file_chooser_set_root_uris (chooser, NULL);
+}
+
+static void
kill_dependent (GtkWindow *win, GtkObject *dep)
{
gtk_object_destroy (dep);
@@ -474,6 +494,16 @@ confirm_overwrite_cb (GtkFileChooser *chooser,
return conf;
}
+static void
+add_test_button (GtkWidget *container, const char *label_text, GCallback callback, gpointer data)
+{
+ GtkWidget *button;
+
+ button = gtk_button_new_with_label (label_text);
+ gtk_container_add (GTK_CONTAINER (container), button);
+ g_signal_connect (button, "clicked", callback, data);
+}
+
int
main (int argc, char **argv)
{
@@ -668,30 +698,13 @@ main (int argc, char **argv)
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_file_chooser_unselect_all), dialog);
- button = gtk_button_new_with_label ("set_current_folder (\"/nonexistent\")");
- gtk_container_add (GTK_CONTAINER (vbbox), button);
- g_signal_connect (button, "clicked",
- G_CALLBACK (set_folder_nonexistent_cb), dialog);
-
- button = gtk_button_new_with_label ("set_current_folder (\"/usr/nonexistent\")");
- gtk_container_add (GTK_CONTAINER (vbbox), button);
- g_signal_connect (button, "clicked",
- G_CALLBACK (set_folder_existing_nonexistent_cb), dialog);
-
- button = gtk_button_new_with_label ("set_filename (\"/nonexistent\")");
- gtk_container_add (GTK_CONTAINER (vbbox), button);
- g_signal_connect (button, "clicked",
- G_CALLBACK (set_filename_nonexistent_cb), dialog);
-
- button = gtk_button_new_with_label ("set_filename (\"/usr/nonexistent\")");
- gtk_container_add (GTK_CONTAINER (vbbox), button);
- g_signal_connect (button, "clicked",
- G_CALLBACK (set_filename_existing_nonexistent_cb), dialog);
-
- button = gtk_button_new_with_label ("Unmap and remap");
- gtk_container_add (GTK_CONTAINER (vbbox), button);
- g_signal_connect (button, "clicked",
- G_CALLBACK (unmap_and_remap_cb), dialog);
+ add_test_button (vbbox, "set_current_folder (\"/nonexistent\")", G_CALLBACK (set_folder_nonexistent_cb), dialog);
+ add_test_button (vbbox, "set_current_folder (\"/usr/nonexistent\")", G_CALLBACK (set_folder_existing_nonexistent_cb), dialog);
+ add_test_button (vbbox, "set_filename (\"/nonexistent\")", G_CALLBACK (set_filename_nonexistent_cb), dialog);
+ add_test_button (vbbox, "set_filename (\"/usr/nonexistent\")", G_CALLBACK (set_filename_existing_nonexistent_cb), dialog);
+ add_test_button (vbbox, "Unmap and remap", G_CALLBACK (unmap_and_remap_cb), dialog);
+ add_test_button (vbbox, "Root to $HOME and /tmp", G_CALLBACK (root_to_home_and_tmp_cb), dialog);
+ add_test_button (vbbox, "Unroot", G_CALLBACK (unroot_cb), dialog);
gtk_widget_show_all (control_window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]