Two Updated Patches (for rev14329) / a missing header
- From: Christopher Bratusek <nano-master gmx de>
- To: nautilus-list gnome org
- Subject: Two Updated Patches (for rev14329) / a missing header
- Date: Wed, 09 Jul 2008 08:49:27 +0200
Hi,
I just checked out the svn and saw the the multiview branch has finally
been merged :) .
Two of the patches around here didn't apply correctly after the merge, I
didn't fix the hunks which still applied with offsets, just the ones
which didn't apply anymore. The original versions have been posted on
the mailing-list, but I can't remember who made them atm.
Furthermore libnautilus-private/nautilus-window-slot-info.h is missing
in rev14329, please add it.
Chris
Index: src/nautilus-navigation-window.c
===================================================================
--- src/nautilus-navigation-window.c (revision 14227)
+++ src/nautilus-navigation-window.c (working copy)
@@ -64,6 +64,7 @@
#include <libnautilus-private/nautilus-file-attributes.h>
#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-horizontal-splitter.h>
+#include <libnautilus-private/nautilus-vertical-splitter.h>
#include <libnautilus-private/nautilus-icon-info.h>
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-mime-actions.h>
@@ -104,7 +105,8 @@ enum {
static int side_pane_width_auto_value = 0;
-static void add_sidebar_panels (NautilusNavigationWindow *window);
+static void add_sidebar_panels (NautilusNavigationWindow *window, NautilusSidePanelInstance *sidebaritem);
+static NautilusSidePanelInstance * get_sidepanelinstance_for_sidebar(NautilusNavigationWindow *window, NautilusSidebar *side_panel);
static void load_view_as_menu (NautilusWindow *window);
static void side_panel_image_changed_callback (NautilusSidebar *side_panel,
gpointer callback_data);
@@ -501,6 +503,13 @@ side_pane_close_requested_callback (GtkW
}
static void
+side_pane_minimize_bottom_requested_callback (GtkWidget *widget,
+ gpointer user_data)
+{
+ nautilus_vertical_splitter_collapse(NAUTILUS_VERTICAL_SPLITTER (user_data));
+}
+
+static void
side_pane_size_allocate_callback (GtkWidget *widget,
GtkAllocation *allocation,
gpointer user_data)
@@ -524,7 +533,7 @@ setup_side_pane_width (NautilusNavigatio
{
static gboolean setup_auto_value= TRUE;
- g_return_if_fail (window->sidebar != NULL);
+ g_return_if_fail (window->sidepanelinstances != NULL);
if (setup_auto_value) {
setup_auto_value = FALSE;
@@ -559,12 +568,135 @@ set_current_side_panel (NautilusNavigati
eel_add_weak_pointer (&window->details->current_side_panel);
}
+/**
+ * Find a the sidepanel instance associated with the given sidebar
+ */
+static NautilusSidePanelInstance *
+get_sidepanelinstance_for_sidebar(NautilusNavigationWindow *window, NautilusSidebar *side_panel)
+{
+ NautilusSidePanelInstance *sidepanelinstance;
+ GList *node, *next;
+
+ for (node = window->sidepanelinstances; node != NULL; node = next) {
+ next = node->next;
+
+ sidepanelinstance = NAUTILUS_SIDEPANEL_INSTANCE (node->data);
+
+ if (g_list_index (sidepanelinstance->sidebar_panels, side_panel) != -1) {
+ return sidepanelinstance;
+ }
+ }
+
+ return NULL;
+}
+
+/**
+ * Save the sidebar id of each sidepanelinstance which is loaded, in order. These may later be read by index
+ * to determine the preferred sidebar id of a given sidepanelinstance.
+ */
+static void
+side_pane_view_preferences_save(NautilusNavigationWindow *window, NautilusSidebar *set_current_sidebar)
+{
+ NautilusSidePanelInstance *sidepanelinstance;
+ NautilusSidePanelInstance *sidebar_sidepanelinstance;
+ char **ids;
+ GPtrArray *new_ids;
+ int index, current_id_index, change_index;
+ char *sidebar_id;
+ GList *node, *next;
+
+ g_return_if_fail (window->sidepanelinstances != NULL);
+
+ new_ids = g_ptr_array_new ();
+ ids = eel_preferences_get_string_array (NAUTILUS_PREFERENCES_SIDE_PANE_VIEWS);
+ sidebar_sidepanelinstance = get_sidepanelinstance_for_sidebar(window, set_current_sidebar);
+ change_index = g_list_index(window->sidepanelinstances, sidebar_sidepanelinstance);
+ sidebar_id = g_strdup (nautilus_sidebar_get_sidebar_id (set_current_sidebar));
+
+ // Now loop through the list of sidepanel instances and set something on each one
+ current_id_index = 0;
+ for (node = window->sidepanelinstances, index = 0; node != NULL; node = next, index++) {
+ next = node->next;
+ sidepanelinstance = NAUTILUS_SIDEPANEL_INSTANCE (node->data);
+
+ if (index == change_index && sidebar_id) {
+ g_ptr_array_add (new_ids, sidebar_id);
+ }
+ else if (ids && ids[current_id_index]) {
+ g_ptr_array_add (new_ids, ids[current_id_index]);
+ }
+ else {
+ g_ptr_array_add (new_ids, "");
+ }
+ if (ids && ids[current_id_index]) {
+ current_id_index++;
+ }
+ }
+ // Add a NULL element as a terminator
+ g_ptr_array_add (new_ids, NULL);
+
+ eel_preferences_set_string_array (NAUTILUS_PREFERENCES_SIDE_PANE_VIEWS, (char **)new_ids->pdata);
+ g_ptr_array_free (new_ids, TRUE);
+ if (ids) {
+ g_strfreev (ids);
+ }
+ g_free (sidebar_id);
+}
+
+static char *
+get_side_pane_default_id(NautilusNavigationWindow *window, NautilusSidePanelInstance *sidepanelinstance)
+{
+ char **ids;
+ int desired_index, current_id_index;
+ char *default_id;
+
+ default_id = NULL;
+
+ if (window->sidepanelinstances == NULL)
+ return NULL;
+
+ desired_index = g_list_index(window->sidepanelinstances, sidepanelinstance);
+
+ if (desired_index == -1)
+ return NULL;
+
+ ids = eel_preferences_get_string_array (NAUTILUS_PREFERENCES_SIDE_PANE_VIEWS);
+ if (ids) {
+ // Loop through the ids until either the one matching the desired index is found, or the NULL terminator is hit
+ for (current_id_index = 0; current_id_index <= desired_index && ids[current_id_index]; current_id_index++) {
+ if (current_id_index == desired_index) {
+ default_id = g_strdup (ids[desired_index]);
+ }
+ }
+ g_strfreev (ids);
+ }
+ return default_id;
+}
+
+static void
+show_side_pane_if_default(
+ NautilusNavigationWindow *window,
+ NautilusSidePanelInstance *sidepanelinstance,
+ NautilusSidebar *sidebar_panel,
+ const char *default_id)
+{
+ const char *sidebar_id;
+
+ g_return_if_fail (window->sidepanelinstances != NULL);
+
+ sidebar_id = nautilus_sidebar_get_sidebar_id (sidebar_panel);
+
+ // Finally, show the panel, if it matches the given sidebar's id
+ if (sidebar_id && default_id && !strcmp (sidebar_id, default_id)) {
+ nautilus_side_pane_show_panel (sidepanelinstance->sidepane, GTK_WIDGET (sidebar_panel));
+ }
+}
+
static void
side_pane_switch_page_callback (NautilusSidePane *side_pane,
GtkWidget *widget,
NautilusNavigationWindow *window)
{
- const char *id;
NautilusSidebar *sidebar;
sidebar = NAUTILUS_SIDEBAR (widget);
@@ -572,66 +704,121 @@ side_pane_switch_page_callback (Nautilus
if (sidebar == NULL) {
return;
}
-
+
set_current_side_panel (window, sidebar);
-
- id = nautilus_sidebar_get_sidebar_id (sidebar);
- if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW)) {
- eel_preferences_set (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW, id);
- }
+ side_pane_view_preferences_save(window, sidebar);
}
static void
nautilus_navigation_window_set_up_sidebar (NautilusNavigationWindow *window)
{
- window->sidebar = nautilus_side_pane_new ();
-
- gtk_paned_pack1 (GTK_PANED (window->details->content_paned),
- GTK_WIDGET (window->sidebar),
- FALSE, TRUE);
-
+ NautilusSidePanelInstance *top_sidepanelinstance;
+ NautilusSidePanelInstance *bottom_sidepanelinstance;
+ GtkWidget *vpaned;
+
+ g_return_if_fail (window->sidepanelinstances == NULL);
+
+ top_sidepanelinstance = nautilus_sidepanel_instance_new ();
+ top_sidepanelinstance->sidepane = nautilus_side_pane_new ();
+ bottom_sidepanelinstance = nautilus_sidepanel_instance_new ();
+ bottom_sidepanelinstance->sidepane = nautilus_side_pane_new ();
+
+ window->sidepanelinstances = g_list_append (window->sidepanelinstances, g_object_ref (top_sidepanelinstance));
+ window->sidepanelinstances = g_list_append (window->sidepanelinstances, g_object_ref (bottom_sidepanelinstance));
+
+ // Add the vpaned to manage the split top/bottom panels
+ vpaned = nautilus_vertical_splitter_new ();
+ top_sidepanelinstance->nextcontainer = vpaned;
+
+ nautilus_vertical_splitter_pack1 (NAUTILUS_VERTICAL_SPLITTER (vpaned), GTK_WIDGET (top_sidepanelinstance->sidepane));
+ nautilus_vertical_splitter_pack2 (NAUTILUS_VERTICAL_SPLITTER (vpaned), GTK_WIDGET (bottom_sidepanelinstance->sidepane));
+ nautilus_vertical_splitter_position_preference_name(NAUTILUS_VERTICAL_SPLITTER (vpaned), NAUTILUS_PREFERENCES_SIDE_PANE_POSITIONS, TRUE);
+ nautilus_vertical_splitter_set_toggle_up(NAUTILUS_VERTICAL_SPLITTER (vpaned), FALSE);
+ gtk_widget_show (vpaned);
+
+ // Add the sidebar splitter to the content pane
+ gtk_paned_pack1 (GTK_PANED (window->details->content_paned), GTK_WIDGET (vpaned), FALSE, TRUE);
+
setup_side_pane_width (window);
- g_signal_connect (window->sidebar,
+
+ // Init top bar
+ g_signal_connect (top_sidepanelinstance->sidepane,
"size_allocate",
G_CALLBACK (side_pane_size_allocate_callback),
window);
- add_sidebar_panels (window);
+ add_sidebar_panels (window, top_sidepanelinstance);
- g_signal_connect (window->sidebar,
+ g_signal_connect (top_sidepanelinstance->sidepane,
"close_requested",
G_CALLBACK (side_pane_close_requested_callback),
window);
- g_signal_connect (window->sidebar,
+ g_signal_connect (top_sidepanelinstance->sidepane,
+ "switch_page",
+ G_CALLBACK (side_pane_switch_page_callback),
+ window);
+
+ gtk_widget_show (GTK_WIDGET (top_sidepanelinstance->sidepane));
+
+ // Init bottom bar
+
+ add_sidebar_panels (window, bottom_sidepanelinstance);
+
+ g_signal_connect (bottom_sidepanelinstance->sidepane,
+ "close_requested",
+ G_CALLBACK (side_pane_minimize_bottom_requested_callback),
+ vpaned);
+
+ g_signal_connect (bottom_sidepanelinstance->sidepane,
"switch_page",
G_CALLBACK (side_pane_switch_page_callback),
window);
- gtk_widget_show (GTK_WIDGET (window->sidebar));
+ gtk_widget_show (GTK_WIDGET (bottom_sidepanelinstance->sidepane));
}
static void
-nautilus_navigation_window_tear_down_sidebar (NautilusNavigationWindow *window)
+nautilus_navigation_window_tear_down_sidepanelinstance (NautilusSidePanelInstance *sidepanelinstance, NautilusNavigationWindow *window)
{
GList *node, *next;
NautilusSidebar *sidebar_panel;
- g_signal_handlers_disconnect_by_func (window->sidebar,
+ g_return_if_fail (sidepanelinstance != NULL);
+
+ g_signal_handlers_disconnect_by_func (sidepanelinstance->sidepane,
side_pane_switch_page_callback,
window);
- for (node = window->sidebar_panels; node != NULL; node = next) {
+ for (node = sidepanelinstance->sidebar_panels; node != NULL; node = next) {
next = node->next;
sidebar_panel = NAUTILUS_SIDEBAR (node->data);
nautilus_navigation_window_remove_sidebar_panel (window,
+ sidepanelinstance,
sidebar_panel);
}
- gtk_widget_destroy (GTK_WIDGET (window->sidebar));
- window->sidebar = NULL;
+ gtk_widget_destroy (GTK_WIDGET (sidepanelinstance->sidepane));
+ // Destroy the container used for grouping a set of panel instances, if defined. The last instance won't have one of these
+ if (sidepanelinstance->nextcontainer != NULL) {
+ gtk_widget_destroy (GTK_WIDGET (sidepanelinstance->nextcontainer));
+ }
+
+ sidepanelinstance->sidepane = NULL;
+ g_object_unref (sidepanelinstance);
+}
+
+static void
+nautilus_navigation_window_tear_down_sidebar (NautilusNavigationWindow *window)
+{
+ if (window->sidepanelinstances != NULL) {
+ // Tear down the instances in reverse order to handle the nextcontainer tree
+ g_list_foreach (g_list_reverse (window->sidepanelinstances), (GFunc)nautilus_navigation_window_tear_down_sidepanelinstance, window);
+ g_list_free (window->sidepanelinstances);
+ window->sidepanelinstances = NULL;
+ }
}
static void
@@ -697,10 +884,9 @@ nautilus_navigation_window_destroy (GtkO
window = NAUTILUS_NAVIGATION_WINDOW (object);
- window->sidebar = NULL;
- g_list_foreach (window->sidebar_panels, (GFunc)g_object_unref, NULL);
- g_list_free (window->sidebar_panels);
- window->sidebar_panels = NULL;
+ if (window->sidepanelinstances != NULL) {
+ nautilus_navigation_window_tear_down_sidebar(window);
+ }
window->view_as_combo_box = NULL;
window->navigation_bar = NULL;
@@ -729,25 +915,24 @@ nautilus_navigation_window_finalize (GOb
/*
* Main API
*/
-
void
nautilus_navigation_window_add_sidebar_panel (NautilusNavigationWindow *window,
- NautilusSidebar *sidebar_panel)
+ NautilusSidePanelInstance *sidepanelinstance,
+ NautilusSidebar *sidebar_panel,
+ const char *default_sidebar_id)
{
- const char *sidebar_id;
char *label;
char *tooltip;
- char *default_id;
GdkPixbuf *icon;
g_return_if_fail (NAUTILUS_IS_NAVIGATION_WINDOW (window));
g_return_if_fail (NAUTILUS_IS_SIDEBAR (sidebar_panel));
- g_return_if_fail (NAUTILUS_IS_SIDE_PANE (window->sidebar));
- g_return_if_fail (g_list_find (window->sidebar_panels, sidebar_panel) == NULL);
+ g_return_if_fail (NAUTILUS_IS_SIDE_PANE (sidepanelinstance->sidepane));
+ g_return_if_fail (g_list_find (sidepanelinstance->sidebar_panels, sidebar_panel) == NULL);
label = nautilus_sidebar_get_tab_label (sidebar_panel);
tooltip = nautilus_sidebar_get_tab_tooltip (sidebar_panel);
- nautilus_side_pane_add_panel (window->sidebar,
+ nautilus_side_pane_add_panel (sidepanelinstance->sidepane,
GTK_WIDGET (sidebar_panel),
label,
tooltip);
@@ -755,7 +940,7 @@ nautilus_navigation_window_add_sidebar_p
g_free (label);
icon = nautilus_sidebar_get_tab_icon (sidebar_panel);
- nautilus_side_pane_set_panel_image (NAUTILUS_NAVIGATION_WINDOW (window)->sidebar,
+ nautilus_side_pane_set_panel_image (sidepanelinstance->sidepane,
GTK_WIDGET (sidebar_panel),
icon);
if (icon) {
@@ -765,35 +950,30 @@ nautilus_navigation_window_add_sidebar_p
g_signal_connect (sidebar_panel, "tab_icon_changed",
(GCallback)side_panel_image_changed_callback, window);
- window->sidebar_panels = g_list_prepend (window->sidebar_panels,
+ sidepanelinstance->sidebar_panels = g_list_prepend (sidepanelinstance->sidebar_panels,
g_object_ref (sidebar_panel));
/* Show if default */
- sidebar_id = nautilus_sidebar_get_sidebar_id (sidebar_panel);
- default_id = eel_preferences_get (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW);
- if (sidebar_id && default_id && !strcmp (sidebar_id, default_id)) {
- nautilus_side_pane_show_panel (window->sidebar,
- GTK_WIDGET (sidebar_panel));
- }
- g_free (default_id);
+ show_side_pane_if_default(window, sidepanelinstance, sidebar_panel, default_sidebar_id);
}
void
nautilus_navigation_window_remove_sidebar_panel (NautilusNavigationWindow *window,
+ NautilusSidePanelInstance *sidepanelinstance,
NautilusSidebar *sidebar_panel)
{
g_return_if_fail (NAUTILUS_IS_NAVIGATION_WINDOW (window));
g_return_if_fail (NAUTILUS_IS_SIDEBAR (sidebar_panel));
- if (g_list_find (window->sidebar_panels, sidebar_panel) == NULL) {
+ if (g_list_find (sidepanelinstance->sidebar_panels, sidebar_panel) == NULL) {
return;
}
g_signal_handlers_disconnect_by_func (sidebar_panel, side_panel_image_changed_callback, window);
- nautilus_side_pane_remove_panel (window->sidebar,
+ nautilus_side_pane_remove_panel (sidepanelinstance->sidepane,
GTK_WIDGET (sidebar_panel));
- window->sidebar_panels = g_list_remove (window->sidebar_panels, sidebar_panel);
+ sidepanelinstance->sidebar_panels = g_list_remove (sidepanelinstance->sidebar_panels, sidebar_panel);
g_object_unref (sidebar_panel);
}
@@ -1208,15 +1388,22 @@ static void
side_panel_image_changed_callback (NautilusSidebar *side_panel,
gpointer callback_data)
{
- NautilusWindow *window;
+ NautilusWindow *window;
GdkPixbuf *icon;
- window = NAUTILUS_WINDOW (callback_data);
+ window = NAUTILUS_WINDOW (callback_data);
icon = nautilus_sidebar_get_tab_icon (side_panel);
- nautilus_side_pane_set_panel_image (NAUTILUS_NAVIGATION_WINDOW (window)->sidebar,
+
+ NautilusSidePanelInstance *sidepanelinstance;
+ sidepanelinstance = get_sidepanelinstance_for_sidebar (NAUTILUS_NAVIGATION_WINDOW (window), side_panel);
+
+ if (sidepanelinstance != NULL) {
+ nautilus_side_pane_set_panel_image (sidepanelinstance->sidepane,
GTK_WIDGET (side_panel),
icon);
+ }
+
if (icon != NULL) {
g_object_unref (icon);
}
@@ -1230,20 +1417,22 @@ side_panel_image_changed_callback (Nauti
*
*/
static void
-add_sidebar_panels (NautilusNavigationWindow *window)
+add_sidebar_panels (NautilusNavigationWindow *window, NautilusSidePanelInstance *sidepanelinstance)
{
GtkWidget *current;
GList *providers;
GList *p;
NautilusSidebar *sidebar_panel;
+ char *default_id;
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
- if (window->sidebar == NULL) {
+ if (sidepanelinstance->sidepane == NULL) {
return;
}
providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_SIDEBAR_PROVIDER);
+ default_id = get_side_pane_default_id(window, sidepanelinstance);
for (p = providers; p != NULL; p = p->next) {
NautilusSidebarProvider *provider;
@@ -1253,17 +1442,20 @@ add_sidebar_panels (NautilusNavigationWi
sidebar_panel = nautilus_sidebar_provider_create (provider,
NAUTILUS_WINDOW_INFO (window));
nautilus_navigation_window_add_sidebar_panel (window,
- sidebar_panel);
+ sidepanelinstance,
+ sidebar_panel,
+ default_id);
g_object_unref (sidebar_panel);
}
nautilus_module_extension_list_free (providers);
-
- current = nautilus_side_pane_get_current_panel (window->sidebar);
- set_current_side_panel
- (window,
- NAUTILUS_SIDEBAR (current));
+ current = nautilus_side_pane_get_current_panel (sidepanelinstance->sidepane);
+ set_current_side_panel(window, NAUTILUS_SIDEBAR (current));
+
+ if (default_id) {
+ g_free (default_id);
+ }
}
void
@@ -1415,7 +1607,7 @@ nautilus_navigation_window_show_toolbar
void
nautilus_navigation_window_hide_sidebar (NautilusNavigationWindow *window)
{
- if (window->sidebar == NULL) {
+ if (window->sidepanelinstances == NULL) {
return;
}
@@ -1431,7 +1623,7 @@ nautilus_navigation_window_hide_sidebar
void
nautilus_navigation_window_show_sidebar (NautilusNavigationWindow *window)
{
- if (window->sidebar != NULL) {
+ if (window->sidepanelinstances != NULL) {
return;
}
@@ -1448,7 +1640,7 @@ nautilus_navigation_window_sidebar_showi
{
g_return_val_if_fail (NAUTILUS_IS_NAVIGATION_WINDOW (window), FALSE);
- return (window->sidebar != NULL)
+ return (window->sidepanelinstances != NULL)
&& nautilus_horizontal_splitter_is_hidden (NAUTILUS_HORIZONTAL_SPLITTER (window->details->content_paned));
}
Index: src/nautilus-navigation-window.h
===================================================================
--- src/nautilus-navigation-window.h (revision 14227)
+++ src/nautilus-navigation-window.h (working copy)
@@ -39,6 +39,7 @@
#include "nautilus-information-panel.h"
#include "nautilus-side-pane.h"
#include "nautilus-window.h"
+#include "nautilus-sidepanel-instance.h"
#define NAUTILUS_TYPE_NAVIGATION_WINDOW (nautilus_navigation_window_get_type())
#define NAUTILUS_NAVIGATION_WINDOW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_NAVIGATION_WINDOW, NautilusNavigationWindow))
@@ -56,7 +57,7 @@ struct _NautilusNavigationWindow {
NautilusNavigationWindowDetails *details;
/** UI stuff **/
- NautilusSidePane *sidebar;
+ GList *sidepanelinstances;
GtkWidget *view_as_combo_box;
GtkWidget *navigation_bar;
GtkWidget *path_bar;
@@ -67,9 +68,6 @@ struct _NautilusNavigationWindow {
GtkWidget *search_bar;
GtkWidget *notebook;
- /* Current views stuff */
- GList *sidebar_panels;
-
/* Widgets to keep track of (for state changes, etc) */
GtkWidget *zoom_control;
};
@@ -107,8 +105,11 @@ void nautilus_navigation_window_hide
void nautilus_navigation_window_show_sidebar (NautilusNavigationWindow *window);
gboolean nautilus_navigation_window_sidebar_showing (NautilusNavigationWindow *window);
void nautilus_navigation_window_add_sidebar_panel (NautilusNavigationWindow *window,
- NautilusSidebar *sidebar_panel);
+ NautilusSidePanelInstance *sidebaritem,
+ NautilusSidebar *sidebar_panel,
+ const char *default_id);
void nautilus_navigation_window_remove_sidebar_panel (NautilusNavigationWindow *window,
+ NautilusSidePanelInstance *sidebaritem,
NautilusSidebar *sidebar_panel);
void nautilus_navigation_window_hide_status_bar (NautilusNavigationWindow *window);
void nautilus_navigation_window_show_status_bar (NautilusNavigationWindow *window);
Index: src/nautilus-sidepanel-instance.c
===================================================================
--- src/nautilus-sidepanel-instance.c (revision 0)
+++ src/nautilus-sidepanel-instance.c (revision 0)
@@ -0,0 +1,56 @@
+/*
+ * Nautilus
+ * nautilus-sidepanel-list.c: a list of side panels bar content items
+ *
+ * Nautilus is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Nautilus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Daren C. Robbins
+ */
+
+#include "nautilus-sidepanel-instance.h"
+
+G_DEFINE_TYPE(NautilusSidePanelInstance, nautilus_sidepanel_instance, GTK_TYPE_OBJECT)
+
+/**
+ * Called (by glib) to initialize the class
+ */
+static void
+nautilus_sidepanel_instance_class_init (NautilusSidePanelInstanceClass *class)
+{
+ /* nothing to do here yet */
+}
+
+/**
+ * Called (by glib) to initialize the instance
+ */
+static void
+nautilus_sidepanel_instance_init (NautilusSidePanelInstance *instance)
+{
+ /* nothing to do here yet */
+}
+
+/**
+ * Create a new gobject for this panel instance
+ */
+NautilusSidePanelInstance *
+nautilus_sidepanel_instance_new (void)
+{
+ NautilusSidePanelInstance *instance;
+ instance = NAUTILUS_SIDEPANEL_INSTANCE (g_object_new (NAUTILUS_TYPE_SIDEPANEL_INSTANCE, NULL));
+
+ return instance;
+}
+
+
Index: src/nautilus-sidepanel-instance.h
===================================================================
--- src/nautilus-sidepanel-instance.h (revision 0)
+++ src/nautilus-sidepanel-instance.h (revision 0)
@@ -0,0 +1,52 @@
+/*
+ * Nautilus
+ * nautilus-sidepanel-list.h: a list of side panels bar content items
+ *
+ * Nautilus is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Nautilus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Daren C. Robbins
+ */
+
+
+#ifndef NAUTILUS_SIDEPANEL_INSTANCE_H
+#define NAUTILUS_SIDEPANEL_INSTANCE_H
+
+#include "nautilus-side-pane.h"
+#include "nautilus-window.h"
+
+typedef struct NautilusSidePanelInstance NautilusSidePanelInstance;
+typedef struct NautilusSidePanelInstanceClass NautilusSidePanelInstanceClass;
+
+#define NAUTILUS_TYPE_SIDEPANEL_INSTANCE (nautilus_sidepanel_instance_get_type ())
+#define NAUTILUS_SIDEPANEL_INSTANCE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SIDEPANEL_INSTANCE, NautilusSidePanelInstance))
+#define NAUTILUS_SIDEPANEL_INSTANCE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SIDEPANEL_INSTANCE, NautilusSidePanelInstanceClass))
+#define NAUTILUS_IS_SIDEPANEL_INSTANCE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SIDEPANEL_INSTANCE))
+#define NAUTILUS_IS_SIDEPANEL_INSTANCE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_SIDEPANEL_INSTANCE))
+
+struct NautilusSidePanelInstance {
+ GtkObject object;
+ NautilusSidePane *sidepane;
+ GtkWidget *nextcontainer;
+ GList *sidebar_panels;
+};
+
+struct NautilusSidePanelInstanceClass {
+ GtkObjectClass parent_class;
+};
+
+GType nautilus_sidepanel_instance_get_type (void);
+NautilusSidePanelInstance * nautilus_sidepanel_instance_new (void);
+
+#endif /* NAUTILUS_SIDEPANEL_INSTANCE_H */
Property changes on: src/nautilus-sidepanel-instance.h
___________________________________________________________________
Name: svn:executable
+ *
Index: src/nautilus-places-sidebar.c
===================================================================
--- src/nautilus-places-sidebar.c (revision 14227)
+++ src/nautilus-places-sidebar.c (working copy)
@@ -253,6 +253,38 @@ update_places (NautilusPlacesSidebar *si
gtk_list_store_clear (sidebar->store);
location = nautilus_window_info_get_current_location (sidebar->window);
+ /* add bookmarks */
+
+ bookmark_count = nautilus_bookmark_list_length (sidebar->bookmarks);
+ for (index = 0; index < bookmark_count; ++index) {
+ bookmark = nautilus_bookmark_list_item_at (sidebar->bookmarks, index);
+
+ if (nautilus_bookmark_uri_known_not_to_exist (bookmark)) {
+ continue;
+ }
+
+ name = nautilus_bookmark_get_name (bookmark);
+ icon = nautilus_bookmark_get_icon (bookmark);
+ mount_uri = nautilus_bookmark_get_uri (bookmark);
+ last_iter = add_place (sidebar, PLACES_BOOKMARK,
+ name, icon, mount_uri,
+ NULL, NULL, NULL, index);
+ if (strcmp (location, mount_uri) == 0) {
+ gtk_tree_selection_select_iter (selection, &last_iter);
+ }
+ g_free (name);
+ g_object_unref (icon);
+ g_free (mount_uri);
+ }
+ g_free (location);
+
+ /* add separator */
+
+ gtk_list_store_append (sidebar->store, &iter);
+ gtk_list_store_set (sidebar->store, &iter,
+ PLACES_SIDEBAR_COLUMN_ROW_TYPE, PLACES_SEPARATOR,
+ -1);
+
/* add built in bookmarks */
desktop_path = nautilus_get_desktop_directory ();
@@ -308,7 +340,7 @@ update_places (NautilusPlacesSidebar *si
volume = ll->data;
mount = g_volume_get_mount (volume);
if (mount != NULL) {
- /* Show mounted volume in the sidebar */
+ /* Show m ounted volume in the sidebar */
icon = g_mount_get_icon (mount);
root = g_mount_get_root (mount);
mount_uri = g_file_get_uri (root);
@@ -494,37 +494,6 @@
}
g_object_unref (icon);
- /* add separator */
-
- gtk_list_store_append (sidebar->store, &iter);
- gtk_list_store_set (sidebar->store, &iter,
- PLACES_SIDEBAR_COLUMN_ROW_TYPE, PLACES_SEPARATOR,
- -1);
-
- /* add bookmarks */
-
- bookmark_count = nautilus_bookmark_list_length (sidebar->bookmarks);
- for (index = 0; index < bookmark_count; ++index) {
- bookmark = nautilus_bookmark_list_item_at (sidebar->bookmarks, index);
-
- if (nautilus_bookmark_uri_known_not_to_exist (bookmark)) {
- continue;
- }
-
- name = nautilus_bookmark_get_name (bookmark);
- icon = nautilus_bookmark_get_icon (bookmark);
- mount_uri = nautilus_bookmark_get_uri (bookmark);
- last_iter = add_place (sidebar, PLACES_BOOKMARK,
- name, icon, mount_uri,
- NULL, NULL, NULL, index);
- if (eel_strcmp (location, mount_uri) == 0) {
- gtk_tree_selection_select_iter (selection, &last_iter);
- }
- g_free (name);
- g_object_unref (icon);
- g_free (mount_uri);
- }
- g_free (location);
}
static gboolean
Index: src/Makefile.am
===================================================================
--- src/Makefile.am (revision 14227)
+++ src/Makefile.am (working copy)
@@ -116,6 +116,8 @@ nautilus_SOURCES = \
nautilus-shell.h \
nautilus-side-pane.c \
nautilus-side-pane.h \
+ nautilus-sidepanel-instance.c \
+ nautilus-sidepanel-instance.h \
nautilus-sidebar-title.c \
nautilus-sidebar-title.h \
nautilus-spatial-window.c \
Index: libnautilus-private/nautilus-vertical-splitter.c
===================================================================
--- libnautilus-private/nautilus-vertical-splitter.c (revision 0)
+++ libnautilus-private/nautilus-vertical-splitter.c (revision 0)
@@ -0,0 +1,367 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-vertical-splitter.c - A vertical splitter with a semi gradient look
+
+ The Gnome Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Author: Daren C. Robbins
+*/
+
+#include <config.h>
+#include "nautilus-vertical-splitter.h"
+#include "nautilus-global-preferences.h"
+#include <eel/eel-gtk-macros.h>
+#include <stdlib.h>
+
+struct NautilusVerticalSplitterDetails {
+ double press_x;
+ guint32 press_time;
+ int press_position;
+ int saved_size;
+};
+
+#define CLOSED_THRESHOLD 4
+#define NOMINAL_SIZE 148
+#define SPLITTER_CLICK_SLOP 1
+#define SPLITTER_CLICK_TIMEOUT 400
+
+static void nautilus_vertical_splitter_class_init (NautilusVerticalSplitterClass *vertical_splitter_class);
+static void nautilus_vertical_splitter_init (NautilusVerticalSplitter *vertical_splitter);
+
+EEL_CLASS_BOILERPLATE (NautilusVerticalSplitter,
+ nautilus_vertical_splitter,
+ GTK_TYPE_VPANED)
+
+static void
+nautilus_vertical_splitter_init (NautilusVerticalSplitter *vertical_splitter)
+{
+ vertical_splitter->details = g_new0 (NautilusVerticalSplitterDetails, 1);
+}
+
+static void
+nautilus_vertical_splitter_finalize (GObject *object)
+{
+ NautilusVerticalSplitter *vertical_splitter;
+
+ vertical_splitter = NAUTILUS_VERTICAL_SPLITTER (object);
+
+ g_free (vertical_splitter->details);
+
+ EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
+}
+
+static gboolean splitter_position_within_closed_threshold(NautilusVerticalSplitter *splitter, int position)
+{
+ if (splitter->toggle_up) {
+ return position < CLOSED_THRESHOLD;
+ } else {
+ return position > (GTK_PANED (splitter)->max_position - CLOSED_THRESHOLD);
+ }
+}
+
+static void
+save_position_preference(NautilusVerticalSplitter *splitter, int position)
+{
+ if (splitter->position_preference_name) {
+ // If it's within the closed threshold, store a fully-closed value
+ if (splitter_position_within_closed_threshold(splitter, position)) {
+ if (splitter->toggle_up) {
+ position = 0;
+ } else {
+ position = INT_MAX;
+ }
+ }
+
+ eel_preferences_set_integer(splitter->position_preference_name, position);
+ }
+}
+
+static void
+splitter_expand (NautilusVerticalSplitter *splitter, int position)
+{
+ g_return_if_fail (NAUTILUS_IS_VERTICAL_SPLITTER (splitter));
+
+ if (!splitter_position_within_closed_threshold(splitter, position)) {
+ return;
+ }
+
+ position = splitter->details->saved_size;
+ if (position == 0 || splitter_position_within_closed_threshold(splitter, position)) {
+ position = NOMINAL_SIZE;
+ }
+
+ gtk_paned_set_position (GTK_PANED (splitter), position);
+ save_position_preference(splitter, position);
+}
+
+static void
+splitter_collapse (NautilusVerticalSplitter *splitter, int position)
+{
+ g_return_if_fail (NAUTILUS_IS_VERTICAL_SPLITTER (splitter));
+
+ splitter->details->saved_size = position;
+ if (splitter->toggle_up) {
+ position = 0;
+ } else {
+ position = INT_MAX;
+ }
+
+ gtk_paned_set_position (GTK_PANED (splitter), position);
+ save_position_preference(splitter, position);
+}
+
+static void
+splitter_toggle (NautilusVerticalSplitter *splitter, int position)
+{
+ g_return_if_fail (NAUTILUS_IS_VERTICAL_SPLITTER (splitter));
+
+ if (!splitter_position_within_closed_threshold(splitter, gtk_paned_get_position (GTK_PANED (splitter)))) {
+ nautilus_vertical_splitter_collapse (splitter);
+ } else {
+ nautilus_vertical_splitter_expand (splitter);
+ }
+}
+
+static void
+splitter_hide (NautilusVerticalSplitter *splitter)
+{
+ GtkPaned *parent;
+
+ parent = GTK_PANED (splitter);
+
+ gtk_widget_hide (parent->child1);
+}
+
+static void
+splitter_show (NautilusVerticalSplitter *splitter)
+{
+ GtkPaned *parent;
+
+ parent = GTK_PANED (splitter);
+
+ gtk_widget_show (parent->child1);
+}
+
+static gboolean
+splitter_is_hidden (NautilusVerticalSplitter *splitter)
+{
+ GtkPaned *parent;
+
+ parent = GTK_PANED (splitter);
+
+ return GTK_WIDGET_VISIBLE (parent->child1);
+}
+
+void
+nautilus_vertical_splitter_expand (NautilusVerticalSplitter *splitter)
+{
+ splitter_expand (splitter, gtk_paned_get_position (GTK_PANED (splitter)));
+}
+
+void
+nautilus_vertical_splitter_hide (NautilusVerticalSplitter *splitter)
+{
+ splitter_hide (splitter);
+}
+
+void
+nautilus_vertical_splitter_show (NautilusVerticalSplitter *splitter)
+{
+ splitter_show (splitter);
+};
+
+gboolean
+nautilus_vertical_splitter_is_hidden (NautilusVerticalSplitter *splitter)
+{
+ return splitter_is_hidden (splitter);
+}
+
+void
+nautilus_vertical_splitter_collapse (NautilusVerticalSplitter *splitter)
+{
+ splitter_collapse (splitter, gtk_paned_get_position (GTK_PANED (splitter)));
+}
+
+/* routine to toggle the open/closed state of the splitter */
+void
+nautilus_vertical_splitter_toggle_position (NautilusVerticalSplitter *splitter)
+{
+ splitter_toggle (splitter, gtk_paned_get_position (GTK_PANED (splitter)));
+}
+
+/* Indicate whether this splitter toggles up (true) or down (false) */
+void nautilus_vertical_splitter_set_toggle_up (NautilusVerticalSplitter *splitter, gboolean toggle_up)
+{
+ splitter->toggle_up = toggle_up;
+}
+
+/* Indicate the name of the preference attribute to use to store/load the position of this splitter */
+void nautilus_vertical_splitter_position_preference_name (NautilusVerticalSplitter *splitter, char *pref_name, gboolean loadPrevValue)
+{
+ int position;
+
+ splitter->position_preference_name = pref_name;
+
+ // When the preference is set, optionally load the preference position
+ if (loadPrevValue && pref_name) {
+ position = eel_preferences_get_integer(splitter->position_preference_name);
+ if (position == 0) {
+ if (splitter->toggle_up) {
+ position = 0;
+ } else {
+ position = INT_MAX;
+ }
+ }
+
+ gtk_paned_set_position (GTK_PANED (splitter), position);
+ }
+}
+
+/* NautilusVerticalSplitter public methods */
+GtkWidget *
+nautilus_vertical_splitter_new (void)
+{
+ return gtk_widget_new (nautilus_vertical_splitter_get_type (), NULL);
+}
+
+/* handle mouse downs by remembering the position and the time */
+static gboolean
+nautilus_vertical_splitter_button_press (GtkWidget *widget, GdkEventButton *event)
+{
+ gboolean result;
+ NautilusVerticalSplitter *splitter;
+ int position;
+
+ splitter = NAUTILUS_VERTICAL_SPLITTER (widget);
+
+ position = gtk_paned_get_position (GTK_PANED (widget));
+
+ result = EEL_CALL_PARENT_WITH_RETURN_VALUE
+ (GTK_WIDGET_CLASS, button_press_event, (widget, event));
+
+ if (result) {
+ splitter->details->press_x = event->x;
+ splitter->details->press_time = event->time;
+ splitter->details->press_position = position;
+ }
+
+ return result;
+}
+
+/* handle mouse ups by seeing if it was a tap and toggling the open state accordingly */
+static gboolean
+nautilus_vertical_splitter_button_release (GtkWidget *widget, GdkEventButton *event)
+{
+ gboolean result;
+ NautilusVerticalSplitter *splitter;
+ int delta, delta_time;
+ splitter = NAUTILUS_VERTICAL_SPLITTER (widget);
+
+ result = EEL_CALL_PARENT_WITH_RETURN_VALUE
+ (GTK_WIDGET_CLASS, button_release_event, (widget, event));
+
+ if (result) {
+ delta = abs (event->x - splitter->details->press_x);
+ delta_time = event->time - splitter->details->press_time;
+ save_position_preference(splitter, gtk_paned_get_position (GTK_PANED (widget)));
+ if (delta < SPLITTER_CLICK_SLOP && delta_time < SPLITTER_CLICK_TIMEOUT) {
+ nautilus_vertical_splitter_toggle_position (splitter);
+ }
+ }
+
+ return result;
+}
+
+static void
+nautilus_vertical_splitter_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ gint border_width;
+ GtkPaned *paned;
+ GtkAllocation child_allocation;
+ GtkRequisition child_requisition;
+
+ paned = GTK_PANED (widget);
+ border_width = GTK_CONTAINER (paned)->border_width;
+
+ widget->allocation = *allocation;
+
+ if (paned->child2 != NULL && GTK_WIDGET_VISIBLE (paned->child2)) {
+ EEL_CALL_PARENT (GTK_WIDGET_CLASS, size_allocate,
+ (widget, allocation));
+ } else if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1)) {
+
+ if (GTK_WIDGET_REALIZED (widget)) {
+ gdk_window_hide (paned->handle);
+ }
+
+ gtk_widget_get_child_requisition (paned->child1,
+ &child_requisition);
+
+ child_allocation.x = widget->allocation.x + border_width;
+ child_allocation.y = widget->allocation.y + border_width;
+ child_allocation.width = MIN (child_requisition.width,
+ allocation->width - 2 * border_width);
+ child_allocation.height = MIN (child_requisition.height,
+ allocation->height - 2 * border_width);
+
+ gtk_widget_size_allocate (paned->child1, &child_allocation);
+ } else
+ if (GTK_WIDGET_REALIZED (widget)) {
+ gdk_window_hide (paned->handle);
+ }
+
+}
+
+static void
+nautilus_vertical_splitter_class_init (NautilusVerticalSplitterClass *class)
+{
+ GtkWidgetClass *widget_class;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+
+ G_OBJECT_CLASS (class)->finalize = nautilus_vertical_splitter_finalize;
+
+ widget_class->size_allocate = nautilus_vertical_splitter_size_allocate;
+ widget_class->button_press_event = nautilus_vertical_splitter_button_press;
+ widget_class->button_release_event = nautilus_vertical_splitter_button_release;
+}
+
+void
+nautilus_vertical_splitter_pack1 (NautilusVerticalSplitter *splitter,
+ GtkWidget *child1)
+{
+ GtkPaned *paned;
+
+ g_return_if_fail (GTK_IS_WIDGET (child1));
+ g_return_if_fail (NAUTILUS_IS_VERTICAL_SPLITTER (splitter));
+
+ paned = GTK_PANED (splitter);
+ gtk_paned_pack1 (paned, child1, TRUE, TRUE);
+}
+
+void
+nautilus_vertical_splitter_pack2 (NautilusVerticalSplitter *splitter,
+ GtkWidget *child2)
+{
+ GtkPaned *paned;
+
+ g_return_if_fail (GTK_IS_WIDGET (child2));
+ g_return_if_fail (NAUTILUS_IS_VERTICAL_SPLITTER (splitter));
+
+ paned = GTK_PANED (splitter);
+ gtk_paned_pack2 (paned, child2, TRUE, TRUE);
+}
Property changes on: libnautilus-private/nautilus-vertical-splitter.c
___________________________________________________________________
Name: svn:executable
+ *
Index: libnautilus-private/nautilus-vertical-splitter.h
===================================================================
--- libnautilus-private/nautilus-vertical-splitter.h (revision 0)
+++ libnautilus-private/nautilus-vertical-splitter.h (revision 0)
@@ -0,0 +1,68 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-vertical-splitter.h - A vertical splitter with a semi gradient look
+
+ The Gnome Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Author: Daren C. Robbins
+*/
+
+#ifndef NAUTILUS_VERTICAL_SPLITTER_H
+#define NAUTILUS_VERTICAL_SPLITTER_H
+
+#include <gtk/gtkvpaned.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_VERTICAL_SPLITTER (nautilus_vertical_splitter_get_type ())
+#define NAUTILUS_VERTICAL_SPLITTER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VERTICAL_SPLITTER, NautilusVerticalSplitter))
+#define NAUTILUS_VERTICAL_SPLITTER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VERTICAL_SPLITTER, NautilusVerticalSplitterClass))
+#define NAUTILUS_IS_VERTICAL_SPLITTER(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VERTICAL_SPLITTER))
+#define NAUTILUS_IS_VERTICAL_SPLITTER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_VERTICAL_SPLITTER))
+
+typedef struct NautilusVerticalSplitterDetails NautilusVerticalSplitterDetails;
+
+typedef struct {
+ GtkVPaned parent_slot;
+ NautilusVerticalSplitterDetails *details;
+ gboolean toggle_up;
+ char *position_preference_name;
+} NautilusVerticalSplitter;
+
+typedef struct {
+ GtkVPanedClass parent_slot;
+} NautilusVerticalSplitterClass;
+
+/* NautilusVerticalSplitter public methods */
+GType nautilus_vertical_splitter_get_type (void);
+GtkWidget *nautilus_vertical_splitter_new (void);
+
+gboolean nautilus_vertical_splitter_is_hidden (NautilusVerticalSplitter *splitter);
+void nautilus_vertical_splitter_collapse (NautilusVerticalSplitter *splitter);
+void nautilus_vertical_splitter_hide (NautilusVerticalSplitter *splitter);
+void nautilus_vertical_splitter_show (NautilusVerticalSplitter *splitter);
+void nautilus_vertical_splitter_expand (NautilusVerticalSplitter *splitter);
+void nautilus_vertical_splitter_toggle_position (NautilusVerticalSplitter *splitter);
+void nautilus_vertical_splitter_set_toggle_up (NautilusVerticalSplitter *splitter, gboolean toggle_up);
+void nautilus_vertical_splitter_position_preference_name (NautilusVerticalSplitter *splitter, char *pref_name, gboolean loadPrevValue);
+void nautilus_vertical_splitter_pack1 (NautilusVerticalSplitter *splitter,
+ GtkWidget *child1);
+void nautilus_vertical_splitter_pack2 (NautilusVerticalSplitter *splitter,
+ GtkWidget *child2);
+
+G_END_DECLS
+
+#endif /* NAUTILUS_VERTICAL_SPLITTER_H */
Property changes on: libnautilus-private/nautilus-vertical-splitter.h
___________________________________________________________________
Name: svn:executable
+ *
Index: libnautilus-private/Makefile.am
===================================================================
--- libnautilus-private/Makefile.am (revision 14227)
+++ libnautilus-private/Makefile.am (working copy)
@@ -184,6 +184,8 @@ libnautilus_private_la_SOURCES = \
nautilus-undo.h \
nautilus-users-groups-cache.c \
nautilus-users-groups-cache.h \
+ nautilus-vertical-splitter.c \
+ nautilus-vertical-splitter.h \
nautilus-vfs-directory.c \
nautilus-vfs-directory.h \
nautilus-vfs-file.c \
Index: libnautilus-private/nautilus-global-preferences.h
===================================================================
--- libnautilus-private/nautilus-global-preferences.h (revision 14227)
+++ libnautilus-private/nautilus-global-preferences.h (working copy)
@@ -96,7 +96,8 @@ typedef enum
#define NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR "preferences/start_with_status_bar"
#define NAUTILUS_PREFERENCES_START_WITH_SIDEBAR "preferences/start_with_sidebar"
#define NAUTILUS_PREFERENCES_START_WITH_TOOLBAR "preferences/start_with_toolbar"
-#define NAUTILUS_PREFERENCES_SIDE_PANE_VIEW "preferences/side_pane_view"
+#define NAUTILUS_PREFERENCES_SIDE_PANE_VIEWS "preferences/side_pane_views"
+#define NAUTILUS_PREFERENCES_SIDE_PANE_POSITIONS "preferences/side_pane_positions"
#define NAUTILUS_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY "preferences/navigation_window_saved_geometry"
#define NAUTILUS_PREFERENCES_NAVIGATION_WINDOW_MAXIMIZED "preferences/navigation_window_saved_maximized"
diff -rupN nautilus-2.22.0-orig/src/nautilus-information-panel.c nautilus-2.22.0/src/nautilus-information-panel.c
--- nautilus-2.22.0-orig/src/nautilus-information-panel.c 2008-03-07 16:28:03.000000000 +0100
+++ nautilus-2.22.0/src/nautilus-information-panel.c 2008-03-24 02:20:41.000000000 +0100
@@ -51,6 +51,8 @@
#include <libnautilus-private/nautilus-program-choosing.h>
#include <libnautilus-private/nautilus-sidebar-provider.h>
#include <libnautilus-private/nautilus-module.h>
+#include <gio/gio.h>
+
struct NautilusInformationPanelDetails {
GtkVBox *container;
@@ -1094,6 +1096,32 @@ nautilus_information_panel_style_set (Gt
}
static void
+selection_changed_callback (NautilusWindowInfo *window,
+ NautilusInformationPanel *panel)
+{
+ int selection_count = nautilus_window_info_get_selection_count (window);
+
+ if (selection_count == 1) {
+ /* One selected, show detailed info */
+ GList* selection = nautilus_window_info_get_selection (window);
+ GFile* selected = selection->data;
+
+ nautilus_information_panel_set_uri (panel,
+ g_file_get_uri (selected), g_file_get_basename (selected));
+
+ g_object_unref (selected);
+ g_list_free (selection);
+ } else {
+ /* Nothing or more than one selected, show directory info */
+ char* uri = nautilus_window_info_get_current_location (window);
+ char* title = nautilus_window_info_get_title (window);
+ nautilus_information_panel_set_uri (panel, uri, title);
+ g_free (title);
+ g_free (uri);
+ }
+}
+
+static void
loading_uri_callback (NautilusWindowInfo *window,
char *uri,
NautilusInformationPanel *panel)
@@ -1119,6 +1147,8 @@ nautilus_information_panel_set_parent_wi
G_CALLBACK (loading_uri_callback), panel, 0);
g_signal_connect_object (window, "title_changed",
G_CALLBACK (title_changed_callback), panel, 0);
+ g_signal_connect_object (window, "selection_changed",
+ G_CALLBACK (selection_changed_callback), panel, 0);
slot = nautilus_window_info_get_active_slot (window);
title = nautilus_window_slot_info_get_title (slot);
diff -rupN nautilus-2.22.0-orig/src/nautilus-notes-viewer.c nautilus-2.22.0/src/nautilus-notes-viewer.c
--- nautilus-2.22.0-orig/src/nautilus-notes-viewer.c 2008-03-07 16:28:03.000000000 +0100
+++ nautilus-2.22.0/src/nautilus-notes-viewer.c 2008-03-24 02:20:21.000000000 +0100
@@ -279,6 +279,39 @@ notes_load_metainfo (NautilusNotesViewer
}
static void
+selection_changed_callback (NautilusWindowInfo *window,
+ NautilusNotesViewer *notes)
+{
+ int selection_count = nautilus_window_info_get_selection_count (window);
+
+ if (selection_count == 1) {
+ /* One selected, show notes of selected file */
+ GList* selection = nautilus_window_info_get_selection (window);
+ GFile* selected = selection->data;
+ char* location = g_file_get_uri (selected);
+ if (strcmp (notes->details->uri, location) != 0) {
+ notes_save_metainfo (notes);
+ g_free (notes->details->uri);
+ notes->details->uri = g_strdup (location);
+ notes_load_metainfo (notes);
+ }
+ g_free (location);
+ g_object_unref (selected);
+ g_list_free (selection);
+ } else {
+ /* Nothing or more than one selected, show directory notes */
+ char* location = nautilus_window_info_get_current_location (window);
+ if (strcmp (notes->details->uri, location) != 0) {
+ notes_save_metainfo (notes);
+ g_free (notes->details->uri);
+ notes->details->uri = g_strdup (location);
+ notes_load_metainfo (notes);
+ }
+ g_free (location);
+ }
+}
+
+static void
loading_uri_callback (NautilusWindowInfo *window,
const char *location,
NautilusNotesViewer *notes)
@@ -432,6 +465,9 @@ nautilus_notes_viewer_set_parent_window
g_signal_connect_object (window, "loading_uri",
G_CALLBACK (loading_uri_callback), sidebar, 0);
+
+ g_signal_connect_object (window, "selection_changed",
+ G_CALLBACK (selection_changed_callback), sidebar, 0);
g_free (sidebar->details->uri);
sidebar->details->uri = nautilus_window_slot_info_get_current_location (slot);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]