From 6b5798037c6df519b12adb45ff919ea796856034 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 7 Mar 2002 14:02:19 +0000 Subject: impl. to cope with having a paned with no child2, without doing lots of 2002-03-07 Michael Meeks * libnautilus-private/nautilus-horizontal-splitter.c (nautilus_horizontal_splitter_size_allocate): impl. to cope with having a paned with no child2, without doing lots of bogus size re-allocation. (nautilus_horizontal_splitter_class_init): upd. (nautilus_horizontal_splitter_pack2): impl, since gtkpaned relies on the re-size to generate an expose to re-render it's splitter grabber thing.a * src/nautilus-sidebar.c (nautilus_sidebar_set_width): impl. moving all sidebar preferences here, (nautilus_sidebar_init): move auto value setup here from class_init to save possible re-enterancy issue. Request the size we want for the sidebar, the pane will under-allocate if neccessary. Set the old_width to the correct size so we don't re-render the paned lots as it swiches about. * src/nautilus-window.c (nautilus_window_constructed): reflow to simplify, call sidebar_set_width. (nautilus_window_set_content_view_widget): use nautilus_..._pack2 instead of gtk_paned to fix rendering. 2002-03-06 Michael Meeks * components/notes/nautilus-notes.c (make_notes_view): upd. * components/news/nautilus-news.c (rss_read_done_callback): parse the RTF, but don't spew warnings everywhere. (make_news_view): upd. * components/throbber/main.c (cb_create_throbber): impl. (throbber_object_destroyed, throbber_make_object): axe cut & paste. * libnautilus/nautilus-view-standard-main.c (nautilus_view_create_from_get_type_function): widen from NautilusView to BonoboObject, this code has a much wider application. (make_object): ditto. * components/hardware/nautilus-hardware-view.c (nautilus_hardware_view_get_nautilus_view): upd. * components/throbber/nautilus-throbber.c (nautilus_throbber_new): kill. * libnautilus/nautilus-view-standard-main.c (nautilus_view_standard_main_multi): use gdk_get_display. * libnautilus-private/nautilus-bonobo-extensions.c (nautilus_bonobo_activation_register_for_display): impl. * src/nautilus-application.c (nautilus_application_startup): use it. * src/nautilus-window-toolbars.c (location_change_at_idle_callback), (throbber_callback): move from nautilus-window.c (nautilus_window_allow_stop): move this here, prune redundant sets, simplify property bag extraction. * src/nautilus-window.c (nautilus_window_constructed): move throbber location changed code out of here. (nautilus_window_unrealize): no explicit removal from remote property bag neccessary & upd. * libnautilus-private/nautilus-metafile-factory.c (corba_open): reduce complexity. --- components/throbber/main.c | 87 +++++++-------------------------- components/throbber/nautilus-throbber.c | 11 ++--- components/throbber/nautilus-throbber.h | 27 +++++----- 3 files changed, 32 insertions(+), 93 deletions(-) (limited to 'components/throbber') diff --git a/components/throbber/main.c b/components/throbber/main.c index 49efd4eb7..b95b27def 100644 --- a/components/throbber/main.c +++ b/components/throbber/main.c @@ -26,87 +26,36 @@ #include "nautilus-throbber.h" #include -#include -#include -#include #include -#include +#include -static int object_count = 0; - -static void -throbber_object_destroyed (GtkObject *obj) -{ - object_count--; - if (object_count <= 0) { - gtk_main_quit (); - } -} +#define FACTORY_IID "OAFIID:nautilus_throbber_factory" +#define VIEW_IID "OAFIID:nautilus_throbber" static BonoboObject * -throbber_make_object (BonoboGenericFactory *factory, - const char *iid, - void *closure) +cb_create_throbber (const char *ignore0, void *ignore1) { - NautilusThrobber *throbber; - BonoboObject *bonobo_control; - - if (strcmp (iid, "OAFIID:nautilus_throbber")) { - return NULL; - } - - throbber = NAUTILUS_THROBBER (g_object_new (NAUTILUS_TYPE_THROBBER, NULL)); - - object_count++; - - bonobo_control = nautilus_throbber_get_control (throbber); - - g_signal_connect (bonobo_control, "destroy", G_CALLBACK (throbber_object_destroyed), NULL); - - return bonobo_control; + NautilusThrobber *throbber = + g_object_new (NAUTILUS_TYPE_THROBBER, NULL); + return nautilus_throbber_get_control (throbber); } int main (int argc, char *argv[]) { - BonoboGenericFactory *factory; - char *registration_id; - if (g_getenv ("NAUTILUS_DEBUG") != NULL) { eel_make_warnings_and_criticals_stop_in_debugger (); } - /* Initialize libraries. */ - gnome_program_init ("nautilus-throbber", - VERSION, - LIBGNOMEUI_MODULE, - argc, argv, - NULL); - - bonobo_ui_init ("nautilus-throbber", VERSION, &argc, argv); - - /* Disable session manager connection */ - g_object_set (G_OBJECT (gnome_program_get()), - GNOME_CLIENT_PARAM_SM_CONNECT, FALSE, NULL); - - nautilus_global_preferences_init (); - - registration_id = bonobo_activation_make_registration_id ("OAFIID:nautilus_throbber_factory", g_getenv ("DISPLAY")); - factory = bonobo_generic_factory_new ("OAFIID:nautilus_throbber_factory", - throbber_make_object, - NULL); - g_free (registration_id); - - if (factory != NULL) { - bonobo_activate (); - do { - gtk_main (); - } while (object_count > 0); - - bonobo_object_unref (factory); - } - - gnome_vfs_shutdown (); - - return EXIT_SUCCESS; + return nautilus_view_standard_main ("nautilus-throbber", + VERSION, + GETTEXT_PACKAGE, + GNOMELOCALEDIR, + argc, + argv, + FACTORY_IID, + VIEW_IID, + cb_create_throbber, + nautilus_global_preferences_init, + NULL); } diff --git a/components/throbber/nautilus-throbber.c b/components/throbber/nautilus-throbber.c index b0f860ea5..f149dc5b9 100644 --- a/components/throbber/nautilus-throbber.c +++ b/components/throbber/nautilus-throbber.c @@ -28,6 +28,7 @@ #include #include "nautilus-throbber.h" +#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -240,20 +242,13 @@ nautilus_throbber_instance_init (NautilusThrobber *throbber) nautilus_throbber_load_images (throbber); gtk_widget_show (widget); - + /* add a callback for when the theme changes */ eel_preferences_add_callback (NAUTILUS_PREFERENCES_THEME, nautilus_throbber_theme_changed, throbber); } -/* allocate a new throbber */ -GtkWidget * -nautilus_throbber_new (void) -{ - return gtk_widget_new (nautilus_throbber_get_type (), NULL); -} - /* handler for handling theme changes */ static void nautilus_throbber_theme_changed (gpointer user_data) diff --git a/components/throbber/nautilus-throbber.h b/components/throbber/nautilus-throbber.h index 3c8722a30..af7fec964 100644 --- a/components/throbber/nautilus-throbber.h +++ b/components/throbber/nautilus-throbber.h @@ -31,9 +31,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS #define NAUTILUS_TYPE_THROBBER (nautilus_throbber_get_type ()) #define NAUTILUS_THROBBER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_THROBBER, NautilusThrobber)) @@ -54,22 +52,19 @@ struct NautilusThrobberClass { GtkEventBoxClass parent_class; /* signals */ - void (* location_changed) (NautilusThrobber *throbber, - const char *location); + void (* location_changed) (NautilusThrobber *throbber, + const char *location); }; -GtkType nautilus_throbber_get_type (void); -GtkWidget * nautilus_throbber_new (void); +GtkType nautilus_throbber_get_type (void); +GtkWidget *nautilus_throbber_new (void); +BonoboObject *nautilus_throbber_get_control (NautilusThrobber *throbber); +void nautilus_throbber_start (NautilusThrobber *throbber); +void nautilus_throbber_stop (NautilusThrobber *throbber); +void nautilus_throbber_set_small_mode (NautilusThrobber *throbber, + gboolean new_mode); -BonoboObject* nautilus_throbber_get_control (NautilusThrobber *throbber); - -void nautilus_throbber_start (NautilusThrobber *throbber); -void nautilus_throbber_stop (NautilusThrobber *throbber); -void nautilus_throbber_set_small_mode (NautilusThrobber *throbber, gboolean new_mode); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* NAUTILUS_THROBBER_H */ -- cgit v1.2.1