[gtranslator: 2/5] tm-dialog: Simplify creation and destruction
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator: 2/5] tm-dialog: Simplify creation and destruction
- Date: Thu, 17 Mar 2022 06:55:02 +0000 (UTC)
commit 72b2b0b091ac23e681da213de23b6b6557025f52
Author: Maximiliano Sandoval R <msandova gnome org>
Date: Wed Mar 16 10:05:52 2022 +0100
tm-dialog: Simplify creation and destruction
The dialog does not need a static reference, since it is transient, it
is not possible to spawn another even with the keybinding making it redundant.
src/gtr-window.c | 13 ++++---------
src/translation-memory/gtr-translation-memory-dialog.c | 3 ---
2 files changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/src/gtr-window.c b/src/gtr-window.c
index a0e757c9..91ccecee 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -817,17 +817,12 @@ void
gtr_window_show_tm_dialog (GtrWindow *window)
{
GtrWindowPrivate *priv = gtr_window_get_instance_private(window);
- static GtkWidget *dlg = NULL;
+ GtkWidget *dlg;
- if (dlg == NULL)
- {
- dlg = gtr_translation_memory_dialog_new (GTK_WINDOW (window),
- priv->translation_memory);
+ dlg = gtr_translation_memory_dialog_new (GTK_WINDOW (window),
+ priv->translation_memory);
- g_signal_connect (dlg, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &dlg);
- gtk_widget_show_all (dlg);
- }
+ g_signal_connect (dlg, "response", G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_present (GTK_WINDOW (dlg));
}
diff --git a/src/translation-memory/gtr-translation-memory-dialog.c
b/src/translation-memory/gtr-translation-memory-dialog.c
index 3e096953..a464b235 100644
--- a/src/translation-memory/gtr-translation-memory-dialog.c
+++ b/src/translation-memory/gtr-translation-memory-dialog.c
@@ -310,9 +310,6 @@ gtr_translation_memory_dialog_init (GtrTranslationMemoryDialog *dlg)
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
- g_signal_connect (dlg, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
builder = gtk_builder_new ();
gtk_builder_add_objects_from_resource (builder,
"/org/gnome/gtranslator/plugins/translation-memory/ui/gtr-translation-memory-dialog.ui", root_objects, NULL);
content = GTK_WIDGET (gtk_builder_get_object (builder, "translation-memory-box"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]