diff options
author | Darin Adler <darin@src.gnome.org> | 2000-11-08 01:11:33 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-11-08 01:11:33 +0000 |
commit | a8470fdc9be24b6078adc16e3b288c6124d5f1f6 (patch) | |
tree | c7de2f158ef5f412b30382fdcef738bd613abbd5 /test/test-nautilus-mime-actions-set.c | |
parent | 9bffb6b742ecee5ff75b3292c19bffdfd5018612 (diff) | |
download | nautilus-a8470fdc9be24b6078adc16e3b288c6124d5f1f6.tar.gz |
Worked on getting rid of wait_until_ready.
* libnautilus-extensions/nautilus-directory.c: Got rid of include
of nautilus-wait-until-ready.h.
* libnautilus-extensions/nautilus-file.c: Got rid of
nautilus_file_wait_until_ready.
* libnautilus-extensions/nautilus-mime-actions.c:
(wait_until_ready_callback),
(nautilus_mime_actions_wait_for_full_file_attributes):
Reimplemented so the wait is in here so we can get rid of
nautilus_file_wait_until_ready.
* libnautilus-extensions/nautilus-mime-actions.h: Moved
nautilus_mime_actions_wait_for_full_file_attributes into
nautilus-wait-until-ready.h.
* libnautilus-extensions/nautilus-program-chooser.c: Added include
of nautilus-wait-until-ready.h since this is one of the two files
that still uses the thing.
* libnautilus-extensions/nautilus-program-choosing.c: Added include
of nautilus-wait-until-ready.h since this is one of the two files
that still uses the thing.
* libnautilus-extensions/nautilus-wait-until-ready.h: Removed
nautilsu_file_wait_until_ready and added
nautilus_mime_actions_wait_for_full_file_attributes.
* src/file-manager/fm-directory-view.c:
(switch_location_and_view): Get rid of code that waits for
attributes, because the code guarantees they will already be read
at this point.
(fm_directory_view_destroy): Stop monitoring the file for the open
with menu.
(files_changed_callback): Update the menus whenever a file changes
or our knowledge about it changes.
(create_open_with_gtk_menu): Use the new monitor call to arrange
to get the information about the single selected file that we
need.
(reset_bonobo_open_with_menu): Use the new monitor call to arrange
to get the information about the single selected file that we
need.
(activate_callback): Remove the hack to work around the
wait_until_ready calls. Also remove the wait_until_ready in here
because we now request all the attributes we will be needing in
the call_when_ready call (that already existed).
(fm_directory_view_activate_file): Request all the attributes
needed for determining MIME actions.
(monitor_file_for_open_with): New function to monitor the stuff we
need to know for the Open with menu.
* test/test-nautilus-mime-actions-set.c: (ready_callback), (main):
Use call_when_ready instead of wait_until_ready.
* test/test-nautilus-mime-actions.c: (ready_callback), (main): Use
call_when_ready instead of wait_until_ready.
* po/ui-extract.pl: Checked in new version from Kenneth.
* po/update.pl: Kenneth wanted me to update the license.
Diffstat (limited to 'test/test-nautilus-mime-actions-set.c')
-rw-r--r-- | test/test-nautilus-mime-actions-set.c | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/test/test-nautilus-mime-actions-set.c b/test/test-nautilus-mime-actions-set.c index b79e0a976..8bcca2981 100644 --- a/test/test-nautilus-mime-actions-set.c +++ b/test/test-nautilus-mime-actions-set.c @@ -21,32 +21,30 @@ Author: Maciej Stachowiak <mjs@eazel.com> */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include <config.h> -#include <libgnomevfs/gnome-vfs.h> +#include <gnome.h> #include <libgnomevfs/gnome-vfs-mime-handlers.h> +#include <libgnomevfs/gnome-vfs.h> #include <libnautilus-extensions/nautilus-mime-actions.h> -#include <gnome.h> - #include <stdio.h> +static gboolean ready = FALSE; static void usage (const char *name) { - fprintf (stderr, "Usage: %s uri field value\n", name); - fprintf (stderr, "Valid field values are: \n"); - fprintf (stderr, "\tdefault_action_type\n"); - fprintf (stderr, "\tdefault_application\n"); - fprintf (stderr, "\tdefault_component\n"); - fprintf (stderr, "\tshort_list_applicationss\n"); - fprintf (stderr, "\tshort_list_components\n"); - fprintf (stderr, "\tadd_to_all_applicationss\n"); - fprintf (stderr, "\tremove_from_all_applications\n"); - exit (1); + fprintf (stderr, "Usage: %s uri field value\n", name); + fprintf (stderr, "Valid field values are: \n"); + fprintf (stderr, "\tdefault_action_type\n"); + fprintf (stderr, "\tdefault_application\n"); + fprintf (stderr, "\tdefault_component\n"); + fprintf (stderr, "\tshort_list_applicationss\n"); + fprintf (stderr, "\tshort_list_components\n"); + fprintf (stderr, "\tadd_to_all_applicationss\n"); + fprintf (stderr, "\tremove_from_all_applications\n"); + exit (1); } static GnomeVFSMimeActionType @@ -68,7 +66,8 @@ strsplit_handle_null (const char *str, const char *delim, int max) } -static GList *gnome_vfs_strsplit_to_list (const char *str, const char *delim, int max) +static GList * +strsplit_to_list (const char *str, const char *delim, int max) { char **strv; GList *retval; @@ -89,11 +88,18 @@ static GList *gnome_vfs_strsplit_to_list (const char *str, const char *delim, in return retval; } -static GList *comma_separated_str_to_str_list (const char *str) +static GList * +comma_separated_str_to_str_list (const char *str) { - return gnome_vfs_strsplit_to_list (str, ",", 0); + return strsplit_to_list (str, ",", 0); } +static void +ready_callback (NautilusFile *file, + gpointer callback_data) +{ + ready = TRUE; +} int main (int argc, char **argv) @@ -102,12 +108,13 @@ main (int argc, char **argv) const char *field; const char *value; NautilusFile *file; + GList *attributes; g_thread_init (NULL); oaf_init (argc, argv); gnome_vfs_init (); - gnome_init("test-nautilus-mime-actions-set", "0.0", - argc, argv); + gnome_init ("test-nautilus-mime-actions-set", "0.0", + argc, argv); if (argc < 3) { usage (argv[0]); @@ -119,7 +126,13 @@ main (int argc, char **argv) file = nautilus_file_get (uri); - nautilus_mime_actions_wait_for_full_file_attributes (file); + attributes = nautilus_mime_actions_get_full_file_attributes (); + nautilus_file_call_when_ready (file, attributes, ready_callback, NULL); + g_list_free (attributes); + + while (!ready) { + gtk_main_iteration (); + } if (strcmp (field, "default_action_type") == 0) { puts ("default_action_type"); @@ -153,9 +166,3 @@ main (int argc, char **argv) return 0; } - - - - - - |