summaryrefslogtreecommitdiff
path: root/test/test-nautilus-mime-actions.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-11-08 01:11:33 +0000
committerDarin Adler <darin@src.gnome.org>2000-11-08 01:11:33 +0000
commita8470fdc9be24b6078adc16e3b288c6124d5f1f6 (patch)
treec7de2f158ef5f412b30382fdcef738bd613abbd5 /test/test-nautilus-mime-actions.c
parent9bffb6b742ecee5ff75b3292c19bffdfd5018612 (diff)
downloadnautilus-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.c')
-rw-r--r--test/test-nautilus-mime-actions.c81
1 files changed, 47 insertions, 34 deletions
diff --git a/test/test-nautilus-mime-actions.c b/test/test-nautilus-mime-actions.c
index a95b0f01b..0b6adc1ca 100644
--- a/test/test-nautilus-mime-actions.c
+++ b/test/test-nautilus-mime-actions.c
@@ -21,17 +21,17 @@
Author: Maciej Stachowiak <mjs@eazel.com>
*/
-#ifdef HAVE_CONFIG_H
+
#include <config.h>
-#endif
-#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
print_application (GnomeVFSMimeApplication *application)
{
@@ -62,13 +62,13 @@ print_action (GnomeVFSMimeAction *action)
if (action == NULL) {
puts ("(none)");
} else {
- if (action->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
- puts ("type: application");
- print_application (action->action.application);
- } else {
- puts ("type: component");
- print_component (action->action.component);
- }
+ if (action->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
+ puts ("type: application");
+ print_application (action->action.application);
+ } else {
+ puts ("type: component");
+ print_component (action->action.component);
+ }
}
}
@@ -76,33 +76,39 @@ print_action (GnomeVFSMimeAction *action)
static void
print_component_list (GList *components)
{
- GList *p;
- if (components == NULL) {
- puts ("(none)");
- } else {
- for (p = components; p != NULL; p = p->next) {
- print_component (p->data);
- puts ("------");
- }
-
- }
+ GList *p;
+
+ if (components == NULL) {
+ puts ("(none)");
+ } else {
+ for (p = components; p != NULL; p = p->next) {
+ print_component (p->data);
+ puts ("------");
+ }
+ }
}
static void
print_application_list (GList *applications)
{
- GList *p;
- if (applications == NULL) {
- puts ("(none)");
- } else {
- for (p = applications; p != NULL; p = p->next) {
- print_application (p->data);
- puts ("------");
- }
-
- }
+ GList *p;
+
+ if (applications == NULL) {
+ puts ("(none)");
+ } else {
+ for (p = applications; p != NULL; p = p->next) {
+ print_application (p->data);
+ puts ("------");
+ }
+ }
}
+static void
+ready_callback (NautilusFile *file,
+ gpointer callback_data)
+{
+ ready = TRUE;
+}
int
main (int argc, char **argv)
@@ -116,6 +122,7 @@ main (int argc, char **argv)
GList *short_list_components;
GList *short_list_applications;
NautilusFile *file;
+ GList *attributes;
g_thread_init (NULL);
oaf_init (argc, argv);
@@ -131,8 +138,14 @@ main (int argc, char **argv)
uri = argv[1];
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 ();
+ }
+
default_action = nautilus_mime_get_default_action_for_file (file);
puts ("Default Action");
print_action (default_action);