Commit 03fd753e authored by Morten Welinder's avatar Morten Welinder

GUI: Use proper icon for sheet direction.

parent f623f825
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>
......
......@@ -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) },
......
......@@ -1017,6 +1017,18 @@ wbcg_menu_state_sheet_count (WBCGtk *wbcg)
wbc_gtk_set_action_sensitivity (wbcg, "SheetRemove", multi_sheet);
}
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,
......@@ -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)) {
......
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