[evolution] The 'Show' combo box hidden for small screens in the search bar ][
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] The 'Show' combo box hidden for small screens in the search bar ][
- Date: Wed, 20 Feb 2019 11:29:13 +0000 (UTC)
commit 30d4b767f50a7b081a34bd636586ebc9a6169182
Author: Milan Crha <mcrha redhat com>
Date: Wed Feb 20 12:25:58 2019 +0100
The 'Show' combo box hidden for small screens in the search bar ][
The previous change missed a fact that the EActionComboBox is used on
various places where always-enabled ellipsizing can cause issues, like
in the composer, where the combox of the message format and the paragraph
mode always used minimum size, thus made those unreadable. This change
enables ellipsizing in the EActionComboBox on demand, with the default
to not ellipsize, which keeps the behavior as before the change for
all but the search bar.
src/e-util/e-action-combo-box.c | 40 ++++++++++++++++++++++++++++++++++++----
src/e-util/e-action-combo-box.h | 5 +++++
src/shell/e-shell-searchbar.c | 2 ++
3 files changed, 43 insertions(+), 4 deletions(-)
---
diff --git a/src/e-util/e-action-combo-box.c b/src/e-util/e-action-combo-box.c
index aca5ef1cab..8e0cf83719 100644
--- a/src/e-util/e-action-combo-box.c
+++ b/src/e-util/e-action-combo-box.c
@@ -45,6 +45,7 @@ struct _EActionComboBoxPrivate {
guint group_sensitive_handler_id; /* action-group::sensitive */
guint group_visible_handler_id; /* action-group::visible */
gboolean group_has_icons;
+ gboolean ellipsize_enabled;
};
G_DEFINE_TYPE (
@@ -305,7 +306,8 @@ e_action_combo_box_get_preferred_width (GtkWidget *widget,
{
GTK_WIDGET_CLASS (e_action_combo_box_parent_class)->get_preferred_width (widget, minimum_width,
natural_width);
- if (*natural_width > 250)
+ if (e_action_combo_box_get_ellipsize_enabled (E_ACTION_COMBO_BOX (widget)) &&
+ natural_width && *natural_width > 250)
*natural_width = 225;
}
@@ -398,9 +400,6 @@ action_combo_box_constructed (GObject *object)
combo_box, NULL);
renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer,
- "ellipsize", PANGO_ELLIPSIZE_END,
- NULL);
gtk_cell_layout_pack_start (
GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
gtk_cell_layout_set_cell_data_func (
@@ -619,3 +618,36 @@ e_action_combo_box_update_model (EActionComboBox *combo_box)
action_combo_box_update_model (combo_box);
}
+
+gboolean
+e_action_combo_box_get_ellipsize_enabled (EActionComboBox *combo_box)
+{
+ g_return_val_if_fail (E_IS_ACTION_COMBO_BOX (combo_box), FALSE);
+
+ return combo_box->priv->ellipsize_enabled;
+}
+
+void
+e_action_combo_box_set_ellipsize_enabled (EActionComboBox *combo_box,
+ gboolean enabled)
+{
+ g_return_if_fail (E_IS_ACTION_COMBO_BOX (combo_box));
+
+ if ((enabled ? 1 : 0) != (combo_box->priv->ellipsize_enabled ? 1 : 0)) {
+ GList *cells, *link;
+
+ combo_box->priv->ellipsize_enabled = enabled;
+
+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (combo_box));
+
+ for (link = cells; link; link = g_list_next (link)) {
+ if (GTK_IS_CELL_RENDERER_TEXT (link->data)) {
+ g_object_set (link->data,
+ "ellipsize", enabled ? PANGO_ELLIPSIZE_END : PANGO_ELLIPSIZE_NONE,
+ NULL);
+ }
+ }
+
+ g_list_free (cells);
+ }
+}
diff --git a/src/e-util/e-action-combo-box.h b/src/e-util/e-action-combo-box.h
index 3a44ed730a..7ec81cda80 100644
--- a/src/e-util/e-action-combo-box.h
+++ b/src/e-util/e-action-combo-box.h
@@ -82,6 +82,11 @@ void e_action_combo_box_add_separator_after
(EActionComboBox *combo_box,
gint action_value);
void e_action_combo_box_update_model (EActionComboBox *combo_box);
+gboolean e_action_combo_box_get_ellipsize_enabled
+ (EActionComboBox *combo_box);
+void e_action_combo_box_set_ellipsize_enabled
+ (EActionComboBox *combo_box,
+ gboolean enabled);
G_END_DECLS
diff --git a/src/shell/e-shell-searchbar.c b/src/shell/e-shell-searchbar.c
index db9c12bc49..d14909b28e 100644
--- a/src/shell/e-shell-searchbar.c
+++ b/src/shell/e-shell-searchbar.c
@@ -929,6 +929,7 @@ e_shell_searchbar_init (EShellSearchbar *searchbar)
label = GTK_LABEL (widget);
widget = e_action_combo_box_new ();
+ e_action_combo_box_set_ellipsize_enabled (E_ACTION_COMBO_BOX (widget), TRUE);
gtk_label_set_mnemonic_widget (label, widget);
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
searchbar->priv->filter_combo_box = widget;
@@ -1022,6 +1023,7 @@ e_shell_searchbar_init (EShellSearchbar *searchbar)
label = GTK_LABEL (widget);
widget = e_action_combo_box_new ();
+ e_action_combo_box_set_ellipsize_enabled (E_ACTION_COMBO_BOX (widget), TRUE);
gtk_label_set_mnemonic_widget (label, widget);
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
searchbar->priv->scope_combo_box = widget;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]