[gtk+/gtk-3-22] printunixdialog: Update collate icon as entry changes
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] printunixdialog: Update collate icon as entry changes
- Date: Wed, 7 Jun 2017 12:39:37 +0000 (UTC)
commit d94038856115f3644514735ecbd11f9465d88bf6
Author: Felipe Borges <felipeborges gnome org>
Date: Thu May 18 16:11:56 2017 +0200
printunixdialog: Update collate icon as entry changes
By relying on GtkSpinButton default activation behavior, the
collate icon doesn't get updated when a new number is typed
in the copies spin button.
https://bugzilla.gnome.org/show_bug.cgi?id=759308
gtk/gtkprintunixdialog.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 82d434a..7259999 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -2546,8 +2546,29 @@ dialog_set_page_set (GtkPrintUnixDialog *dialog,
static gint
dialog_get_n_copies (GtkPrintUnixDialog *dialog)
{
+ GtkPrintUnixDialogPrivate *priv = dialog->priv;
+ GtkAdjustment *adjustment;
+ const gchar *text;
+ gchar *endptr = NULL;
+ gint n_copies;
+
+ adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->copies_spin));
+
+ text = gtk_entry_get_text (GTK_ENTRY (priv->copies_spin));
+ n_copies = g_ascii_strtoull (text, &endptr, 0);
+
if (gtk_widget_is_sensitive (dialog->priv->copies_spin))
- return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->copies_spin));
+ {
+ if (n_copies != 0 && endptr != text && (endptr != NULL && endptr[0] == '\0') &&
+ n_copies >= gtk_adjustment_get_lower (adjustment) &&
+ n_copies <= gtk_adjustment_get_upper (adjustment))
+ {
+ return n_copies;
+ }
+
+ return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (priv->copies_spin));
+ }
+
return 1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]