Commit 85e1ba07 authored by Andy Hertzfeld's avatar Andy Hertzfeld
Browse files

did some work at Bud's request. Made a global preference for the sidebar


         did some work at Bud's request.  Made a global preference for the
	 sidebar width, and made it use it.  Also, changed the index title
	 font to helvetica, to avoid clash with other text
parent da87340b
2000-05-05 Andy Hertzfeld <andy@eazel.com>
did some work at the request of Bud
* libnautilus-extenstions/nautilus-global-preferences.h:
added preference NAUTILUS_PREFERENCES_SIDEBAR_WIDTH
* src/ntl-window.c:
set the initial sidebar width from NAUTILUS_PREFERENCES_SIDEBAR_WIDTH. As a welcome
side-effect, this allowed me to remove the old "sopwidth hack". I also increased
the default size.
* src/ntl-index-panel:
added old_width to details. Overrode size_allocate signal to get in there when the
size changes to record it in preferences when it changes
* src/nautilus-index-title.c:
changed the font used for the title to helvetica, to match the other text
2000-05-05 Darin Adler <darin@eazel.com>
* libnautilus-extensions/.cvsignore: Ignore the new files that
......
......@@ -38,6 +38,9 @@ BEGIN_GNOME_DECLS
/* Show hidden files */
#define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES "/nautilus/preferences/show_hidden_files"
/* sidebar width */
#define NAUTILUS_PREFERENCES_SIDEBAR_WIDTH "/nautilus/preferences/sidebar_width"
/* Home URI */
#define NAUTILUS_PREFERENCES_HOME_URI "/nautilus/preferences/home_uri"
......
......@@ -38,6 +38,9 @@ BEGIN_GNOME_DECLS
/* Show hidden files */
#define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES "/nautilus/preferences/show_hidden_files"
/* sidebar width */
#define NAUTILUS_PREFERENCES_SIDEBAR_WIDTH "/nautilus/preferences/sidebar_width"
/* Home URI */
#define NAUTILUS_PREFERENCES_HOME_URI "/nautilus/preferences/home_uri"
......
......@@ -231,7 +231,7 @@ nautilus_index_title_update_label (NautilusIndexTitle *index_title)
* don't use hardwired font like this - get it from preferences
*/
label_font = nautilus_get_largest_fitting_font (displayed_text, GTK_WIDGET (index_title)->allocation.width - 4,
"-bitstream-courier-medium-r-normal-*-%d-*-*-*-*-*-*-*");
"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*");
nautilus_gtk_widget_set_font (index_title->details->title, label_font);
g_free (displayed_text);
......
......@@ -36,11 +36,13 @@
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-mime-type.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include "ntl-meta-view.h"
#include "nautilus-index-tabs.h"
#include "nautilus-index-title.h"
......@@ -57,6 +59,7 @@ struct NautilusIndexPanelDetails {
int selected_index;
NautilusDirectory *directory;
int background_connection;
int old_width;
};
static void nautilus_index_panel_initialize_class (GtkObjectClass *object_klass);
......@@ -75,6 +78,8 @@ static void nautilus_index_panel_drag_data_received (GtkWidget *wid
GtkSelectionData *selection_data,
guint info,
guint time);
static void nautilus_index_panel_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void nautilus_index_panel_update_info (NautilusIndexPanel *index_panel,
const char *title);
static void nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel);
......@@ -131,6 +136,7 @@ nautilus_index_panel_initialize_class (GtkObjectClass *object_klass)
widget_class->motion_notify_event = nautilus_index_panel_motion_event;
widget_class->leave_notify_event = nautilus_index_panel_leave_event;
widget_class->button_press_event = nautilus_index_panel_press_event;
widget_class->size_allocate = nautilus_index_panel_size_allocate;
}
/* utility routine to allocate the box the holds the command buttons */
......@@ -188,6 +194,8 @@ nautilus_index_panel_initialize (GtkObject *object)
GTK_WIDGET (index_panel->details->index_tabs),
FALSE, FALSE, 0);
index_panel->details->old_width = widget->allocation.width;
/* allocate and install the meta-tabs */
index_panel->details->notebook = GTK_NOTEBOOK (gtk_notebook_new ());
gtk_object_ref (GTK_OBJECT (index_panel->details->notebook));
......@@ -867,3 +875,22 @@ nautilus_index_panel_set_title (NautilusIndexPanel *index_panel, const char* new
nautilus_index_title_set_text (index_panel->details->title,
new_title);
}
/* we override size allocate so we can remember our size when it changes, since the paned widget
doesn't generate a signal */
static void
nautilus_index_panel_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
NautilusIndexPanel *index_panel = NAUTILUS_INDEX_PANEL(widget);
NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, size_allocate, (widget, allocation));
/* remember the size if it changed */
if (widget->allocation.width != index_panel->details->old_width) {
index_panel->details->old_width = widget->allocation.width;
nautilus_preferences_set_enum(NAUTILUS_PREFERENCES_SIDEBAR_WIDTH, widget->allocation.width);
}
}
......@@ -42,6 +42,7 @@
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
......@@ -195,8 +196,6 @@ static void zoom_in_cb (NautilusZoomControl *zoom_control,
static void zoom_out_cb (NautilusZoomControl *zoom_control,
NautilusWindow *window);
/* #define CONTENTS_AS_HBOX 1 */
/* milliseconds */
#define STATUSBAR_CLEAR_TIMEOUT 5000
......@@ -363,6 +362,7 @@ nautilus_window_constructed(NautilusWindow *window)
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame;
GnomeDockItemBehavior behavior;
int sidebar_width;
app = GNOME_APP(window);
......@@ -408,20 +408,10 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE);
gtk_window_set_default_size(GTK_WINDOW(window), 650, 400);
#ifdef CONTENTS_AS_HBOX
window->content_hbox = gtk_hbox_new(FALSE, 0);
#else
window->content_hbox = gtk_hpaned_new();
{
/* special case the width of the index panel for sopwith */
char *user_name = getenv("USER");
gint pos = 136;
if (!strcmp(user_name, "sopwith"))
pos = 275;
gtk_paned_set_position(GTK_PANED(window->content_hbox), pos);
}
#endif
sidebar_width = nautilus_preferences_get_enum(NAUTILUS_PREFERENCES_SIDEBAR_WIDTH, 148);
gtk_paned_set_position(GTK_PANED(window->content_hbox), sidebar_width);
gnome_app_set_contents(app, window->content_hbox);
/* set up the index panel in a frame */
......@@ -434,11 +424,7 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_show (GTK_WIDGET (window->index_panel));
gtk_container_add(GTK_CONTAINER(temp_frame), GTK_WIDGET (window->index_panel));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_start(GTK_BOX(window->content_hbox), temp_frame, FALSE, FALSE, 0);
#else
gtk_paned_pack1(GTK_PANED(window->content_hbox), temp_frame, FALSE, FALSE);
#endif
gtk_widget_show_all(window->content_hbox);
......@@ -1064,11 +1050,7 @@ nautilus_window_real_set_content_view (NautilusWindow *window, NautilusView *new
nautilus_content_view_set_active (NAUTILUS_CONTENT_VIEW (new_view));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_end(GTK_BOX(window->content_hbox), GTK_WIDGET (new_view), TRUE, TRUE, 0);
#else
gtk_paned_pack2(GTK_PANED(window->content_hbox), GTK_WIDGET (new_view), TRUE, FALSE);
#endif
}
gtk_widget_queue_resize(window->content_hbox);
......
......@@ -42,6 +42,7 @@
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
......@@ -195,8 +196,6 @@ static void zoom_in_cb (NautilusZoomControl *zoom_control,
static void zoom_out_cb (NautilusZoomControl *zoom_control,
NautilusWindow *window);
/* #define CONTENTS_AS_HBOX 1 */
/* milliseconds */
#define STATUSBAR_CLEAR_TIMEOUT 5000
......@@ -363,6 +362,7 @@ nautilus_window_constructed(NautilusWindow *window)
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame;
GnomeDockItemBehavior behavior;
int sidebar_width;
app = GNOME_APP(window);
......@@ -408,20 +408,10 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE);
gtk_window_set_default_size(GTK_WINDOW(window), 650, 400);
#ifdef CONTENTS_AS_HBOX
window->content_hbox = gtk_hbox_new(FALSE, 0);
#else
window->content_hbox = gtk_hpaned_new();
{
/* special case the width of the index panel for sopwith */
char *user_name = getenv("USER");
gint pos = 136;
if (!strcmp(user_name, "sopwith"))
pos = 275;
gtk_paned_set_position(GTK_PANED(window->content_hbox), pos);
}
#endif
sidebar_width = nautilus_preferences_get_enum(NAUTILUS_PREFERENCES_SIDEBAR_WIDTH, 148);
gtk_paned_set_position(GTK_PANED(window->content_hbox), sidebar_width);
gnome_app_set_contents(app, window->content_hbox);
/* set up the index panel in a frame */
......@@ -434,11 +424,7 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_show (GTK_WIDGET (window->index_panel));
gtk_container_add(GTK_CONTAINER(temp_frame), GTK_WIDGET (window->index_panel));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_start(GTK_BOX(window->content_hbox), temp_frame, FALSE, FALSE, 0);
#else
gtk_paned_pack1(GTK_PANED(window->content_hbox), temp_frame, FALSE, FALSE);
#endif
gtk_widget_show_all(window->content_hbox);
......@@ -1064,11 +1050,7 @@ nautilus_window_real_set_content_view (NautilusWindow *window, NautilusView *new
nautilus_content_view_set_active (NAUTILUS_CONTENT_VIEW (new_view));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_end(GTK_BOX(window->content_hbox), GTK_WIDGET (new_view), TRUE, TRUE, 0);
#else
gtk_paned_pack2(GTK_PANED(window->content_hbox), GTK_WIDGET (new_view), TRUE, FALSE);
#endif
}
gtk_widget_queue_resize(window->content_hbox);
......
......@@ -231,7 +231,7 @@ nautilus_index_title_update_label (NautilusIndexTitle *index_title)
* don't use hardwired font like this - get it from preferences
*/
label_font = nautilus_get_largest_fitting_font (displayed_text, GTK_WIDGET (index_title)->allocation.width - 4,
"-bitstream-courier-medium-r-normal-*-%d-*-*-*-*-*-*-*");
"-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*");
nautilus_gtk_widget_set_font (index_title->details->title, label_font);
g_free (displayed_text);
......
......@@ -36,11 +36,13 @@
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-mime-type.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include "ntl-meta-view.h"
#include "nautilus-index-tabs.h"
#include "nautilus-index-title.h"
......@@ -57,6 +59,7 @@ struct NautilusIndexPanelDetails {
int selected_index;
NautilusDirectory *directory;
int background_connection;
int old_width;
};
static void nautilus_index_panel_initialize_class (GtkObjectClass *object_klass);
......@@ -75,6 +78,8 @@ static void nautilus_index_panel_drag_data_received (GtkWidget *wid
GtkSelectionData *selection_data,
guint info,
guint time);
static void nautilus_index_panel_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void nautilus_index_panel_update_info (NautilusIndexPanel *index_panel,
const char *title);
static void nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel);
......@@ -131,6 +136,7 @@ nautilus_index_panel_initialize_class (GtkObjectClass *object_klass)
widget_class->motion_notify_event = nautilus_index_panel_motion_event;
widget_class->leave_notify_event = nautilus_index_panel_leave_event;
widget_class->button_press_event = nautilus_index_panel_press_event;
widget_class->size_allocate = nautilus_index_panel_size_allocate;
}
/* utility routine to allocate the box the holds the command buttons */
......@@ -188,6 +194,8 @@ nautilus_index_panel_initialize (GtkObject *object)
GTK_WIDGET (index_panel->details->index_tabs),
FALSE, FALSE, 0);
index_panel->details->old_width = widget->allocation.width;
/* allocate and install the meta-tabs */
index_panel->details->notebook = GTK_NOTEBOOK (gtk_notebook_new ());
gtk_object_ref (GTK_OBJECT (index_panel->details->notebook));
......@@ -867,3 +875,22 @@ nautilus_index_panel_set_title (NautilusIndexPanel *index_panel, const char* new
nautilus_index_title_set_text (index_panel->details->title,
new_title);
}
/* we override size allocate so we can remember our size when it changes, since the paned widget
doesn't generate a signal */
static void
nautilus_index_panel_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
NautilusIndexPanel *index_panel = NAUTILUS_INDEX_PANEL(widget);
NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, size_allocate, (widget, allocation));
/* remember the size if it changed */
if (widget->allocation.width != index_panel->details->old_width) {
index_panel->details->old_width = widget->allocation.width;
nautilus_preferences_set_enum(NAUTILUS_PREFERENCES_SIDEBAR_WIDTH, widget->allocation.width);
}
}
......@@ -42,6 +42,7 @@
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
......@@ -195,8 +196,6 @@ static void zoom_in_cb (NautilusZoomControl *zoom_control,
static void zoom_out_cb (NautilusZoomControl *zoom_control,
NautilusWindow *window);
/* #define CONTENTS_AS_HBOX 1 */
/* milliseconds */
#define STATUSBAR_CLEAR_TIMEOUT 5000
......@@ -363,6 +362,7 @@ nautilus_window_constructed(NautilusWindow *window)
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame;
GnomeDockItemBehavior behavior;
int sidebar_width;
app = GNOME_APP(window);
......@@ -408,20 +408,10 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE);
gtk_window_set_default_size(GTK_WINDOW(window), 650, 400);
#ifdef CONTENTS_AS_HBOX
window->content_hbox = gtk_hbox_new(FALSE, 0);
#else
window->content_hbox = gtk_hpaned_new();
{
/* special case the width of the index panel for sopwith */
char *user_name = getenv("USER");
gint pos = 136;
if (!strcmp(user_name, "sopwith"))
pos = 275;
gtk_paned_set_position(GTK_PANED(window->content_hbox), pos);
}
#endif
sidebar_width = nautilus_preferences_get_enum(NAUTILUS_PREFERENCES_SIDEBAR_WIDTH, 148);
gtk_paned_set_position(GTK_PANED(window->content_hbox), sidebar_width);
gnome_app_set_contents(app, window->content_hbox);
/* set up the index panel in a frame */
......@@ -434,11 +424,7 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_show (GTK_WIDGET (window->index_panel));
gtk_container_add(GTK_CONTAINER(temp_frame), GTK_WIDGET (window->index_panel));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_start(GTK_BOX(window->content_hbox), temp_frame, FALSE, FALSE, 0);
#else
gtk_paned_pack1(GTK_PANED(window->content_hbox), temp_frame, FALSE, FALSE);
#endif
gtk_widget_show_all(window->content_hbox);
......@@ -1064,11 +1050,7 @@ nautilus_window_real_set_content_view (NautilusWindow *window, NautilusView *new
nautilus_content_view_set_active (NAUTILUS_CONTENT_VIEW (new_view));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_end(GTK_BOX(window->content_hbox), GTK_WIDGET (new_view), TRUE, TRUE, 0);
#else
gtk_paned_pack2(GTK_PANED(window->content_hbox), GTK_WIDGET (new_view), TRUE, FALSE);
#endif
}
gtk_widget_queue_resize(window->content_hbox);
......
......@@ -42,6 +42,7 @@
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
......@@ -195,8 +196,6 @@ static void zoom_in_cb (NautilusZoomControl *zoom_control,
static void zoom_out_cb (NautilusZoomControl *zoom_control,
NautilusWindow *window);
/* #define CONTENTS_AS_HBOX 1 */
/* milliseconds */
#define STATUSBAR_CLEAR_TIMEOUT 5000
......@@ -363,6 +362,7 @@ nautilus_window_constructed(NautilusWindow *window)
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame;
GnomeDockItemBehavior behavior;
int sidebar_width;
app = GNOME_APP(window);
......@@ -408,20 +408,10 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE);
gtk_window_set_default_size(GTK_WINDOW(window), 650, 400);
#ifdef CONTENTS_AS_HBOX
window->content_hbox = gtk_hbox_new(FALSE, 0);
#else
window->content_hbox = gtk_hpaned_new();
{
/* special case the width of the index panel for sopwith */
char *user_name = getenv("USER");
gint pos = 136;
if (!strcmp(user_name, "sopwith"))
pos = 275;
gtk_paned_set_position(GTK_PANED(window->content_hbox), pos);
}
#endif
sidebar_width = nautilus_preferences_get_enum(NAUTILUS_PREFERENCES_SIDEBAR_WIDTH, 148);
gtk_paned_set_position(GTK_PANED(window->content_hbox), sidebar_width);
gnome_app_set_contents(app, window->content_hbox);
/* set up the index panel in a frame */
......@@ -434,11 +424,7 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_show (GTK_WIDGET (window->index_panel));
gtk_container_add(GTK_CONTAINER(temp_frame), GTK_WIDGET (window->index_panel));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_start(GTK_BOX(window->content_hbox), temp_frame, FALSE, FALSE, 0);
#else
gtk_paned_pack1(GTK_PANED(window->content_hbox), temp_frame, FALSE, FALSE);
#endif
gtk_widget_show_all(window->content_hbox);
......@@ -1064,11 +1050,7 @@ nautilus_window_real_set_content_view (NautilusWindow *window, NautilusView *new
nautilus_content_view_set_active (NAUTILUS_CONTENT_VIEW (new_view));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_end(GTK_BOX(window->content_hbox), GTK_WIDGET (new_view), TRUE, TRUE, 0);
#else
gtk_paned_pack2(GTK_PANED(window->content_hbox), GTK_WIDGET (new_view), TRUE, FALSE);
#endif
}
gtk_widget_queue_resize(window->content_hbox);
......
......@@ -36,11 +36,13 @@
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-mime-type.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include "ntl-meta-view.h"
#include "nautilus-index-tabs.h"
#include "nautilus-index-title.h"
......@@ -57,6 +59,7 @@ struct NautilusIndexPanelDetails {
int selected_index;
NautilusDirectory *directory;
int background_connection;
int old_width;
};
static void nautilus_index_panel_initialize_class (GtkObjectClass *object_klass);
......@@ -75,6 +78,8 @@ static void nautilus_index_panel_drag_data_received (GtkWidget *wid
GtkSelectionData *selection_data,
guint info,
guint time);
static void nautilus_index_panel_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void nautilus_index_panel_update_info (NautilusIndexPanel *index_panel,
const char *title);
static void nautilus_index_panel_update_buttons (NautilusIndexPanel *index_panel);
......@@ -131,6 +136,7 @@ nautilus_index_panel_initialize_class (GtkObjectClass *object_klass)
widget_class->motion_notify_event = nautilus_index_panel_motion_event;
widget_class->leave_notify_event = nautilus_index_panel_leave_event;
widget_class->button_press_event = nautilus_index_panel_press_event;
widget_class->size_allocate = nautilus_index_panel_size_allocate;
}
/* utility routine to allocate the box the holds the command buttons */
......@@ -188,6 +194,8 @@ nautilus_index_panel_initialize (GtkObject *object)
GTK_WIDGET (index_panel->details->index_tabs),
FALSE, FALSE, 0);
index_panel->details->old_width = widget->allocation.width;
/* allocate and install the meta-tabs */
index_panel->details->notebook = GTK_NOTEBOOK (gtk_notebook_new ());
gtk_object_ref (GTK_OBJECT (index_panel->details->notebook));
......@@ -867,3 +875,22 @@ nautilus_index_panel_set_title (NautilusIndexPanel *index_panel, const char* new
nautilus_index_title_set_text (index_panel->details->title,
new_title);
}
/* we override size allocate so we can remember our size when it changes, since the paned widget
doesn't generate a signal */
static void
nautilus_index_panel_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
NautilusIndexPanel *index_panel = NAUTILUS_INDEX_PANEL(widget);
NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, size_allocate, (widget, allocation));
/* remember the size if it changed */
if (widget->allocation.width != index_panel->details->old_width) {
index_panel->details->old_width = widget->allocation.width;
nautilus_preferences_set_enum(NAUTILUS_PREFERENCES_SIDEBAR_WIDTH, widget->allocation.width);
}
}
......@@ -42,6 +42,7 @@
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
......@@ -195,8 +196,6 @@ static void zoom_in_cb (NautilusZoomControl *zoom_control,
static void zoom_out_cb (NautilusZoomControl *zoom_control,
NautilusWindow *window);
/* #define CONTENTS_AS_HBOX 1 */
/* milliseconds */
#define STATUSBAR_CLEAR_TIMEOUT 5000
......@@ -363,6 +362,7 @@ nautilus_window_constructed(NautilusWindow *window)
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame;
GnomeDockItemBehavior behavior;
int sidebar_width;
app = GNOME_APP(window);
......@@ -408,20 +408,10 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE);
gtk_window_set_default_size(GTK_WINDOW(window), 650, 400);
#ifdef CONTENTS_AS_HBOX
window->content_hbox = gtk_hbox_new(FALSE, 0);
#else
window->content_hbox = gtk_hpaned_new();
{
/* special case the width of the index panel for sopwith */
char *user_name = getenv("USER");
gint pos = 136;
if (!strcmp(user_name, "sopwith"))
pos = 275;
gtk_paned_set_position(GTK_PANED(window->content_hbox), pos);
}
#endif
sidebar_width = nautilus_preferences_get_enum(NAUTILUS_PREFERENCES_SIDEBAR_WIDTH, 148);
gtk_paned_set_position(GTK_PANED(window->content_hbox), sidebar_width);
gnome_app_set_contents(app, window->content_hbox);
/* set up the index panel in a frame */
......@@ -434,11 +424,7 @@ nautilus_window_constructed(NautilusWindow *window)
gtk_widget_show (GTK_WIDGET (window->index_panel));
gtk_container_add(GTK_CONTAINER(temp_frame), GTK_WIDGET (window->index_panel));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_start(GTK_BOX(window->content_hbox), temp_frame, FALSE, FALSE, 0);
#else
gtk_paned_pack1(GTK_PANED(window->content_hbox), temp_frame, FALSE, FALSE);
#endif
gtk_widget_show_all(window->content_hbox);
......@@ -1064,11 +1050,7 @@ nautilus_window_real_set_content_view (NautilusWindow *window, NautilusView *new
nautilus_content_view_set_active (NAUTILUS_CONTENT_VIEW (new_view));
#ifdef CONTENTS_AS_HBOX
gtk_box_pack_end(GTK_BOX(window->content_hbox), GTK_WIDGET (new_view), TRUE, TRUE, 0);
#else
gtk_paned_pack2(GTK_PANED(window->content_hbox), GTK_WIDGET (new_view), TRUE, FALSE);
#endif
}
gtk_widget_queue_resize(window->content_hbox);
......
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