[gnumeric] GUI: Hide scrollbars when requested.



commit d8242167e06a2e221a5ee1264886183ab11e04fa
Author: Morten Welinder <terra gnome org>
Date:   Mon May 18 10:34:58 2009 -0400

    GUI: Hide scrollbars when requested.
---
 ChangeLog                          |    3 +++
 NEWS                               |    1 +
 src/dialogs/ChangeLog              |    5 +++++
 src/dialogs/dialog-workbook-attr.c |   29 ++++++++++++++++-------------
 src/wbc-gtk-impl.h                 |    1 +
 src/wbc-gtk.c                      |   26 ++++++++++++++++++++++++++
 6 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fcb8c43..122f3f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-05-18  Morten Welinder  <terra gnome org>
 
+	* src/wbc-gtk.c (wbcg_scrollbar_visibility): New function.
+	(wbcg_view_changed): Hook up wbcg_scrollbar_visibility.
+
 	* src/workbook-view.c 	(workbook_view_class_init, wb_view_set_property,
 	wb_view_get_property): Add new properties:
 	PROP_SHOW_HORIZONTAL_SCROLLBAR, PROP_SHOW_VERTICAL_SCROLLBAR,
diff --git a/NEWS b/NEWS
index f5e9079..99bf129 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@ Morten:
 	* Fix sheet-object paste crash.  [#490479]
 	* Fix critical in format dialog.  [#582890]
 	* Turn WorkbookView into a more proper GObject.
+	* Hide scrollbars as requested.  [#583005]
 
 Paul Fitzpatrick:
 	* Extend ssconvert to also merge multiple sheets.  [#581616]
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 4931796..80c31fa 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-18  Morten Welinder  <terra gnome org>
+
+	* dialog-workbook-attr.c (cb_attr_dialog_dialog_apply): Use
+	g_object_set to store workbook attributes.
+
 2009-05-16  Morten Welinder  <terra gnome org>
 
 	* dialog-cell-format.c (cb_check_cell_format): Ignore markup
diff --git a/src/dialogs/dialog-workbook-attr.c b/src/dialogs/dialog-workbook-attr.c
index 55661cc..3339521 100644
--- a/src/dialogs/dialog-workbook-attr.c
+++ b/src/dialogs/dialog-workbook-attr.c
@@ -133,16 +133,19 @@ static void
 cb_attr_dialog_dialog_apply (G_GNUC_UNUSED GtkWidget *button,
 			     AttrState *state)
 {
-	state->wbv->show_horizontal_scrollbar = state->old.show_hsb =
-		gtk_toggle_button_get_active (state->view.show_hsb);
-	state->wbv->show_vertical_scrollbar = state->old.show_vsb =
-		gtk_toggle_button_get_active (state->view.show_vsb);
-	state->wbv->show_notebook_tabs = state->old.show_tabs =
-		gtk_toggle_button_get_active (state->view.show_tabs);
-	state->wbv->do_auto_completion = state->old.autocomplete =
-		gtk_toggle_button_get_active (state->view.autocomplete);
-	state->wbv->is_protected = state->old.is_protected =
-		gtk_toggle_button_get_active (state->view.is_protected);
+	state->old.show_hsb = gtk_toggle_button_get_active (state->view.show_hsb);
+	state->old.show_vsb = gtk_toggle_button_get_active (state->view.show_vsb);
+	state->old.show_tabs = gtk_toggle_button_get_active (state->view.show_tabs);
+	state->old.autocomplete = gtk_toggle_button_get_active (state->view.autocomplete);
+	state->old.is_protected = gtk_toggle_button_get_active (state->view.is_protected);
+
+	g_object_set (G_OBJECT (state->wbv),
+		      "show-horizontal-scrollbar", state->old.show_hsb,
+		      "show-vertical-scrollbar", state->old.show_vsb,
+		      "show-notebook-tabs", state->old.show_tabs,
+		      "do-auto-completion", state->old.autocomplete,
+		      "protected", state->old.is_protected,
+		      NULL);
 
 	state->old.recalc_auto =
 		gtk_toggle_button_get_active (state->view.recalc_auto);
@@ -152,9 +155,9 @@ cb_attr_dialog_dialog_apply (G_GNUC_UNUSED GtkWidget *button,
 	get_entry_values (state, &state->old.max_iterations,
 			  &state->old.iteration_tolerance);
 	workbook_set_recalcmode	(state->wb, state->old.recalc_auto);
-	workbook_iteration_enabled	(state->wb, state->old.iteration_enabled);
-	workbook_iteration_max_number	(state->wb, state->old.max_iterations);
-	workbook_iteration_tolerance	(state->wb, state->old.iteration_tolerance);
+	workbook_iteration_enabled (state->wb, state->old.iteration_enabled);
+	workbook_iteration_max_number (state->wb, state->old.max_iterations);
+	workbook_iteration_tolerance (state->wb, state->old.iteration_tolerance);
 
 	cb_widget_changed (NULL, state);
 }
diff --git a/src/wbc-gtk-impl.h b/src/wbc-gtk-impl.h
index 93d1d3e..8722dea 100644
--- a/src/wbc-gtk-impl.h
+++ b/src/wbc-gtk-impl.h
@@ -103,6 +103,7 @@ struct _WBCGtk {
 	SheetControlGUI *active_scg;
 	gulong sig_view_changed;
 	gulong sig_auto_expr_text;
+	gulong sig_show_horizontal_scrollbar, sig_show_vertical_scrollbar;
 	gulong sig_sheet_order, sig_notify_uri, sig_notify_dirty;
 	gpointer sig_wbv;
 
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index debdcb5..1394d1f 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -1408,6 +1408,15 @@ wbcg_auto_expr_text_changed (WorkbookView *wbv,
 }
 
 static void
+wbcg_scrollbar_visibility (WorkbookView *wbv,
+			   G_GNUC_UNUSED GParamSpec *pspec,
+			   WBCGtk *wbcg)
+{
+	SheetControlGUI *scg = wbcg_cur_scg (wbcg);
+	scg_adjust_preferences (scg);
+}
+
+static void
 wbcg_menu_state_update (WorkbookControl *wbc, int flags)
 {
 	WBCGtk *wbcg = (WBCGtk *)wbc;
@@ -2361,6 +2370,8 @@ wbcg_view_changed (WBCGtk *wbcg,
 		 0);
 
 	DISCONNECT (wbcg->sig_wbv, sig_auto_expr_text);
+	DISCONNECT (wbcg->sig_wbv, sig_show_horizontal_scrollbar);
+	DISCONNECT (wbcg->sig_wbv, sig_show_vertical_scrollbar);
 	if (wbcg->sig_wbv)
 		g_object_remove_weak_pointer (wbcg->sig_wbv,
 					      &wbcg->sig_wbv);
@@ -2376,6 +2387,21 @@ wbcg_view_changed (WBCGtk *wbcg,
 			 wbcg,
 			 0);
 		wbcg_auto_expr_text_changed (wbv, NULL, wbcg);
+
+		wbcg->sig_show_horizontal_scrollbar =
+			g_signal_connect_object
+			(G_OBJECT (wbv),
+			 "notify::show-horizontal-scrollbar",
+			 G_CALLBACK (wbcg_scrollbar_visibility),
+			 wbcg,
+			 0);
+		wbcg->sig_show_vertical_scrollbar =
+			g_signal_connect_object
+			(G_OBJECT (wbv),
+			 "notify::show-vertical-scrollbar",
+			 G_CALLBACK (wbcg_scrollbar_visibility),
+			 wbcg,
+			 0);
 	}
 
 	DISCONNECT (old_wb, sig_sheet_order);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]