From 5fa1dede21dcc931ce109f02e12629d10ba10598 Mon Sep 17 00:00:00 2001 From: Felipe Borges Date: Tue, 21 Feb 2017 15:32:59 +0100 Subject: [PATCH] printers: Do not apply rename/location changes in focus-out-event Since we are already applying the changing in the PpDetailsDialog when it gets closed, there's no need to apply these changes in the focus-out-event of its respective GtkEntries. https://bugzilla.gnome.org/show_bug.cgi?id=769114 --- panels/printers/details-dialog.ui | 5 +--- panels/printers/pp-details-dialog.c | 43 +++++++++++------------------ 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/panels/printers/details-dialog.ui b/panels/printers/details-dialog.ui index 181bbcd24..58f251724 100644 --- a/panels/printers/details-dialog.ui +++ b/panels/printers/details-dialog.ui @@ -10,8 +10,7 @@ True dialog 1 - - + 20 @@ -37,7 +36,6 @@ fill 320 - @@ -63,7 +61,6 @@ 320 fill - 1 diff --git a/panels/printers/pp-details-dialog.c b/panels/printers/pp-details-dialog.c index 6a98f88ec..4473d228a 100644 --- a/panels/printers/pp-details-dialog.c +++ b/panels/printers/pp-details-dialog.c @@ -65,14 +65,24 @@ struct _PpDetailsDialogClass GtkDialogClass parent_class; }; -G_DEFINE_TYPE (PpDetailsDialog, pp_details_dialog, GTK_TYPE_DIALOG); +G_DEFINE_TYPE (PpDetailsDialog, pp_details_dialog, GTK_TYPE_DIALOG) -static gboolean -printer_name_edit_cb (GtkWidget *entry, - GdkEventFocus *event, - PpDetailsDialog *self) +static void +pp_details_dialog_response_cb (GtkDialog *dialog, + gint response_id, + gpointer user_data) { + PpDetailsDialog *self = (PpDetailsDialog*) dialog; const gchar *new_name; + const gchar *new_location; + + new_location = gtk_entry_get_text (GTK_ENTRY (self->printer_location_entry)); + if (g_strcmp0 (self->printer_location, new_location) != 0) + { + printer_set_location (self->printer_name, new_location); + + self->printer_location = g_strdup (new_location); + } new_name = gtk_entry_get_text (GTK_ENTRY (self->printer_name_entry)); if (g_strcmp0 (self->printer_name, new_name) != 0) @@ -81,8 +91,6 @@ printer_name_edit_cb (GtkWidget *entry, self->printer_name = g_strdup (new_name); } - - return FALSE; } static void @@ -105,24 +113,6 @@ printer_name_changed (GtkEditable *editable, g_free (title); } -static gboolean -printer_location_edit_cb (GtkWidget *entry, - GdkEventFocus *event, - PpDetailsDialog *self) -{ - const gchar *location; - - location = gtk_entry_get_text (GTK_ENTRY (self->printer_location_entry)); - if (g_strcmp0 (self->printer_location, location) != 0) - { - printer_set_location (self->printer_name, location); - - self->printer_location = g_strdup (location); - } - - return FALSE; -} - static void ppd_names_free (gpointer user_data) { @@ -379,12 +369,11 @@ pp_details_dialog_class_init (PpDetailsDialogClass *klass) gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, search_for_drivers_button); gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, driver_buttons); - gtk_widget_class_bind_template_callback (widget_class, printer_name_edit_cb); gtk_widget_class_bind_template_callback (widget_class, printer_name_changed); - gtk_widget_class_bind_template_callback (widget_class, printer_location_edit_cb); gtk_widget_class_bind_template_callback (widget_class, search_for_drivers); gtk_widget_class_bind_template_callback (widget_class, select_ppd_in_dialog); gtk_widget_class_bind_template_callback (widget_class, select_ppd_manually); + gtk_widget_class_bind_template_callback (widget_class, pp_details_dialog_response_cb); } PpDetailsDialog *