Merge branch 'gtkprintunixdialog-ui' into 'master'

Slightly ease page range entry in PrintUnixDialog

Closes #591

See merge request GNOME/gtk!922
This commit is contained in:
Matthias Clasen 2019-06-13 21:11:56 +00:00
commit 7815d0e933
2 changed files with 18 additions and 3 deletions

View File

@ -157,6 +157,9 @@ static void emit_ok_response (GtkTreeView *tree_vie
GtkTreePath *path,
GtkTreeViewColumn *column,
gpointer *user_data);
static gboolean page_range_entry_focus_changed (GtkWidget *entry,
GParamSpec *pspec,
GtkPrintUnixDialog *dialog);
static void update_page_range_entry_sensitivity(GtkWidget *button,
GtkPrintUnixDialog *dialog);
static void update_print_at_entry_sensitivity (GtkWidget *button,
@ -562,6 +565,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class)
gtk_widget_class_bind_template_callback (widget_class, error_dialogs);
gtk_widget_class_bind_template_callback (widget_class, emit_ok_response);
gtk_widget_class_bind_template_callback (widget_class, selected_printer_changed);
gtk_widget_class_bind_template_callback (widget_class, page_range_entry_focus_changed);
gtk_widget_class_bind_template_callback (widget_class, update_page_range_entry_sensitivity);
gtk_widget_class_bind_template_callback (widget_class, update_print_at_entry_sensitivity);
gtk_widget_class_bind_template_callback (widget_class, update_print_at_option);
@ -2308,6 +2312,19 @@ draw_collate (GtkDrawingArea *da,
}
}
static gboolean
page_range_entry_focus_changed (GtkWidget *entry,
GParamSpec *pspec,
GtkPrintUnixDialog *dialog)
{
GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
if (gtk_widget_has_focus (entry))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->page_range_radio), TRUE);
return FALSE;
}
static void
update_page_range_entry_sensitivity (GtkWidget *button,
GtkPrintUnixDialog *dialog)
@ -2317,8 +2334,6 @@ update_page_range_entry_sensitivity (GtkWidget *button,
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
gtk_widget_set_sensitive (priv->page_range_entry, active);
if (active)
gtk_widget_grab_focus (priv->page_range_entry);
}

View File

@ -225,11 +225,11 @@
</child>
<child>
<object class="GtkEntry" id="page_range_entry">
<property name="sensitive">0</property>
<property name="can-focus">1</property>
<property name="tooltip-text" translatable="yes">Specify one or more page ranges,
e.g. 13, 7, 11</property>
<property name="activates-default">1</property>
<signal name="notify::has-focus" handler="page_range_entry_focus_changed" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="page_range_entry-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Pages</property>