Commit e7df9b4e authored by Elliot Lee's avatar Elliot Lee
Browse files

Async notification of navinfo - now we just need an async get_file_info



* src/ntl-uri-map.c: Async notification of navinfo - now we just need an async get_file_info call.
* src/ntl-view.[ch]: Better error handling.
* src/file-manager/fm-directory-view.c (display_selection_info): Send a 'selection change' request.
* src/ntl-window-msgs.c: Totally rewrite the state changing machine. Now handles errors slightly
  better.
* src/ntl-types.h: Remove requesting_view from the navigation info.
* src/ntl-window.h: Move all the state machine stuff into NautilusWindow itself.
* src/ntl-window.c: Update for new 'stop doing stuff' API.
parent f804c9ac
2000-01-20 Elliot Lee <sopwith@redhat.com>
* src/ntl-uri-map.c: Async notification of navinfo - now we just need an async get_file_info call.
* src/ntl-view.[ch]: Better error handling.
* src/file-manager/fm-directory-view.c (display_selection_info): Send a 'selection change' request.
2000-01-19 Elliot Lee <sopwith@redhat.com>
* src/ntl-window-msgs.c: Totally rewrite the state changing machine. Now handles things slightly better.
* src/ntl-types.h: Remove requesting_view from the navigation info.
* src/ntl-window.h: Move all the state machine stuff into NautilusWindow itself.
* src/ntl-window.c: Update for new 'stop doing stuff' API.
2000-01-20 Darin Adler <darin@eazel.com>
Store icon positions as "x,y" in ICON_POSITION instead of
......
......@@ -285,8 +285,6 @@ nautilus_background_set_widget_style (NautilusBackground *background,
g_return_if_fail (GTK_IS_WIDGET (widget));
style = gtk_widget_get_style (widget);
g_return_if_fail(style->klass == nautilus_gtk_style_get_default_class ()
|| style->klass == nautilus_background_get_gtk_style_class ());
/* Make a copy of the style. */
style = gtk_style_copy (style);
......
......@@ -285,8 +285,6 @@ nautilus_background_set_widget_style (NautilusBackground *background,
g_return_if_fail (GTK_IS_WIDGET (widget));
style = gtk_widget_get_style (widget);
g_return_if_fail(style->klass == nautilus_gtk_style_get_default_class ()
|| style->klass == nautilus_background_get_gtk_style_class ());
/* Make a copy of the style. */
style = gtk_style_copy (style);
......
......@@ -285,8 +285,6 @@ nautilus_background_set_widget_style (NautilusBackground *background,
g_return_if_fail (GTK_IS_WIDGET (widget));
style = gtk_widget_get_style (widget);
g_return_if_fail(style->klass == nautilus_gtk_style_get_default_class ()
|| style->klass == nautilus_background_get_gtk_style_class ());
/* Make a copy of the style. */
style = gtk_style_copy (style);
......
......@@ -28,15 +28,8 @@
#include "explorer-location-bar.h"
#include <gtk/gtklabel.h>
#include <gtk/gtkentry.h>
#include <gtk/gtkeventbox.h>
#include <gtk/gtkdnd.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-mime.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-uidefs.h>
#include <gnome.h>
#include <string.h>
#define EXPLORER_DND_URI_LIST_TYPE "text/uri-list"
#define EXPLORER_DND_TEXT_PLAIN_TYPE "text/plain"
......
......@@ -38,6 +38,11 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus/nautilus-gtk-macros.h>
#ifndef g_alloca
#include <alloca.h>
#define g_alloca alloca
#endif
#define DISPLAY_TIMEOUT_INTERVAL 500
#define ENTRIES_PER_CB 1
......@@ -219,7 +224,7 @@ fm_directory_view_destroy (GtkObject *object)
/**
* display_selection_info:
*
* Display textual information about the current selection.
* Display information about the current selection, and notify the view frame of the changed selection.
* @view: FMDirectoryView for which to display selection info.
*
**/
......@@ -232,6 +237,7 @@ display_selection_info (FMDirectoryView *view)
NautilusFileList *p;
char *first_item_name;
Nautilus_StatusRequestInfo sri;
Nautilus_SelectionRequestInfo selri;
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
......@@ -240,16 +246,20 @@ display_selection_info (FMDirectoryView *view)
count = 0;
size = 0;
first_item_name = NULL;
memset(&selri, 0, sizeof(selri));
selri.selected_uris._buffer = g_alloca(g_list_length(selection) * sizeof(char *));
for (p = selection; p != NULL; p = p->next) {
NautilusFile *file;
char *fn;
file = p->data;
count++;
size += nautilus_file_get_info (file)->size;
fn = nautilus_file_get_name (file);
if (first_item_name == NULL)
first_item_name = nautilus_file_get_name (file);
first_item_name = fn;
selri.selected_uris._buffer[selri.selected_uris._length++] = fn;
}
g_list_free (selection);
memset(&sri, 0, sizeof(sri));
......@@ -284,6 +294,8 @@ display_selection_info (FMDirectoryView *view)
nautilus_view_frame_request_status_change
(NAUTILUS_VIEW_FRAME (view->details->view_frame), &sri);
nautilus_view_frame_request_selection_change
(NAUTILUS_VIEW_FRAME (view->details->view_frame), &selri);
}
......
......@@ -156,6 +156,17 @@ navinfo_load_mappings(char *dir)
g_free(dir);
}
static gboolean
my_notify_when_ready(gpointer data)
{
NautilusNavigationInfo *navi = data;
navi->notify_tag = 0;
navi->notify_ready(navi, navi->data);
return FALSE;
}
void
nautilus_navinfo_init(void)
{
......@@ -228,7 +239,6 @@ nautilus_navinfo_append_globals(gpointer value, gpointer data)
guint
nautilus_navinfo_new(Nautilus_NavigationRequestInfo *nri,
Nautilus_NavigationInfo *old_navinfo,
NautilusView *requesting_view,
NautilusNavigationInfoFunc notify_when_ready,
gpointer notify_data)
{
......@@ -247,8 +257,6 @@ nautilus_navinfo_new(Nautilus_NavigationRequestInfo *nri,
navinfo->navinfo.referring_content_type = old_navinfo->content_type;
}
navinfo->requesting_view = requesting_view;
navinfo->navinfo.requested_uri = g_strdup(nri->requested_uri);
nautilus_navinfo_map(navinfo);
......@@ -337,23 +345,17 @@ nautilus_navinfo_new(Nautilus_NavigationRequestInfo *nri,
g_slist_foreach(nautilus_prefs.global_meta_views, nautilus_navinfo_append_globals, &navinfo->meta_iids);
if(notify_when_ready)
{
navinfo->notify_tag = 0;
notify_when_ready(navinfo, notify_data);
}
navinfo->notify_tag = g_idle_add(my_notify_when_ready, navinfo);
out:
return 0;
return navinfo?navinfo->notify_tag:0;
}
void
nautilus_navinfo_free(NautilusNavigationInfo *navinfo)
{
if(navinfo->notify_tag)
{
/* XXX remove_notification */
}
g_source_remove(navinfo->notify_tag);
g_slist_foreach(navinfo->content_identifiers, (GFunc)nautilus_view_identifier_free, NULL);
g_slist_free(navinfo->content_identifiers);
......
......@@ -33,7 +33,6 @@
void nautilus_navinfo_init(void);
guint nautilus_navinfo_new(Nautilus_NavigationRequestInfo *nri,
Nautilus_NavigationInfo *old_navinfo,
NautilusView *requesting_view,
NautilusNavigationInfoFunc notify_when_ready,
gpointer notify_data);
void nautilus_navinfo_free(NautilusNavigationInfo *navinfo);
......
......@@ -825,7 +825,7 @@ static void nautilus_window_show_color_picker (GtkWidget *btn, NautilusWindow *w
static void
nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
{
nautilus_window_end_location_change(window);
nautilus_window_set_state_info(window, RESET_TO_IDLE, 0);
}
......
......@@ -49,36 +49,54 @@ typedef struct {
guint window_signals[0];
} NautilusWindowClass;
typedef struct _NautilusWindowLoadInfo NautilusWindowLoadInfo;
typedef struct _NautilusContentViewLoadInfo NautilusContentViewLoadInfo;
typedef struct _NautilusWindowStateInfo NautilusWindowStateInfo;
struct _NautilusWindow {
GnomeApp parent_object;
/* Views stuff */
NautilusView *content_view;
GSList *meta_views;
/* UI stuff */
/** UI stuff **/
NautilusIndexPanel *index_panel;
GtkWidget *content_hbox, *btn_back, *btn_fwd;
GtkWidget *option_cvtype, *ent_uri;
guint statusbar_ctx, statusbar_clear_id;
/* History stuff */
GSList *uris_prev, *uris_next;
/* CORBA stuff */
/** CORBA-related elements **/
GnomeObject *ntl_viewwindow;
GnomeUIHandler *uih;
/** State information **/
/* Information about current location/selection */
Nautilus_NavigationInfo *ni;
Nautilus_SelectionInfo *si;
/* History stuff */
GSList *uris_prev, *uris_next;
/* Current views stuff */
NautilusView *content_view;
GSList *meta_views;
NautilusWindowLoadInfo *load_info;
NautilusContentViewLoadInfo *content_view_info;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
NautilusView *new_content_view, *new_requesting_view;
GSList *new_meta_views, *error_views;
enum { NW_LOADING_INFO, NW_LOADING_VIEWS, NW_IDLE } state;
guint cancel_tag;
guint action_tag;
guint16 made_changes, making_changes;
gboolean changes_pending : 1;
gboolean is_back : 1;
gboolean views_shown : 1;
gboolean view_bombed_out : 1;
gboolean view_activation_complete : 1;
gboolean cv_progress_initial : 1;
gboolean cv_progress_done : 1;
gboolean cv_progress_error : 1;
gboolean reset_to_idle : 1;
};
GtkType nautilus_window_get_type(void);
......
......@@ -825,7 +825,7 @@ static void nautilus_window_show_color_picker (GtkWidget *btn, NautilusWindow *w
static void
nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
{
nautilus_window_end_location_change(window);
nautilus_window_set_state_info(window, RESET_TO_IDLE, 0);
}
......
......@@ -49,36 +49,54 @@ typedef struct {
guint window_signals[0];
} NautilusWindowClass;
typedef struct _NautilusWindowLoadInfo NautilusWindowLoadInfo;
typedef struct _NautilusContentViewLoadInfo NautilusContentViewLoadInfo;
typedef struct _NautilusWindowStateInfo NautilusWindowStateInfo;
struct _NautilusWindow {
GnomeApp parent_object;
/* Views stuff */
NautilusView *content_view;
GSList *meta_views;
/* UI stuff */
/** UI stuff **/
NautilusIndexPanel *index_panel;
GtkWidget *content_hbox, *btn_back, *btn_fwd;
GtkWidget *option_cvtype, *ent_uri;
guint statusbar_ctx, statusbar_clear_id;
/* History stuff */
GSList *uris_prev, *uris_next;
/* CORBA stuff */
/** CORBA-related elements **/
GnomeObject *ntl_viewwindow;
GnomeUIHandler *uih;
/** State information **/
/* Information about current location/selection */
Nautilus_NavigationInfo *ni;
Nautilus_SelectionInfo *si;
/* History stuff */
GSList *uris_prev, *uris_next;
/* Current views stuff */
NautilusView *content_view;
GSList *meta_views;
NautilusWindowLoadInfo *load_info;
NautilusContentViewLoadInfo *content_view_info;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
NautilusView *new_content_view, *new_requesting_view;
GSList *new_meta_views, *error_views;
enum { NW_LOADING_INFO, NW_LOADING_VIEWS, NW_IDLE } state;
guint cancel_tag;
guint action_tag;
guint16 made_changes, making_changes;
gboolean changes_pending : 1;
gboolean is_back : 1;
gboolean views_shown : 1;
gboolean view_bombed_out : 1;
gboolean view_activation_complete : 1;
gboolean cv_progress_initial : 1;
gboolean cv_progress_done : 1;
gboolean cv_progress_error : 1;
gboolean reset_to_idle : 1;
};
GtkType nautilus_window_get_type(void);
......
......@@ -825,7 +825,7 @@ static void nautilus_window_show_color_picker (GtkWidget *btn, NautilusWindow *w
static void
nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
{
nautilus_window_end_location_change(window);
nautilus_window_set_state_info(window, RESET_TO_IDLE, 0);
}
......
......@@ -49,36 +49,54 @@ typedef struct {
guint window_signals[0];
} NautilusWindowClass;
typedef struct _NautilusWindowLoadInfo NautilusWindowLoadInfo;
typedef struct _NautilusContentViewLoadInfo NautilusContentViewLoadInfo;
typedef struct _NautilusWindowStateInfo NautilusWindowStateInfo;
struct _NautilusWindow {
GnomeApp parent_object;
/* Views stuff */
NautilusView *content_view;
GSList *meta_views;
/* UI stuff */
/** UI stuff **/
NautilusIndexPanel *index_panel;
GtkWidget *content_hbox, *btn_back, *btn_fwd;
GtkWidget *option_cvtype, *ent_uri;
guint statusbar_ctx, statusbar_clear_id;
/* History stuff */
GSList *uris_prev, *uris_next;
/* CORBA stuff */
/** CORBA-related elements **/
GnomeObject *ntl_viewwindow;
GnomeUIHandler *uih;
/** State information **/
/* Information about current location/selection */
Nautilus_NavigationInfo *ni;
Nautilus_SelectionInfo *si;
/* History stuff */
GSList *uris_prev, *uris_next;
/* Current views stuff */
NautilusView *content_view;
GSList *meta_views;
NautilusWindowLoadInfo *load_info;
NautilusContentViewLoadInfo *content_view_info;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
NautilusView *new_content_view, *new_requesting_view;
GSList *new_meta_views, *error_views;
enum { NW_LOADING_INFO, NW_LOADING_VIEWS, NW_IDLE } state;
guint cancel_tag;
guint action_tag;
guint16 made_changes, making_changes;
gboolean changes_pending : 1;
gboolean is_back : 1;
gboolean views_shown : 1;
gboolean view_bombed_out : 1;
gboolean view_activation_complete : 1;
gboolean cv_progress_initial : 1;
gboolean cv_progress_done : 1;
gboolean cv_progress_error : 1;
gboolean reset_to_idle : 1;
};
GtkType nautilus_window_get_type(void);
......
......@@ -243,8 +243,13 @@ nautilus_view_destroy(GtkObject *view)
NautilusViewClass *klass = NAUTILUS_VIEW_CLASS(view->klass);
NautilusView *nview = NAUTILUS_VIEW(view);
g_message("-------------------- nautilus_view_destroy(%p): %u", view, nview->timer_id);
if(nview->timer_id)
g_source_remove(nview->timer_id);
{
g_source_remove(nview->timer_id);
nview->timer_id = 0;
}
nautilus_view_destroy_client(nview);
......@@ -414,6 +419,7 @@ nautilus_view_notify_location_change(NautilusView *view,
g_return_if_fail(view);
g_return_if_fail(view->component_class);
g_return_if_fail(NAUTILUS_VIEW(view));
real_nav_ctx = *nav_context;
g_assert(real_nav_ctx.requested_uri);
......@@ -439,6 +445,7 @@ nautilus_view_notify_selection_change(NautilusView *view,
g_return_if_fail(view);
g_return_if_fail(view->component_class);
g_return_if_fail(NAUTILUS_VIEW(view));
CORBA_exception_init(&ev);
......@@ -455,6 +462,7 @@ nautilus_view_load_state(NautilusView *view, const char *config_path)
g_return_if_fail(view);
g_return_if_fail(view->component_class);
g_return_if_fail(NAUTILUS_VIEW(view));
CORBA_exception_init(&ev);
......@@ -567,6 +575,10 @@ check_object(NautilusView *view)
gboolean retval = TRUE;
CORBA_exception_init(&ev);
g_assert(!view->checking);
view->checking++;
if(CORBA_Object_non_existent(gnome_object_corba_objref(GNOME_OBJECT(view->client_object)), &ev))
{
view->timer_id = 0;
......@@ -575,6 +587,8 @@ check_object(NautilusView *view)
}
CORBA_exception_free(&ev);
view->checking--;
return retval;
}
......
......@@ -88,12 +88,13 @@ struct _NautilusView
GnomeObject *view_frame;
guint construct_arg_count;
NautilusViewComponentType *component_class;
gpointer component_data;
guint construct_arg_count;
guint timer_id;
guint checking;
};
GtkType nautilus_view_get_type (void);
......
This diff is collapsed.
......@@ -5,6 +5,19 @@
#include <libnautilus/libnautilus.h>
#include <gtk/gtk.h>
typedef enum {
CV_PROGRESS_INITIAL = 1,
CV_PROGRESS_DONE,
CV_PROGRESS_ERROR,
VIEW_ERROR,
RESET_TO_IDLE,
NAVINFO_RECEIVED,
NEW_CONTENT_VIEW_ACTIVATED,
NEW_META_VIEW_ACTIVATED
} NautilusWindowStateItem;
void nautilus_window_set_state_info(NautilusWindow *window, ... /* things to set, plus optional params */);
void nautilus_window_real_request_selection_change(NautilusWindow *window,
Nautilus_SelectionRequestInfo *loc,
NautilusView *requesting_view);
......
......@@ -825,7 +825,7 @@ static void nautilus_window_show_color_picker (GtkWidget *btn, NautilusWindow *w
static void
nautilus_window_stop (GtkWidget *btn, NautilusWindow *window)
{
nautilus_window_end_location_change(window);
nautilus_window_set_state_info(window, RESET_TO_IDLE, 0);
}
......
......@@ -49,36 +49,54 @@ typedef struct {
guint window_signals[0];
} NautilusWindowClass;
typedef struct _NautilusWindowLoadInfo NautilusWindowLoadInfo;
typedef struct _NautilusContentViewLoadInfo NautilusContentViewLoadInfo;
typedef struct _NautilusWindowStateInfo NautilusWindowStateInfo;
struct _NautilusWindow {
GnomeApp parent_object;
/* Views stuff */
NautilusView *content_view;
GSList *meta_views;
/* UI stuff */
/** UI stuff **/
NautilusIndexPanel *index_panel;
GtkWidget *content_hbox, *btn_back, *btn_fwd;
GtkWidget *option_cvtype, *ent_uri;
guint statusbar_ctx, statusbar_clear_id;
/* History stuff */
GSList *uris_prev, *uris_next;
/* CORBA stuff */
/** CORBA-related elements **/
GnomeObject *ntl_viewwindow;
GnomeUIHandler *uih;
/** State information **/
/* Information about current location/selection */
Nautilus_NavigationInfo *ni;
Nautilus_SelectionInfo *si;
/* History stuff */
GSList *uris_prev, *uris_next;
/* Current views stuff */
NautilusView *content_view;
GSList *meta_views;
NautilusWindowLoadInfo *load_info;
NautilusContentViewLoadInfo *content_view_info;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
NautilusView *new_content_view, *new_requesting_view;
GSList *new_meta_views, *error_views;
enum { NW_LOADING_INFO, NW_LOADING_VIEWS, NW_IDLE } state;
guint cancel_tag;
guint action_tag;
guint16 made_changes, making_changes;
gboolean changes_pending : 1;
gboolean is_back : 1;
gboolean views_shown : 1;
gboolean view_bombed_out : 1;
gboolean view_activation_complete : 1;
gboolean cv_progress_initial : 1;
gboolean cv_progress_done : 1;
gboolean cv_progress_error : 1;
gboolean reset_to_idle : 1;
};
GtkType nautilus_window_get_type(void);
......
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