[gtranslator: 4/9] language-panel: Use async response on dialog
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator: 4/9] language-panel: Use async response on dialog
- Date: Fri, 18 Mar 2022 09:37:22 +0000 (UTC)
commit 2e3e1b55e95a67d82a0ac3ef50076dca7e3f6c48
Author: Maximiliano Sandoval R <msandova gnome org>
Date: Sun Mar 6 16:38:17 2022 +0100
language-panel: Use async response on dialog
.../gtr-alternate-language-panel.c | 25 ++++++----------------
1 file changed, 7 insertions(+), 18 deletions(-)
---
diff --git a/plugins/alternate-language/gtr-alternate-language-panel.c
b/plugins/alternate-language/gtr-alternate-language-panel.c
index 844d75aa..17460144 100644
--- a/plugins/alternate-language/gtr-alternate-language-panel.c
+++ b/plugins/alternate-language/gtr-alternate-language-panel.c
@@ -183,27 +183,15 @@ open_file (GtkWidget *dialog, GtrAlternateLangPanel *panel)
gtk_widget_destroy (dialog);
}
-
static void
-gtr_file_chooser_analyse (GtkNativeDialog * dialog, GtrAlternateLangPanel * panel)
+gtr_file_chooser_cb (GtkNativeDialog * dialog, guint response, gpointer user_data)
{
- gint reply;
+ GtrAlternateLangPanel *panel = GTR_ALTERNATE_LANG_PANEL (user_data);
- reply = gtk_dialog_run (GTK_DIALOG (dialog));
- switch (reply)
- {
- case GTK_RESPONSE_ACCEPT:
+ if response == GTK_RESPONSE_ACCEPT:
open_file (GTK_WIDGET (dialog), panel);
- break;
- case GTK_RESPONSE_CANCEL:
- gtk_widget_hide (GTK_WIDGET (dialog));
- break;
- case GTK_RESPONSE_DELETE_EVENT:
- gtk_widget_hide (GTK_WIDGET (dialog));
- break;
- default:
- break;
- }
+
+ gtk_native_dialog_destroy (dialog);
}
static void
@@ -241,7 +229,8 @@ open_button_clicked_cb (GtkWidget * open_button,
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), TRUE);
- gtr_file_chooser_analyse (GTK_NATIVE_DIALOG (dialog), panel);
+ g_signal_connect (dialog, "response", G_CALLBACK (gtr_file_chooser_cb), panel);
+ gtk_native_dialog_show (dialog);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]