summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@src.gnome.org>2007-11-30 14:51:10 +0000
committerAlexander Larsson <alexl@src.gnome.org>2007-11-30 14:51:10 +0000
commit469047a2a58430026d68a3b99b223b922b18b8d1 (patch)
tree0d7422285604a348f98f3c93e39afdf570050678 /test
parentce669bd18cf00a3fc485ffedc53850e2d89b57e0 (diff)
downloadnautilus-469047a2a58430026d68a3b99b223b922b18b8d1.tar.gz
Merge gio-branch
svn path=/trunk/; revision=13464
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am3
-rw-r--r--test/test-copy.c93
-rw-r--r--test/test-nautilus-directory-async.c4
-rw-r--r--test/test-nautilus-mime-actions-set.c4
-rw-r--r--test/test-nautilus-mime-actions.c18
-rw-r--r--test/test-nautilus-preferences-change.c121
-rw-r--r--test/test-nautilus-wrap-table.c2
-rw-r--r--test/test.c52
-rw-r--r--test/test.h1
9 files changed, 106 insertions, 192 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index b6fd4cd70..d018fea59 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -16,8 +16,11 @@ noinst_PROGRAMS =\
test-nautilus-wrap-table \
test-nautilus-search-engine \
test-nautilus-directory-async \
+ test-nautilus-copy \
$(NULL)
+test_nautilus_copy_SOURCES = test-copy.c test.c
+
test_nautilus_wrap_table_SOURCES = test-nautilus-wrap-table.c test.c
test_nautilus_search_engine_SOURCES = test-nautilus-search-engine.c
diff --git a/test/test-copy.c b/test/test-copy.c
new file mode 100644
index 000000000..c71cda907
--- /dev/null
+++ b/test/test-copy.c
@@ -0,0 +1,93 @@
+#include "test.h"
+
+#include <libnautilus-private/nautilus-file-operations.h>
+#include <libnautilus-private/nautilus-progress-info.h>
+
+static void
+copy_done (GHashTable *debuting_uris, gpointer data)
+{
+ g_print ("Copy done\n");
+}
+
+static void
+changed_cb (NautilusProgressInfo *info,
+ gpointer data)
+{
+ g_print ("Changed: %s -- %s\n",
+ nautilus_progress_info_get_status (info),
+ nautilus_progress_info_get_details (info));
+}
+
+static void
+progress_changed_cb (NautilusProgressInfo *info,
+ gpointer data)
+{
+ g_print ("Progress changed: %f\n",
+ nautilus_progress_info_get_progress (info));
+}
+
+static void
+finished_cb (NautilusProgressInfo *info,
+ gpointer data)
+{
+ g_print ("Finished\n");
+ gtk_main_quit ();
+}
+
+int
+main (int argc, char* argv[])
+{
+ GtkWidget *window;
+ GList *sources;
+ GFile *dest;
+ GFile *source;
+ int i;
+ GList *infos;
+ NautilusProgressInfo *progress_info;
+
+ g_thread_init (NULL);
+
+ test_init (&argc, &argv);
+
+ if (argc < 3) {
+ g_print ("Usage test-copy <sources...> <dest dir>\n");
+ return 1;
+ }
+
+ sources = NULL;
+ for (i = 1; i < argc - 1; i++) {
+ source = g_file_new_for_commandline_arg (argv[i]);
+ sources = g_list_prepend (sources, source);
+ }
+ sources = g_list_reverse (sources);
+
+ dest = g_file_new_for_commandline_arg (argv[i]);
+
+ window = test_window_new ("copy test", 5);
+
+ gtk_widget_show (window);
+
+ nautilus_file_operations_copy (sources,
+ NULL /* GArray *relative_item_points */,
+ dest,
+ GTK_WINDOW (window),
+ copy_done, NULL);
+
+ infos = nautilus_get_all_progress_info ();
+
+ if (infos == NULL) {
+ return 0;
+ }
+
+ progress_info = NAUTILUS_PROGRESS_INFO (infos->data);
+
+ g_signal_connect (progress_info, "changed", (GCallback)changed_cb, NULL);
+ g_signal_connect (progress_info, "progress-changed", (GCallback)progress_changed_cb, NULL);
+ g_signal_connect (progress_info, "finished", (GCallback)finished_cb, NULL);
+
+ gtk_main ();
+
+ return 0;
+}
+
+
diff --git a/test/test-nautilus-directory-async.c b/test/test-nautilus-directory-async.c
index 0bb82f85c..49098c4c5 100644
--- a/test/test-nautilus-directory-async.c
+++ b/test/test-nautilus-directory-async.c
@@ -1,5 +1,4 @@
#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <libnautilus-private/nautilus-directory.h>
#include <libnautilus-private/nautilus-search-directory.h>
#include <libnautilus-private/nautilus-file.h>
@@ -84,12 +83,11 @@ main (int argc, char **argv)
client1 = g_new0 (int, 1);
client2 = g_new0 (int, 1);
- gnome_vfs_init ();
gtk_init (&argc, &argv);
query = nautilus_query_new ();
nautilus_query_set_text (query, "richard hult");
- directory = nautilus_directory_get ("x-nautilus-search://0/");
+ directory = nautilus_directory_get_by_uri ("x-nautilus-search://0/");
nautilus_search_directory_set_query (NAUTILUS_SEARCH_DIRECTORY (directory), query);
g_object_unref (query);
diff --git a/test/test-nautilus-mime-actions-set.c b/test/test-nautilus-mime-actions-set.c
index e2f63ac0d..7bf6ec49b 100644
--- a/test/test-nautilus-mime-actions-set.c
+++ b/test/test-nautilus-mime-actions-set.c
@@ -25,8 +25,6 @@
#include <config.h>
#include <gnome.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <libnautilus-private/nautilus-mime-actions.h>
#include <stdio.h>
@@ -121,7 +119,7 @@ main (int argc, char **argv)
field = argv[2];
value = argv[3];
- file = nautilus_file_get (uri);
+ file = nautilus_file_get_by_uri (uri);
attributes = nautilus_mime_actions_get_full_file_attributes ();
nautilus_file_call_when_ready (file, attributes, ready_callback, NULL);
diff --git a/test/test-nautilus-mime-actions.c b/test/test-nautilus-mime-actions.c
index 72cf4d680..4e92e0854 100644
--- a/test/test-nautilus-mime-actions.c
+++ b/test/test-nautilus-mime-actions.c
@@ -25,8 +25,6 @@
#include <config.h>
#include <gnome.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <libnautilus-private/nautilus-mime-actions.h>
#include <stdio.h>
@@ -62,17 +60,15 @@ format_supported_uri_schemes_for_display (GList *supported_uri_schemes)
}
static void
-print_application (GnomeVFSMimeApplication *application)
+print_application (GAppInfo *application)
{
if (application == NULL) {
puts ("(none)");
} else {
- printf ("name: %s\ncommand: %s\ncan_open_multiple_files: %s\nexpects_uris: %s\nsupported_uri_schemes: %s\nrequires_terminal: %s\n",
- application->name, application->command,
- (application->can_open_multiple_files ? "TRUE" : "FALSE"),
- (application->expects_uris ? "TRUE" : "FALSE"),
- format_supported_uri_schemes_for_display (application->supported_uri_schemes),
- (application->requires_terminal ? "TRUE" : "FALSE"));
+ printf ("name: %s\ncommand: %s\nexpects_uris: %s\n",
+ g_application_get_name (application),
+ g_application_get_executable (application),
+ (g_app_info_supports_uris (application) ? "TRUE" : "FALSE"));
}
}
@@ -102,7 +98,7 @@ int
main (int argc, char **argv)
{
const char *uri;
- GnomeVFSMimeApplication *default_application;
+ GAppInfo *default_application;
GList *all_applications;
NautilusFile *file;
NautilusFileAttributes attributes;
@@ -116,7 +112,7 @@ main (int argc, char **argv)
}
uri = argv[1];
- file = nautilus_file_get (uri);
+ file = nautilus_file_get_by_uri (uri);
attributes = nautilus_mime_actions_get_full_file_attributes ();
nautilus_file_call_when_ready (file, attributes, ready_callback, NULL);
diff --git a/test/test-nautilus-preferences-change.c b/test/test-nautilus-preferences-change.c
deleted file mode 100644
index b34317751..000000000
--- a/test/test-nautilus-preferences-change.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include "test.h"
-
-#include <eel/eel-string-picker.h>
-#include <libnautilus-private/nautilus-global-preferences.h>
-#include <unistd.h>
-
-static void
-fruits_changed_callback (gpointer callback_data)
-{
- g_print ("Something underneath 'fruits' changed, dunno what\n");
-}
-
-static void
-int_picker_changed_callback (EelStringPicker *string_picker,
- gpointer callback_data)
-{
- char *selected_string;
- int new_value;
-
- g_return_if_fail (EEL_IS_STRING_PICKER (string_picker));
- g_return_if_fail (callback_data != NULL);
-
- selected_string = eel_string_picker_get_selected_string (string_picker);
-
- new_value = eel_string_picker_get_index_for_string (string_picker, selected_string);
-
- eel_preferences_set_integer ((const char *) callback_data, new_value);
-
- g_free (selected_string);
-}
-
-static GtkWidget *
-picker_new (const char *name,
- const EelStringList *entries)
-{
- GtkWidget *string_picker;
-
- g_return_val_if_fail (name != NULL, NULL);
- g_return_val_if_fail (entries != NULL, NULL);
-
- string_picker = eel_string_picker_new ();
- eel_caption_set_title_label (EEL_CAPTION (string_picker), name);
- g_signal_connect (string_picker, "changed",
- G_CALLBACK (int_picker_changed_callback), (gpointer) name);
-
- eel_string_picker_set_string_list (EEL_STRING_PICKER (string_picker), entries);
- eel_string_picker_set_selected_string_index (EEL_STRING_PICKER (string_picker),
- eel_preferences_get_integer (name));
-
- return string_picker;
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window;
- GtkWidget *green_picker;
- GtkWidget *yellow_picker;
- GtkWidget *red_picker;
- GtkWidget *fruits_apple_picker;
- GtkWidget *fruits_orange_picker;
- GtkWidget *fruits_pear_picker;
-
- GtkWidget *vbox;
-
- EelStringList *user_level_entries;
- EelStringList *color_entries;
- EelStringList *fruits_entries;
-
- test_init (&argc, &argv);
-
- nautilus_global_preferences_init ();
-
- user_level_entries = eel_string_list_new_from_tokens ("Beginner,Intermediate,Advanced", ",", TRUE);
- color_entries = eel_string_list_new_from_tokens ("0,1,2,3,4,5,6,7,8,9,10", ",", TRUE);
- fruits_entries = eel_string_list_new_from_tokens ("0,1,2,3", ",", TRUE);
-
- eel_preferences_set_emergency_fallback_integer ("green", 3);
-
- eel_preferences_set_emergency_fallback_integer ("yellow", 9);
-
- eel_preferences_set_emergency_fallback_integer ("red", 7);
-
- eel_preferences_set_emergency_fallback_integer ("fruits/apple", 1);
- eel_preferences_set_emergency_fallback_integer ("fruits/orange", 2);
- eel_preferences_set_emergency_fallback_integer ("fruits/pear", 3);
-
- /* sleep (10); */
-
- window = test_window_new (NULL, 4);
- test_window_set_title_with_pid (GTK_WINDOW (window), "Preferences Change");
-
- vbox = gtk_vbox_new (FALSE, 2);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- green_picker = picker_new ("green", color_entries);
- yellow_picker = picker_new ("yellow", color_entries);
- red_picker = picker_new ("red", color_entries);
- fruits_apple_picker = picker_new ("fruits/apple", fruits_entries);
- fruits_orange_picker = picker_new ("fruits/orange", fruits_entries);
- fruits_pear_picker = picker_new ("fruits/pear", fruits_entries);
-
- gtk_box_pack_start (GTK_BOX (vbox), green_picker, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), yellow_picker, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), red_picker, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), fruits_apple_picker, FALSE, FALSE, 20);
- gtk_box_pack_start (GTK_BOX (vbox), fruits_orange_picker, FALSE, FALSE, 20);
- gtk_box_pack_start (GTK_BOX (vbox), fruits_pear_picker, FALSE, FALSE, 20);
-
- eel_string_list_free (user_level_entries);
- eel_string_list_free (color_entries);
- eel_string_list_free (fruits_entries);
-
- eel_preferences_add_callback ("fruits", fruits_changed_callback, NULL);
-
- gtk_widget_show_all (window);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/test/test-nautilus-wrap-table.c b/test/test-nautilus-wrap-table.c
index bb1996915..258bde9a9 100644
--- a/test/test-nautilus-wrap-table.c
+++ b/test/test-nautilus-wrap-table.c
@@ -3,7 +3,7 @@
#include <eel/eel-wrap-table.h>
#include <eel/eel-labeled-image.h>
#include <libnautilus-private/nautilus-customization-data.h>
-#include <libnautilus-private/nautilus-icon-factory.h>
+#include <libnautilus-private/nautilus-icon-info.h>
int
main (int argc, char* argv[])
diff --git a/test/test.c b/test/test.c
index 46d9f93b0..bd9065ecd 100644
--- a/test/test.c
+++ b/test/test.c
@@ -8,7 +8,6 @@ test_init (int *argc,
{
gtk_init (argc, argv);
gdk_rgb_init ();
- gnome_vfs_init ();
eel_make_warnings_and_criticals_stop_in_debugger ();
}
@@ -16,8 +15,6 @@ test_init (int *argc,
int
test_quit (int exit_code)
{
- /* gnome_vfs_shutdown (); */
-
if (gtk_main_level () > 0) {
gtk_main_quit ();
}
@@ -152,52 +149,3 @@ test_window_set_title_with_pid (GtkWindow *window,
g_free (tmp);
}
-void
-test_pixbuf_draw_rectangle_tiled (GdkPixbuf *pixbuf,
- const char *tile_name,
- int x0,
- int y0,
- int x1,
- int y1,
- int opacity)
-{
- ArtIRect area;
- GdkPixbuf *tile_pixbuf;
-
- g_return_if_fail (eel_gdk_pixbuf_is_valid (pixbuf));
- g_return_if_fail (tile_name != NULL);
- g_return_if_fail (opacity > EEL_OPACITY_FULLY_TRANSPARENT);
- g_return_if_fail (opacity <= EEL_OPACITY_FULLY_OPAQUE);
-
- tile_pixbuf = test_pixbuf_new_named (tile_name, 1.0);
-
- g_return_if_fail (tile_pixbuf != NULL);
-
- if (x0 == -1 && y0 == -1 && x1 == -1 && y1 == -1) {
- EelDimensions dimensions;
- dimensions = eel_gdk_pixbuf_get_dimensions (pixbuf);
- area = eel_art_irect_assign_dimensions (0, 0, dimensions);
- } else {
- g_return_if_fail (x0 >= 0);
- g_return_if_fail (y0 >= 0);
- g_return_if_fail (x1 > x0);
- g_return_if_fail (y1 > y0);
-
- area.x0 = x0;
- area.y0 = y0;
- area.x1 = x1;
- area.y1 = y1;
- }
-
- eel_gdk_pixbuf_draw_to_pixbuf_tiled (tile_pixbuf,
- pixbuf,
- area,
- gdk_pixbuf_get_width (tile_pixbuf),
- gdk_pixbuf_get_height (tile_pixbuf),
- 0,
- 0,
- opacity,
- GDK_INTERP_NEAREST);
-
- g_object_unref (tile_pixbuf);
-}
diff --git a/test/test.h b/test/test.h
index bb97aa076..3acddeb2b 100644
--- a/test/test.h
+++ b/test/test.h
@@ -4,7 +4,6 @@
#include <config.h>
#include <gtk/gtk.h>
#include <gnome.h>
-#include <libgnomevfs/gnome-vfs-init.h>
#include <eel/eel-art-extensions.h>
#include <eel/eel-art-gtk-extensions.h>