Commit cf21c9ee authored by Maciej Stachowiak's avatar Maciej Stachowiak

Fix bugzilla tasks #599 (hex number is bad default for meta view

	names) and #631 (nead oaf query to determine metaviews).

	* libnautilus-extensions/nautilus-view-identifier.h,
	libnautilus-extensions/nautilus-view-identifier.c:
	(nautilus_view_identifier_new, get_lang_list,
	nautilus_view_identifier_new_from_oaf_server_info,
	nautilus_view_identifier_free): Moved NautilusViewIdentifier code
	here from ntl-uri-map.[ch].
	(nautilus_view_identifier_new_from_content_view),
	(nautilus_view_identifier_new_from_sidebar_panel),
	(nautilus_view_identifier_free_callback),
	(nautilus_view_identifier_free_list): New functions.
	* libnautilus-extensions/Makefile.am: Add
	nautilus-view-identifier.[ch] to build.
	* src/ntl-types.h: Removed typedef for NautilusViewIdentifier.

	* libnautilus-extensions/nautilus-glib-extensions.h:
	* libnautilus-extensions/nautilus-glib-extensions.c
	(nautilus_g_list_free_deep_custom): New function, like
	`nautilus_g_list_free_deep' but lets you pass your own free
	function.
	(nautilus_g_list_free_deep): Use `nautilus_g_list_free_deep_custom'
	(nautilus_g_list_partition): New function to destructively
	partition a GList into two, depending on whether they satisfy the
	provided predicate or not.
	(nautilus_test_predicate), (nautilus_self_check_glib_extensions):
	Added unit tests for `nautilus_g_list_partition' and for
	`nautilus_g_list_equal' since the `nautilus_g_list_partition'
	tests rely on it.
	* libnautilus-extensions/nautilus-directory.c:
	(nautilus_directory_notify_files_moved): Use
	`nautilus_g_list_free_deep_custom'.
	* libnautilus-extensions/nautilus-gdk-pixbuf-extensions.c
	(nautilus_gdk_pixbuf_list_free): Likewise.
	* libnautilus-extensions/nautilus-icon-factory.c
	(nautilus_scalable_icon_list_free): Likewise.
	* libnautilus-extensions/nautilus-string-list.c
	(nautilus_string_list_clear): Likewise.
	* nautilus-widgets/nautilus-preferences.c (pref_hash_node_free,
	prefs_hash_lookup_with_implicit_registration): Likewise.

	* libnautilus-extensions/nautilus-global-preferences.c,
	libnautilus-extensions/nautilus-global-preferences.h
	(global_preferences_create_dialog,
	nautilus_global_preferences_get_sidebar_panel_view_identifiers,
	nautilus_global_preferences_get_meta_view_iids,
	nautilus_preferences_register_meta_view_preferences_for_ui,
	global_preferences_register_for_ui): Change things around to
	determine the set of sidebar panel prefs at run time, and to pass
	around NautilusViewIdentifiers rather than just iid strings so we
	can use the statically defined name in the oafinfo.

	* src/ntl-uri-map.h, src/ntl-uri-map.c: (set_initial_content_iid,
	got_file_info_callback, sidebar_panel_preference_is_on,
	(add_sidebar_panel_identifiers, nautilus_navigation_info_free):
	Changed things around to better handle sidebar panel (AKA meta
	view) selection, and pass around both name and iid.

	* src/ntl-window-msgs.c:
	(nautilus_window_request_selection_change,
	nautilus_window_has_really_changed,
	nautilus_window_load_meta_view, nautilus_window_update_state,
	nautilus_window_set_state_info): Fixed everything to pass around
	ViewIdentifiers instead of iids for sidebar panels and set the
	label approrpiately when activating; replaced a whole bunch of
	GSList usage with GList (we can always optimize this stuff later).
	* src/ntl-window.h, src/ntl-window.c: (nautilus_window_destroy,
	nautilus_window_load_content_view_menu,
	nautilus_window_set_content_view, nautilus_window_add_meta_view,
	nautilus_window_remove_meta_view_real,
	nautilus_window_remove_meta_view): Deal with the above changes
	(mostly GSList -> GList changes).

	* src/ntl-view-bonobo-control.c, src/ntl-view-bonobo-subdoc.c,
	src/ntl-view-nautilus.c, src/ntl-view-private.h: Remove all
	get_label related calls since we get that from the oafinfo now.
	* libnautilus/nautilus-meta-view-frame.h,
	libnautilus/nautilus-meta-view-frame.c:
	(nautilus_meta_view_frame_initialize,
	nautilus_meta_view_frame_new_from_bonobo_control,
	nautilus_meta_view_frame_destroy): Remove
	`nautilus_meta_view_frame_set_label' machinery and associated
	machinery since we now get the label statically from the oafinfo.
	* components/history/ntl-history-view.c: (make_obj): Don't call
	`nautilus_meta_view_frame_set_label' any more, the label is now
	statically determined from the oafinfo file.
	* components/notes/ntl-notes.c: (make_notes_view): Likewise.
	* components/websearch/ntl-web-search.c: (make_obj): Likewise.
	* components/help/hyperbola-nav-index.c: Likewise.
	(hyperbola_navigation_index_new): Likewise.
	* components/help/hyperbola-nav-search.c: Likewise.
	(hyperbola_navigation_search_new): Likewise.
	* components/help/hyperbola-nav-tree.c: Likewise.
	(hyperbola_navigation_tree_new): Likewise.
	* src/ntl-meta-view.h, src/ntl-meta-view.c:
	(nautilus_meta_view_set_label),
	(nautilus_meta_view_get_label): Have an explicit value to set,
	rather than trying to get it through CORBA. This is kind of a
	hack, really we should pass around a label and a NautilusMetaView
	separately and remove this stuff.
	* components/help/hyperbola.oafinfo,
	components/notes/ntl-notes.oafinfo,
	components/websearch/ntl-web-search.oafinfo,
	components/history/ntl-history-view.oafinfo: Updated to include
	latest Nautilus attributes.
parent 7f1e84bb
2000-05-19 Maciej Stachowiak <mjs@eazel.com>
Fix bugzilla tasks #599 (hex number is bad default for meta view
names) and #631 (nead oaf query to determine metaviews).
* libnautilus-extensions/nautilus-view-identifier.h,
libnautilus-extensions/nautilus-view-identifier.c:
(nautilus_view_identifier_new, get_lang_list,
nautilus_view_identifier_new_from_oaf_server_info,
nautilus_view_identifier_free): Moved NautilusViewIdentifier code
here from ntl-uri-map.[ch].
(nautilus_view_identifier_new_from_content_view),
(nautilus_view_identifier_new_from_sidebar_panel),
(nautilus_view_identifier_free_callback),
(nautilus_view_identifier_free_list): New functions.
* libnautilus-extensions/Makefile.am: Add
nautilus-view-identifier.[ch] to build.
* src/ntl-types.h: Removed typedef for NautilusViewIdentifier.
* libnautilus-extensions/nautilus-glib-extensions.h:
* libnautilus-extensions/nautilus-glib-extensions.c
(nautilus_g_list_free_deep_custom): New function, like
`nautilus_g_list_free_deep' but lets you pass your own free
function.
(nautilus_g_list_free_deep): Use `nautilus_g_list_free_deep_custom'
(nautilus_g_list_partition): New function to destructively
partition a GList into two, depending on whether they satisfy the
provided predicate or not.
(nautilus_test_predicate), (nautilus_self_check_glib_extensions):
Added unit tests for `nautilus_g_list_partition' and for
`nautilus_g_list_equal' since the `nautilus_g_list_partition'
tests rely on it.
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_notify_files_moved): Use
`nautilus_g_list_free_deep_custom'.
* libnautilus-extensions/nautilus-gdk-pixbuf-extensions.c
(nautilus_gdk_pixbuf_list_free): Likewise.
* libnautilus-extensions/nautilus-icon-factory.c
(nautilus_scalable_icon_list_free): Likewise.
* libnautilus-extensions/nautilus-string-list.c
(nautilus_string_list_clear): Likewise.
* nautilus-widgets/nautilus-preferences.c (pref_hash_node_free,
prefs_hash_lookup_with_implicit_registration): Likewise.
* libnautilus-extensions/nautilus-global-preferences.c,
libnautilus-extensions/nautilus-global-preferences.h
(global_preferences_create_dialog,
nautilus_global_preferences_get_sidebar_panel_view_identifiers,
nautilus_global_preferences_get_meta_view_iids,
nautilus_preferences_register_meta_view_preferences_for_ui,
global_preferences_register_for_ui): Change things around to
determine the set of sidebar panel prefs at run time, and to pass
around NautilusViewIdentifiers rather than just iid strings so we
can use the statically defined name in the oafinfo.
* src/ntl-uri-map.h, src/ntl-uri-map.c: (set_initial_content_iid,
got_file_info_callback, sidebar_panel_preference_is_on,
(add_sidebar_panel_identifiers, nautilus_navigation_info_free):
Changed things around to better handle sidebar panel (AKA meta
view) selection, and pass around both name and iid.
* src/ntl-window-msgs.c:
(nautilus_window_request_selection_change,
nautilus_window_has_really_changed,
nautilus_window_load_meta_view, nautilus_window_update_state,
nautilus_window_set_state_info): Fixed everything to pass around
ViewIdentifiers instead of iids for sidebar panels and set the
label approrpiately when activating; replaced a whole bunch of
GSList usage with GList (we can always optimize this stuff later).
* src/ntl-window.h, src/ntl-window.c: (nautilus_window_destroy,
nautilus_window_load_content_view_menu,
nautilus_window_set_content_view, nautilus_window_add_meta_view,
nautilus_window_remove_meta_view_real,
nautilus_window_remove_meta_view): Deal with the above changes
(mostly GSList -> GList changes).
* src/ntl-view-bonobo-control.c, src/ntl-view-bonobo-subdoc.c,
src/ntl-view-nautilus.c, src/ntl-view-private.h: Remove all
get_label related calls since we get that from the oafinfo now.
* libnautilus/nautilus-meta-view-frame.h,
libnautilus/nautilus-meta-view-frame.c:
(nautilus_meta_view_frame_initialize,
nautilus_meta_view_frame_new_from_bonobo_control,
nautilus_meta_view_frame_destroy): Remove
`nautilus_meta_view_frame_set_label' machinery and associated
machinery since we now get the label statically from the oafinfo.
* components/history/ntl-history-view.c: (make_obj): Don't call
`nautilus_meta_view_frame_set_label' any more, the label is now
statically determined from the oafinfo file.
* components/notes/ntl-notes.c: (make_notes_view): Likewise.
* components/websearch/ntl-web-search.c: (make_obj): Likewise.
* components/help/hyperbola-nav-index.c: Likewise.
(hyperbola_navigation_index_new): Likewise.
* components/help/hyperbola-nav-search.c: Likewise.
(hyperbola_navigation_search_new): Likewise.
* components/help/hyperbola-nav-tree.c: Likewise.
(hyperbola_navigation_tree_new): Likewise.
* src/ntl-meta-view.h, src/ntl-meta-view.c:
(nautilus_meta_view_set_label),
(nautilus_meta_view_get_label): Have an explicit value to set,
rather than trying to get it through CORBA. This is kind of a
hack, really we should pass around a label and a NautilusMetaView
separately and remove this stuff.
* components/help/hyperbola.oafinfo,
components/notes/ntl-notes.oafinfo,
components/websearch/ntl-web-search.oafinfo,
components/history/ntl-history-view.oafinfo: Updated to include
latest Nautilus attributes.
2000-05-19 Andy Hertzfeld <andy@eazel.com>
* components/music/Makefile.am:
......
......@@ -718,7 +718,6 @@ BonoboObject *hyperbola_navigation_index_new(void)
gtk_widget_show_all(vbox);
hni->view_frame = NAUTILUS_VIEW_FRAME (nautilus_meta_view_frame_new (vbox));
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hni->view_frame), _("Help Index"));
return BONOBO_OBJECT (hni->view_frame);
}
......@@ -175,7 +175,6 @@ BonoboObject *hyperbola_navigation_search_new(void)
gtk_widget_show_all(vbox);
hns->view_frame = NAUTILUS_VIEW_FRAME (nautilus_meta_view_frame_new (vbox));
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hns->view_frame), _("Help Search"));
return BONOBO_OBJECT (hns->view_frame);
}
......@@ -95,7 +95,6 @@ hyperbola_navigation_tree_new(void)
gtk_signal_connect(GTK_OBJECT(view->view_frame), "notify_location_change",
hyperbola_navigation_tree_notify_location_change,
view);
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(view->view_frame), _("Help Contents"));
return BONOBO_OBJECT (view->view_frame);
}
......
......@@ -15,24 +15,52 @@
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Help Navigation Tree"/>
<oaf_attribute name="name" type="string" value="Help Contents sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="Help Contents"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="help"/>
<item value="man"/>
<item value="info"/>
</oaf_attribute>
</oaf_server>
<oaf_server iid="OAFIID:hyperbola_navigation_index:0bafadc7-09f1-4f10-8c8e-dad53124fc49" type="factory" location="OAFIID:hyperbola_factory:02b54c63-101b-4b27-a285-f99ed332ecdb">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Control:1.0"/>
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Help Index"/>
<oaf_attribute name="name" type="string" value="Help Index sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="Help Index"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="help"/>
<item value="man"/>
<item value="info"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Help Index"/>
</oaf_server>
<oaf_server iid="OAFIID:hyperbola_navigation_search:89b2f3b8-4f09-49c8-9a7b-ccb14d034813" type="factory" location="OAFIID:hyperbola_factory:02b54c63-101b-4b27-a285-f99ed332ecdb">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Control:1.0"/>
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Help Search"/>
<oaf_attribute name="name" type="string" value="Help Search sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="Help Search"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="help"/>
<item value="man"/>
<item value="info"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -14,7 +14,13 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="History"/>
<oaf_attribute name="description" type="string" value="History sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="History sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="History"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -14,7 +14,13 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="History"/>
<oaf_attribute name="description" type="string" value="History sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="History sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="History"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -14,7 +14,13 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="History"/>
<oaf_attribute name="description" type="string" value="History sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="History sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="History"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -242,10 +242,6 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
hview->clist = (GtkCList *)clist;
/* set description */
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hview->view),
_("History"));
/* handle events */
gtk_signal_connect(GTK_OBJECT(hview->view), "notify_location_change", hyperbola_navigation_history_notify_location_change, hview);
gtk_signal_connect(GTK_OBJECT(clist), "select_row", hyperbola_navigation_history_select_row, hview);
......
......@@ -14,7 +14,13 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="History"/>
<oaf_attribute name="description" type="string" value="History sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="History sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="History"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -242,10 +242,6 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
hview->clist = (GtkCList *)clist;
/* set description */
nautilus_meta_view_frame_set_label(NAUTILUS_META_VIEW_FRAME(hview->view),
_("History"));
/* handle events */
gtk_signal_connect(GTK_OBJECT(hview->view), "notify_location_change", hyperbola_navigation_history_notify_location_change, hview);
gtk_signal_connect(GTK_OBJECT(clist), "select_row", hyperbola_navigation_history_select_row, hview);
......
......@@ -14,7 +14,13 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="History"/>
<oaf_attribute name="description" type="string" value="History sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="History sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="History"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -14,7 +14,12 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Annotation"/>
<oaf_attribute name="description" type="string" value="Notes sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="Notes sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="Notes"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -14,7 +14,12 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Annotation"/>
<oaf_attribute name="description" type="string" value="Notes sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="Notes sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="Notes"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -14,7 +14,12 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Annotation"/>
<oaf_attribute name="description" type="string" value="Notes sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="Notes sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="Notes"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
......@@ -217,8 +216,6 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl
gtk_signal_connect (GTK_OBJECT (notes->view), "destroy", nautilus_clipboard_info_destroy, info);
/* set description */
nautilus_meta_view_frame_set_label (NAUTILUS_META_VIEW_FRAME (notes->view),
_("Notes"));
return BONOBO_OBJECT (notes->view);
}
......
......@@ -14,7 +14,12 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Annotation"/>
<oaf_attribute name="description" type="string" value="Notes sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="Notes sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="Notes"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
......@@ -217,8 +216,6 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl
gtk_signal_connect (GTK_OBJECT (notes->view), "destroy", nautilus_clipboard_info_destroy, info);
/* set description */
nautilus_meta_view_frame_set_label (NAUTILUS_META_VIEW_FRAME (notes->view),
_("Notes"));
return BONOBO_OBJECT (notes->view);
}
......
......@@ -14,7 +14,12 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Annotation"/>
<oaf_attribute name="description" type="string" value="Notes sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="Notes sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="Notes"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="*"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -232,11 +232,6 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
GTK_SIGNAL_FUNC (nautilus_component_unmerge_bonobo_items_cb), info);
gtk_signal_connect (GTK_OBJECT (hview->ent_params), "destroy", nautilus_clipboard_info_destroy, info);
/* set description */
nautilus_meta_view_frame_set_label (NAUTILUS_META_VIEW_FRAME (hview->view),
_("WebSearch"));
return BONOBO_OBJECT (hview->view);
}
......
......@@ -14,7 +14,13 @@
<item value="IDL:Nautilus/MetaView:1.0"/>
<item value="IDL:Nautilus/View:1.0"/>
</oaf_attribute>
<oaf_attribute name="description" type="string" value="Web Search"/>
<oaf_attribute name="description" type="string" value="Web Search sidebar panel for Nautilus"/>
<oaf_attribute name="name" type="string" value="Web Search sidebar panel"/>
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" value="Web Search"/>
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
<item value="http"/>
</oaf_attribute>
</oaf_server>
</oaf_info>
......@@ -64,6 +64,7 @@ libnautilus_extensionsinclude_HEADERS= \
nautilus-self-checks.h \
nautilus-string-list.h \
nautilus-string.h \
nautilus-view-identifier.h \
nautilus-xml-extensions.h \
$(NULL)
......@@ -113,5 +114,6 @@ libnautilus_extensions_la_SOURCES = \
nautilus-self-checks.c \
nautilus-string-list.c \
nautilus-string.c \
nautilus-view-identifier.c \
nautilus-xml-extensions.c \
$(NULL)
......@@ -786,8 +786,7 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
g_hash_table_destroy (added_lists);
/* Let the file objects go. */
g_list_foreach (unref_list, (GFunc) nautilus_file_unref, NULL);
g_list_free (unref_list);
nautilus_g_list_free_deep_custom (unref_list, (GFunc) nautilus_file_unref, NULL);
/* Separate handling for brand new file objects. */
nautilus_directory_notify_files_added (new_files_list);
......
......@@ -25,6 +25,7 @@
#include <config.h>
#include <math.h>
#include "nautilus-gdk-pixbuf-extensions.h"
#include "nautilus-glib-extensions.h"
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
#include <libgnomevfs/gnome-vfs-ops.h>
......@@ -77,8 +78,7 @@ nautilus_gdk_pixbuf_list_ref (GList *pixbuf_list)
void
nautilus_gdk_pixbuf_list_free (GList *pixbuf_list)
{
g_list_foreach (pixbuf_list, (GFunc) gdk_pixbuf_unref, NULL);
g_list_free (pixbuf_list);
nautilus_g_list_free_deep_custom (pixbuf_list, (GFunc) gdk_pixbuf_unref, NULL);
}
GdkPixbuf *
......
......@@ -196,6 +196,23 @@ nautilus_g_str_list_copy (GList *list)
return result;
}
/**
* nautilus_g_list_free_deep_custom
*
* Frees the elements of a list and then the list, using a custom free function.
*
* @list: List of elements that can be freed with the provided free function.
* @element_free_func: function to call with the data pointer and user_data to free it.
* @user_data: User data to pass to element_free_func
**/
void
nautilus_g_list_free_deep_custom (GList *list, GFunc element_free_func, gpointer user_data)
{
g_list_foreach (list, element_free_func, user_data);
g_list_free (list);
}
/**
* nautilus_g_list_free_deep
*
......@@ -205,10 +222,10 @@ nautilus_g_str_list_copy (GList *list)
void
nautilus_g_list_free_deep (GList *list)
{
g_list_foreach (list, (GFunc) g_free, NULL);
g_list_free (list);
nautilus_g_list_free_deep_custom (list, (GFunc) g_free, NULL);
}
/**
* nautilus_g_strv_find
*
......@@ -257,6 +274,68 @@ nautilus_g_list_safe_for_each (GList *list, GFunc function, gpointer user_data)
}
}
/**
* nautilus_g_list_partition
*
* Parition a list into two parts depending on whether the data
* elements satisfy a provided predicate. Order is preserved in both
* of the resulting lists, and the original list is consumed. A list
* of the items that satisfy the predicate is returned, and the list
* of items not satisfying the predicate is returned via the failed
* out argument.
*
* @list: List to partition.
* @predicate: Function to call on each element.
* @user_data: Data to pass to function.
* @removed: The GList * variable pinted to by this argument will be
* set to the list of elements for which the predicate returned
* false. */
GList *
nautilus_g_list_partition (GList *list,
NautilusGPredicateFunc predicate,
gpointer user_data,
GList **failed)
{
GList *predicate_true;
GList *predicate_false;
GList *reverse;
GList *p;
GList *next;
predicate_true = NULL;
predicate_false = NULL;
reverse = g_list_reverse (list);
for (p = reverse; p != NULL; p = next) {
next = p->next;
if (next != NULL) {
next->prev = NULL;
}
if (predicate (p->data, user_data)) {
p->next = predicate_true;
if (predicate_true != NULL) {
predicate_true->prev = p;
}
predicate_true = p;
} else {
p->next = predicate_false;
if (predicate_false != NULL) {
predicate_false->prev = p;
}
predicate_false = p;
}
}
*failed = predicate_false;
return predicate_true;
}
/**
* nautilus_g_ptr_array_new_from_list
*
......@@ -461,10 +540,32 @@ check_tm_to_g_date (time_t time)
before_conversion->tm_year);
}
static gboolean
nautilus_test_predicate (char *data,
char *user_data)
{
if (g_strcasecmp (data, user_data) <= 0) {
return TRUE;
} else {
return FALSE;
}
}
void
nautilus_self_check_glib_extensions (void)
{
char **strv;
GList *compare_list_1;
GList *compare_list_2;
GList *compare_list_3;
GList *compare_list_4;
GList *compare_list_5;
GList *list_to_partition;
GList *expected_passed;
GList *expected_failed;
GList *actual_passed;
GList *actual_failed;
check_tm_to_g_date (0); /* lower limit */
check_tm_to_g_date ((time_t) -1); /* upper limit */
......@@ -483,6 +584,76 @@ nautilus_self_check_glib_extensions (void)
NAUTILUS_CHECK_BOOLEAN_RESULT ((nautilus_get_system_time () - nautilus_get_system_time ()) < 0LL, TRUE);
g_strfreev (strv);
/* nautilus_g_str_list_equal */
/* We g_strdup because identical string constants can be shared. */
compare_list_1 = NULL;
compare_list_1 = g_list_append (list_to_partition, g_strdup ("Apple"));
compare_list_1 = g_list_append (list_to_partition, g_strdup ("zebra"));
compare_list_1 = g_list_append (list_to_partition, g_strdup ("!@#!@$#@$!"));
compare_list_2 = NULL;
compare_list_2 = g_list_append (list_to_partition, g_strdup ("Apple"));
compare_list_2 = g_list_append (list_to_partition, g_strdup ("zebra"));
compare_list_2 = g_list_append (list_to_partition, g_strdup ("!@#!@$#@$!"));
compare_list_3 = NULL;
compare_list_3 = g_list_append (list_to_partition, g_strdup ("Apple"));
compare_list_3 = g_list_append (list_to_partition, g_strdup ("zebra"));
compare_list_4 = NULL;
compare_list_4 = g_list_append (list_to_partition, g_strdup ("Apple"));
compare_list_4 = g_list_append (list_to_partition, g_strdup ("zebra"));
compare_list_4 = g_list_append (list_to_partition, g_strdup ("!@#!@$#@$!"));
compare_list_4 = g_list_append (list_to_partition, g_strdup ("foobar"));
compare_list_5 = NULL;
compare_list_5 = g_list_append (list_to_partition, g_strdup ("Apple"));
compare_list_5 = g_list_append (list_to_partition, g_strdup ("zzzzzebraaaaaa"));
compare_list_5 = g_list_append (list_to_partition, g_strdup ("!@#!@$#@$!"));
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_g_str_list_equal (compare_list_1, compare_list_2), TRUE);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_g_str_list_equal (compare_list_1, compare_list_3), FALSE);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_g_str_list_equal (compare_list_1, compare_list_4), FALSE);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_g_str_list_equal (compare_list_1, compare_list_5), FALSE);
nautilus_g_list_free_deep (compare_list_1);
nautilus_g_list_free_deep (compare_list_2);
nautilus_g_list_free_deep (compare_list_3);
nautilus_g_list_free_deep (compare_list_4);
nautilus_g_list_free_deep (compare_list_5);
/* nautilus_g_list_partition */
list_to_partition = NULL;
list_to_partition = g_list_append (list_to_partition, "Cadillac");
list_to_partition = g_list_append (list_to_partition, "Pontiac");
list_to_partition = g_list_append (list_to_partition, "Ford");
list_to_partition = g_list_append (list_to_partition, "Range Rover");
expected_passed = NULL;
expected_passed = g_list_append (list_to_partition, "Cadillac");
expected_passed = g_list_append (list_to_partition, "Ford");
expected_failed = NULL;
expected_failed = g_list_append (list_to_partition, "Pontiac");
expected_failed = g_list_append (list_to_partition, "Range Rover");
actual_passed = nautilus_g_list_partition (list_to_partition,
(NautilusGPredicateFunc) nautilus_test_predicate,
"m",
&actual_failed);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_g_str_list_equal (expected_passed, actual_passed), TRUE);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_g_str_list_equal (expected_failed, actual_failed), TRUE);
nautilus_g_list_free_deep (expected_passed);
nautilus_g_list_free_deep (actual_passed);
nautilus_g_list_free_deep (expected_failed);
nautilus_g_list_free_deep (actual_failed);
}
#endif /* !NAUTILUS_OMIT_SELF_CHECK */
......@@ -49,6 +49,10 @@ char * nautilus_strdup_strftime (const char *format,
struct tm *time_pieces);
/* List functions. */
typedef gboolean (*NautilusGPredicateFunc) (gpointer data,
gpointer user_data);
gboolean nautilus_g_list_exactly_one_item (GList *list);
gboolean nautilus_g_list_more_than_one_item (GList *list);
gboolean nautilus_g_list_equal (GList *list_a,
......@@ -57,6 +61,13 @@ GList * nautilus_g_list_copy (GList *list);
void nautilus_g_list_safe_for_each (GList *list,
GFunc function,
gpointer user_data);
GList * nautilus_g_list_partition (GList *list,
NautilusGPredicateFunc predicate,
gpointer user_data,
GList **removed);
void nautilus_g_list_free_deep_custom (GList *list,
GFunc element_free_func,
gpointer user_data);
/* List functions for lists of g_free'able objects. */