[goffice] GOActionComboPixmap: don't show arrow in vertical mode.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GOActionComboPixmap: don't show arrow in vertical mode.
- Date: Fri, 19 Apr 2013 14:02:51 +0000 (UTC)
commit 5e7f6304dd6d72b1fbdc57d6e79b74a97f6b0c4b
Author: Morten Welinder <terra gnome org>
Date: Fri Apr 19 10:02:07 2013 -0400
GOActionComboPixmap: don't show arrow in vertical mode.
ChangeLog | 7 +++++++
NEWS | 2 +-
goffice/gtk/go-action-combo-pixmaps.c | 15 +++++++++++++++
goffice/gtk/go-combo-box.c | 1 +
goffice/gtk/go-combo-pixmaps.c | 29 ++++++++++++++++++++++++-----
5 files changed, 48 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bdf61f5..e259233 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2013-04-19 Morten Welinder <terra gnome org>
+ * goffice/gtk/go-combo-pixmaps.c (cb_preview_clicked): If arrow
+ isn't shown, just pop up the choices.
+
+ * goffice/gtk/go-action-combo-pixmaps.c
+ (go_action_combo_pixmaps_create_tool_item): Show arrow only in
+ horizontal mode.
+
* goffice/gtk/go-combo-box.c (go_combo_box_class_init): Install
"title" and "show-arrow" properties.
diff --git a/NEWS b/NEWS
index ab7b2b1..8354272 100644
--- a/NEWS
+++ b/NEWS
@@ -24,7 +24,7 @@ Morten:
* Rewrite font selector. [#695031]
* Fix GOComboColor signal problem. [#696022]
* Plug leaks.
- * Enhance canvas with posibility of css.
+ * Enhance canvas with possibility of css.
* Improve printing of grey patterns.
--------------------------------------------------------------------------
diff --git a/goffice/gtk/go-action-combo-pixmaps.c b/goffice/gtk/go-action-combo-pixmaps.c
index 0392424..0910932 100644
--- a/goffice/gtk/go-action-combo-pixmaps.c
+++ b/goffice/gtk/go-action-combo-pixmaps.c
@@ -134,6 +134,16 @@ cb_selection_changed (GOComboPixmaps *combo, int id, GOActionComboPixmaps *pacti
gtk_action_activate (GTK_ACTION (paction));
}
+static void
+cb_toolbar_reconfigured (GOToolComboPixmaps *tool)
+{
+ GtkOrientation o = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (tool));
+
+ g_object_set (G_OBJECT (tool->combo),
+ "show-arrow", o == GTK_ORIENTATION_HORIZONTAL,
+ NULL);
+}
+
static GtkWidget *
go_action_combo_pixmaps_create_tool_item (GtkAction *a)
{
@@ -152,6 +162,11 @@ go_action_combo_pixmaps_create_tool_item (GtkAction *a)
}
go_combo_pixmaps_select_id (tool->combo, paction->selected_id);
+ g_signal_connect (tool, "toolbar-reconfigured",
+ G_CALLBACK (cb_toolbar_reconfigured),
+ NULL);
+ cb_toolbar_reconfigured (tool);
+
go_combo_box_set_relief (GO_COMBO_BOX (tool->combo), GTK_RELIEF_NONE);
go_gtk_widget_disable_focus (GTK_WIDGET (tool->combo));
gtk_container_add (GTK_CONTAINER (tool), GTK_WIDGET (tool->combo));
diff --git a/goffice/gtk/go-combo-box.c b/goffice/gtk/go-combo-box.c
index 057bbe0..b20b747 100644
--- a/goffice/gtk/go-combo-box.c
+++ b/goffice/gtk/go-combo-box.c
@@ -206,6 +206,7 @@ static void
set_arrow_state (GOComboBox *combo_box, gboolean state)
{
GOComboBoxPrivate *priv = combo_box->priv;
+
g_return_if_fail (!combo_box->priv->updating_buttons);
combo_box->priv->updating_buttons = TRUE;
diff --git a/goffice/gtk/go-combo-pixmaps.c b/goffice/gtk/go-combo-pixmaps.c
index 59303b1..ec13dce 100644
--- a/goffice/gtk/go-combo-pixmaps.c
+++ b/goffice/gtk/go-combo-pixmaps.c
@@ -99,6 +99,23 @@ emit_change (GOComboPixmaps *combo)
}
static void
+cb_preview_clicked (GOComboPixmaps *combo)
+{
+ gboolean show_arrow;
+
+ if (_go_combo_is_updating (GO_COMBO_BOX (combo)))
+ return;
+
+ g_object_get (G_OBJECT (combo), "show-arrow", &show_arrow, NULL);
+ if (show_arrow)
+ emit_change (combo);
+ else {
+ /* Condensed mode. */
+ go_combo_box_popup_display (GO_COMBO_BOX (combo));
+ }
+}
+
+static void
go_combo_pixmaps_init (GOComboPixmaps *combo)
{
combo->elements = g_array_new (FALSE, FALSE, sizeof (Element));
@@ -111,7 +128,7 @@ go_combo_pixmaps_init (GOComboPixmaps *combo)
g_signal_connect_swapped (combo->preview_button,
"clicked",
- G_CALLBACK (emit_change), combo);
+ G_CALLBACK (cb_preview_clicked), combo);
gtk_widget_show_all (combo->preview_button);
gtk_widget_show_all (combo->grid);
@@ -173,12 +190,14 @@ cb_swatch_release_event (GtkWidget *button, GdkEventButton *event, GOComboPixmap
static gboolean
cb_swatch_key_press (GtkWidget *button, GdkEventKey *event, GOComboPixmaps *combo)
{
- if (event->keyval == GDK_KEY_Return ||
- event->keyval == GDK_KEY_KP_Enter ||
- event->keyval == GDK_KEY_space)
+ switch (event->keyval) {
+ case GDK_KEY_Return:
+ case GDK_KEY_KP_Enter:
+ case GDK_KEY_space:
return swatch_activated (combo, button);
- else
+ default:
return FALSE;
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]