Commit 36e8d6ca authored by Elliot Lee's avatar Elliot Lee

Update debugging messages. Allow synchronous state changes (needed to



* src/ntl-window-msgs.c, src/ntl-window-private.h: Update debugging messages. Allow
synchronous state changes (needed to avoid race conditions), and
don't reset the idle handler if the idle handler is already running.

* src/file-manager/fm-directory-view.c: Include
<libnautilus/libnautilus.h> rather than just
<libnautilus/nautilus-alloc.h> - nitpick in passing.

* src/ntl-uri-map.c: OK, don't check for NULL here, in an attempt to flush out bugs elsewhere.
Let me know of any problems that show up because of this.
parent 58a9b33c
2000-01-31 Elliot Lee <sopwith@redhat.com>
* src/ntl-window-msgs.c, src/ntl-window-private.h: Update debugging messages. Allow
synchronous state changes (needed to avoid race conditions), and
don't reset the idle handler if the idle handler is already running.
* src/file-manager/fm-directory-view.c: Include
<libnautilus/libnautilus.h> rather than just
<libnautilus/nautilus-alloc.h> - nitpick in passing.
* src/ntl-uri-map.c: OK, don't check for NULL here, in an attempt to flush out bugs elsewhere.
2000-01-31 Darin Adler <darin@eazel.com>
* nautilus-icons-view-icon-item.c:
......
......@@ -36,7 +36,7 @@
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus/nautilus-gtk-macros.h>
#include <libnautilus/nautilus-alloc.h>
#include <libnautilus/libnautilus.h>
#define DISPLAY_TIMEOUT_INTERVAL_MSECS 500
......
......@@ -257,7 +257,7 @@ nautilus_navinfo_new(Nautilus_NavigationRequestInfo *nri,
navinfo->navinfo.referring_content_type = old_navinfo->content_type;
}
navinfo->navinfo.requested_uri = g_strdup(nri->requested_uri?nri->requested_uri:"");
navinfo->navinfo.requested_uri = g_strdup(nri->requested_uri);
nautilus_navinfo_map(navinfo);
......
......@@ -905,7 +905,7 @@ nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
}
......
......@@ -905,7 +905,7 @@ nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
}
......
......@@ -905,7 +905,7 @@ nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
}
......
......@@ -492,6 +492,10 @@ nautilus_window_update_state(gpointer data)
if(window->making_changes)
{
#ifdef EXTREME_DEBUGGING
g_message("In the middle of making changes %d (action_tag %d) - RETURNING",
window->making_changes, window->action_tag);
#endif
return FALSE;
}
......@@ -499,7 +503,7 @@ nautilus_window_update_state(gpointer data)
window->making_changes++;
#ifdef EXTREME_DEBUGGING
g_message(">>> nautilus_window_update_state:");
g_message(">>> nautilus_window_update_state (action tag is %d):", window->action_tag);
g_print("made_changes %d, making_changes %d\n", window->made_changes, window->making_changes);
g_print("changes_pending %d, is_back %d, views_shown %d, view_bombed_out %d, view_activation_complete %d\n",
window->changes_pending, window->is_back, window->views_shown,
......@@ -694,12 +698,13 @@ nautilus_window_update_state(gpointer data)
else
window->action_tag = 0;
window->making_changes--;
#ifdef EXTREME_DEBUGGING
g_message("update_state done <<<");
g_message("update_state done (new action tag is %d, making_changes is %d) <<<", window->action_tag,
window->making_changes);
#endif
window->making_changes--;
return retval;
}
......@@ -709,6 +714,7 @@ nautilus_window_set_state_info(NautilusWindow *window, ...)
va_list args;
NautilusWindowStateItem item_type;
NautilusView *new_view;
gboolean do_sync = FALSE;
if(window->made_changes) /* Ensure that changes happen in-order */
{
......@@ -772,6 +778,7 @@ nautilus_window_set_state_info(NautilusWindow *window, ...)
g_message("CV_PROGRESS_INITIAL");
#endif
window->cv_progress_initial = TRUE;
window->cv_progress_done = window->cv_progress_error = FALSE;
window->changes_pending = TRUE;
break;
case CV_PROGRESS_ERROR: /* We have received a load error from the content view */
......@@ -792,14 +799,42 @@ nautilus_window_set_state_info(NautilusWindow *window, ...)
g_message("RESET_TO_IDLE");
#endif
break;
case SYNC_STATE:
do_sync = TRUE;
#ifdef EXTREME_DEBUGGING
g_message("SYNC_STATE");
#endif
break;
default:
break;
}
}
va_end(args);
if(!window->action_tag)
window->action_tag = g_idle_add_full(G_PRIORITY_LOW, nautilus_window_update_state, window, NULL);
window->made_changes++;
if(!window->making_changes)
{
if(do_sync)
{
if(window->action_tag)
{
g_message("Doing sync - action_tag was %d", window->action_tag);
g_source_remove(window->action_tag);
window->action_tag = 0;
}
if(nautilus_window_update_state(window))
do_sync = FALSE;
}
if(!window->action_tag && !do_sync)
{
window->action_tag = g_idle_add_full(G_PRIORITY_LOW, nautilus_window_update_state, window, NULL);
#ifdef EXTREME_DEBUGGING
g_message("Added callback to update_state - tag is %d", window->action_tag);
#endif
}
}
}
static void
......@@ -841,18 +876,18 @@ nautilus_window_change_location(NautilusWindow *window,
gboolean is_back,
gboolean is_reload)
{
nautilus_window_set_state_info(window, (NautilusWindowStateItem)RESET_TO_IDLE, (NautilusWindowStateItem)0);
nautilus_window_set_state_info(window, (NautilusWindowStateItem)RESET_TO_IDLE, (NautilusWindowStateItem)SYNC_STATE, (NautilusWindowStateItem)0);
while (gdk_events_pending())
gtk_main_iteration();
nautilus_window_allow_stop(window, TRUE);
nautilus_window_progress_indicate(window, PROGRESS_INITIAL, 0, _("Gathering information"));
window->is_back = is_back;
window->is_reload = is_reload;
window->new_requesting_view = requesting_view;
nautilus_window_allow_stop(window, TRUE);
window->cancel_tag =
nautilus_navinfo_new(loc, window->ni, nautilus_window_change_location_2, window);
}
......
......@@ -10,10 +10,11 @@ typedef enum {
CV_PROGRESS_DONE,
CV_PROGRESS_ERROR,
VIEW_ERROR,
RESET_TO_IDLE,
RESET_TO_IDLE, /* Not a real item - a command */
NAVINFO_RECEIVED,
NEW_CONTENT_VIEW_ACTIVATED,
NEW_META_VIEW_ACTIVATED
NEW_META_VIEW_ACTIVATED,
SYNC_STATE /* Not a real item - a flag */
} NautilusWindowStateItem;
void nautilus_window_set_state_info(NautilusWindow *window, ... /* things to set, plus optional params */);
......
......@@ -905,7 +905,7 @@ nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
}
......
......@@ -257,7 +257,7 @@ nautilus_navinfo_new(Nautilus_NavigationRequestInfo *nri,
navinfo->navinfo.referring_content_type = old_navinfo->content_type;
}
navinfo->navinfo.requested_uri = g_strdup(nri->requested_uri?nri->requested_uri:"");
navinfo->navinfo.requested_uri = g_strdup(nri->requested_uri);
nautilus_navinfo_map(navinfo);
......
......@@ -492,6 +492,10 @@ nautilus_window_update_state(gpointer data)
if(window->making_changes)
{
#ifdef EXTREME_DEBUGGING
g_message("In the middle of making changes %d (action_tag %d) - RETURNING",
window->making_changes, window->action_tag);
#endif
return FALSE;
}
......@@ -499,7 +503,7 @@ nautilus_window_update_state(gpointer data)
window->making_changes++;
#ifdef EXTREME_DEBUGGING
g_message(">>> nautilus_window_update_state:");
g_message(">>> nautilus_window_update_state (action tag is %d):", window->action_tag);
g_print("made_changes %d, making_changes %d\n", window->made_changes, window->making_changes);
g_print("changes_pending %d, is_back %d, views_shown %d, view_bombed_out %d, view_activation_complete %d\n",
window->changes_pending, window->is_back, window->views_shown,
......@@ -694,12 +698,13 @@ nautilus_window_update_state(gpointer data)
else
window->action_tag = 0;
window->making_changes--;
#ifdef EXTREME_DEBUGGING
g_message("update_state done <<<");
g_message("update_state done (new action tag is %d, making_changes is %d) <<<", window->action_tag,
window->making_changes);
#endif
window->making_changes--;
return retval;
}
......@@ -709,6 +714,7 @@ nautilus_window_set_state_info(NautilusWindow *window, ...)
va_list args;
NautilusWindowStateItem item_type;
NautilusView *new_view;
gboolean do_sync = FALSE;
if(window->made_changes) /* Ensure that changes happen in-order */
{
......@@ -772,6 +778,7 @@ nautilus_window_set_state_info(NautilusWindow *window, ...)
g_message("CV_PROGRESS_INITIAL");
#endif
window->cv_progress_initial = TRUE;
window->cv_progress_done = window->cv_progress_error = FALSE;
window->changes_pending = TRUE;
break;
case CV_PROGRESS_ERROR: /* We have received a load error from the content view */
......@@ -792,14 +799,42 @@ nautilus_window_set_state_info(NautilusWindow *window, ...)
g_message("RESET_TO_IDLE");
#endif
break;
case SYNC_STATE:
do_sync = TRUE;
#ifdef EXTREME_DEBUGGING
g_message("SYNC_STATE");
#endif
break;
default:
break;
}
}
va_end(args);
if(!window->action_tag)
window->action_tag = g_idle_add_full(G_PRIORITY_LOW, nautilus_window_update_state, window, NULL);
window->made_changes++;
if(!window->making_changes)
{
if(do_sync)
{
if(window->action_tag)
{
g_message("Doing sync - action_tag was %d", window->action_tag);
g_source_remove(window->action_tag);
window->action_tag = 0;
}
if(nautilus_window_update_state(window))
do_sync = FALSE;
}
if(!window->action_tag && !do_sync)
{
window->action_tag = g_idle_add_full(G_PRIORITY_LOW, nautilus_window_update_state, window, NULL);
#ifdef EXTREME_DEBUGGING
g_message("Added callback to update_state - tag is %d", window->action_tag);
#endif
}
}
}
static void
......@@ -841,18 +876,18 @@ nautilus_window_change_location(NautilusWindow *window,
gboolean is_back,
gboolean is_reload)
{
nautilus_window_set_state_info(window, (NautilusWindowStateItem)RESET_TO_IDLE, (NautilusWindowStateItem)0);
nautilus_window_set_state_info(window, (NautilusWindowStateItem)RESET_TO_IDLE, (NautilusWindowStateItem)SYNC_STATE, (NautilusWindowStateItem)0);
while (gdk_events_pending())
gtk_main_iteration();
nautilus_window_allow_stop(window, TRUE);
nautilus_window_progress_indicate(window, PROGRESS_INITIAL, 0, _("Gathering information"));
window->is_back = is_back;
window->is_reload = is_reload;
window->new_requesting_view = requesting_view;
nautilus_window_allow_stop(window, TRUE);
window->cancel_tag =
nautilus_navinfo_new(loc, window->ni, nautilus_window_change_location_2, window);
}
......
......@@ -10,10 +10,11 @@ typedef enum {
CV_PROGRESS_DONE,
CV_PROGRESS_ERROR,
VIEW_ERROR,
RESET_TO_IDLE,
RESET_TO_IDLE, /* Not a real item - a command */
NAVINFO_RECEIVED,
NEW_CONTENT_VIEW_ACTIVATED,
NEW_META_VIEW_ACTIVATED
NEW_META_VIEW_ACTIVATED,
SYNC_STATE /* Not a real item - a flag */
} NautilusWindowStateItem;
void nautilus_window_set_state_info(NautilusWindow *window, ... /* things to set, plus optional params */);
......
......@@ -905,7 +905,7 @@ nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
gtk_widget_set_sensitive(toolbar_info[7].widget, allow);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment