Commit 62ce8b92 authored by Mathieu Lacage's avatar Mathieu Lacage Committed by Mathieu Lacage
Browse files

completes task 1567. it shows a bug in the way the history view displays

2000-08-19  Mathieu Lacage  <mathieu@eazel.com>

        completes task 1567. it shows a bug in the way the history
        view displays the current location given the history. to be
	fixed soon.

        * components/history/nautilus-history-view.c:
        (history_load_location), (history_title_changed), (make_obj):
        add title_changed_callback, connect it to changed_title signal.
        make it call load_location.
        Hack evil stuff in load_location: a hand-made lock because the
        function calls some gtk calls which seem to make the main loop
		run at least once. This allowed the main loop to use the events
	in the event queue and it happened that the title_changed signal
	is usually emited more than once so it called again the
	non-reentrant signal callback... BAD THINGS HAPPENED.


	* libnautilus/nautilus-view-component.idl: add changed_title method
	to Nautilus::View.
	* libnautilus/nautilus-view.c: (impl_Nautilus_View_title_changed),
	(nautilus_view_initialize_class): implement the new idl function and
	add a signal for it.
        * libnautilus/nautilus-view.h: add the new signal class method.


        * src/nautilus-view-frame-bonobo-control.c: add the title_changed
        field to the vtable.
        * src/nautilus-view-frame-nautilus-view.c: (title_changed): idem.
        * src/nautilus-view-frame-private.h: idem.
        * src/nautilus-view-frame.c: (nautilus_view_frame_title_changed):
        add api function to emit the signal and make the actual corba call.
        * src/nautilus-view-frame.h: add function prototype.
        * src/nautilus-window-manage-views.c: add calls to
        (nautilus_window_update_title): to notify view frames of changed
	titles.
parent 8ddbe9e7
2000-08-19 Mathieu Lacage <mathieu@eazel.com>
completes task 1567. it shows a bug in the way the history
view displays the current location given the history. to be
fixed soon.
* components/history/nautilus-history-view.c:
(history_load_location), (history_title_changed), (make_obj):
add title_changed_callback, connect it to changed_title signal.
make it call load_location.
Hack evil stuff in load_location: a hand-made lock because the
function calls some gtk calls which seem to make the main loop
run at least once. This allowed the main loop to use the events
in the event queue and it happened that the title_changed signal
is usually emited more than once so it called again the
non-reentrant signal callback... BAD THINGS HAPPENED.
* libnautilus/nautilus-view-component.idl: add changed_title method
to Nautilus::View.
* libnautilus/nautilus-view.c: (impl_Nautilus_View_title_changed),
(nautilus_view_initialize_class): implement the new idl function and
add a signal for it.
* libnautilus/nautilus-view.h: add the new signal class method.
* src/nautilus-view-frame-bonobo-control.c: add the title_changed
field to the vtable.
* src/nautilus-view-frame-nautilus-view.c: (title_changed): idem.
* src/nautilus-view-frame-private.h: idem.
* src/nautilus-view-frame.c: (nautilus_view_frame_title_changed):
add api function to emit the signal and make the actual corba call.
* src/nautilus-view-frame.h: add function prototype.
* src/nautilus-window-manage-views.c: add calls to
(nautilus_window_update_title): to notify view frames of changed
titles.
2000-08-18 Gene Z. Ragan <gzr@eazel.com>
* libnautilus-extensions/nautilus-volume-monitor.c:
......
......@@ -129,6 +129,8 @@ get_history_list (HistoryView *hview)
return list;
}
static void
history_load_location (NautilusView *view,
const char *location,
......@@ -141,6 +143,12 @@ history_load_location (NautilusView *view,
Nautilus_HistoryList *history_list;
Nautilus_HistoryItem *item;
int i;
static int lock = 0;
if (lock != 0) {
return;
}
lock = 1;
hview->notify_count++;
......@@ -154,7 +162,7 @@ history_load_location (NautilusView *view,
history_list = get_history_list (hview);
for (i = 0; i < history_list->_length; i++) {
item = &history_list->_buffer[i];
item = &history_list->_buffer[i];
bookmark = nautilus_bookmark_new (item->location, item->title);
cols[HISTORY_VIEW_COLUMN_ICON] = NULL;
......@@ -179,6 +187,15 @@ history_load_location (NautilusView *view,
gtk_clist_thaw (clist);
hview->notify_count--;
lock = 0;
}
static void
history_title_changed (NautilusView *view,
HistoryView *hview)
{
history_load_location (view, NULL, hview);
}
......@@ -273,6 +290,8 @@ make_obj (BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
/* handle events */
gtk_signal_connect(GTK_OBJECT(hview->view), "load_location",
history_load_location, hview);
gtk_signal_connect(GTK_OBJECT(hview->view), "title_changed",
history_title_changed, hview);
gtk_signal_connect(GTK_OBJECT(clist), "button-press-event", history_button_press, hview);
gtk_signal_connect(GTK_OBJECT(clist), "button-release-event", history_button_release, hview);
......
......@@ -35,6 +35,8 @@ module Nautilus {
* report_selection_change.
*/
oneway void selection_changed (in URIList selection);
oneway void title_changed ();
};
/* The ViewFrame interface is used by the view to communicate
......
......@@ -40,6 +40,7 @@ enum {
LOAD_LOCATION,
STOP_LOADING,
SELECTION_CHANGED,
TITLE_CHANGED,
LAST_SIGNAL
};
......@@ -62,6 +63,8 @@ static void impl_Nautilus_View_stop_loading (PortableServer_Servant servan
static void impl_Nautilus_View_selection_changed (PortableServer_Servant servant,
const Nautilus_URIList *selection,
CORBA_Environment *ev);
static void impl_Nautilus_View_title_changed (PortableServer_Servant servant,
CORBA_Environment *ev);
static void nautilus_view_initialize (NautilusView *view);
static void nautilus_view_destroy (GtkObject *object);
static void nautilus_view_initialize_class (NautilusViewClass *klass);
......@@ -73,7 +76,8 @@ POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
NULL,
&impl_Nautilus_View_load_location,
&impl_Nautilus_View_stop_loading,
&impl_Nautilus_View_selection_changed
&impl_Nautilus_View_selection_changed,
&impl_Nautilus_View_title_changed
};
static PortableServer_ServantBase__epv base_epv;
......@@ -161,6 +165,15 @@ impl_Nautilus_View_selection_changed (PortableServer_Servant servant,
g_list_free (selection_as_g_list);
}
static void
impl_Nautilus_View_title_changed (PortableServer_Servant servant,
CORBA_Environment *ev)
{
gtk_signal_emit (GTK_OBJECT (((impl_POA_Nautilus_View *) servant)->bonobo_object),
signals[TITLE_CHANGED]);
}
static void
impl_Nautilus_View__destroy (BonoboObject *object, PortableServer_Servant servant)
{
......@@ -230,6 +243,13 @@ nautilus_view_initialize_class (NautilusViewClass *klass)
GTK_SIGNAL_OFFSET (NautilusViewClass, selection_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
signals[TITLE_CHANGED] =
gtk_signal_new ("title_changed",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusViewClass, title_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
......
......@@ -84,8 +84,9 @@ bonobo_control_load_location(NautilusViewFrame *view, Nautilus_URI location, COR
NautilusViewComponentType bonobo_control_component_type = {
"IDL:Bonobo/Control:1.0",
&bonobo_control_try_load_client, /* try_load */
&destroy_bonobo_control_view, /* destroy */
&bonobo_control_load_location, /* load_location */
NULL, /* stop_loading */
NULL /* selection_changed */
&destroy_bonobo_control_view, /* destroy */
&bonobo_control_load_location, /* load_location */
NULL, /* stop_loading */
NULL, /* selection_changed */
NULL /* title_changed */
};
......@@ -115,11 +115,29 @@ selection_changed(NautilusViewFrame *view, const Nautilus_URIList *selection, CO
gtk_object_destroy(GTK_OBJECT(view));
}
void
title_changed (NautilusViewFrame *view, CORBA_Environment *ev);
void
title_changed (NautilusViewFrame *view, CORBA_Environment *ev)
{
NautilusViewInfo *nvi = view->component_data;
Nautilus_View_title_changed(nvi->view_client, ev);
if(ev->_major != CORBA_NO_EXCEPTION)
/* FIXME: Is a destroy really sufficient here? Who does the unref? */
gtk_object_destroy(GTK_OBJECT(view));
}
NautilusViewComponentType nautilus_view_component_type = {
"IDL:Nautilus/View:1.0",
&nautilus_view_try_load_client, /* try_load */
&destroy_nautilus_view, /* destroy */
&load_location, /* load_location */
&stop_loading, /* stop_loading */
&selection_changed /* selection_changed */
&nautilus_view_try_load_client, /* try_load */
&destroy_nautilus_view, /* destroy */
&load_location, /* load_location */
&stop_loading, /* stop_loading */
&selection_changed, /* selection_changed */
&title_changed /* title_changed */
};
......@@ -85,6 +85,7 @@ struct NautilusViewComponentType {
void (* load_location) (NautilusViewFrame *view, Nautilus_URI location, CORBA_Environment *ev);
void (* stop_loading) (NautilusViewFrame *view, CORBA_Environment *ev);
void (* selection_changed) (NautilusViewFrame *view, const Nautilus_URIList *selection, CORBA_Environment *ev);
void (* title_changed) (NautilusViewFrame *view, CORBA_Environment *ev);
};
#endif /* NAUTILUS_VIEW_FRAME_PRIVATE_H */
......
......@@ -469,6 +469,24 @@ nautilus_view_frame_selection_changed (NautilusViewFrame *view,
CORBA_free (uri_list);
}
void
nautilus_view_frame_title_changed (NautilusViewFrame *view)
{
CORBA_Environment ev;
g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
g_return_if_fail (view->component_class != NULL);
if (view->component_class->title_changed == NULL) {
return;
}
CORBA_exception_init(&ev);
view->component_class->title_changed(view, &ev);
CORBA_exception_free(&ev);
}
gboolean
nautilus_view_frame_is_zoomable (NautilusViewFrame *view)
{
......@@ -868,3 +886,6 @@ nautilus_view_frame_get_history_list (NautilusViewFrame *view)
&history_list);
return history_list;
}
......@@ -158,4 +158,7 @@ void nautilus_view_frame_set_label (NautilusViewFrame *
void nautilus_view_frame_activate (NautilusViewFrame *view);
Nautilus_HistoryList * nautilus_view_frame_get_history_list (NautilusViewFrame *view);
void nautilus_view_frame_title_changed (NautilusViewFrame *view);
#endif /* NAUTILUS_VIEW_FRAME_H */
......@@ -239,6 +239,7 @@ nautilus_window_update_title (NautilusWindow *window)
char *title;
char *window_title;
char *truncated_title;
GList *temp;
title = nautilus_window_get_current_location_title (window);
......@@ -259,6 +260,21 @@ nautilus_window_update_title (NautilusWindow *window)
/* Name of item in history list may have changed, tell listeners. */
nautilus_send_history_list_changed ();
/* warn all views and sidebar panels of the potential title change */
if (window->content_view != NULL) {
nautilus_view_frame_title_changed (window->content_view);
}
if (window->new_content_view != NULL) {
nautilus_view_frame_title_changed (window->new_content_view);
}
for (temp = window->sidebar_panels; temp != NULL; temp = temp->next) {
if (temp->data != NULL) {
nautilus_view_frame_title_changed (NAUTILUS_VIEW_FRAME (temp->data));
}
}
}
/* nautilus_window_set_displayed_location:
......
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