mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
activate the throbber in case we didn't earlier.
2002-05-13 Michael Meeks <michael@ximian.com> * src/nautilus-window.c (nautilus_window_show_toolbar): activate the throbber in case we didn't earlier. * src/nautilus-window-toolbars.c (nautilus_window_activate_throbber): split out of (nautilus_window_initialize_toolbars): here, only activate the throbber if we are starting with a toolbar. * src/nautilus-window.c: (nautilus_window_show_toolbar, nautilus_window_hide_toolbar): move into nautilus-window-toolbars. * libnautilus/nautilus-view-standard-main.c (object_destroyed): upd. comment. (make_object): prune bogus comment. (nautilus_view_instrument_for_failure): impl. (object_destroyed): only do 1 destroy ever, rename (view_object_destroy): to this. (make_object): upd. (nautilus_view_never_got_frame_timeout), (nautilus_view_set_frame_callback), (nautilus_view_cnx_broken_callback): impl.
This commit is contained in:
parent
878ff2caa6
commit
03a2dbc312
8 changed files with 171 additions and 20 deletions
26
ChangeLog
26
ChangeLog
|
@ -1,3 +1,29 @@
|
|||
2002-05-13 Michael Meeks <michael@ximian.com>
|
||||
|
||||
* src/nautilus-window.c (nautilus_window_show_toolbar):
|
||||
activate the throbber in case we didn't earlier.
|
||||
|
||||
* src/nautilus-window-toolbars.c
|
||||
(nautilus_window_activate_throbber): split out of
|
||||
(nautilus_window_initialize_toolbars): here,
|
||||
only activate the throbber if we are starting
|
||||
with a toolbar.
|
||||
|
||||
* src/nautilus-window.c:
|
||||
(nautilus_window_show_toolbar, nautilus_window_hide_toolbar): move
|
||||
into nautilus-window-toolbars.
|
||||
|
||||
* libnautilus/nautilus-view-standard-main.c
|
||||
(object_destroyed): upd. comment.
|
||||
(make_object): prune bogus comment.
|
||||
(nautilus_view_instrument_for_failure): impl.
|
||||
(object_destroyed): only do 1 destroy ever, rename
|
||||
(view_object_destroy): to this.
|
||||
(make_object): upd.
|
||||
(nautilus_view_never_got_frame_timeout),
|
||||
(nautilus_view_set_frame_callback),
|
||||
(nautilus_view_cnx_broken_callback): impl.
|
||||
|
||||
2002-05-12 Dave Camp <dave@ximian.com>
|
||||
|
||||
* libnautilus-private/nautilus-global-preferences.c:
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <bonobo/bonobo-generic-factory.h>
|
||||
#include <bonobo/bonobo-main.h>
|
||||
#include <bonobo/bonobo-control.h>
|
||||
#include <bonobo/bonobo-ui-main.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
|
@ -68,28 +69,128 @@ delayed_quit_timeout_callback (gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
object_destroyed (GObject *object,
|
||||
CallbackData *callback_data)
|
||||
view_object_destroy (GObject *object,
|
||||
CallbackData *callback_data)
|
||||
{
|
||||
g_assert (G_IS_OBJECT (object));
|
||||
|
||||
callback_data->object_count--;
|
||||
if (!g_object_get_data (object, "standard_main_destroy_accounted")) {
|
||||
g_object_set_data (object, "standard_main_destroy_accounted",
|
||||
GUINT_TO_POINTER (TRUE));
|
||||
|
||||
if (callback_data->object_count <= 0 &&
|
||||
callback_data->delayed_quit_timeout_id == 0) {
|
||||
callback_data->delayed_quit_timeout_id =
|
||||
g_timeout_add (N_IDLE_SECONDS_BEFORE_QUIT * 1000,
|
||||
delayed_quit_timeout_callback,
|
||||
callback_data);
|
||||
callback_data->object_count--;
|
||||
|
||||
if (callback_data->object_count <= 0 &&
|
||||
callback_data->delayed_quit_timeout_id == 0) {
|
||||
/* Connect a handler that will get us out of the
|
||||
* main loop when there are no more objects outstanding.
|
||||
*/
|
||||
callback_data->delayed_quit_timeout_id =
|
||||
g_timeout_add (N_IDLE_SECONDS_BEFORE_QUIT * 1000,
|
||||
delayed_quit_timeout_callback,
|
||||
callback_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Time we're prepared to wait without a ControlFrame
|
||||
* before terminating the Control. This can happen if the
|
||||
* container activates us but crashes before the set_frame.
|
||||
*
|
||||
* NB. if we don't get a frame in 30 seconds, something
|
||||
* is badly wrong, or Gnome performance needs improving
|
||||
* markedly !
|
||||
*/
|
||||
#define NAUTILUS_VIEW_NEVER_GOT_FRAME_TIMEOUT (30 * 1000)
|
||||
#define CALLBACK_DATA_KEY "standard_main_callback_data_key"
|
||||
|
||||
static void
|
||||
nautilus_view_cnx_broken_callback (GObject *control)
|
||||
{
|
||||
view_object_destroy (control,
|
||||
g_object_get_data (G_OBJECT (control),
|
||||
CALLBACK_DATA_KEY));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
nautilus_view_never_got_frame_timeout (gpointer user_data)
|
||||
{
|
||||
g_warning ("Never got frame, container died - abnormal exit condition");
|
||||
|
||||
nautilus_view_cnx_broken_callback (user_data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_set_frame_callback (BonoboControl *control,
|
||||
gpointer user_data)
|
||||
{
|
||||
Bonobo_ControlFrame remote_frame;
|
||||
|
||||
remote_frame = bonobo_control_get_control_frame (control, NULL);
|
||||
|
||||
if (remote_frame != CORBA_OBJECT_NIL) {
|
||||
ORBitConnectionStatus status;
|
||||
|
||||
g_source_remove (GPOINTER_TO_UINT (user_data));
|
||||
|
||||
status = ORBit_small_get_connection_status (remote_frame);
|
||||
|
||||
/* Only track out of proc controls */
|
||||
if (status != ORBIT_CONNECTION_IN_PROC) {
|
||||
g_signal_connect_closure (
|
||||
ORBit_small_get_connection (remote_frame),
|
||||
"broken",
|
||||
g_cclosure_new_object_swap (
|
||||
G_CALLBACK (nautilus_view_cnx_broken_callback),
|
||||
G_OBJECT (control)),
|
||||
FALSE);
|
||||
g_signal_connect (
|
||||
control, "destroy",
|
||||
G_CALLBACK (nautilus_view_cnx_broken_callback),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This code is somewhat duplicated in gnome-panel/libpanel-applet
|
||||
* and is ripe for abstracting in an intermediate library.
|
||||
*/
|
||||
static void
|
||||
nautilus_view_instrument_for_failure (BonoboObject *control,
|
||||
CallbackData *callback_data)
|
||||
{
|
||||
guint no_frame_timeout_id;
|
||||
|
||||
g_object_set_data (G_OBJECT (control),
|
||||
CALLBACK_DATA_KEY, callback_data);
|
||||
|
||||
no_frame_timeout_id = g_timeout_add (
|
||||
NAUTILUS_VIEW_NEVER_GOT_FRAME_TIMEOUT,
|
||||
nautilus_view_never_got_frame_timeout,
|
||||
control);
|
||||
g_signal_connect_closure (
|
||||
control, "destroy",
|
||||
g_cclosure_new_swap (
|
||||
G_CALLBACK (g_source_remove_by_user_data),
|
||||
control, NULL),
|
||||
0);
|
||||
g_signal_connect (
|
||||
control, "set_frame",
|
||||
G_CALLBACK (nautilus_view_set_frame_callback),
|
||||
GUINT_TO_POINTER (no_frame_timeout_id));
|
||||
}
|
||||
|
||||
static BonoboObject *
|
||||
make_object (BonoboGenericFactory *factory,
|
||||
const char *iid,
|
||||
gpointer data)
|
||||
{
|
||||
BonoboObject *view;
|
||||
BonoboObject *control;
|
||||
CallbackData *callback_data;
|
||||
|
||||
callback_data = (CallbackData *) data;
|
||||
|
@ -98,10 +199,7 @@ make_object (BonoboGenericFactory *factory,
|
|||
g_assert (iid != NULL);
|
||||
g_assert (callback_data != NULL);
|
||||
|
||||
/* Check that this is one of the types of object we know how to
|
||||
* create.
|
||||
*/
|
||||
|
||||
/* Check that this is one of the types of object we know how to create. */
|
||||
if (g_list_find_custom (callback_data->view_iids,
|
||||
(gpointer) iid, (GCompareFunc) strcmp) == NULL) {
|
||||
return NULL;
|
||||
|
@ -109,18 +207,21 @@ make_object (BonoboGenericFactory *factory,
|
|||
|
||||
view = callback_data->create_function (iid, callback_data->user_data);
|
||||
|
||||
/* Connect a handler that will get us out of the main loop
|
||||
* when there are no more objects outstanding.
|
||||
*/
|
||||
callback_data->object_count++;
|
||||
if (callback_data->delayed_quit_timeout_id != 0) {
|
||||
g_source_remove (callback_data->delayed_quit_timeout_id);
|
||||
callback_data->delayed_quit_timeout_id = 0;
|
||||
}
|
||||
g_signal_connect (view, "destroy",
|
||||
G_CALLBACK (object_destroyed),
|
||||
G_CALLBACK (view_object_destroy),
|
||||
callback_data);
|
||||
|
||||
/* We can do some more agressive tracking of controls */
|
||||
if ((control = bonobo_object_query_local_interface
|
||||
(view, "IDL:Bonobo/Control:1.0"))) {
|
||||
nautilus_view_instrument_for_failure (control, callback_data);
|
||||
}
|
||||
|
||||
return BONOBO_OBJECT (view);
|
||||
}
|
||||
|
||||
|
@ -227,7 +328,8 @@ nautilus_view_standard_main_multi (const char *executable_name,
|
|||
bonobo_activate ();
|
||||
do {
|
||||
gtk_main ();
|
||||
} while (callback_data.object_count > 0 || callback_data.delayed_quit_timeout_id != 0);
|
||||
} while (callback_data.object_count > 0 ||
|
||||
callback_data.delayed_quit_timeout_id != 0);
|
||||
bonobo_object_unref (factory);
|
||||
}
|
||||
|
||||
|
|
|
@ -1892,6 +1892,7 @@ nautilus_window_hide_toolbar (NautilusWindow *window)
|
|||
void
|
||||
nautilus_window_show_toolbar (NautilusWindow *window)
|
||||
{
|
||||
nautilus_window_activate_throbber (window);
|
||||
show_dock_item (window, TOOLBAR_PATH);
|
||||
}
|
||||
|
||||
|
|
|
@ -1892,6 +1892,7 @@ nautilus_window_hide_toolbar (NautilusWindow *window)
|
|||
void
|
||||
nautilus_window_show_toolbar (NautilusWindow *window)
|
||||
{
|
||||
nautilus_window_activate_throbber (window);
|
||||
show_dock_item (window, TOOLBAR_PATH);
|
||||
}
|
||||
|
||||
|
|
|
@ -1892,6 +1892,7 @@ nautilus_window_hide_toolbar (NautilusWindow *window)
|
|||
void
|
||||
nautilus_window_show_toolbar (NautilusWindow *window)
|
||||
{
|
||||
nautilus_window_activate_throbber (window);
|
||||
show_dock_item (window, TOOLBAR_PATH);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ struct NautilusWindowDetails
|
|||
|
||||
/* Throbber. */
|
||||
gboolean throbber_active;
|
||||
gboolean throbber_activating;
|
||||
Bonobo_PropertyBag throbber_property_bag;
|
||||
Bonobo_Listener throbber_listener;
|
||||
|
||||
|
@ -133,6 +134,7 @@ void nautilus_window_synch_view_as_menus (Nautil
|
|||
void nautilus_window_initialize_menus_part_1 (NautilusWindow *window);
|
||||
void nautilus_window_initialize_menus_part_2 (NautilusWindow *window);
|
||||
void nautilus_window_initialize_toolbars (NautilusWindow *window);
|
||||
void nautilus_window_activate_throbber (NautilusWindow *window);
|
||||
void nautilus_window_handle_ui_event_callback (BonoboUIComponent *ui,
|
||||
const char *id,
|
||||
Bonobo_UIComponent_EventType type,
|
||||
|
|
|
@ -478,6 +478,8 @@ throbber_created_callback (Bonobo_Unknown throbber,
|
|||
|
||||
window = NAUTILUS_WINDOW (user_data);
|
||||
|
||||
window->details->throbber_activating = FALSE;
|
||||
|
||||
bonobo_ui_component_object_set (window->details->shell_ui,
|
||||
"/Toolbar/ThrobberWrapper",
|
||||
throbber, ev);
|
||||
|
@ -531,13 +533,17 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
|
|||
nautilus_window_ui_thaw (window);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nautilus_window_initialize_toolbars (NautilusWindow *window)
|
||||
nautilus_window_activate_throbber (NautilusWindow *window)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
char *exception_as_text;
|
||||
|
||||
nautilus_window_ui_freeze (window);
|
||||
if (window->details->throbber_activating ||
|
||||
window->details->throbber_property_bag != CORBA_OBJECT_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* FIXME bugzilla.gnome.org 41243:
|
||||
* We should use inheritance instead of these special cases
|
||||
|
@ -559,6 +565,17 @@ nautilus_window_initialize_toolbars (NautilusWindow *window)
|
|||
g_free (exception_as_text);
|
||||
}
|
||||
CORBA_exception_free (&ev);
|
||||
window->details->throbber_activating = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_initialize_toolbars (NautilusWindow *window)
|
||||
{
|
||||
nautilus_window_ui_freeze (window);
|
||||
|
||||
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
|
||||
nautilus_window_activate_throbber (window);
|
||||
}
|
||||
|
||||
window->details->back_button_item = create_back_or_forward_toolbar_item
|
||||
|
|
|
@ -1892,6 +1892,7 @@ nautilus_window_hide_toolbar (NautilusWindow *window)
|
|||
void
|
||||
nautilus_window_show_toolbar (NautilusWindow *window)
|
||||
{
|
||||
nautilus_window_activate_throbber (window);
|
||||
show_dock_item (window, TOOLBAR_PATH);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue