summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRamiro Estrugo <ramiro@src.gnome.org>2000-05-26 15:51:43 +0000
committerRamiro Estrugo <ramiro@src.gnome.org>2000-05-26 15:51:43 +0000
commit371919a9c0fde4e78c9eebcb5337b2122acbfe47 (patch)
tree8e2076325446689ebffea897aa43532ba7abe28c /src
parent88a49b83364add807cd39dd8d5d6323326880278 (diff)
downloadnautilus-371919a9c0fde4e78c9eebcb5337b2122acbfe47.tar.gz
Expose only a single function to deal with sidebar panels. Return a list
* libnautilus-extensions/nautilus-global-preferences.c: (global_preferences_create_dialog), (global_preferences_get_sidebar_panel_view_identifiers), (nautilus_global_preferences_get_enabled_sidebar_panel_view_identifiers), (global_preferences_register_sidebar_panels_preferences_for_ui), (global_preferences_is_sidebar_panel_enabled), (nautilus_global_preferences_shutdown): * libnautilus-extensions/nautilus-global-preferences.h: Expose only a single function to deal with sidebar panels. Return a list of enabled view indentifiers, saving callers the work and complication of figuring out which panels are on. Make NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE cause i need it to later keep track of sidebar panel changes in NautilusWindow. * src/ntl-uri-map.c: (got_file_info_callback), (nautilus_navigation_info_free): * src/ntl-uri-map.h: * src/ntl-window-msgs.c: (nautilus_window_update_state): Exorcise the 'sidebar_panel_identifiers' member. Instead of complicating life by managing this list, simply obtain it when needed from global preferences.
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-applicable-views.c35
-rw-r--r--src/nautilus-applicable-views.h1
-rw-r--r--src/nautilus-window-manage-views.c36
-rw-r--r--src/ntl-uri-map.c35
-rw-r--r--src/ntl-uri-map.h1
-rw-r--r--src/ntl-window-msgs.c36
6 files changed, 46 insertions, 98 deletions
diff --git a/src/nautilus-applicable-views.c b/src/nautilus-applicable-views.c
index c919d5563..fb7f7d2b3 100644
--- a/src/nautilus-applicable-views.c
+++ b/src/nautilus-applicable-views.c
@@ -54,7 +54,6 @@
#include <string.h>
/* forward declarations */
-static void add_sidebar_panel_identifiers (NautilusNavigationInfo *navinfo);
static void async_get_file_info_text (GnomeVFSAsyncHandle **handle,
const char *text_uri,
GnomeVFSFileInfoOptions options,
@@ -615,8 +614,6 @@ got_file_info_callback (GnomeVFSAsyncHandle *ah,
#endif
}
- add_sidebar_panel_identifiers (navinfo);
-
/* Now that all the content_identifiers are in place, we're ready to choose
* the initial one.
*/
@@ -629,37 +626,6 @@ got_file_info_callback (GnomeVFSAsyncHandle *ah,
/* The following routine uses metadata associated with the current url to add content view components specified in the metadata */
-
-static gboolean
-sidebar_panel_preference_is_on (NautilusViewIdentifier *identifier,
- gpointer ignore)
-{
- g_assert (identifier != NULL);
- g_assert (identifier->iid != NULL);
-
- return nautilus_global_preferences_is_sidebar_panel_enabled (identifier->iid);
-}
-
-static void
-add_sidebar_panel_identifiers (NautilusNavigationInfo *navinfo)
-{
- GList *view_identifiers;
- GList *disabled_view_identifiers;
-
- g_assert (navinfo != NULL);
-
- view_identifiers = nautilus_global_preferences_get_sidebar_panel_view_identifiers ();
-
- view_identifiers = nautilus_g_list_partition (view_identifiers,
- (NautilusGPredicateFunc) sidebar_panel_preference_is_on,
- NULL,
- &disabled_view_identifiers);
-
- navinfo->sidebar_panel_identifiers = view_identifiers;
-
- nautilus_view_identifier_free_list (disabled_view_identifiers);
-}
-
static void
got_metadata_callback (NautilusDirectory *directory,
GList *files,
@@ -744,7 +710,6 @@ nautilus_navigation_info_free (NautilusNavigationInfo *info)
nautilus_navigation_info_cancel (info);
- nautilus_view_identifier_free_list (info->sidebar_panel_identifiers);
nautilus_view_identifier_free_list (info->content_identifiers);
nautilus_g_list_free_deep (info->explicit_iids);
diff --git a/src/nautilus-applicable-views.h b/src/nautilus-applicable-views.h
index 925bab73b..c05ed220c 100644
--- a/src/nautilus-applicable-views.h
+++ b/src/nautilus-applicable-views.h
@@ -60,7 +60,6 @@ struct NautilusNavigationInfo {
char *referring_iid; /* iid of content view that we're coming from */
char *initial_content_iid; /* iid to use for content view that we're going to display */
GList *content_identifiers; /* list of NautilusViewIdentifiers */
- GList *sidebar_panel_identifiers; /* list of NautilusViewIdentifiers */
GList *files; /* NautilusFile's for files in the dir, if it is one. */
GList *explicit_iids; /* IIDs explicitly mentioned in the metafile. */
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 4a3fe5f85..38aafaed2 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -44,6 +44,7 @@
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gnome-extensions.h>
#include <libnautilus-extensions/nautilus-view-identifier.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
#include "ntl-app.h"
#include "ntl-uri-map.h"
#include "ntl-window-private.h"
@@ -835,24 +836,33 @@ nautilus_window_update_state (gpointer data)
if (window->pending_ni && !window->new_content_view && !window->cv_progress_error
&& !window->view_activation_complete) {
+ GList *sidebar_panel_identifiers = NULL;
+
window->new_content_view = nautilus_window_load_content_view
(window, window->pending_ni->initial_content_iid,
&window->pending_ni->navinfo,
&window->new_requesting_view);
-
- for (p = window->pending_ni->sidebar_panel_identifiers; p != NULL; p = p->next) {
- NautilusViewFrame *meta_view;
- NautilusViewIdentifier *identifier;
-
- identifier = (NautilusViewIdentifier *) p->data;
- meta_view = nautilus_window_load_meta_view
- (window, identifier->iid, window->new_requesting_view);
- if (meta_view != NULL) {
- nautilus_view_frame_set_label (meta_view, identifier->name);
- window->new_meta_views = g_list_prepend (window->new_meta_views, meta_view);
- }
- }
+ sidebar_panel_identifiers =
+ nautilus_global_preferences_get_enabled_sidebar_panel_view_identifiers ();
+
+ if (sidebar_panel_identifiers != NULL) {
+ for (p = sidebar_panel_identifiers; p != NULL; p = p->next) {
+ NautilusViewFrame *meta_view;
+ NautilusViewIdentifier *identifier;
+
+ identifier = (NautilusViewIdentifier *) p->data;
+
+ meta_view = nautilus_window_load_meta_view
+ (window, identifier->iid, window->new_requesting_view);
+ if (meta_view != NULL) {
+ nautilus_view_frame_set_label (meta_view, identifier->name);
+ window->new_meta_views = g_list_prepend (window->new_meta_views, meta_view);
+ }
+ }
+
+ nautilus_view_identifier_free_list (sidebar_panel_identifiers);
+ }
window->view_activation_complete = TRUE;
window->made_changes++;
diff --git a/src/ntl-uri-map.c b/src/ntl-uri-map.c
index c919d5563..fb7f7d2b3 100644
--- a/src/ntl-uri-map.c
+++ b/src/ntl-uri-map.c
@@ -54,7 +54,6 @@
#include <string.h>
/* forward declarations */
-static void add_sidebar_panel_identifiers (NautilusNavigationInfo *navinfo);
static void async_get_file_info_text (GnomeVFSAsyncHandle **handle,
const char *text_uri,
GnomeVFSFileInfoOptions options,
@@ -615,8 +614,6 @@ got_file_info_callback (GnomeVFSAsyncHandle *ah,
#endif
}
- add_sidebar_panel_identifiers (navinfo);
-
/* Now that all the content_identifiers are in place, we're ready to choose
* the initial one.
*/
@@ -629,37 +626,6 @@ got_file_info_callback (GnomeVFSAsyncHandle *ah,
/* The following routine uses metadata associated with the current url to add content view components specified in the metadata */
-
-static gboolean
-sidebar_panel_preference_is_on (NautilusViewIdentifier *identifier,
- gpointer ignore)
-{
- g_assert (identifier != NULL);
- g_assert (identifier->iid != NULL);
-
- return nautilus_global_preferences_is_sidebar_panel_enabled (identifier->iid);
-}
-
-static void
-add_sidebar_panel_identifiers (NautilusNavigationInfo *navinfo)
-{
- GList *view_identifiers;
- GList *disabled_view_identifiers;
-
- g_assert (navinfo != NULL);
-
- view_identifiers = nautilus_global_preferences_get_sidebar_panel_view_identifiers ();
-
- view_identifiers = nautilus_g_list_partition (view_identifiers,
- (NautilusGPredicateFunc) sidebar_panel_preference_is_on,
- NULL,
- &disabled_view_identifiers);
-
- navinfo->sidebar_panel_identifiers = view_identifiers;
-
- nautilus_view_identifier_free_list (disabled_view_identifiers);
-}
-
static void
got_metadata_callback (NautilusDirectory *directory,
GList *files,
@@ -744,7 +710,6 @@ nautilus_navigation_info_free (NautilusNavigationInfo *info)
nautilus_navigation_info_cancel (info);
- nautilus_view_identifier_free_list (info->sidebar_panel_identifiers);
nautilus_view_identifier_free_list (info->content_identifiers);
nautilus_g_list_free_deep (info->explicit_iids);
diff --git a/src/ntl-uri-map.h b/src/ntl-uri-map.h
index 925bab73b..c05ed220c 100644
--- a/src/ntl-uri-map.h
+++ b/src/ntl-uri-map.h
@@ -60,7 +60,6 @@ struct NautilusNavigationInfo {
char *referring_iid; /* iid of content view that we're coming from */
char *initial_content_iid; /* iid to use for content view that we're going to display */
GList *content_identifiers; /* list of NautilusViewIdentifiers */
- GList *sidebar_panel_identifiers; /* list of NautilusViewIdentifiers */
GList *files; /* NautilusFile's for files in the dir, if it is one. */
GList *explicit_iids; /* IIDs explicitly mentioned in the metafile. */
diff --git a/src/ntl-window-msgs.c b/src/ntl-window-msgs.c
index 4a3fe5f85..38aafaed2 100644
--- a/src/ntl-window-msgs.c
+++ b/src/ntl-window-msgs.c
@@ -44,6 +44,7 @@
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gnome-extensions.h>
#include <libnautilus-extensions/nautilus-view-identifier.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
#include "ntl-app.h"
#include "ntl-uri-map.h"
#include "ntl-window-private.h"
@@ -835,24 +836,33 @@ nautilus_window_update_state (gpointer data)
if (window->pending_ni && !window->new_content_view && !window->cv_progress_error
&& !window->view_activation_complete) {
+ GList *sidebar_panel_identifiers = NULL;
+
window->new_content_view = nautilus_window_load_content_view
(window, window->pending_ni->initial_content_iid,
&window->pending_ni->navinfo,
&window->new_requesting_view);
-
- for (p = window->pending_ni->sidebar_panel_identifiers; p != NULL; p = p->next) {
- NautilusViewFrame *meta_view;
- NautilusViewIdentifier *identifier;
-
- identifier = (NautilusViewIdentifier *) p->data;
- meta_view = nautilus_window_load_meta_view
- (window, identifier->iid, window->new_requesting_view);
- if (meta_view != NULL) {
- nautilus_view_frame_set_label (meta_view, identifier->name);
- window->new_meta_views = g_list_prepend (window->new_meta_views, meta_view);
- }
- }
+ sidebar_panel_identifiers =
+ nautilus_global_preferences_get_enabled_sidebar_panel_view_identifiers ();
+
+ if (sidebar_panel_identifiers != NULL) {
+ for (p = sidebar_panel_identifiers; p != NULL; p = p->next) {
+ NautilusViewFrame *meta_view;
+ NautilusViewIdentifier *identifier;
+
+ identifier = (NautilusViewIdentifier *) p->data;
+
+ meta_view = nautilus_window_load_meta_view
+ (window, identifier->iid, window->new_requesting_view);
+ if (meta_view != NULL) {
+ nautilus_view_frame_set_label (meta_view, identifier->name);
+ window->new_meta_views = g_list_prepend (window->new_meta_views, meta_view);
+ }
+ }
+
+ nautilus_view_identifier_free_list (sidebar_panel_identifiers);
+ }
window->view_activation_complete = TRUE;
window->made_changes++;