diff options
author | Michael Meeks <michael@ximian.com> | 2002-01-18 15:10:35 +0000 |
---|---|---|
committer | Michael Meeks <michael@src.gnome.org> | 2002-01-18 15:10:35 +0000 |
commit | 1da01a652dfe0b962fda1dd5722797fdd032ce51 (patch) | |
tree | 3af43dce280855223bb226e3e1b7b0f5b28beb7b /src | |
parent | a3950d89866244dee068bee8778c15c453b561a0 (diff) | |
download | nautilus-1da01a652dfe0b962fda1dd5722797fdd032ce51.tar.gz |
don't set the background, it causes a strange segv later.
2002-01-18 Michael Meeks <michael@ximian.com>
* libnautilus-private/nautilus-directory-background.c
(image_loading_done_callback): don't set the background, it
causes a strange segv later.
* src/nautilus-window-toolbars.c
(set_widget_for_bonobo_control): fold into
(set_up_back_or_forward_toolbar_item): here.
(set_up_standard_bonobo_button): kill redundant
freeze / thaws.
(set_up_special_bonobo_button): don't do nasty
pixbuf roundtrips on a NULL icon_file_name
(get_pixbuf_for_xml_node): kill - somewhat inefficient.
(set_up_special_bonobo_button): set a straight pixbuf
on the button item for more speed, and kill bogus
in-proc freeze/thaw.
(set_up_back_or_forward_toolbar_item): rename to
(create_back_or_forward_toolbar_item): this to better
reflect function, aggregate a property bag.
(back_or_forward_tooblar_item_property_set_cb): impl.
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-main.h | 6 | ||||
-rw-r--r-- | src/nautilus-window-toolbars.c | 111 |
2 files changed, 57 insertions, 60 deletions
diff --git a/src/nautilus-main.h b/src/nautilus-main.h index 1e16b0e61..1a434f96e 100644 --- a/src/nautilus-main.h +++ b/src/nautilus-main.h @@ -29,9 +29,9 @@ #include <gtk/gtktypeutils.h> -void nautilus_main_event_loop_register (GtkObject* object); -gboolean nautilus_main_is_event_loop_mainstay (GtkObject* object); -void nautilus_main_event_loop_quit (void); +void nautilus_main_event_loop_register (GtkObject *object); +gboolean nautilus_main_is_event_loop_mainstay (GtkObject *object); +void nautilus_main_event_loop_quit (void); #endif /* NAUTILUS_MAIN_H */ diff --git a/src/nautilus-window-toolbars.c b/src/nautilus-window-toolbars.c index b6d271c1e..86329dd29 100644 --- a/src/nautilus-window-toolbars.c +++ b/src/nautilus-window-toolbars.c @@ -33,6 +33,7 @@ #include "nautilus-window-private.h" #include "nautilus-window.h" #include <bonobo/bonobo-control.h> +#include <bonobo/bonobo-property-bag.h> #include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-moniker-util.h> #include <bonobo/bonobo-ui-util.h> @@ -224,8 +225,6 @@ set_up_standard_bonobo_button (NautilusWindow *window, file_name = get_file_name_from_icon_name (icon_name, is_custom); - nautilus_window_ui_freeze (window); - /* set up the toolbar component with the new image */ bonobo_ui_component_set_prop (window->details->shell_ui, item_path, @@ -239,35 +238,16 @@ set_up_standard_bonobo_button (NautilusWindow *window, NULL); g_free (file_name); - - nautilus_window_ui_thaw (window); -} - -static GdkPixbuf * -get_pixbuf_for_xml_node (NautilusWindow *window, const char *node_path) -{ - BonoboUINode *node; - GdkPixbuf *pixbuf; - - node = bonobo_ui_component_get_tree (window->details->shell_ui, node_path, FALSE, NULL); -#if GNOME2_CONVERSION_COMPLETE - pixbuf = bonobo_ui_util_xml_get_icon_pixbuf (node, FALSE); -#else - pixbuf = NULL; -#endif - bonobo_ui_node_free (node); - - return pixbuf; } /* Use only for toolbar buttons that had to be explicitly created so they * could have behaviors not present in standard Bonobo toolbar buttons. */ static void -set_up_special_bonobo_button (NautilusWindow *window, +set_up_special_bonobo_button (NautilusWindow *window, BonoboUIToolbarButtonItem *item, - const char *control_path, - const char *icon_name) + const char *control_path, + const char *icon_name) { char *icon_file_name; GdkPixbuf *pixbuf; @@ -275,15 +255,13 @@ set_up_special_bonobo_button (NautilusWindow *window, icon_file_name = get_file_name_from_icon_name (icon_name, FALSE); if (icon_file_name == NULL) { - pixbuf = get_pixbuf_for_xml_node (window, control_path); - } else { - pixbuf = gdk_pixbuf_new_from_file (icon_file_name, NULL); - g_free (icon_file_name); + return; } - - nautilus_window_ui_freeze (window); - bonobo_ui_toolbar_button_item_set_image (item, gtk_image_new_from_pixbuf (pixbuf)); + pixbuf = gdk_pixbuf_new_from_file (icon_file_name, NULL); + g_free (icon_file_name); + + bonobo_ui_toolbar_button_item_set_image (item, pixbuf); g_object_unref (pixbuf); #if GNOME2_CONVERSION_COMPLETE @@ -299,8 +277,6 @@ set_up_special_bonobo_button (NautilusWindow *window, ? BONOBO_UI_TOOLBAR_ITEM_STYLE_ICON_AND_TEXT_VERTICAL : BONOBO_UI_TOOLBAR_ITEM_STYLE_ICON_ONLY); #endif - - nautilus_window_ui_thaw (window); } @@ -345,26 +321,32 @@ theme_changed_callback (gpointer callback_data) } static void -set_widget_for_bonobo_control (NautilusWindow *window, - GtkWidget *widget, - const char *control_path) +back_or_forward_toolbar_item_property_set_cb (BonoboPropertyBag *bag, + const BonoboArg *arg, + guint arg_id, + CORBA_Environment *ev, + gpointer user_data) { - BonoboControl *wrapper; - - wrapper = bonobo_control_new (widget); - bonobo_ui_component_object_set (window->details->shell_ui, - control_path, - bonobo_object_corba_objref (BONOBO_OBJECT (wrapper)), - NULL); - bonobo_object_unref (BONOBO_OBJECT (wrapper)); + BonoboControl *control; + BonoboUIToolbarItem *item; + BonoboUIToolbarItemStyle style; + + control = BONOBO_CONTROL (user_data); + item = BONOBO_UI_TOOLBAR_ITEM ( + bonobo_control_get_widget (control)); + style = BONOBO_ARG_GET_INT (arg); + + bonobo_ui_toolbar_item_set_style (item, style); } static BonoboUIToolbarButtonItem * -set_up_back_or_forward_toolbar_item (NautilusWindow *window, - const char *label, - const char *control_path) +create_back_or_forward_toolbar_item (NautilusWindow *window, + const char *label, + const char *control_path) { BonoboUIToolbarButtonItem *item; + BonoboPropertyBag *pb; + BonoboControl *wrapper; GtkButton *button; item = BONOBO_UI_TOOLBAR_BUTTON_ITEM @@ -373,18 +355,33 @@ set_up_back_or_forward_toolbar_item (NautilusWindow *window, button = bonobo_ui_toolbar_button_item_get_button_widget (item); g_signal_connect (button, - "button_press_event", - G_CALLBACK (back_or_forward_button_pressed_callback), - window); + "button_press_event", + G_CALLBACK (back_or_forward_button_pressed_callback), + window); g_signal_connect (button, - "clicked", - G_CALLBACK (back_or_forward_button_clicked_callback), - window); - set_widget_for_bonobo_control (window, GTK_WIDGET (item), control_path); + "clicked", + G_CALLBACK (back_or_forward_button_clicked_callback), + window); + + wrapper = bonobo_control_new (GTK_WIDGET (item)); + pb = bonobo_property_bag_new ( + NULL, back_or_forward_toolbar_item_property_set_cb, wrapper); + bonobo_property_bag_add (pb, "style", 0, + BONOBO_ARG_INT, NULL, + _("Toolbar item style"), + Bonobo_PROPERTY_WRITEABLE); + bonobo_control_set_properties (wrapper, BONOBO_OBJREF (pb), NULL); + bonobo_object_unref (BONOBO_OBJECT (pb)); + + bonobo_ui_component_object_set (window->details->shell_ui, + control_path, + BONOBO_OBJREF (wrapper), + NULL); + + bonobo_object_unref (BONOBO_OBJECT (wrapper)); return item; } - void nautilus_window_initialize_toolbars (NautilusWindow *window) @@ -424,9 +421,9 @@ nautilus_window_initialize_toolbars (NautilusWindow *window) &ev); CORBA_exception_free (&ev); - window->details->back_button_item = set_up_back_or_forward_toolbar_item + window->details->back_button_item = create_back_or_forward_toolbar_item (window, _("Back"), "/Toolbar/BackWrapper"); - window->details->forward_button_item = set_up_back_or_forward_toolbar_item + window->details->forward_button_item = create_back_or_forward_toolbar_item (window, _("Forward"), "/Toolbar/ForwardWrapper"); set_up_toolbar_images (window); |