summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Hertzfeld <andy@src.gnome.org>2001-01-16 08:18:19 +0000
committerAndy Hertzfeld <andy@src.gnome.org>2001-01-16 08:18:19 +0000
commit75ac9bf9f5adff8471f2e44530c624999ed03ba3 (patch)
tree94c1ab5f0cd1e972a664d01ac3caf2ab3c6cd3b1 /src
parenteff6327497af0338693f20af002ec77d7cdca91b (diff)
downloadnautilus-75ac9bf9f5adff8471f2e44530c624999ed03ba3.tar.gz
fixed bug 5657, crash during menu update when switching views. This is
* src/nautilus-window-manage-views.c: (change_state_at_idle), (load_underway_callback): fixed bug 5657, crash during menu update when switching views. This is also behind several other reported bugs. Fixed it as Darin suggested, which is to defer the window state change associated with loading a new component until idle time, so it doesn't wreak havoc by interrupting other idle routines. * components/throbber/nautilus-throbber.c: (nautilus_throbber_initialize_class), (get_bonobo_properties), (set_bonobo_properties), (nautilus_throbber_destroy), (nautilus_throbber_initialize), (nautilus_throbber_button_press_event): added a location property and made it issue a notification when the throbber is clicked on. Also, removed the no longer used "location_changed" signal and better memory management of the property bag. * src/nautilus-window.c: (throbber_location_changed_callback), (nautilus_window_constructed), (nautilus_window_destroy): make clicking on the throbber work by adding a listener for the throbber location property and changing the location accordingly when the event is posted. Also, fixed a leak of the bonobo object. * src/nautilus-window-private.h: added a field to hold the event source listener ID.
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-navigation-window.c50
-rw-r--r--src/nautilus-object-window.c50
-rw-r--r--src/nautilus-spatial-window.c50
-rw-r--r--src/nautilus-window-manage-views.c11
-rw-r--r--src/nautilus-window-private.h2
-rw-r--r--src/nautilus-window.c50
6 files changed, 196 insertions, 17 deletions
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index d4894a60c..0f001090b 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -388,6 +388,21 @@ menu_bar_no_resize_hack (NautilusWindow *window)
menu_bar->klass = menu_bar_no_resize_hack_class;
}
+/* handle bonobo events from the throbber */
+static void
+throbber_location_changed_callback (BonoboListener *listener,
+ char *event_name,
+ CORBA_any *arg,
+ CORBA_Environment *ev,
+ gpointer user_data)
+{
+ NautilusWindow *window = NAUTILUS_WINDOW (user_data);
+ gchar *location;
+
+ location = BONOBO_ARG_GET_STRING (arg);
+ nautilus_window_goto_uri (window, location);
+}
+
static void
nautilus_window_constructed (NautilusWindow *window)
{
@@ -537,10 +552,20 @@ nautilus_window_constructed (NautilusWindow *window)
nautilus_window_initialize_toolbars (window);
/* watch for throbber location changes, too */
- /*
- gtk_signal_connect (GTK_OBJECT (window->throbber), "location_changed",
- goto_uri_callback, window);
- */
+ if (window->throbber != NULL) {
+ CORBA_Environment ev;
+ Bonobo_PropertyBag property_bag;
+
+ CORBA_exception_init (&ev);
+ property_bag = Bonobo_Control_getProperties (window->throbber, &ev);
+
+ if (property_bag != NULL && !BONOBO_EX (&ev)) {
+ window->details->throbber_listener_id = bonobo_event_source_client_add_listener (property_bag, throbber_location_changed_callback,
+ "Bonobo/Property:change:location", NULL, window);
+ bonobo_object_release_unref (property_bag, &ev);
+ }
+ CORBA_exception_free (&ev);
+ }
/* Set initial sensitivity of some buttons & menu items
* now that they're all created.
@@ -665,6 +690,23 @@ nautilus_window_destroy (GtkObject *object)
bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container));
}
+ /* get rid of the CORBA objects */
+ if (window->throbber != NULL) {
+ CORBA_Environment ev;
+ Bonobo_PropertyBag property_bag;
+
+ CORBA_exception_init (&ev);
+ property_bag = Bonobo_Control_getProperties (window->throbber, &ev);
+
+ if (property_bag != NULL && !BONOBO_EX (&ev)) {
+ bonobo_event_source_client_remove_listener (property_bag, window->details->throbber_listener_id, &ev);
+ bonobo_object_release_unref (property_bag, &ev);
+ }
+
+ bonobo_object_release_unref (window->throbber, &ev);
+ CORBA_exception_free (&ev);
+ }
+
g_free (window->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (GTK_OBJECT (window)));
diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c
index d4894a60c..0f001090b 100644
--- a/src/nautilus-object-window.c
+++ b/src/nautilus-object-window.c
@@ -388,6 +388,21 @@ menu_bar_no_resize_hack (NautilusWindow *window)
menu_bar->klass = menu_bar_no_resize_hack_class;
}
+/* handle bonobo events from the throbber */
+static void
+throbber_location_changed_callback (BonoboListener *listener,
+ char *event_name,
+ CORBA_any *arg,
+ CORBA_Environment *ev,
+ gpointer user_data)
+{
+ NautilusWindow *window = NAUTILUS_WINDOW (user_data);
+ gchar *location;
+
+ location = BONOBO_ARG_GET_STRING (arg);
+ nautilus_window_goto_uri (window, location);
+}
+
static void
nautilus_window_constructed (NautilusWindow *window)
{
@@ -537,10 +552,20 @@ nautilus_window_constructed (NautilusWindow *window)
nautilus_window_initialize_toolbars (window);
/* watch for throbber location changes, too */
- /*
- gtk_signal_connect (GTK_OBJECT (window->throbber), "location_changed",
- goto_uri_callback, window);
- */
+ if (window->throbber != NULL) {
+ CORBA_Environment ev;
+ Bonobo_PropertyBag property_bag;
+
+ CORBA_exception_init (&ev);
+ property_bag = Bonobo_Control_getProperties (window->throbber, &ev);
+
+ if (property_bag != NULL && !BONOBO_EX (&ev)) {
+ window->details->throbber_listener_id = bonobo_event_source_client_add_listener (property_bag, throbber_location_changed_callback,
+ "Bonobo/Property:change:location", NULL, window);
+ bonobo_object_release_unref (property_bag, &ev);
+ }
+ CORBA_exception_free (&ev);
+ }
/* Set initial sensitivity of some buttons & menu items
* now that they're all created.
@@ -665,6 +690,23 @@ nautilus_window_destroy (GtkObject *object)
bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container));
}
+ /* get rid of the CORBA objects */
+ if (window->throbber != NULL) {
+ CORBA_Environment ev;
+ Bonobo_PropertyBag property_bag;
+
+ CORBA_exception_init (&ev);
+ property_bag = Bonobo_Control_getProperties (window->throbber, &ev);
+
+ if (property_bag != NULL && !BONOBO_EX (&ev)) {
+ bonobo_event_source_client_remove_listener (property_bag, window->details->throbber_listener_id, &ev);
+ bonobo_object_release_unref (property_bag, &ev);
+ }
+
+ bonobo_object_release_unref (window->throbber, &ev);
+ CORBA_exception_free (&ev);
+ }
+
g_free (window->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (GTK_OBJECT (window)));
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index d4894a60c..0f001090b 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -388,6 +388,21 @@ menu_bar_no_resize_hack (NautilusWindow *window)
menu_bar->klass = menu_bar_no_resize_hack_class;
}
+/* handle bonobo events from the throbber */
+static void
+throbber_location_changed_callback (BonoboListener *listener,
+ char *event_name,
+ CORBA_any *arg,
+ CORBA_Environment *ev,
+ gpointer user_data)
+{
+ NautilusWindow *window = NAUTILUS_WINDOW (user_data);
+ gchar *location;
+
+ location = BONOBO_ARG_GET_STRING (arg);
+ nautilus_window_goto_uri (window, location);
+}
+
static void
nautilus_window_constructed (NautilusWindow *window)
{
@@ -537,10 +552,20 @@ nautilus_window_constructed (NautilusWindow *window)
nautilus_window_initialize_toolbars (window);
/* watch for throbber location changes, too */
- /*
- gtk_signal_connect (GTK_OBJECT (window->throbber), "location_changed",
- goto_uri_callback, window);
- */
+ if (window->throbber != NULL) {
+ CORBA_Environment ev;
+ Bonobo_PropertyBag property_bag;
+
+ CORBA_exception_init (&ev);
+ property_bag = Bonobo_Control_getProperties (window->throbber, &ev);
+
+ if (property_bag != NULL && !BONOBO_EX (&ev)) {
+ window->details->throbber_listener_id = bonobo_event_source_client_add_listener (property_bag, throbber_location_changed_callback,
+ "Bonobo/Property:change:location", NULL, window);
+ bonobo_object_release_unref (property_bag, &ev);
+ }
+ CORBA_exception_free (&ev);
+ }
/* Set initial sensitivity of some buttons & menu items
* now that they're all created.
@@ -665,6 +690,23 @@ nautilus_window_destroy (GtkObject *object)
bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container));
}
+ /* get rid of the CORBA objects */
+ if (window->throbber != NULL) {
+ CORBA_Environment ev;
+ Bonobo_PropertyBag property_bag;
+
+ CORBA_exception_init (&ev);
+ property_bag = Bonobo_Control_getProperties (window->throbber, &ev);
+
+ if (property_bag != NULL && !BONOBO_EX (&ev)) {
+ bonobo_event_source_client_remove_listener (property_bag, window->details->throbber_listener_id, &ev);
+ bonobo_object_release_unref (property_bag, &ev);
+ }
+
+ bonobo_object_release_unref (window->throbber, &ev);
+ CORBA_exception_free (&ev);
+ }
+
g_free (window->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (GTK_OBJECT (window)));
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 9fbc8af42..88936dbc9 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -1770,6 +1770,14 @@ failed_callback (NautilusViewFrame *view,
change_state (window, VIEW_FAILED, NULL, view);
}
+/* idle routine to accomplish the state change at idle time */
+static gboolean
+change_state_at_idle (NautilusWindow *window)
+{
+ change_state (window, LOAD_UNDERWAY, NULL, NULL);
+ return FALSE;
+}
+
static void
load_underway_callback (NautilusViewFrame *view,
NautilusWindow *window)
@@ -1785,9 +1793,10 @@ load_underway_callback (NautilusViewFrame *view,
* or new really equally interesting?
*/
+ /* only perform the state change at idle time to avoid conflicting with idle routines */
if (view == window->new_content_view
|| view == window->content_view) {
- change_state (window, LOAD_UNDERWAY, NULL, NULL);
+ gtk_idle_add ((GtkFunction) change_state_at_idle, window);
}
}
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index 9d007d12d..976fcc471 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -38,6 +38,8 @@ struct NautilusWindowDetails
/* Bonobo. */
BonoboUIContainer *ui_container;
BonoboUIComponent *shell_ui;
+ Bonobo_EventSource_ListenerId throbber_listener_id;
+
gboolean updating_bonobo_state;
/* Menus. */
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index d4894a60c..0f001090b 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -388,6 +388,21 @@ menu_bar_no_resize_hack (NautilusWindow *window)
menu_bar->klass = menu_bar_no_resize_hack_class;
}
+/* handle bonobo events from the throbber */
+static void
+throbber_location_changed_callback (BonoboListener *listener,
+ char *event_name,
+ CORBA_any *arg,
+ CORBA_Environment *ev,
+ gpointer user_data)
+{
+ NautilusWindow *window = NAUTILUS_WINDOW (user_data);
+ gchar *location;
+
+ location = BONOBO_ARG_GET_STRING (arg);
+ nautilus_window_goto_uri (window, location);
+}
+
static void
nautilus_window_constructed (NautilusWindow *window)
{
@@ -537,10 +552,20 @@ nautilus_window_constructed (NautilusWindow *window)
nautilus_window_initialize_toolbars (window);
/* watch for throbber location changes, too */
- /*
- gtk_signal_connect (GTK_OBJECT (window->throbber), "location_changed",
- goto_uri_callback, window);
- */
+ if (window->throbber != NULL) {
+ CORBA_Environment ev;
+ Bonobo_PropertyBag property_bag;
+
+ CORBA_exception_init (&ev);
+ property_bag = Bonobo_Control_getProperties (window->throbber, &ev);
+
+ if (property_bag != NULL && !BONOBO_EX (&ev)) {
+ window->details->throbber_listener_id = bonobo_event_source_client_add_listener (property_bag, throbber_location_changed_callback,
+ "Bonobo/Property:change:location", NULL, window);
+ bonobo_object_release_unref (property_bag, &ev);
+ }
+ CORBA_exception_free (&ev);
+ }
/* Set initial sensitivity of some buttons & menu items
* now that they're all created.
@@ -665,6 +690,23 @@ nautilus_window_destroy (GtkObject *object)
bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container));
}
+ /* get rid of the CORBA objects */
+ if (window->throbber != NULL) {
+ CORBA_Environment ev;
+ Bonobo_PropertyBag property_bag;
+
+ CORBA_exception_init (&ev);
+ property_bag = Bonobo_Control_getProperties (window->throbber, &ev);
+
+ if (property_bag != NULL && !BONOBO_EX (&ev)) {
+ bonobo_event_source_client_remove_listener (property_bag, window->details->throbber_listener_id, &ev);
+ bonobo_object_release_unref (property_bag, &ev);
+ }
+
+ bonobo_object_release_unref (window->throbber, &ev);
+ CORBA_exception_free (&ev);
+ }
+
g_free (window->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (GTK_OBJECT (window)));