diff options
author | John Sullivan <sullivan@src.gnome.org> | 2000-10-03 15:57:31 +0000 |
---|---|---|
committer | John Sullivan <sullivan@src.gnome.org> | 2000-10-03 15:57:31 +0000 |
commit | 8da2f7ba50c382c7b8a96879b914c9abcf38f4ee (patch) | |
tree | 62f8808d4a6d2049ee4c79cfd89dbfc2597410e2 /libnautilus-private/nautilus-horizontal-splitter.c | |
parent | 304974cfe837cdd7bf7c75a66fe87dc56e4cac32 (diff) | |
download | nautilus-8da2f7ba50c382c7b8a96879b914c9abcf38f4ee.tar.gz |
Fixed bug 3420: "Show Sidebar" can leave sidebar at zero width
* libnautilus-extensions/nautilus-horizontal-splitter.h:
New public functions nautilus_horizontal_splitter_expand,
..._collapse, and ..._toggle_position.
* libnautilus-extensions/nautilus-horizontal-splitter.c:
(nautilus_horizontal_splitter_expand): Broken out of
toggle_position, just does the expanding part (or nothing
if already expanded).
(nautilus_horizontal_splitter_collapse): Broken out of
toggle_position, just does the collapsing part (or nothing
if already collapsed).
(nautilus_horizontal_splitter_toggle_position): renamed
from toggle_splitter_position; now calls the broken-out
functions.
(nautilus_horizontal_splitter_button_release): Updated for
name change.
* src/nautilus-window.c: (nautilus_window_show_sidebar):
Call nautilus_horizontal_splitter_expand when showing sidebar.
Diffstat (limited to 'libnautilus-private/nautilus-horizontal-splitter.c')
-rw-r--r-- | libnautilus-private/nautilus-horizontal-splitter.c | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/libnautilus-private/nautilus-horizontal-splitter.c b/libnautilus-private/nautilus-horizontal-splitter.c index d1f08a578..4ec5f1fb5 100644 --- a/libnautilus-private/nautilus-horizontal-splitter.c +++ b/libnautilus-private/nautilus-horizontal-splitter.c @@ -263,27 +263,57 @@ nautilus_horizontal_splitter_draw (GtkWidget *widget, } } -/* routine to toggle the open/closed state of the splitter */ -static void -toggle_splitter_position (NautilusHorizontalSplitter *splitter) +void +nautilus_horizontal_splitter_expand (NautilusHorizontalSplitter *splitter) { int position; + g_return_if_fail (NAUTILUS_IS_HORIZONTAL_SPLITTER (splitter)); + position = e_paned_get_position (E_PANED (splitter)); if (position >= CLOSED_THRESHOLD) { - splitter->details->saved_size = position; - position = 0; - } else { - position = splitter->details->saved_size; - if (splitter->details->saved_size < CLOSED_THRESHOLD) { - position = NOMINAL_SIZE; - } + return; + } + + position = splitter->details->saved_size; + if (position < CLOSED_THRESHOLD) { + position = NOMINAL_SIZE; } e_paned_set_position (E_PANED (splitter), position); } +void +nautilus_horizontal_splitter_collapse (NautilusHorizontalSplitter *splitter) +{ + int position; + + g_return_if_fail (NAUTILUS_IS_HORIZONTAL_SPLITTER (splitter)); + + position = e_paned_get_position (E_PANED (splitter)); + + if (position < CLOSED_THRESHOLD) { + return; + } + + splitter->details->saved_size = position; + e_paned_set_position (E_PANED (splitter), 0); +} + +/* routine to toggle the open/closed state of the splitter */ +void +nautilus_horizontal_splitter_toggle_position (NautilusHorizontalSplitter *splitter) +{ + g_return_if_fail (NAUTILUS_IS_HORIZONTAL_SPLITTER (splitter)); + + if (e_paned_get_position (E_PANED (splitter)) >= CLOSED_THRESHOLD) { + nautilus_horizontal_splitter_collapse (splitter); + } else { + nautilus_horizontal_splitter_expand (splitter); + } +} + /* NautilusHorizontalSplitter public methods */ GtkWidget * nautilus_horizontal_splitter_new (void) @@ -324,7 +354,7 @@ nautilus_horizontal_splitter_button_release (GtkWidget *widget, GdkEventButton * delta = abs (event->x - splitter->details->down_position); delta_time = abs (splitter->details->down_time - event->time); if (delta < SPLITTER_CLICK_SLOP && delta_time < SPLITTER_CLICK_TIMEOUT) { - toggle_splitter_position(splitter); + nautilus_horizontal_splitter_toggle_position (splitter); } } |