diff options
34 files changed, 433 insertions, 429 deletions
@@ -1,3 +1,57 @@ +2002-02-26 Darin Adler <darin@bentspoon.com> + + * Many files: + Simplified calls to bonobo_object_ref/unref. + + * components/history/nautilus-history-view.c: (update_history): + Fixed so that a history update while one is already in progress + will work properly. + + * libnautilus/nautilus-view.c: + (remove_listener): New. + (update_listener): Renamed from nautilus_view_set_frame, made it + handle various cases better. Fixed leak of property bag. + (forget_cached_view_frame): New. + (nautilus_view_set_frame_callback): Use new forget_cached_view_frame + and update_listener. + (nautilus_view_construct_from_bonobo_control): Use + g_signal_connect_object. Not sure if this is better, since they + are part of the same aggregate. + (nautilus_view_finalize): Use new forget_cached_view_frame and + remove_listener. + (nautilus_view_dispose): Use new forget_cached_view_frame and + remove_listener. + (nautilus_view_get_view_frame): Fixed leak of control frame. + (nautilus_view_set_listener_mask): Simplified, and made it work even + if you call it multiple times, by calling new update_listener. + + * libnautilus-private/nautilus-icon-canvas-item.c: + (create_label_layout): Handle NULL font_name case just in case. + * libnautilus-private/nautilus-icon-container.c: + (nautilus_icon_container_set_zoom_level): Use + invalidate_label_sizes instead of setting update_icon_font. + (nautilus_icon_container_set_font_name): Do nothing if font name + doesn't change. If it does, use invalidate_label_sizes rather than + setting update_icon_font. + (nautilus_icon_container_set_font_size_table): Only redraw if font + size changes. Also, use invalidate_label_sizes rather than setting + update_icon_font. + + * libnautilus-private/nautilus-directory.c: + (add_preferences_callbacks): + * libnautilus-private/nautilus-icon-factory.c: (get_icon_factory): + Initialize global preferences as needed. + + * src/file-manager/fm-icon-view.c: (fm_icon_view_finalize): + * src/file-manager/fm-search-list-view.c: (real_destroy): + * src/nautilus-application.c: (nautilus_application_destroy), + (nautilus_application_create_window), + (nautilus_application_class_init): + * src/nautilus-main.c: (main): + + * src/nautilus-view-frame.c: (create_corba_objects): Fix property + bag leak. + 2002-02-26 Michael Meeks <michael@ximian.com> * components/history/nautilus-history-view.c @@ -25,6 +79,8 @@ that makes us return the right name, rather than returning an already-freed pointer. +=== nautilus 1.1.6 === + 2002-02-25 Darin Adler <darin@bentspoon.com> * configure.in: Bump version. diff --git a/components/adapter/main.c b/components/adapter/main.c index 613178d5e..c5cb46301 100644 --- a/components/adapter/main.c +++ b/components/adapter/main.c @@ -117,7 +117,7 @@ main (int argc, char *argv[]) } while (object_count > 0); /* Let the factory go. */ - bonobo_object_unref (BONOBO_OBJECT (factory)); + bonobo_object_unref (factory); gnome_vfs_shutdown (); diff --git a/components/adapter/nautilus-adapter-control-embed-strategy.c b/components/adapter/nautilus-adapter-control-embed-strategy.c index 1f50b3988..758036c7b 100644 --- a/components/adapter/nautilus-adapter-control-embed-strategy.c +++ b/components/adapter/nautilus-adapter-control-embed-strategy.c @@ -93,10 +93,7 @@ nautilus_adapter_control_embed_strategy_destroy (GtkObject *object) strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (object); - if (strategy->details->control_frame != NULL) { - bonobo_object_unref (BONOBO_OBJECT (strategy->details->control_frame)); - } - + bonobo_object_unref (strategy->details->control_frame); g_free (strategy->details); EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); diff --git a/components/adapter/nautilus-adapter-control-factory-embed-strategy.c b/components/adapter/nautilus-adapter-control-factory-embed-strategy.c index 76a5605f1..78082c4a1 100644 --- a/components/adapter/nautilus-adapter-control-factory-embed-strategy.c +++ b/components/adapter/nautilus-adapter-control-factory-embed-strategy.c @@ -91,11 +91,7 @@ nautilus_adapter_control_factory_embed_strategy_destroy (GtkObject *object) strategy = NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (object); - if (strategy->details->control_frame != NULL) { - bonobo_object_unref (BONOBO_OBJECT (strategy->details->control_frame)); - strategy->details->control_frame = NULL; - } - + bonobo_object_unref (strategy->details->control_frame); g_free (strategy->details); strategy->details = NULL; diff --git a/components/adapter/nautilus-adapter-factory-server.c b/components/adapter/nautilus-adapter-factory-server.c index a49c244c9..3431c3745 100644 --- a/components/adapter/nautilus-adapter-factory-server.c +++ b/components/adapter/nautilus-adapter-factory-server.c @@ -89,7 +89,7 @@ static void adapter_object_weak_notify (gpointer server, GObject *adapter) { - bonobo_object_unref (BONOBO_OBJECT (server)); + bonobo_object_unref (server); } @@ -108,7 +108,7 @@ impl_Nautilus_ComponentAdapterFactory_create_adapter (PortableServer_Servant se if (adapter == NULL) { return CORBA_OBJECT_NIL; } else { - bonobo_object_ref (BONOBO_OBJECT (factory_servant)); + bonobo_object_ref (factory_servant); adapter_view = nautilus_adapter_get_nautilus_view (adapter); g_object_weak_ref (G_OBJECT (adapter_view), diff --git a/components/hardware/nautilus-hardware-view.c b/components/hardware/nautilus-hardware-view.c index b056494c8..106c9c6d2 100644 --- a/components/hardware/nautilus-hardware-view.c +++ b/components/hardware/nautilus-hardware-view.c @@ -193,12 +193,8 @@ nautilus_hardware_view_destroy (GtkObject *object) hardware_view = NAUTILUS_HARDWARE_VIEW (object); - /* free the property bag */ - if (hardware_view->details->property_bag != NULL) { - bonobo_object_unref (BONOBO_OBJECT (hardware_view->details->property_bag)); - } + bonobo_object_unref (hardware_view->details->property_bag); - /* remove the timer task */ if (hardware_view->details->timer_task != 0) { gtk_timeout_remove (hardware_view->details->timer_task); } diff --git a/components/history/nautilus-history-view.c b/components/history/nautilus-history-view.c index 4d8e69dc5..244d4414b 100644 --- a/components/history/nautilus-history-view.c +++ b/components/history/nautilus-history-view.c @@ -29,7 +29,6 @@ #include <bonobo/bonobo-ui-util.h> #include <eel/eel-debug.h> -#include <eel/eel-gdk-pixbuf-extensions.h> #include <gtk/gtkcellrendererpixbuf.h> #include <gtk/gtkcellrenderertext.h> #include <gtk/gtkliststore.h> @@ -39,7 +38,6 @@ #include <gtk/gtkscrolledwindow.h> #include <libgnome/gnome-macros.h> #include <libnautilus-private/nautilus-bookmark.h> -#include <libnautilus-private/nautilus-global-preferences.h> #include <libnautilus/nautilus-view-standard-main.h> #define FACTORY_IID "OAFIID:nautilus_history_view_factory:912d6634-d18f-40b6-bb83-bdfe16f1d15e" @@ -53,13 +51,9 @@ typedef struct { NautilusView parent; - GtkTreeView *treeview; - GtkListStore *store; - GtkTreeSelection *selection; - gboolean updating_history; - int press_row; - gboolean *external_destroyed_flag; - int selection_changed_id; + GtkTreeView *tree_view; + guint selection_changed_id; + gboolean *stop_updating_history; } NautilusHistoryView; typedef struct { @@ -71,9 +65,9 @@ enum { HISTORY_VIEW_COLUMN_NAME, HISTORY_VIEW_COLUMN_BOOKMARK, HISTORY_VIEW_COLUMN_COUNT, -} HistoryViewColumnType; +}; -static GtkType nautilus_history_view_get_type (void); +static GType nautilus_history_view_get_type (void); BONOBO_CLASS_BOILERPLATE (NautilusHistoryView, nautilus_history_view, NautilusView, NAUTILUS_TYPE_VIEW) @@ -82,38 +76,31 @@ static void update_history (NautilusHistoryView *view, const Nautilus_History *history) { - GtkTreeView *treeview; GtkListStore *store; GtkTreeSelection *selection; NautilusBookmark *bookmark; Nautilus_HistoryItem *item; GdkPixbuf *pixbuf; guint i; - gboolean destroyed_flag; + gboolean stop_updating_history; GtkTreeIter iter; - /* FIXME: We'll end up with old history if this happens. */ - if (view->updating_history) { - return; - } - - treeview = view->treeview; - store = view->store; - selection = view->selection; - /* Set up a local boolean so we can detect that the view has * been destroyed. We can't ask the view itself because once * it's destroyed it's pointer is a pointer to freed storage. */ /* FIXME: We can't just keep an extra ref to the view as we * normally would because of a bug in Bonobo that means a - * BonoboControl must not outlast its BonoboFrame + * BonoboControl must not outlast its BonoboControlFrame * (NautilusHistoryView is a BonoboControl). */ - destroyed_flag = FALSE; - view->external_destroyed_flag = &destroyed_flag; + if (view->stop_updating_history != NULL) { + *view->stop_updating_history = TRUE; + } + stop_updating_history = FALSE; + view->stop_updating_history = &stop_updating_history; - view->updating_history = TRUE; + store = GTK_LIST_STORE (gtk_tree_view_get_model (view->tree_view)); gtk_list_store_clear (store); @@ -129,9 +116,10 @@ update_history (NautilusHistoryView *view, * in practice, none of the other calls used here have * that problem. */ - if (destroyed_flag) { + if (stop_updating_history) { return; } + pixbuf = bonobo_ui_util_xml_to_pixbuf (item->icon); gtk_list_store_append (store, &iter); @@ -144,18 +132,17 @@ update_history (NautilusHistoryView *view, if (pixbuf != NULL) { g_object_unref (pixbuf); } - } + selection = GTK_TREE_SELECTION (gtk_tree_view_get_selection (view->tree_view)); + g_signal_handler_block (selection, view->selection_changed_id); - if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) { + if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (store), &iter)) { gtk_tree_selection_select_iter (selection, &iter); } - g_signal_handler_unblock (selection, view->selection_changed_id); + g_signal_handler_unblock (selection, view->selection_changed_id); - view->updating_history = FALSE; - - view->external_destroyed_flag = NULL; + view->stop_updating_history = NULL; } static void @@ -173,7 +160,6 @@ on_selection_changed (GtkTreeSelection *selection, gpointer user_data) { NautilusHistoryView *view; - GtkListStore *store; GtkTreeIter iter; NautilusBookmark *bookmark; char *uri; @@ -182,17 +168,13 @@ on_selection_changed (GtkTreeSelection *selection, g_return_if_fail (NAUTILUS_IS_HISTORY_VIEW (user_data)); view = NAUTILUS_HISTORY_VIEW (user_data); - store = view->store; /* If this function returns FALSE, we don't have any rows selected */ - if (!gtk_tree_selection_get_selected (selection, - NULL, - &iter)) { + if (! gtk_tree_selection_get_selected (selection, NULL, &iter)) { return; } - gtk_tree_model_get (GTK_TREE_MODEL (store), - &iter, + gtk_tree_model_get (GTK_TREE_MODEL (gtk_tree_view_get_model (view->tree_view)), &iter, HISTORY_VIEW_COLUMN_BOOKMARK, &bookmark, -1); @@ -207,16 +189,16 @@ on_selection_changed (GtkTreeSelection *selection, static void nautilus_history_view_instance_init (NautilusHistoryView *view) { - GtkTreeView *treeview; + GtkTreeView *tree_view; GtkTreeViewColumn *col; GtkCellRenderer *cell; GtkListStore *store; GtkTreeSelection *selection; GtkWidget *window; - treeview = GTK_TREE_VIEW (gtk_tree_view_new ()); - gtk_tree_view_set_headers_visible (treeview, FALSE); - gtk_widget_show (GTK_WIDGET (treeview)); + tree_view = GTK_TREE_VIEW (gtk_tree_view_new ()); + gtk_tree_view_set_headers_visible (tree_view, FALSE); + gtk_widget_show (GTK_WIDGET (tree_view)); col = GTK_TREE_VIEW_COLUMN (gtk_tree_view_column_new ()); @@ -233,45 +215,39 @@ nautilus_history_view_instance_init (NautilusHistoryView *view) NULL); gtk_tree_view_column_set_fixed_width (col, NAUTILUS_ICON_SIZE_SMALLER); - gtk_tree_view_append_column (treeview, col); + gtk_tree_view_append_column (tree_view, col); store = gtk_list_store_new (HISTORY_VIEW_COLUMN_COUNT, GDK_TYPE_PIXBUF, G_TYPE_STRING, NAUTILUS_TYPE_BOOKMARK); - gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (store)); - - selection = GTK_TREE_SELECTION (gtk_tree_view_get_selection (treeview)); + gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (store)); window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (treeview)); + gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (tree_view)); gtk_widget_show (window); nautilus_view_construct (NAUTILUS_VIEW (view), window); - g_object_ref (treeview); - view->treeview = treeview; - view->store = store; - view->selection = selection; + g_object_ref (tree_view); + view->tree_view = tree_view; nautilus_view_set_listener_mask (NAUTILUS_VIEW (view), NAUTILUS_VIEW_LISTEN_HISTORY); - view->selection_changed_id = g_signal_connect (selection, - "changed", - G_CALLBACK (on_selection_changed), - view); + selection = gtk_tree_view_get_selection (tree_view); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); + view->selection_changed_id = g_signal_connect_object + (selection, "changed", + G_CALLBACK (on_selection_changed), view, 0); - g_signal_connect (view, - "history_changed", - G_CALLBACK (history_changed_callback), - view); + g_signal_connect (view, "history_changed", + G_CALLBACK (history_changed_callback), view); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); } static void @@ -281,19 +257,19 @@ nautilus_history_view_finalize (GObject *object) view = NAUTILUS_HISTORY_VIEW (object); - if (view->external_destroyed_flag != NULL) { - *view->external_destroyed_flag = TRUE; + if (view->stop_updating_history != NULL) { + *view->stop_updating_history = TRUE; } - g_object_unref (view->treeview); + g_object_unref (view->tree_view); - GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void -nautilus_history_view_class_init (NautilusHistoryViewClass *klass) +nautilus_history_view_class_init (NautilusHistoryViewClass *class) { - G_OBJECT_CLASS (klass)->finalize = nautilus_history_view_finalize; + G_OBJECT_CLASS (class)->finalize = nautilus_history_view_finalize; } int @@ -312,6 +288,6 @@ main (int argc, char *argv[]) FACTORY_IID, VIEW_IID, nautilus_view_create_from_get_type_function, - nautilus_global_preferences_init, + NULL, nautilus_history_view_get_type); } diff --git a/components/news/nautilus-news.c b/components/news/nautilus-news.c index 2b3c3e83e..ef4d6da61 100644 --- a/components/news/nautilus-news.c +++ b/components/news/nautilus-news.c @@ -345,9 +345,7 @@ do_destroy (GtkObject *obj, News *news) nautilus_news_free_channel_list (news); /* free the property bag */ - if (news->property_bag != NULL) { - bonobo_object_unref (BONOBO_OBJECT (news->property_bag)); - } + bonobo_object_unref (news->property_bag); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_NEWS_MAX_ITEMS, max_items_changed, diff --git a/components/notes/nautilus-notes.c b/components/notes/nautilus-notes.c index beda69999..f74153122 100644 --- a/components/notes/nautilus-notes.c +++ b/components/notes/nautilus-notes.c @@ -342,8 +342,8 @@ do_destroy (GtkObject *obj, Notes *notes) * this because it exposes a bonobo bug. */ if (!GTK_OBJECT_DESTROYED (GTK_OBJECT (notes->view))) { - bonobo_object_ref (BONOBO_OBJECT (notes->view)); - bonobo_object_idle_unref (BONOBO_OBJECT (notes->view)); + bonobo_object_ref (notes->view); + bonobo_object_idle_unref (notes->view); } #endif diff --git a/components/throbber/main.c b/components/throbber/main.c index 205bab9e5..49efd4eb7 100644 --- a/components/throbber/main.c +++ b/components/throbber/main.c @@ -103,7 +103,7 @@ main (int argc, char *argv[]) gtk_main (); } while (object_count > 0); - bonobo_object_unref (BONOBO_OBJECT (factory)); + bonobo_object_unref (factory); } gnome_vfs_shutdown (); diff --git a/components/throbber/nautilus-throbber.c b/components/throbber/nautilus-throbber.c index acc23f3bf..116fd5c0d 100644 --- a/components/throbber/nautilus-throbber.c +++ b/components/throbber/nautilus-throbber.c @@ -653,9 +653,7 @@ nautilus_throbber_finalize (GObject *object) eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, nautilus_throbber_theme_changed, object); - if (throbber->details->property_bag != NULL) { - bonobo_object_unref (BONOBO_OBJECT (throbber->details->property_bag)); - } + bonobo_object_unref (throbber->details->property_bag); if (throbber->details->control != NULL) { g_object_remove_weak_pointer (G_OBJECT (throbber->details->control), diff --git a/libnautilus-private/nautilus-directory-metafile.c b/libnautilus-private/nautilus-directory-metafile.c index a87384375..c22aeb6fa 100644 --- a/libnautilus-private/nautilus-directory-metafile.c +++ b/libnautilus-private/nautilus-directory-metafile.c @@ -587,7 +587,7 @@ nautilus_directory_unregister_metadata_monitor (NautilusDirectory *directory) CORBA_exception_free (&ev); bonobo_object_release_unref (metafile, NULL); - bonobo_object_unref (BONOBO_OBJECT (directory->details->metafile_monitor)); + bonobo_object_unref (directory->details->metafile_monitor); directory->details->metafile_monitor = NULL; } diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c index 9e7d7f3b0..a0f21b57b 100644 --- a/libnautilus-private/nautilus-directory.c +++ b/libnautilus-private/nautilus-directory.c @@ -283,6 +283,8 @@ async_data_preference_changed_callback (gpointer callback_data) static void add_preferences_callbacks (void) { + nautilus_global_preferences_init (); + eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, filtering_changed_callback, NULL); diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c index bb904d8bc..1dca6d3a3 100644 --- a/libnautilus-private/nautilus-icon-canvas-item.c +++ b/libnautilus-private/nautilus-icon-canvas-item.c @@ -1145,7 +1145,11 @@ create_label_layout (NautilusIconCanvasItem *item, pango_layout_set_spacing (layout, LABEL_LINE_SPACING); /* Create a font description */ - desc = pango_font_description_from_string (container->details->font_name); + if (container->details->font_name == NULL) { + desc = pango_font_description_new (); + } else { + desc = pango_font_description_from_string (container->details->font_name); + } pango_font_description_set_size (desc, container->details->font_size_table [container->details->zoom_level] * PANGO_SCALE); pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c index 806a1faab..ffd0fe5b3 100644 --- a/libnautilus-private/nautilus-icon-container.c +++ b/libnautilus-private/nautilus-icon-container.c @@ -3710,11 +3710,11 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container, /* Get the icons. */ g_signal_emit (container, - signals[GET_ICON_IMAGES], 0, - icon->data, - (icon == details->drop_target) ? "accept" : "", - &emblem_scalable_icons, - &scalable_icon); + signals[GET_ICON_IMAGES], 0, + icon->data, + (icon == details->drop_target) ? "accept" : "", + &emblem_scalable_icons, + &scalable_icon); /* compute the maximum size based on the scale factor */ min_image_size = MINIMUM_IMAGE_SIZE * GNOME_CANVAS (container)->pixels_per_unit; @@ -3733,8 +3733,7 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container, nautilus_scalable_icon_unref (scalable_icon); - /* in the rare case an image is too small, scale it up */ - + /* in the rare case an image is too small, scale it up */ width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); if (width < min_image_size || height < min_image_size) { @@ -3801,10 +3800,6 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container, nautilus_icon_canvas_item_set_attach_points (icon->item, &attach_points); nautilus_icon_canvas_item_set_emblems (icon->item, emblem_pixbufs); - if (container->details->update_icon_font == TRUE) { - nautilus_icon_canvas_item_invalidate_label_size (icon->item); - } - /* Let the pixbufs go. */ g_object_unref (pixbuf); eel_gdk_pixbuf_list_free (emblem_pixbufs); @@ -4028,9 +4023,7 @@ nautilus_icon_container_set_zoom_level (NautilusIconContainer *container, int ne / NAUTILUS_ICON_SIZE_STANDARD; gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (container), pixels_per_unit); - /* We need to update the icon font too */ - container->details->update_icon_font = TRUE; - + invalidate_label_sizes (container); nautilus_icon_container_request_update_all (container); } @@ -4044,16 +4037,16 @@ nautilus_icon_container_set_zoom_level (NautilusIconContainer *container, int ne void nautilus_icon_container_request_update_all (NautilusIconContainer *container) { - GList *p; + GList *node; + NautilusIcon *icon; g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container)); - for (p = container->details->icons; p != NULL; p = p->next) { - nautilus_icon_container_update_icon (container, p->data); + for (node = container->details->icons; node != NULL; node = node->next) { + icon = node->data; + nautilus_icon_container_update_icon (container, icon); } - container->details->update_icon_font = FALSE; - redo_layout (container); } @@ -5081,39 +5074,45 @@ nautilus_icon_container_theme_changed (gpointer user_data) } void -nautilus_icon_container_set_font_name (NautilusIconContainer *container, - const char *font_name) +nautilus_icon_container_set_font_name (NautilusIconContainer *container, + const char *font_name) { g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container)); - g_free (container->details->font_name); - - g_print ("new font name is: %s\n", font_name); - - if (font_name != NULL) { - container->details->font_name = g_strdup (font_name); - } - else { - container->details->font_name = NULL; + if (eel_strcmp (container->details->font_name, font_name) == 0) { + return; } - container->details->update_icon_font = TRUE; + g_free (container->details->font_name); + container->details->font_name = g_strdup (font_name); + + invalidate_label_sizes (container); + nautilus_icon_container_request_update_all (container); } void nautilus_icon_container_set_font_size_table (NautilusIconContainer *container, const int font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST + 1]) { + int old_font_size; int i; g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container)); g_return_if_fail (font_size_table != NULL); + old_font_size = container->details->font_size_table[container->details->zoom_level]; + for (i = 0; i <= NAUTILUS_ZOOM_LEVEL_LARGEST; i++) { - container->details->font_size_table[i] = font_size_table[i]; + if (container->details->font_size_table[i] != font_size_table[i]) { + container->details->font_size_table[i] = font_size_table[i]; + changed = TRUE; + } } - container->details->update_icon_font = TRUE; + if (old_font_size != container->details->font_size_table[container->details->zoom_level]) { + invalidate_label_sizes (container); + nautilus_icon_container_request_update_all (container); + } } #if ! defined (NAUTILUS_OMIT_SELF_CHECK) diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c index 74a5ad420..89be6ffbc 100644 --- a/libnautilus-private/nautilus-icon-factory.c +++ b/libnautilus-private/nautilus-icon-factory.c @@ -267,6 +267,8 @@ static NautilusIconFactory * get_icon_factory (void) { if (global_icon_factory == NULL) { + nautilus_global_preferences_init (); + global_icon_factory = NAUTILUS_ICON_FACTORY (g_object_new (nautilus_icon_factory_get_type (), NULL)); g_object_ref (global_icon_factory); @@ -276,7 +278,7 @@ get_icon_factory (void) eel_preferences_add_callback (NAUTILUS_PREFERENCES_THEME, icon_theme_changed_callback, NULL); - + thumbnail_limit_changed_callback (NULL); eel_preferences_add_callback (NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT, thumbnail_limit_changed_callback, @@ -1022,7 +1024,7 @@ should_display_image_file_as_itself (NautilusFile *file) if (!show_thumbnail_auto_value_registered) { eel_preferences_add_auto_integer (NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS, - &show_thumbnails_auto_value); + &show_thumbnails_auto_value); show_thumbnail_auto_value_registered = TRUE; } diff --git a/libnautilus-private/nautilus-metafile-factory.c b/libnautilus-private/nautilus-metafile-factory.c index 3eb3387a6..b72ed5d9e 100644 --- a/libnautilus-private/nautilus-metafile-factory.c +++ b/libnautilus-private/nautilus-metafile-factory.c @@ -69,7 +69,7 @@ static NautilusMetafileFactory *the_factory; static void free_factory_instance (void) { - bonobo_object_unref (BONOBO_OBJECT (the_factory)); + bonobo_object_unref (the_factory); the_factory = NULL; } @@ -81,7 +81,7 @@ nautilus_metafile_factory_get_instance (void) eel_debug_call_at_shutdown (free_factory_instance); } - return bonobo_object_ref (BONOBO_OBJECT (the_factory)); + return bonobo_object_ref (the_factory); } static Nautilus_Metafile diff --git a/libnautilus-private/nautilus-metafile.c b/libnautilus-private/nautilus-metafile.c index ce5c01b56..84e696a85 100644 --- a/libnautilus-private/nautilus-metafile.c +++ b/libnautilus-private/nautilus-metafile.c @@ -285,7 +285,7 @@ nautilus_metafile_get (const char *directory_uri) metafile = g_hash_table_lookup (metafiles, canonical_uri); if (metafile != NULL) { - bonobo_object_ref (BONOBO_OBJECT (metafile)); + bonobo_object_ref (metafile); } else { metafile = nautilus_metafile_new (canonical_uri); @@ -528,7 +528,7 @@ corba_copy (PortableServer_Servant servant, copy_file_metadata (source_metafile, source_file_name, destination_metafile, destination_file_name); - bonobo_object_unref (BONOBO_OBJECT (destination_metafile)); + bonobo_object_unref (destination_metafile); } static void @@ -1876,7 +1876,7 @@ metafile_write_done (NautilusMetafile *metafile) xmlFree (metafile->details->write_state->buffer); g_free (metafile->details->write_state); metafile->details->write_state = NULL; - bonobo_object_unref (BONOBO_OBJECT (metafile)); + bonobo_object_unref (metafile); } static void @@ -2002,11 +2002,11 @@ metafile_write (NautilusMetafile *metafile) g_assert (NAUTILUS_IS_METAFILE (metafile)); - bonobo_object_ref (BONOBO_OBJECT (metafile)); + bonobo_object_ref (metafile); /* If we are already writing, then just remember to do it again. */ if (metafile->details->write_state != NULL) { - bonobo_object_unref (BONOBO_OBJECT (metafile)); + bonobo_object_unref (metafile); metafile->details->write_state->write_again = TRUE; return; } @@ -2016,7 +2016,7 @@ metafile_write (NautilusMetafile *metafile) * the metafile in this case. */ if (metafile->details->xml == NULL) { - bonobo_object_unref (BONOBO_OBJECT (metafile)); + bonobo_object_unref (metafile); return; } @@ -2041,7 +2041,7 @@ metafile_write_idle_callback (gpointer callback_data) metafile->details->write_idle_id = 0; metafile_write (metafile); - bonobo_object_unref (BONOBO_OBJECT (metafile)); + bonobo_object_unref (metafile); return FALSE; } @@ -2057,10 +2057,9 @@ directory_request_write_metafile (NautilusMetafile *metafile) /* Set up an idle task that will write the metafile. */ if (metafile->details->write_idle_id == 0) { - bonobo_object_ref (BONOBO_OBJECT (metafile)); + bonobo_object_ref (metafile); metafile->details->write_idle_id = - gtk_idle_add (metafile_write_idle_callback, - metafile); + gtk_idle_add (metafile_write_idle_callback, metafile); } } diff --git a/libnautilus/nautilus-clipboard.c b/libnautilus/nautilus-clipboard.c index c35182ff2..dce4d139a 100644 --- a/libnautilus/nautilus-clipboard.c +++ b/libnautilus/nautilus-clipboard.c @@ -338,7 +338,7 @@ target_destroy_callback (GtkObject *object, * everything. */ bonobo_ui_component_unset_container (target_data->component, NULL); - bonobo_object_unref (BONOBO_OBJECT (target_data->component)); + bonobo_object_unref (target_data->component); bonobo_object_release_unref (target_data->container, NULL); g_free (target_data); } @@ -368,7 +368,7 @@ initialize_clipboard_component_with_callback_data (GtkEditable *target, * time. */ target_data = g_new (TargetCallbackData, 1); - bonobo_object_ref (BONOBO_OBJECT (ui)); + bonobo_object_ref (ui); target_data->component = ui; target_data->container = bonobo_object_dup_ref (ui_container, NULL); target_data->editable_shares_selection_changes = diff --git a/libnautilus/nautilus-undo.c b/libnautilus/nautilus-undo.c index b2d760a93..fbf297085 100644 --- a/libnautilus/nautilus-undo.c +++ b/libnautilus/nautilus-undo.c @@ -108,7 +108,7 @@ nautilus_undo_register_full (GList *atoms, /* Now we are done with the transaction. * If the undo manager is holding it, then this will not destroy it. */ - bonobo_object_unref (BONOBO_OBJECT (transaction)); + bonobo_object_unref (transaction); } /* Cover for forgetting about all undo relating to a particular target. */ diff --git a/libnautilus/nautilus-view-standard-main.c b/libnautilus/nautilus-view-standard-main.c index 52fd4c95e..2cab21484 100644 --- a/libnautilus/nautilus-view-standard-main.c +++ b/libnautilus/nautilus-view-standard-main.c @@ -227,7 +227,7 @@ nautilus_view_standard_main_multi (const char *executable_name, do { gtk_main (); } while (callback_data.object_count > 0 || callback_data.delayed_quit_timeout_id != 0); - bonobo_object_unref (BONOBO_OBJECT (factory)); + bonobo_object_unref (factory); } gnome_vfs_shutdown (); diff --git a/libnautilus/nautilus-view.c b/libnautilus/nautilus-view.c index 144cb5ee4..89ef9d239 100644 --- a/libnautilus/nautilus-view.c +++ b/libnautilus/nautilus-view.c @@ -30,21 +30,19 @@ nautilus view implementation. */ #include <config.h> -#include <string.h> #include "nautilus-view.h" #include "nautilus-idle-queue.h" #include "nautilus-undo.h" -#include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-listener.h> #include <bonobo/bonobo-event-source.h> +#include <bonobo/bonobo-exception.h> +#include <bonobo/bonobo-listener.h> #include <bonobo/bonobo-main.h> #include <bonobo/bonobo-ui-util.h> -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> #include <libgnome/gnome-macros.h> #include <libgnomevfs/gnome-vfs-utils.h> +#include <string.h> enum { HISTORY_CHANGED, @@ -59,11 +57,12 @@ static guint signals[LAST_SIGNAL]; struct NautilusViewDetails { BonoboControl *control; - Nautilus_ViewFrame view_frame; - NautilusViewListenerMask listen_mask; + Nautilus_ViewFrame cached_view_frame; + + NautilusViewListenerMask listener_mask; BonoboListener *listener; - Bonobo_EventSource event_source; + Bonobo_EventSource listener_event_source; NautilusIdleQueue *incoming_queue; NautilusIdleQueue *outgoing_queue; @@ -91,7 +90,6 @@ queue_incoming_call (PortableServer_Servant servant, NautilusView *view; view = NAUTILUS_VIEW (bonobo_object_from_servant (servant)); - nautilus_idle_queue_add (view->details->incoming_queue, (GFunc) call, view, @@ -105,6 +103,8 @@ queue_outgoing_call (NautilusView *view, gpointer callback_data, GDestroyNotify destroy_callback_data) { + g_return_if_fail (NAUTILUS_IS_VIEW (view)); + nautilus_idle_queue_add (view->details->outgoing_queue, (GFunc) call, view, @@ -257,29 +257,20 @@ nautilus_view_frame_property_changed_callback (BonoboListener *listener, gpointer callback_data; GDestroyNotify destroy_callback_data; - view = user_data; - - g_return_if_fail (NAUTILUS_IS_VIEW (user_data)); + view = NAUTILUS_VIEW (user_data); if (strcmp (event_name, "Bonobo/Property:change:title") == 0) { - callback = call_title_changed; callback_data = g_strdup (BONOBO_ARG_GET_STRING (any)); destroy_callback_data = g_free; - } else if (strcmp (event_name, "Bonobo/Property:change:history") == 0) { - - callback = call_history_changed; callback_data = history_dup (any->_value); destroy_callback_data = CORBA_free; - } else if (strcmp (event_name, "Bonobo/Property:change:selection") == 0) { - callback = call_selection_changed; callback_data = nautilus_g_list_from_uri_list (any->_value); destroy_callback_data = list_deep_free_cover; - } else { g_warning ("Unknown event '%s'", event_name); return; @@ -293,17 +284,44 @@ nautilus_view_frame_property_changed_callback (BonoboListener *listener, } static void +remove_listener (NautilusView *view) +{ + BonoboListener *listener; + Bonobo_EventSource es; + CORBA_Environment ev; + + listener = view->details->listener; + if (listener == NULL) { + g_assert (view->details->listener_event_source == CORBA_OBJECT_NIL); + return; + } + + es = view->details->listener_event_source; + + view->details->listener = NULL; + view->details->listener_event_source = CORBA_OBJECT_NIL; + + CORBA_exception_init (&ev); + + bonobo_event_source_client_remove_listener (es, BONOBO_OBJREF (listener), &ev); + + CORBA_Object_release (es, &ev); + bonobo_object_unref (listener); + + CORBA_exception_free (&ev); +} + +static void append_mask (GString *str, const char *mask_element) { - if (str->len) { + if (str->len != 0) { g_string_append_c (str, ','); } g_string_append (str, mask_element); } static void -nautilus_view_set_frame (NautilusView *view, - Bonobo_ControlFrame frame) +update_listener (NautilusView *view) { BonoboListener *listener; CORBA_Environment ev; @@ -311,98 +329,75 @@ nautilus_view_set_frame (NautilusView *view, Bonobo_PropertyBag pbag; GString *mask; - CORBA_exception_init (&ev); + remove_listener (view); - if (frame == CORBA_OBJECT_NIL && - view->details->view_frame != CORBA_OBJECT_NIL) { - CORBA_Object_release (view->details->view_frame, &ev); - view->details->view_frame = CORBA_OBJECT_NIL; + if (view->details->listener_mask == 0) { + return; } - if (view->details->listen_mask == 0) { /* Defer until we need to */ + pbag = nautilus_view_get_ambient_properties (view, NULL); + if (pbag == CORBA_OBJECT_NIL) { return; } + + CORBA_exception_init (&ev); - if ((listener = view->details->listener) != NULL) { - view->details->listener = NULL; - - bonobo_event_source_client_remove_listener ( - view->details->event_source, - BONOBO_OBJREF (listener), &ev); - - CORBA_Object_release (view->details->event_source, &ev); - bonobo_object_unref (BONOBO_OBJECT (listener)); - - CORBA_exception_free (&ev); + es = Bonobo_Unknown_queryInterface (pbag, "IDL:Bonobo/EventSource:1.0", &ev); + if (BONOBO_EX (&ev)) { + es = CORBA_OBJECT_NIL; + } + if (es == CORBA_OBJECT_NIL) { + g_warning ("Contractual breakage - NautilusViewFrame's " + "ambient property bag has no event source"); + goto failed; + } + + listener = bonobo_listener_new (nautilus_view_frame_property_changed_callback, view); + + mask = g_string_sized_new (128); + if (view->details->listener_mask & NAUTILUS_VIEW_LISTEN_TITLE) { + append_mask (mask, "Bonobo/Property:change:title"); + } + if (view->details->listener_mask & NAUTILUS_VIEW_LISTEN_HISTORY) { + append_mask (mask, "Bonobo/Property:change:history"); + } + if (view->details->listener_mask & NAUTILUS_VIEW_LISTEN_SELECTION) { + append_mask (mask, "Bonobo/Property:change:selection"); } - if (frame != CORBA_OBJECT_NIL) { - - pbag = bonobo_control_get_ambient_properties ( - view->details->control, &ev); - - if (BONOBO_EX (&ev)) { - goto add_failed; - } - if (pbag == CORBA_OBJECT_NIL) { - g_warning ("NautilusView: contractural breakage - " - "NautilusViewFrame has no ambient property bag"); - goto add_failed; - } - - es = Bonobo_Unknown_queryInterface ( - pbag, "IDL:Bonobo/EventSource:1.0", &ev); - - if (BONOBO_EX (&ev)) { - goto add_failed; - } - - if (es == CORBA_OBJECT_NIL) { - g_warning ("Contractural breakage - NautilusViewFrame's " - "ambient property bag has no event source"); - goto add_failed; - } - - view->details->event_source = CORBA_Object_duplicate (es, &ev); - bonobo_object_release_unref (es, &ev); - - listener = bonobo_listener_new ( - nautilus_view_frame_property_changed_callback, view); - - view->details->listener = listener; - - mask = g_string_sized_new (128); - - if (view->details->listen_mask & NAUTILUS_VIEW_LISTEN_TITLE) - append_mask (mask, "Bonobo/Property:change:title"); - - if (view->details->listen_mask & NAUTILUS_VIEW_LISTEN_HISTORY) - append_mask (mask, "Bonobo/Property:change:history"); - - if (view->details->listen_mask & NAUTILUS_VIEW_LISTEN_SELECTION) - append_mask (mask, "Bonobo/Property:change:selection"); + Bonobo_EventSource_addListenerWithMask (es, BONOBO_OBJREF (listener), mask->str, &ev); + + g_string_free (mask, TRUE); + + view->details->listener = listener; + view->details->listener_event_source = es; - Bonobo_EventSource_addListenerWithMask ( - es, BONOBO_OBJREF (listener), mask->str, &ev); + Bonobo_Unknown_unref (es, &ev); + + failed: + bonobo_object_release_unref (pbag, NULL); + CORBA_exception_free (&ev); +} - g_string_free (mask, TRUE); - } +static void +forget_cached_view_frame (NautilusView *view) +{ + CORBA_Environment ev; - add_failed: + CORBA_exception_init (&ev); + CORBA_Object_release (view->details->cached_view_frame, &ev); + view->details->cached_view_frame = CORBA_OBJECT_NIL; CORBA_exception_free (&ev); } static void nautilus_view_set_frame_callback (BonoboControl *control, - NautilusView *view) + NautilusView *view) { - Bonobo_ControlFrame frame; - g_return_if_fail (NAUTILUS_IS_VIEW (view)); - frame = bonobo_control_get_control_frame (control, NULL); - - nautilus_view_set_frame (view, frame); + forget_cached_view_frame (view); + update_listener (view); } static void @@ -417,40 +412,45 @@ nautilus_view_instance_init (NautilusView *view) NautilusView * nautilus_view_new (GtkWidget *widget) { - return nautilus_view_new_from_bonobo_control - (bonobo_control_new (widget)); + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + + return nautilus_view_new_from_bonobo_control (bonobo_control_new (widget)); } NautilusView * nautilus_view_new_from_bonobo_control (BonoboControl *control) { + g_return_val_if_fail (BONOBO_IS_CONTROL (control), NULL); + return nautilus_view_construct_from_bonobo_control - (NAUTILUS_VIEW (g_object_new (NAUTILUS_TYPE_VIEW, NULL)), - control); + (NAUTILUS_VIEW (g_object_new (NAUTILUS_TYPE_VIEW, NULL)), control); } NautilusView * -nautilus_view_construct (NautilusView *view, - GtkWidget *widget) +nautilus_view_construct (NautilusView *view, + GtkWidget *widget) { + g_return_val_if_fail (NAUTILUS_IS_VIEW (view), view); + g_return_val_if_fail (GTK_IS_WIDGET (widget), view); + return nautilus_view_construct_from_bonobo_control (view, bonobo_control_new (widget)); } NautilusView * -nautilus_view_construct_from_bonobo_control (NautilusView *view, - BonoboControl *control) +nautilus_view_construct_from_bonobo_control (NautilusView *view, + BonoboControl *control) { - g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL); - g_return_val_if_fail (BONOBO_IS_CONTROL (control), NULL); + g_return_val_if_fail (NAUTILUS_IS_VIEW (view), view); + g_return_val_if_fail (BONOBO_IS_CONTROL (control), view); view->details->control = control; bonobo_object_add_interface (BONOBO_OBJECT (view), BONOBO_OBJECT (control)); nautilus_undo_set_up_bonobo_control (control); - g_signal_connect (G_OBJECT (control), "set_frame", - G_CALLBACK (nautilus_view_set_frame_callback), - view); + g_signal_connect_object (G_OBJECT (control), "set_frame", + G_CALLBACK (nautilus_view_set_frame_callback), + view, 0); return view; } @@ -462,6 +462,9 @@ nautilus_view_finalize (GObject *object) view = NAUTILUS_VIEW (object); + forget_cached_view_frame (view); + remove_listener (view); + nautilus_idle_queue_destroy (view->details->incoming_queue); nautilus_idle_queue_destroy (view->details->outgoing_queue); @@ -477,12 +480,8 @@ nautilus_view_dispose (GObject *object) view = NAUTILUS_VIEW (object); - if (view->details->view_frame == CORBA_OBJECT_NIL) { - CORBA_Object_release (view->details->view_frame, NULL); - view->details->view_frame = CORBA_OBJECT_NIL; - } - - nautilus_view_set_frame (view, CORBA_OBJECT_NIL); + forget_cached_view_frame (view); + remove_listener (view); GNOME_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); } @@ -490,31 +489,26 @@ nautilus_view_dispose (GObject *object) static Nautilus_ViewFrame nautilus_view_get_view_frame (NautilusView *view, CORBA_Environment *ev) { - Nautilus_ViewFrame view_frame; + Nautilus_ViewFrame view_frame; Bonobo_ControlFrame control_frame; g_return_val_if_fail (NAUTILUS_IS_VIEW (view), CORBA_OBJECT_NIL); - if (view->details->view_frame == CORBA_OBJECT_NIL) { - - control_frame = bonobo_control_get_control_frame ( - nautilus_view_get_bonobo_control (view), ev); - - if (ev->_major != CORBA_NO_EXCEPTION || - control_frame == CORBA_OBJECT_NIL) { - view_frame = CORBA_OBJECT_NIL; - } else { - view_frame = Bonobo_Unknown_queryInterface ( - control_frame, "IDL:Nautilus/ViewFrame:1.0", ev); - if (ev->_major != CORBA_NO_EXCEPTION) { - view_frame = CORBA_OBJECT_NIL; + if (view->details->cached_view_frame == CORBA_OBJECT_NIL) { + control_frame = bonobo_control_get_control_frame (view->details->control, ev); + if (! BONOBO_EX (ev) && control_frame != CORBA_OBJECT_NIL) { + view_frame = Bonobo_Unknown_queryInterface + (control_frame, "IDL:Nautilus/ViewFrame:1.0", ev); + if (! BONOBO_EX (ev) && view_frame != CORBA_OBJECT_NIL) { + Bonobo_Unknown_unref (view_frame, ev); + view->details->cached_view_frame = view_frame; } + + CORBA_Object_release (control_frame, ev); } - view->details->view_frame = CORBA_Object_duplicate (view_frame, ev); - bonobo_object_release_unref (view_frame, ev); } - return CORBA_Object_duplicate (view->details->view_frame, ev); + return CORBA_Object_duplicate (view->details->cached_view_frame, ev); } static Nautilus_ViewFrame @@ -963,7 +957,6 @@ nautilus_view_close_window (NautilusView *view) NULL); } - BonoboControl * nautilus_view_get_bonobo_control (NautilusView *view) { @@ -996,16 +989,14 @@ nautilus_view_set_up_ui (NautilusView *view, } static void -nautilus_view_class_init (NautilusViewClass *klass) +nautilus_view_class_init (NautilusViewClass *class) { - POA_Nautilus_View__epv *epv = &klass->epv; - - G_OBJECT_CLASS (klass)->finalize = nautilus_view_finalize; - G_OBJECT_CLASS (klass)->dispose = nautilus_view_dispose; + G_OBJECT_CLASS (class)->finalize = nautilus_view_finalize; + G_OBJECT_CLASS (class)->dispose = nautilus_view_dispose; signals[LOAD_LOCATION] = g_signal_new ("load_location", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusViewClass, load_location), NULL, NULL, @@ -1013,7 +1004,7 @@ nautilus_view_class_init (NautilusViewClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); signals[STOP_LOADING] = g_signal_new ("stop_loading", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusViewClass, stop_loading), NULL, NULL, @@ -1021,7 +1012,7 @@ nautilus_view_class_init (NautilusViewClass *klass) G_TYPE_NONE, 0); signals[SELECTION_CHANGED] = g_signal_new ("selection_changed", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusViewClass, selection_changed), NULL, NULL, @@ -1029,7 +1020,7 @@ nautilus_view_class_init (NautilusViewClass *klass) G_TYPE_NONE, 1, G_TYPE_POINTER); signals[TITLE_CHANGED] = g_signal_new ("title_changed", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusViewClass, title_changed), NULL, NULL, @@ -1037,41 +1028,32 @@ nautilus_view_class_init (NautilusViewClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); signals[HISTORY_CHANGED] = g_signal_new ("history_changed", - G_TYPE_FROM_CLASS (klass), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NautilusViewClass, history_changed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - epv->load_location = impl_Nautilus_View_load_location; - epv->stop_loading = impl_Nautilus_View_stop_loading; + class->epv.load_location = impl_Nautilus_View_load_location; + class->epv.stop_loading = impl_Nautilus_View_stop_loading; } Bonobo_PropertyBag -nautilus_view_get_ambient_properties (NautilusView *view, +nautilus_view_get_ambient_properties (NautilusView *view, CORBA_Environment *opt_ev) { g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL); - return bonobo_control_get_ambient_properties ( - view->details->control, opt_ev); + return bonobo_control_get_ambient_properties (view->details->control, opt_ev); } void -nautilus_view_set_listener_mask (NautilusView *view, +nautilus_view_set_listener_mask (NautilusView *view, NautilusViewListenerMask mask) { - if (!view->details->listen_mask) { - Bonobo_ControlFrame frame; - - view->details->listen_mask = mask; - - frame = bonobo_control_get_control_frame ( - view->details->control, NULL); + g_return_if_fail (NAUTILUS_IS_VIEW (view)); - if (frame != CORBA_OBJECT_NIL) { - nautilus_view_set_frame (view, frame); - } - } + view->details->listener_mask = mask; + update_listener (view); } diff --git a/po/ChangeLog b/po/ChangeLog index b93ab7b98..6e2a4dbde 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,11 @@ +2002-02-26 Darin Adler <darin@bentspoon.com> + + reviewed by: <delete if not using a buddy> + + * ChangeLog: + +=== nautilus 1.1.6 === + 2002-02-26 Stanislav Visnovsky <visnovsky@nenya.ms.mff.cuni.cz> * sk.po: Updated Slovak translation. diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index ccfb9f7d2..25189c61f 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -255,7 +255,7 @@ fm_desktop_icon_view_destroy (GtkObject *object) /* Clean up details */ if (icon_view->details->ui != NULL) { bonobo_ui_component_unset_container (icon_view->details->ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (icon_view->details->ui)); + bonobo_object_unref (icon_view->details->ui); icon_view->details->ui = NULL; } diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index 2141ff0b0..c2f8c9026 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -244,7 +244,7 @@ fm_icon_view_finalize (GObject *object) if (icon_view->details->ui != NULL) { bonobo_ui_component_unset_container (icon_view->details->ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (icon_view->details->ui)); + bonobo_object_unref (icon_view->details->ui); } if (icon_view->details->react_to_icon_change_idle_id != 0) { diff --git a/src/file-manager/fm-search-list-view.c b/src/file-manager/fm-search-list-view.c index 29f5ca3fb..e655c71af 100644 --- a/src/file-manager/fm-search-list-view.c +++ b/src/file-manager/fm-search-list-view.c @@ -401,7 +401,7 @@ real_destroy (GtkObject *object) if (search_view->details->ui != NULL) { bonobo_ui_component_unset_container (search_view->details->ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (search_view->details->ui)); + bonobo_object_unref (search_view->details->ui); } g_free (search_view->details); diff --git a/src/nautilus-application.c b/src/nautilus-application.c index 639ccfc0c..a388a7ec4 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -176,7 +176,7 @@ nautilus_application_destroy (BonoboObject *object) nautilus_bookmarks_exiting (); - bonobo_object_unref (BONOBO_OBJECT (application->undo_manager)); + bonobo_object_unref (application->undo_manager); EEL_CALL_PARENT (BONOBO_OBJECT_CLASS, destroy, (object)); } @@ -642,12 +642,12 @@ nautilus_application_create_window (NautilusApplication *application) "app_id", "nautilus", NULL)); g_signal_connect (window, - "delete_event", G_CALLBACK (nautilus_window_delete_event_callback), - NULL); + "delete_event", G_CALLBACK (nautilus_window_delete_event_callback), + NULL); g_signal_connect (window, - "destroy", G_CALLBACK (nautilus_application_destroyed_window), - application); + "destroy", G_CALLBACK (nautilus_application_destroyed_window), + application); nautilus_application_window_list = g_list_prepend (nautilus_application_window_list, window); @@ -1017,9 +1017,8 @@ is_kdesktop_present (void) } static void -nautilus_application_class_init (NautilusApplicationClass *klass) +nautilus_application_class_init (NautilusApplicationClass *class) { - BONOBO_OBJECT_CLASS (klass)->destroy = nautilus_application_destroy; - - BONOBO_GENERIC_FACTORY_CLASS (klass)->epv.createObject = create_object; + BONOBO_OBJECT_CLASS (class)->destroy = nautilus_application_destroy; + BONOBO_GENERIC_FACTORY_CLASS (class)->epv.createObject = create_object; } diff --git a/src/nautilus-main.c b/src/nautilus-main.c index 1c2b855b2..744f1c041 100644 --- a/src/nautilus-main.c +++ b/src/nautilus-main.c @@ -267,7 +267,7 @@ main (int argc, char *argv[]) if (is_event_loop_needed ()) { gtk_main (); } - bonobo_object_unref (BONOBO_OBJECT (application)); + bonobo_object_unref (application); } poptFreeContext (popt_context); diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index 65c74b0e8..d9437d00c 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -765,7 +765,7 @@ nautilus_window_constructed (NautilusWindow *window) BONOBO_OBJREF (location_bar_wrapper), NULL); bonobo_ui_component_thaw (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (location_bar_wrapper)); + bonobo_object_unref (location_bar_wrapper); /* initalize the menus and toolbars */ nautilus_window_initialize_menus_part_1 (window); @@ -934,7 +934,7 @@ nautilus_window_destroy (GtkObject *object) if (window->details->shell_ui != NULL) { bonobo_ui_component_unset_container (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); + bonobo_object_unref (window->details->shell_ui); } nautilus_file_unref (window->details->viewed_file); @@ -961,9 +961,7 @@ nautilus_window_destroy (GtkObject *object) g_source_remove (window->status_bar_clear_id); } - if (window->details->ui_container != NULL) { - bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); - } + bonobo_object_unref (window->details->ui_container); if (window->details->location_change_at_idle_id != 0) { gtk_idle_remove (window->details->location_change_at_idle_id); diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c index 65c74b0e8..d9437d00c 100644 --- a/src/nautilus-object-window.c +++ b/src/nautilus-object-window.c @@ -765,7 +765,7 @@ nautilus_window_constructed (NautilusWindow *window) BONOBO_OBJREF (location_bar_wrapper), NULL); bonobo_ui_component_thaw (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (location_bar_wrapper)); + bonobo_object_unref (location_bar_wrapper); /* initalize the menus and toolbars */ nautilus_window_initialize_menus_part_1 (window); @@ -934,7 +934,7 @@ nautilus_window_destroy (GtkObject *object) if (window->details->shell_ui != NULL) { bonobo_ui_component_unset_container (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); + bonobo_object_unref (window->details->shell_ui); } nautilus_file_unref (window->details->viewed_file); @@ -961,9 +961,7 @@ nautilus_window_destroy (GtkObject *object) g_source_remove (window->status_bar_clear_id); } - if (window->details->ui_container != NULL) { - bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); - } + bonobo_object_unref (window->details->ui_container); if (window->details->location_change_at_idle_id != 0) { gtk_idle_remove (window->details->location_change_at_idle_id); diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index 65c74b0e8..d9437d00c 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -765,7 +765,7 @@ nautilus_window_constructed (NautilusWindow *window) BONOBO_OBJREF (location_bar_wrapper), NULL); bonobo_ui_component_thaw (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (location_bar_wrapper)); + bonobo_object_unref (location_bar_wrapper); /* initalize the menus and toolbars */ nautilus_window_initialize_menus_part_1 (window); @@ -934,7 +934,7 @@ nautilus_window_destroy (GtkObject *object) if (window->details->shell_ui != NULL) { bonobo_ui_component_unset_container (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); + bonobo_object_unref (window->details->shell_ui); } nautilus_file_unref (window->details->viewed_file); @@ -961,9 +961,7 @@ nautilus_window_destroy (GtkObject *object) g_source_remove (window->status_bar_clear_id); } - if (window->details->ui_container != NULL) { - bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); - } + bonobo_object_unref (window->details->ui_container); if (window->details->location_change_at_idle_id != 0) { gtk_idle_remove (window->details->location_change_at_idle_id); diff --git a/src/nautilus-view-frame.c b/src/nautilus-view-frame.c index 2e328f091..f0b8bc32f 100644 --- a/src/nautilus-view-frame.c +++ b/src/nautilus-view-frame.c @@ -35,9 +35,9 @@ #include "nautilus-signaller.h" #include "nautilus-view-frame-private.h" #include "nautilus-window.h" -#include <nautilus-marshal.h> -#include <bonobo/bonobo-event-source.h> #include <bonobo/bonobo-control-frame.h> +#include <bonobo/bonobo-event-source.h> +#include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-zoomable-frame.h> #include <bonobo/bonobo-zoomable.h> #include <eel/eel-gtk-extensions.h> @@ -50,6 +50,7 @@ #include <libnautilus-private/nautilus-undo-manager.h> #include <libnautilus/nautilus-idle-queue.h> #include <libnautilus/nautilus-view.h> +#include <nautilus-marshal.h> #include <string.h> enum { @@ -192,7 +193,7 @@ destroy_view (NautilusViewFrame *view) if (engine != NULL) { bonobo_ui_engine_deregister_dead_components (engine); } - bonobo_object_unref (BONOBO_OBJECT (view->details->ui_container)); + bonobo_object_unref (view->details->ui_container); view->details->ui_container = NULL; } @@ -428,7 +429,7 @@ nautilus_view_frame_new (BonoboUIContainer *ui_container, view_frame = NAUTILUS_VIEW_FRAME (gtk_widget_new (nautilus_view_frame_get_type (), NULL)); - bonobo_object_ref (BONOBO_OBJECT (ui_container)); + bonobo_object_ref (ui_container); view_frame->details->ui_container = ui_container; view_frame->details->undo_manager = undo_manager; @@ -495,8 +496,8 @@ get_history_list (NautilusViewFrame *view) history_list = NULL; g_signal_emit (view, - signals[GET_HISTORY_LIST], 0, - &history_list); + signals[GET_HISTORY_LIST], 0, + &history_list); return history_list; } @@ -534,42 +535,40 @@ nautilus_view_frame_get_prop (BonoboPropertyBag *bag, static BonoboPropertyBag * create_ambient_properties (NautilusViewFrame *view) { - BonoboPropertyBag *pbag; + BonoboPropertyBag *bag; - pbag = bonobo_property_bag_new ( - nautilus_view_frame_get_prop, - NULL, view); + bag = bonobo_property_bag_new (nautilus_view_frame_get_prop, NULL, view); - bonobo_property_bag_add ( - pbag, - "title", - BONOBO_PROPERTY_TITLE, - TC_CORBA_string, - NULL, - _("a title"), - BONOBO_PROPERTY_READABLE); - - bonobo_property_bag_add ( - pbag, - "history", - BONOBO_PROPERTY_HISTORY, - TC_Nautilus_History, - NULL, - _("the browse history"), - BONOBO_PROPERTY_READABLE); - - bonobo_property_bag_add ( - pbag, - "selection", - BONOBO_PROPERTY_SELECTION, - TC_Nautilus_URIList, - NULL, - _("the current selection"), - BONOBO_PROPERTY_READABLE); - - view->details->event_source = pbag->es; - - return pbag; + bonobo_property_bag_add + (bag, + "title", + BONOBO_PROPERTY_TITLE, + TC_CORBA_string, + NULL, + _("a title"), + BONOBO_PROPERTY_READABLE); + + bonobo_property_bag_add + (bag, + "history", + BONOBO_PROPERTY_HISTORY, + TC_Nautilus_History, + NULL, + _("the browse history"), + BONOBO_PROPERTY_READABLE); + + bonobo_property_bag_add + (bag, + "selection", + BONOBO_PROPERTY_SELECTION, + TC_Nautilus_URIList, + NULL, + _("the current selection"), + BONOBO_PROPERTY_READABLE); + + view->details->event_source = bag->es; + + return bag; } static void @@ -578,6 +577,7 @@ create_corba_objects (NautilusViewFrame *view) CORBA_Environment ev; Bonobo_Control control; Bonobo_Zoomable zoomable; + BonoboPropertyBag *bag; CORBA_exception_init (&ev); @@ -587,26 +587,28 @@ create_corba_objects (NautilusViewFrame *view) /* Create a control frame. */ control = Bonobo_Unknown_queryInterface (view->details->view, "IDL:Bonobo/Control:1.0", &ev); - g_assert (ev._major == CORBA_NO_EXCEPTION); - view->details->control_frame = bonobo_control_frame_new ( - BONOBO_OBJREF (view->details->ui_container)); + g_assert (! BONOBO_EX (&ev)); + + view->details->control_frame = bonobo_control_frame_new + (BONOBO_OBJREF (view->details->ui_container)); - bonobo_control_frame_set_propbag ( - view->details->control_frame, - create_ambient_properties (view)); + bag = create_ambient_properties (view); + bonobo_control_frame_set_propbag (view->details->control_frame, bag); + bonobo_object_unref (bag); bonobo_control_frame_bind_to_control (view->details->control_frame, control, NULL); + bonobo_object_release_unref (control, NULL); /* Create a zoomable frame. */ zoomable = Bonobo_Unknown_queryInterface (view->details->view, "IDL:Bonobo/Zoomable:1.0", &ev); - if (ev._major == CORBA_NO_EXCEPTION + if (!BONOBO_EX (&ev) && !CORBA_Object_is_nil (zoomable, &ev) - && ev._major == CORBA_NO_EXCEPTION) { + && !BONOBO_EX (&ev)) { view->details->zoomable_frame = bonobo_zoomable_frame_new (); - bonobo_zoomable_frame_bind_to_zoomable ( - view->details->zoomable_frame, zoomable, NULL); + bonobo_zoomable_frame_bind_to_zoomable + (view->details->zoomable_frame, zoomable, NULL); bonobo_object_release_unref (zoomable, NULL); } @@ -810,11 +812,9 @@ nautilus_view_frame_load_location (NautilusViewFrame *view, view_frame_wait (view); - /* ORBit does a bad job with Nautilus_URI, so it's not const char *. */ CORBA_exception_init (&ev); - Nautilus_View_load_location (view->details->view, - (Nautilus_URI) location, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + Nautilus_View_load_location (view->details->view, location, &ev); + if (BONOBO_EX (&ev)) { view_frame_failed (view); } CORBA_exception_free (&ev); @@ -836,7 +836,7 @@ nautilus_view_frame_stop (NautilusViewFrame *view) if (view->details->view != CORBA_OBJECT_NIL) { CORBA_exception_init (&ev); Nautilus_View_stop_loading (view->details->view, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { view_frame_failed (view); } CORBA_exception_free (&ev); @@ -864,16 +864,17 @@ nautilus_view_frame_selection_changed (NautilusViewFrame *view, arg = bonobo_arg_new_from (TC_Nautilus_URIList, uri_list); CORBA_free (uri_list); - bonobo_event_source_notify_listeners ( - view->details->event_source, - "Bonobo/Property:change:selection", arg, &ev); + bonobo_event_source_notify_listeners + (view->details->event_source, + "Bonobo/Property:change:selection", arg, &ev); + + CORBA_free (arg); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { view_frame_failed (view); } + CORBA_exception_free (&ev); - - CORBA_free (arg); } void @@ -894,11 +895,11 @@ nautilus_view_frame_title_changed (NautilusViewFrame *view, arg._type = TC_CORBA_string; arg._value = &title; - bonobo_event_source_notify_listeners ( - view->details->event_source, - "Bonobo/Property:change:title", &arg, &ev); + bonobo_event_source_notify_listeners + (view->details->event_source, + "Bonobo/Property:change:title", &arg, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { view_frame_failed (view); } @@ -922,7 +923,7 @@ nautilus_view_frame_get_zoom_level (NautilusViewFrame *view) return 0.0; } - return (double) bonobo_zoomable_frame_get_zoom_level (view->details->zoomable_frame); + return bonobo_zoomable_frame_get_zoom_level (view->details->zoomable_frame); } void @@ -947,7 +948,7 @@ nautilus_view_frame_get_min_zoom_level (NautilusViewFrame *view) return 0.0; } - return (double) bonobo_zoomable_frame_get_min_zoom_level (view->details->zoomable_frame); + return bonobo_zoomable_frame_get_min_zoom_level (view->details->zoomable_frame); } double @@ -959,7 +960,7 @@ nautilus_view_frame_get_max_zoom_level (NautilusViewFrame *view) return 0.0; } - return (double) bonobo_zoomable_frame_get_max_zoom_level (view->details->zoomable_frame); + return bonobo_zoomable_frame_get_max_zoom_level (view->details->zoomable_frame); } gboolean @@ -1065,8 +1066,7 @@ nautilus_view_frame_open_location_in_this_window (NautilusViewFrame *view, } view_frame_wait_is_over (view); - g_signal_emit (view, - signals[OPEN_LOCATION_IN_THIS_WINDOW], 0, location); + g_signal_emit (view, signals[OPEN_LOCATION_IN_THIS_WINDOW], 0, location); } void @@ -1080,8 +1080,7 @@ nautilus_view_frame_open_location_prefer_existing_window (NautilusViewFrame *vie } view_frame_wait_is_over (view); - g_signal_emit (view, - signals[OPEN_LOCATION_PREFER_EXISTING_WINDOW], 0, location); + g_signal_emit (view, signals[OPEN_LOCATION_PREFER_EXISTING_WINDOW], 0, location); } void @@ -1097,8 +1096,8 @@ nautilus_view_frame_open_location_force_new_window (NautilusViewFrame *view, view_frame_wait_is_over (view); g_signal_emit (view, - signals[OPEN_LOCATION_FORCE_NEW_WINDOW], 0, - location, selection); + signals[OPEN_LOCATION_FORCE_NEW_WINDOW], 0, + location, selection); } void @@ -1118,8 +1117,8 @@ nautilus_view_frame_report_location_change (NautilusViewFrame *view, view_frame_wait_is_over (view); g_signal_emit (view, - signals[REPORT_LOCATION_CHANGE], 0, - location, selection, title); + signals[REPORT_LOCATION_CHANGE], 0, + location, selection, title); } void @@ -1140,8 +1139,8 @@ nautilus_view_frame_report_redirect (NautilusViewFrame *view, view_frame_wait_is_over (view); g_signal_emit (view, - signals[REPORT_REDIRECT], 0, - from_location, to_location, selection, title); + signals[REPORT_REDIRECT], 0, + from_location, to_location, selection, title); } void @@ -1171,7 +1170,7 @@ nautilus_view_frame_report_status (NautilusViewFrame *view, view_frame_wait_is_over (view); g_signal_emit (view, - signals[CHANGE_STATUS], 0, status); + signals[CHANGE_STATUS], 0, status); } void @@ -1194,7 +1193,7 @@ nautilus_view_frame_report_load_progress (NautilusViewFrame *view, view_frame_underway (view); g_signal_emit (view, - signals[LOAD_PROGRESS_CHANGED], 0); + signals[LOAD_PROGRESS_CHANGED], 0); } void @@ -1324,7 +1323,7 @@ send_history (NautilusViewFrame *view) } history = get_history_list (view); - if (history == NULL) { + if (history == CORBA_OBJECT_NIL) { return; } @@ -1334,16 +1333,17 @@ send_history (NautilusViewFrame *view) CORBA_free (history); - bonobo_event_source_notify_listeners ( - view->details->event_source, - "Bonobo/Property:change:history", arg, &ev); + bonobo_event_source_notify_listeners + (view->details->event_source, + "Bonobo/Property:change:history", arg, &ev); + + CORBA_free (arg); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { view_frame_failed (view); } + CORBA_exception_free (&ev); - - CORBA_free (arg); } gboolean diff --git a/src/nautilus-window-toolbars.c b/src/nautilus-window-toolbars.c index 9d4410cf5..5f22a25a4 100644 --- a/src/nautilus-window-toolbars.c +++ b/src/nautilus-window-toolbars.c @@ -392,14 +392,14 @@ create_back_or_forward_toolbar_item (NautilusWindow *window, _("Toolbar item orientation"), Bonobo_PROPERTY_WRITEABLE); bonobo_control_set_properties (wrapper, BONOBO_OBJREF (pb), NULL); - bonobo_object_unref (BONOBO_OBJECT (pb)); + bonobo_object_unref (pb); bonobo_ui_component_object_set (window->details->shell_ui, control_path, BONOBO_OBJREF (wrapper), NULL); - bonobo_object_unref (BONOBO_OBJECT (wrapper)); + bonobo_object_unref (wrapper); return item; } diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 65c74b0e8..d9437d00c 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -765,7 +765,7 @@ nautilus_window_constructed (NautilusWindow *window) BONOBO_OBJREF (location_bar_wrapper), NULL); bonobo_ui_component_thaw (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (location_bar_wrapper)); + bonobo_object_unref (location_bar_wrapper); /* initalize the menus and toolbars */ nautilus_window_initialize_menus_part_1 (window); @@ -934,7 +934,7 @@ nautilus_window_destroy (GtkObject *object) if (window->details->shell_ui != NULL) { bonobo_ui_component_unset_container (window->details->shell_ui, NULL); - bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui)); + bonobo_object_unref (window->details->shell_ui); } nautilus_file_unref (window->details->viewed_file); @@ -961,9 +961,7 @@ nautilus_window_destroy (GtkObject *object) g_source_remove (window->status_bar_clear_id); } - if (window->details->ui_container != NULL) { - bonobo_object_unref (BONOBO_OBJECT (window->details->ui_container)); - } + bonobo_object_unref (window->details->ui_container); if (window->details->location_change_at_idle_id != 0) { gtk_idle_remove (window->details->location_change_at_idle_id); |