[evince/gnome-3-30] ev-view: fix appearance of editable GtkComboBox in PDF form
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gnome-3-30] ev-view: fix appearance of editable GtkComboBox in PDF form
- Date: Tue, 23 Oct 2018 18:11:18 +0000 (UTC)
commit 42447a420fbe492ea84576a4bb1b674899a7f877
Author: Nelson Benítez León <nbenitezl gmail com>
Date: Mon Oct 22 14:45:29 2018 +0500
ev-view: fix appearance of editable GtkComboBox in PDF form
Due to a bug in GtkEntry, the GtkEntry of an editable GtkComboBox
will be too wide (due to a hardcoded minimum-width of
150px), overcome this by forcing a very small minimum-width via
"width-chars" property, this allows the GtkEntry to match the
width of the ComboBox item list.
We also tweak evince.css to reduce the padding of the GtkEntry and
GtkButton of the GtkComboBox, which was 8px and made the GtkButton
take up too much space and GtkEntry be left with too little space
for displaying text.
Workarounds gtk#1422
Fixes evince#1002
libview/ev-view.c | 7 ++++++-
shell/evince.css | 5 +++++
2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index a0b16146..219ee9f9 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -2692,14 +2692,19 @@ ev_view_form_field_choice_create_widget (EvView *view,
G_CALLBACK (ev_view_form_field_destroy),
view);
} else if (field_choice->is_editable) { /* ComboBoxEntry */
+ GtkEntry *combo_entry;
gchar *text;
choice = gtk_combo_box_new_with_model_and_entry (model);
+ combo_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (choice)));
+ /* This sets GtkEntry's minimum-width to be 1 char long, short enough
+ * to workaround gtk issue gtk#1422 . Evince issue #1002 */
+ gtk_entry_set_width_chars (combo_entry, 1);
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (choice), 0);
text = ev_document_forms_form_field_choice_get_text (EV_DOCUMENT_FORMS (view->document),
field);
if (text) {
- gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (choice))), text);
+ gtk_entry_set_text (combo_entry, text);
g_free (text);
}
diff --git a/shell/evince.css b/shell/evince.css
index 93a10c37..02501d26 100644
--- a/shell/evince.css
+++ b/shell/evince.css
@@ -80,3 +80,8 @@ evannotationwindow label:backdrop {
evannotationwindow label {
color: black;
}
+
+.content-view .combo {
+ padding-left: 2px;
+ padding-right: 2px;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]