[gnumeric] GUI: Use proper icon for sheet direction.



commit 03fd753e8e5e96f6e4dde631443589e141bc3b43
Author: Morten Welinder <terra gnome org>
Date:   Thu Dec 25 17:40:18 2014 -0500

    GUI: Use proper icon for sheet direction.

 ChangeLog             |    5 +++++
 src/wbc-gtk-actions.c |    6 +++---
 src/wbc-gtk.c         |   14 ++++++++++++++
 3 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8959336..898228a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-12-25  Morten Welinder  <terra gnome org>
 
+       * src/wbc-gtk-actions.c (SheetDirection): use proper icon.
+
+       * src/wbc-gtk.c (cb_sheet_direction_change): New function to fix
+       icon on sheet direction changes.
+
        * src/wbc-gtk-actions.c: Eliminate many uses of GTK_STOCK_...
 
 2014-12-24  Morten Welinder  <terra gnome org>
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 8224c5c..1519b7a 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -667,8 +667,8 @@ static GNM_ACTION_DEF (cb_repeat)   { command_repeat (WORKBOOK_CONTROL (wbcg)); }
 
 static GNM_ACTION_DEF (cb_direction)
 {
-       cmd_toggle_rtl (WORKBOOK_CONTROL (wbcg),
-               wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg)));
+       Sheet *sheet = wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg));
+       cmd_toggle_rtl (WORKBOOK_CONTROL (wbcg), sheet);
 }
 
 static GNM_ACTION_DEF (cb_view_zoom_in)
@@ -2352,7 +2352,7 @@ static GtkActionEntry const actions[] = {
        { "FormatAuto", NULL, N_("_Autoformat..."),
                NULL, N_("Format a region of cells according to a pre-defined template"),
                G_CALLBACK (cb_autoformat) },
-       { "SheetDirection", "go-next", N_("Direction"),
+       { "SheetDirection", "format-text-direction-ltr", N_("Direction"),
                NULL, N_("Toggle sheet direction, left-to-right vs right-to-left"),
                G_CALLBACK (cb_direction) },
 
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index fedbd5e..a3766cf 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -1018,6 +1018,18 @@ wbcg_menu_state_sheet_count (WBCGtk *wbcg)
 }
 
 static void
+cb_sheet_direction_change (Sheet *sheet,
+                          G_GNUC_UNUSED GParamSpec *pspec,
+                          GtkAction *a)
+{
+       g_object_set (a,
+                     "icon-name", (sheet->text_is_rtl
+                                   ? "format-text-direction-rtl"
+                                   : "format-text-direction-ltr"),
+                     NULL);
+}
+
+static void
 cb_sheet_tab_change (Sheet *sheet,
                     G_GNUC_UNUSED GParamSpec *pspec,
                     GtkWidget *widget)
@@ -1103,6 +1115,7 @@ disconnect_sheet_signals (SheetControlGUI *scg)
        g_printerr ("Disconnecting all for %s with scg=%p\n", sheet->name_unquoted, scg);
 #endif
 
+       g_signal_handlers_disconnect_by_func (sheet, cb_sheet_direction_change, gtk_action_group_get_action 
(wbcg->actions, "SheetDirection"));
        g_signal_handlers_disconnect_by_func (sheet, cb_sheet_tab_change, scg->label);
        g_signal_handlers_disconnect_by_func (sheet, cb_sheet_visibility_change, scg);
 }
@@ -1166,6 +1179,7 @@ wbcg_sheet_add (WorkbookControl *wbc, SheetView *sv)
                          "signal::notify::name", cb_sheet_tab_change, scg->label,
                          "signal::notify::tab-foreground", cb_sheet_tab_change, scg->label,
                          "signal::notify::tab-background", cb_sheet_tab_change, scg->label,
+                         "signal::notify::text-is-rtl", cb_sheet_direction_change, 
gtk_action_group_get_action (wbcg->actions, "SheetDirection"),
                          NULL);
 
        if (wbcg_ui_update_begin (wbcg)) {


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