diff options
author | Michael Fleming <mfleming@src.gnome.org> | 2001-03-02 04:51:49 +0000 |
---|---|---|
committer | Michael Fleming <mfleming@src.gnome.org> | 2001-03-02 04:51:49 +0000 |
commit | ddb8e5543ae79dca50e51933b51158e57bf82bc2 (patch) | |
tree | deb267f5b8e74adc39dda0dde87a74db2a479772 /components/services | |
parent | 0d2fffe5d0465f088c7ac5d070e2a6b144702838 (diff) | |
download | nautilus-ddb8e5543ae79dca50e51933b51158e57bf82bc2.tar.gz |
reviewed by: <ian@eazel.com>
Part of bug 5575: Polish up inventory view.
Makes "enable" and "disable" views look reasonable and
adds a optional ? arg for the next URI.
* components/services/inventory-view/nautilus-inventory-disable-pag
e.c: (disable_inventory_callback),
(nautilus_inventory_disable_page_initialize),
(nautilus_inventory_disable_page_new),
(nautilus_inventory_disable_page_destroy),
(nautilus_inventory_disable_page_run):
* components/services/inventory-view/nautilus-inventory-disable-pag
e.h:
* components/services/inventory-view/nautilus-inventory-enable-page
.c: (callback_progress_update),
(nautilus_inventory_enable_page_initialize),
(nautilus_inventory_enable_page_new),
(callback_timeout_error_navigate), (callback_eazel_inventory),
(nautilus_inventory_enable_page_run),
(nautilus_inventory_enable_page_destroy):
* components/services/inventory-view/nautilus-inventory-enable-page
.h:
* components/services/inventory-view/nautilus-inventory-view.c:
(nautilus_inventory_view_initialize), (get_finish_uri),
(inventory_load_location_callback):
* libnautilus-extensions/nautilus-file-utilities.c:
(nautilus_self_check_file_utilities):
Diffstat (limited to 'components/services')
5 files changed, 254 insertions, 109 deletions
diff --git a/components/services/inventory-view/nautilus-inventory-disable-page.c b/components/services/inventory-view/nautilus-inventory-disable-page.c index 2a037673e..a4c3aa53a 100644 --- a/components/services/inventory-view/nautilus-inventory-disable-page.c +++ b/components/services/inventory-view/nautilus-inventory-disable-page.c @@ -30,22 +30,21 @@ #include "nautilus-inventory-disable-page.h" #include "eazel-services-header.h" #include "eazel-services-extensions.h" +#include "nautilus-inventory-view-private.h" #include <gtk/gtklabel.h> #include <gtk/gtkprogressbar.h> #include <gtk/gtk.h> #include <gnome.h> #include <libnautilus-extensions/nautilus-gtk-macros.h> +#include <libnautilus-extensions/nautilus-label.h> #include <libnautilus-extensions/nautilus-background.h> #include <libnautilus/nautilus-view.h> #include <eazel-inventory.h> struct NautilusInventoryDisablePageDetails { - EazelInventory *inventory; - GtkWidget *progress_bar; - GtkWidget *label; - NautilusView *nautilus_view; - char *next_uri; + EazelInventory *inventory; + NautilusInventoryView *view; }; static void nautilus_inventory_disable_page_initialize_class (NautilusInventoryDisablePageClass *klass); @@ -64,37 +63,31 @@ nautilus_inventory_disable_page_initialize_class (NautilusInventoryDisablePageCl object_class->destroy = nautilus_inventory_disable_page_destroy; } -static void -yes_callback (GtkWidget *button, gpointer data) +static gint /*GtkFunction*/ +disable_inventory_callback (gpointer data) { NautilusInventoryDisablePage *disable_page = NAUTILUS_INVENTORY_DISABLE_PAGE (data); - eazel_inventory_set_enabled (disable_page->details->inventory, - FALSE); + g_return_val_if_fail (disable_page != NULL, FALSE); - nautilus_view_open_location_in_this_window (disable_page->details->nautilus_view, - "eazel:" /*FIXME*/); + eazel_inventory_set_enabled (disable_page->details->inventory, FALSE); -} + nautilus_view_open_location_in_this_window (NAUTILUS_VIEW (disable_page->details->view), + disable_page->details->view->details->next_uri); -static void -no_callback (GtkWidget *button, gpointer data) -{ - NautilusInventoryDisablePage *disable_page = NAUTILUS_INVENTORY_DISABLE_PAGE (data); - - nautilus_view_go_back (disable_page->details->nautilus_view); + /* Unref the ref that was added when the callback was scheduled */ + gtk_object_unref (GTK_OBJECT (disable_page)); + return FALSE; } - static void nautilus_inventory_disable_page_initialize (NautilusInventoryDisablePage *disable_page) { NautilusBackground *background; GtkWidget *header; GtkWidget *vbox; - GtkWidget *buttonbox; - GtkWidget *yes, *no; + GtkWidget *label; vbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox); @@ -107,52 +100,35 @@ nautilus_inventory_disable_page_initialize (NautilusInventoryDisablePage *disabl disable_page->details->inventory = eazel_inventory_get (); - header = eazel_services_header_title_new (_("Disable Inventory [FIXME]")); + header = eazel_services_header_title_new (_("Disabling Inventory...")); gtk_widget_show (header); gtk_box_pack_start (GTK_BOX (vbox), header, FALSE, FALSE, 0); - - disable_page->details->label = gtk_label_new (_("An explanation of how why and what we're doing here.")); - gtk_widget_show (disable_page->details->label); - gtk_box_pack_start (GTK_BOX (vbox), disable_page->details->label, FALSE, FALSE, 0); - - /* - disable_page->details->progress_bar = gtk_progress_bar_new (); - gtk_widget_show (disable_page->details->progress_bar); - gtk_box_pack_start (GTK_BOX (vbox), disable_page->details->progress_bar, FALSE, FALSE, 0); - */ - - buttonbox = gtk_hbutton_box_new (); - gtk_button_box_set_layout (GTK_BUTTON_BOX (buttonbox), - GTK_BUTTONBOX_SPREAD); - gtk_widget_show (buttonbox); - gtk_box_pack_start (GTK_BOX (vbox), buttonbox, FALSE, FALSE, 0); - - /* FIXME use stock buttons? */ - yes = gtk_button_new_with_label (_("Yes")); - gtk_widget_show (yes); - gtk_signal_connect (GTK_OBJECT (yes), "clicked", - GTK_SIGNAL_FUNC (yes_callback), disable_page); - gtk_container_add (GTK_CONTAINER (buttonbox), yes); - - no = gtk_button_new_with_label (_("No")); - gtk_widget_show (no); - gtk_signal_connect (GTK_OBJECT (no), "clicked", - GTK_SIGNAL_FUNC (no_callback), disable_page); - gtk_container_add (GTK_CONTAINER (buttonbox), no); + label = eazel_services_label_new (_("Please wait while we disable Eazel Inventory..."), + 0, + 0.5, + 0.5, + 0, + 0, + NAUTILUS_RGB_COLOR_BLACK, + NAUTILUS_RGB_COLOR_WHITE, + NULL, + 4, /*relative size*/ + TRUE); + + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0); } GtkWidget * -nautilus_inventory_disable_page_new (NautilusView *view, - const char *next_uri) +nautilus_inventory_disable_page_new (NautilusInventoryView *view) { NautilusInventoryDisablePage *disable_page; disable_page = NAUTILUS_INVENTORY_DISABLE_PAGE (gtk_widget_new (nautilus_inventory_disable_page_get_type (), NULL)); - disable_page->details->nautilus_view = view; - disable_page->details->next_uri = g_strdup (next_uri); + disable_page->details->view = view; return GTK_WIDGET (disable_page); } @@ -169,9 +145,17 @@ nautilus_inventory_disable_page_destroy (GtkObject *object) if (page->details->inventory != CORBA_OBJECT_NIL) { gtk_object_unref (GTK_OBJECT (page->details->inventory)); } - g_free (page->details->next_uri); g_free (page->details); NAUTILUS_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); } +void +nautilus_inventory_disable_page_run (NautilusInventoryDisablePage *disable_page) +{ + /* Pause for impact */ + /* This ref is released in the callback function */ + gtk_object_ref (GTK_OBJECT (disable_page)); + gtk_timeout_add (3 * 1000, disable_inventory_callback, disable_page); +} + diff --git a/components/services/inventory-view/nautilus-inventory-disable-page.h b/components/services/inventory-view/nautilus-inventory-disable-page.h index 3d7a1778b..e471b7258 100644 --- a/components/services/inventory-view/nautilus-inventory-disable-page.h +++ b/components/services/inventory-view/nautilus-inventory-disable-page.h @@ -26,6 +26,7 @@ #ifndef NAUTILUS_INVENTORY_DISABLE_PAGE_H #define NAUTILUS_INVENTORY_DISABLE_PAGE_H +#include "nautilus-inventory-view.h" #include <gtk/gtkeventbox.h> #include <libnautilus/nautilus-view.h> @@ -52,8 +53,7 @@ struct NautilusInventoryDisablePageClass { GtkType nautilus_inventory_disable_page_get_type (void); -GtkWidget *nautilus_inventory_disable_page_new (NautilusView *view, - const char *next_uri); +GtkWidget *nautilus_inventory_disable_page_new (NautilusInventoryView *view); void nautilus_inventory_disable_page_run (NautilusInventoryDisablePage *disable_page); diff --git a/components/services/inventory-view/nautilus-inventory-enable-page.c b/components/services/inventory-view/nautilus-inventory-enable-page.c index 36b87b3e8..5b1d972b7 100644 --- a/components/services/inventory-view/nautilus-inventory-enable-page.c +++ b/components/services/inventory-view/nautilus-inventory-enable-page.c @@ -27,25 +27,41 @@ #include <config.h> #include "nautilus-inventory-enable-page.h" -#include <gtk/gtklabel.h> +#include "nautilus-inventory-view-private.h" +#include "eazel-services-header.h" +#include "eazel-services-extensions.h" + +#include <gnome.h> #include <gtk/gtkprogressbar.h> #include <libnautilus-extensions/nautilus-gtk-macros.h> +#include <libnautilus-extensions/nautilus-label.h> #include <libnautilus/nautilus-view.h> #include <eazel-inventory.h> +#include <libnautilus-extensions/nautilus-background.h> + + +#undef DEBUG_MESSAGES + +#ifdef DEBUG_MESSAGES +#define DEBUG_MSG(x) g_print x +#else +#define DEBUG_MSG(x) +#endif struct NautilusInventoryEnablePageDetails { - EazelInventory *inventory; - GtkWidget *progress_bar; - GtkWidget *label; - NautilusView *view; - char *next_uri; + EazelInventory * inventory; + GtkWidget * progress_bar; + GtkWidget * label; + NautilusInventoryView * view; + guint timeout_id; + gboolean timeout_added; }; static void nautilus_inventory_enable_page_initialize_class (NautilusInventoryEnablePageClass *klass); static void nautilus_inventory_enable_page_initialize (NautilusInventoryEnablePage *file); static void nautilus_inventory_enable_page_destroy (GtkObject *object); -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusInventoryEnablePage, nautilus_inventory_enable_page, GTK_TYPE_VBOX) +NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusInventoryEnablePage, nautilus_inventory_enable_page, GTK_TYPE_EVENT_BOX) static void nautilus_inventory_enable_page_initialize_class (NautilusInventoryEnablePageClass *klass) @@ -57,52 +73,148 @@ nautilus_inventory_enable_page_initialize_class (NautilusInventoryEnablePageClas object_class->destroy = nautilus_inventory_enable_page_destroy; } +static int /*GtkFunction*/ +callback_progress_update (gpointer data) +{ + NautilusInventoryEnablePage *enable_page; + + enable_page = NAUTILUS_INVENTORY_ENABLE_PAGE (data); + + g_return_val_if_fail (enable_page != NULL, 0); + + DEBUG_MSG (("%s: updating...\n", __FUNCTION__)); + + /* I guess the progress bar only cares that the new value is different */ + /* (note that this won't collapse to 0, because 0.75 and 0.25 can be represented w/o rounding) */ + gtk_progress_set_value (GTK_PROGRESS (enable_page->details->progress_bar), + 1.0 - gtk_progress_get_value (GTK_PROGRESS (enable_page->details->progress_bar))); + + return TRUE; +} static void nautilus_inventory_enable_page_initialize (NautilusInventoryEnablePage *enable_page) { + GtkWidget *header; + GtkWidget *vbox_top; + GtkWidget *align_outer; + GtkWidget *align_progress; + GtkWidget *aligned_box; + enable_page->details = g_new0 (NautilusInventoryEnablePageDetails, 1); + align_outer = gtk_alignment_new (0.5, 0.5, 1.0, 0.0); + align_progress = gtk_alignment_new (0.5, 0.5, 0.20, 1.0); + aligned_box = gtk_vbox_new (FALSE, 20); + vbox_top = gtk_vbox_new (FALSE, 0); + + gtk_container_add (GTK_CONTAINER (enable_page), vbox_top); + + nautilus_background_set_color (nautilus_get_widget_background (GTK_WIDGET (enable_page)), + EAZEL_SERVICES_BACKGROUND_COLOR_SPEC); + + header = eazel_services_header_title_new (_("Uploading your System Inventory...")); + gtk_box_pack_start (GTK_BOX (vbox_top), header, FALSE, FALSE, 0); + + gtk_box_pack_start (GTK_BOX (vbox_top), align_outer, TRUE, TRUE, 0); + + gtk_container_add (GTK_CONTAINER (align_outer), aligned_box); enable_page->details->progress_bar = gtk_progress_bar_new (); - gtk_widget_show (enable_page->details->progress_bar); - gtk_box_pack_start (GTK_BOX (enable_page), enable_page->details->progress_bar, FALSE, FALSE, 0); + gtk_progress_set_activity_mode (GTK_PROGRESS (enable_page->details->progress_bar), TRUE); + gtk_progress_set_value (GTK_PROGRESS (enable_page->details->progress_bar), 0.75); - enable_page->details->label = gtk_label_new ("Collecting package data..."); - gtk_widget_show (enable_page->details->label); - gtk_box_pack_start (GTK_BOX (enable_page), enable_page->details->label, FALSE, FALSE, 0); + enable_page->details->label = eazel_services_label_new (_("Please wait while we upload your System Inventory..."), + 0, + 0.5, + 0.5, + 0, + 0, + NAUTILUS_RGB_COLOR_BLACK, + NAUTILUS_RGB_COLOR_WHITE, + NULL, + 4, /*relative size*/ + TRUE); + + gtk_box_pack_start (GTK_BOX (aligned_box), enable_page->details->label, FALSE, FALSE, 0); + + gtk_container_add (GTK_CONTAINER (align_progress), enable_page->details->progress_bar); + + gtk_box_pack_start (GTK_BOX (aligned_box), align_progress, FALSE, FALSE, 0); + + gtk_widget_show_all (GTK_WIDGET (enable_page)); } GtkWidget * -nautilus_inventory_enable_page_new (NautilusView *view, - const char *next_uri) +nautilus_inventory_enable_page_new (NautilusInventoryView *view) { NautilusInventoryEnablePage *enable_page; enable_page = NAUTILUS_INVENTORY_ENABLE_PAGE (gtk_widget_new (nautilus_inventory_enable_page_get_type (), NULL)); enable_page->details->view = view; - enable_page->details->next_uri = g_strdup (next_uri); return GTK_WIDGET (enable_page); } +static int /*GtkFunction*/ +callback_timeout_error_navigate (gpointer data) +{ + NautilusInventoryEnablePage *enable_page; -static void -callback (EazelInventory *inventory, - gboolean succeeded, - NautilusInventoryEnablePage *enable_page) + enable_page = NAUTILUS_INVENTORY_ENABLE_PAGE (data); + + g_return_val_if_fail (enable_page != NULL, FALSE); + + DEBUG_MSG (("%s: navigating to '%s'\n", __FUNCTION__, "eazel:")); + + nautilus_view_open_location_in_this_window (NAUTILUS_VIEW (enable_page->details->view), + "eazel:"); + + /* This ref was added when callback was schedule */ + gtk_object_unref (GTK_OBJECT (enable_page)); + + return FALSE; +} + +static void /*EazelInventoryDoneCallback*/ +callback_eazel_inventory (EazelInventory *inventory, + gboolean succeeded, + gpointer data) { - gtk_progress_bar_update (GTK_PROGRESS_BAR (enable_page->details->progress_bar), 100); + NautilusInventoryEnablePage *enable_page; + + enable_page = NAUTILUS_INVENTORY_ENABLE_PAGE (data); + g_return_if_fail (enable_page != NULL); + + DEBUG_MSG (("%s: inventory upload complete: %s\n", __FUNCTION__, succeeded ? "SUCCESS" : "FAILURE")); + + if (!GTK_OBJECT_DESTROYED (enable_page)) { + gtk_timeout_remove (enable_page->details->timeout_id); + enable_page->details->timeout_id = 0; + enable_page->details->timeout_added = FALSE; + } if (succeeded) { - nautilus_view_open_location_in_this_window (enable_page->details->view, - enable_page->details->next_uri); + DEBUG_MSG (("%s: navigating to '%s'\n", __FUNCTION__, enable_page->details->view->details->next_uri)); + + nautilus_view_open_location_in_this_window (NAUTILUS_VIEW (enable_page->details->view), + enable_page->details->view->details->next_uri); } else { - nautilus_view_go_back (enable_page->details->view); + nautilus_label_set_wrap (NAUTILUS_LABEL (enable_page->details->label), TRUE); + nautilus_label_set_justify (NAUTILUS_LABEL (enable_page->details->label), GTK_JUSTIFY_CENTER); + + nautilus_label_set_text (NAUTILUS_LABEL (enable_page->details->label), _("I'm sorry, an error prevented your System Inventory from being uploaded\n")); + /* Pause for impact */ + /* This ref is released in the callback function */ + gtk_object_ref (GTK_OBJECT (enable_page)); + gtk_timeout_add (3 * 1000, callback_timeout_error_navigate, enable_page); } + + /* release the ref that was added when the callback was scheduled */ + gtk_object_unref (GTK_OBJECT (enable_page)); } @@ -114,28 +226,39 @@ nautilus_inventory_enable_page_run (NautilusInventoryEnablePage *enable_page) enable_page->details->inventory = eazel_inventory_get (); + DEBUG_MSG (("%s: starting inventory upload\n", __FUNCTION__)); + eazel_inventory_set_enabled (enable_page->details->inventory, TRUE); + + /* Released in callback */ + gtk_object_ref (GTK_OBJECT (enable_page)); + eazel_inventory_upload (enable_page->details->inventory, - (gpointer) callback, + callback_eazel_inventory, enable_page); + enable_page->details->timeout_id = gtk_timeout_add (80, callback_progress_update, enable_page); + enable_page->details->timeout_added = TRUE; } static void nautilus_inventory_enable_page_destroy (GtkObject *object) { - NautilusInventoryEnablePage *page; + NautilusInventoryEnablePage *enable_page; CORBA_Environment ev; - page = NAUTILUS_INVENTORY_ENABLE_PAGE (object); + enable_page = NAUTILUS_INVENTORY_ENABLE_PAGE (object); CORBA_exception_init (&ev); - if (page->details->inventory != CORBA_OBJECT_NIL) { - gtk_object_unref (GTK_OBJECT (page->details->inventory)); + if (enable_page->details->timeout_added) { + gtk_timeout_remove (enable_page->details->timeout_id); + } + + if (enable_page->details->inventory != CORBA_OBJECT_NIL) { + gtk_object_unref (GTK_OBJECT (enable_page->details->inventory)); } - g_free (page->details->next_uri); - g_free (page->details); + g_free (enable_page->details); NAUTILUS_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); } diff --git a/components/services/inventory-view/nautilus-inventory-enable-page.h b/components/services/inventory-view/nautilus-inventory-enable-page.h index 46ec187d7..f9c2d06d8 100644 --- a/components/services/inventory-view/nautilus-inventory-enable-page.h +++ b/components/services/inventory-view/nautilus-inventory-enable-page.h @@ -27,8 +27,9 @@ #ifndef NAUTILUS_INVENTORY_ENABLE_PAGE_H #define NAUTILUS_INVENTORY_ENABLE_PAGE_H -#include <gtk/gtkvbox.h> +#include <gtk/gtkeventbox.h> #include <libnautilus/nautilus-view.h> +#include "nautilus-inventory-view.h" #define NAUTILUS_TYPE_INVENTORY_ENABLE_PAGE (nautilus_inventory_enable_page_get_type ()) #define NAUTILUS_INVENTORY_ENABLE_PAGE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_INVENTORY_ENABLE_PAGE, NautilusInventoryEnablePage)) @@ -41,18 +42,17 @@ typedef struct NautilusInventoryEnablePageClass NautilusInventoryEnablePageCla typedef struct NautilusInventoryEnablePageDetails NautilusInventoryEnablePageDetails; struct NautilusInventoryEnablePage { - GtkVBox base; + GtkEventBox base; NautilusInventoryEnablePageDetails *details; }; struct NautilusInventoryEnablePageClass { - GtkVBoxClass base; + GtkEventBoxClass base; }; GtkType nautilus_inventory_enable_page_get_type (void); -GtkWidget *nautilus_inventory_enable_page_new (NautilusView *view, - const char *next_uri); +GtkWidget *nautilus_inventory_enable_page_new (NautilusInventoryView *view); void nautilus_inventory_enable_page_run (NautilusInventoryEnablePage *enable_page); diff --git a/components/services/inventory-view/nautilus-inventory-view.c b/components/services/inventory-view/nautilus-inventory-view.c index 2b0b5091f..12026f9c1 100644 --- a/components/services/inventory-view/nautilus-inventory-view.c +++ b/components/services/inventory-view/nautilus-inventory-view.c @@ -25,12 +25,17 @@ component. */ #include <config.h> -#include "nautilus-inventory-view.h" +#include "nautilus-inventory-view-private.h" #include "nautilus-inventory-enable-page.h" #include "nautilus-inventory-disable-page.h" +#include "eazel-services-extensions.h" + #include <libnautilus-extensions/nautilus-gtk-macros.h> +#include <libnautilus-extensions/nautilus-background.h> +#include <libnautilus-extensions/nautilus-string.h> +#include <libgnomevfs/gnome-vfs.h> #include <libnautilus/nautilus-bonobo-ui.h> #include <bonobo/bonobo-control.h> #include <libgnome/gnome-i18n.h> @@ -39,11 +44,13 @@ #include <gtk/gtknotebook.h> #include <gtk/gtksignal.h> -struct NautilusInventoryViewDetails { - GtkWidget *notebook; - GtkWidget *enable_page; - GtkWidget *disable_page; -}; +#undef DEBUG_MESSAGES + +#ifdef DEBUG_MESSAGES +#define DEBUG_MSG(x) g_print x +#else +#define DEBUG_MSG(x) +#endif static void nautilus_inventory_view_initialize_class (NautilusInventoryViewClass *klass); static void nautilus_inventory_view_initialize (NautilusInventoryView *view); @@ -80,12 +87,10 @@ nautilus_inventory_view_initialize (NautilusInventoryView *view) view->details->notebook = gtk_notebook_new (); gtk_notebook_set_show_border (GTK_NOTEBOOK (view->details->notebook), FALSE); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (view->details->notebook), FALSE); - - view->details->enable_page = nautilus_inventory_enable_page_new (NAUTILUS_VIEW (view), - "eazel-services:/inventory/updates"); - view->details->disable_page = nautilus_inventory_disable_page_new (NAUTILUS_VIEW (view), - "eazel-services:/inventory/updates"); + view->details->enable_page = nautilus_inventory_enable_page_new (view); + view->details->disable_page = nautilus_inventory_disable_page_new (view); + gtk_notebook_append_page (GTK_NOTEBOOK (view->details->notebook), view->details->enable_page, gtk_label_new ("")); @@ -117,6 +122,26 @@ nautilus_inventory_view_destroy (GtkObject *object) } +static char * +get_finish_uri (const char *uri, const char *default_finish_uri) +{ + char *query_portion; + char *ret; + + query_portion = strchr (uri, '?'); + + if (query_portion != NULL) { + ret = gnome_vfs_unescape_string (query_portion + 1, NULL); + } else { + ret = NULL; + } + + if (ret == NULL) { + ret = g_strdup (default_finish_uri); + } + + return ret; +} static void @@ -132,16 +157,29 @@ inventory_load_location_callback (NautilusView *nautilus_view, view = NAUTILUS_INVENTORY_VIEW (nautilus_view); nautilus_view_report_load_underway (nautilus_view); - - if (strcmp (location, "eazel-inventory:enable") == 0) { + + DEBUG_MSG (("%s: load_location '%s'\n", __FUNCTION__, location)); + + if (nautilus_istr_has_prefix (location, "eazel-inventory:enable")) { + view->details->next_uri = get_finish_uri (location, "eazel:"); + + DEBUG_MSG (("%s: enabling, next_uri is '%s'\n", __FUNCTION__, view->details->next_uri)); + gtk_notebook_set_page (GTK_NOTEBOOK (view->details->notebook), 0); nautilus_view_report_load_complete (nautilus_view); - nautilus_inventory_enable_page_run (NAUTILUS_INVENTORY_ENABLE_PAGE - (view->details->enable_page)); - } else if (strcmp (location, "eazel-inventory:disable") == 0) { + nautilus_inventory_enable_page_run ( + NAUTILUS_INVENTORY_ENABLE_PAGE (view->details->enable_page)); + } else if (nautilus_istr_has_prefix (location, "eazel-inventory:disable")) { + view->details->next_uri = get_finish_uri (location, "eazel:"); + + DEBUG_MSG (("%s: disabling, next_uri is '%s'\n", __FUNCTION__, view->details->next_uri)); + gtk_notebook_set_page (GTK_NOTEBOOK (view->details->notebook), 1); nautilus_view_report_load_complete (nautilus_view); + nautilus_inventory_disable_page_run ( + NAUTILUS_INVENTORY_DISABLE_PAGE (view->details->disable_page)); } else { + DEBUG_MSG (("%s: invalid uri '%s'\n", __FUNCTION__, location)); nautilus_view_report_load_failed (nautilus_view); } } |