[gnumeric] GUI: Use a combo for align left/right/... in vertical toolbar mode
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Use a combo for align left/right/... in vertical toolbar mode
- Date: Sat, 22 Jan 2022 01:09:55 +0000 (UTC)
commit a61a274b881ca8ee91bbc6eab244b478224c14ae
Author: Morten Welinder <terra gnome org>
Date: Fri Jan 21 20:08:55 2022 -0500
GUI: Use a combo for align left/right/... in vertical toolbar mode
Space is at a premium.
ChangeLog | 5 +++++
src/GNOME_Gnumeric-gtk.xml | 1 +
src/gui-util.c | 6 +++++-
src/gui-util.h | 4 ++++
src/wbc-gtk-actions.c | 9 +++++++++
5 files changed, 24 insertions(+), 1 deletion(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5949a3ddd..c557eea0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-21 Morten Welinder <terra gnome org>
+
+ * src/wbc-gtk-actions.c: In vertical toolbar mode, show a combo
+ instead of individual horizontal alignment entries.
+
2022-01-20 Morten Welinder <terra gnome org>
* configure.ac: Post-release bump.
diff --git a/src/GNOME_Gnumeric-gtk.xml b/src/GNOME_Gnumeric-gtk.xml
index fd9a0a38f..279268d75 100644
--- a/src/GNOME_Gnumeric-gtk.xml
+++ b/src/GNOME_Gnumeric-gtk.xml
@@ -372,6 +372,7 @@
<toolitem action="FormatMergeCells"/>
<toolitem action="FormatUnmergeCells"/>
<!-- Just a selector for vertical alignment. -->
+ <toolitem action="HAlignmentSelector"/>
<toolitem action="VAlignmentSelector"/>
<separator/>
<toolitem action="FormatAsAccounting"/>
diff --git a/src/gui-util.c b/src/gui-util.c
index 3a6021c54..957d7d4ee 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -1347,7 +1347,11 @@ gnm_action_group_add_actions (GtkActionGroup *group,
a = gtk_action_new (name, label, tip, NULL);
}
- g_object_set (a, "icon-name", entry->icon, NULL);
+ g_object_set (a,
+ "icon-name", entry->icon,
+ "visible-horizontal", !entry->hide_horizontal,
+ "visible-vertical", !entry->hide_vertical,
+ NULL);
if (entry->callback) {
GClosure *closure =
diff --git a/src/gui-util.h b/src/gui-util.h
index 8edd693cb..ace857a69 100644
--- a/src/gui-util.h
+++ b/src/gui-util.h
@@ -172,6 +172,10 @@ typedef struct
const gchar *tooltip;
GCallback callback;
+ // Visibility.
+ guint hide_horizontal : 1;
+ guint hide_vertical : 1;
+
/* Fields for toggles. */
guint toggle : 1;
guint is_active : 1;
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 14b1bebb9..d38d06c80 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -3580,6 +3580,7 @@ static GnmActionEntry const actions[] = {
.icon = "format-justify-left",
.label = N_("_Left Align"),
.tooltip = N_("Align left"),
+ .hide_vertical = TRUE,
.callback = G_CALLBACK (cb_align_left)
},
{ .name = "AlignCenter",
@@ -3587,6 +3588,7 @@ static GnmActionEntry const actions[] = {
.icon = "format-justify-center",
.label = N_("_Center"),
.tooltip = N_("Center horizontally"),
+ .hide_vertical = TRUE,
.callback = G_CALLBACK (cb_align_center)
},
{ .name = "AlignRight",
@@ -3594,6 +3596,7 @@ static GnmActionEntry const actions[] = {
.icon = "format-justify-right",
.label = N_("_Right Align"),
.tooltip = N_("Align right"),
+ .hide_vertical = TRUE,
.callback = G_CALLBACK (cb_align_right)
},
{ .name = "CenterAcrossSelection",
@@ -3601,12 +3604,14 @@ static GnmActionEntry const actions[] = {
.icon = "gnumeric-center-across-selection",
.label = N_("_Center Across Selection"),
.tooltip = N_("Center horizontally across the selection"),
+ .hide_vertical = TRUE,
.callback = G_CALLBACK (cb_center_across_selection)
},
{ .name = "MergeAndCenter",
.toggle = TRUE,
.label = N_("_Merge and Center"),
.tooltip = N_("Merge the selection into 1 cell, and center horizontally."),
+ .hide_vertical = TRUE,
.callback = G_CALLBACK (cb_merge_and_center)
},
#warning "Add justify"
@@ -3617,6 +3622,7 @@ static GnmActionEntry const actions[] = {
.toggle = TRUE,
.label = N_("Align _Top"),
.tooltip = N_("Align Top"),
+ .hide_vertical = TRUE,
.callback = G_CALLBACK (cb_align_top)
},
{ .name = "AlignVCenter",
@@ -3624,6 +3630,7 @@ static GnmActionEntry const actions[] = {
.toggle = TRUE,
.label = N_("_Vertically Center"),
.tooltip = N_("Vertically Center"),
+ .hide_vertical = TRUE,
.callback = G_CALLBACK (cb_align_vcenter)
},
{ .name = "AlignBottom",
@@ -3631,6 +3638,7 @@ static GnmActionEntry const actions[] = {
.toggle = TRUE,
.label = N_("Align _Bottom"),
.tooltip = N_("Align Bottom"),
+ .hide_vertical = TRUE,
.callback = G_CALLBACK (cb_align_bottom)
},
};
@@ -3752,6 +3760,7 @@ wbc_gtk_init_alignments (WBCGtk *wbcg)
g_object_set (G_OBJECT (wbcg->halignment),
"label", _("Horizontal Alignment"),
"tooltip", _("Horizontal Alignment"),
+ "visible-horizontal", FALSE,
NULL);
g_signal_connect (G_OBJECT (wbcg->halignment),
"activate",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]