[gtranslator/gtk4: 28/52] Fix gtr_window_remove_tab
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator/gtk4: 28/52] Fix gtr_window_remove_tab
- Date: Mon, 5 Sep 2022 15:17:50 +0000 (UTC)
commit 0e14c791d51750a57824588900ef7d944263aacd
Author: Daniel GarcĂa Moreno <dani danigm net>
Date: Wed Jul 6 19:17:19 2022 +0200
Fix gtr_window_remove_tab
This patch fixes the workflow of opening a .po file and then, with the
tab opened, open another one. The gtr_window_remove_tab removes the
GtrTab widget from the stack so the new created in the open operation
can be shown inside the stack now.
src/gtr-actions-file.c | 1 -
src/gtr-window.c | 12 ++++--------
2 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/src/gtr-actions-file.c b/src/gtr-actions-file.c
index a19ae1a4..957c009e 100644
--- a/src/gtr-actions-file.c
+++ b/src/gtr-actions-file.c
@@ -110,7 +110,6 @@ gtr_open (GFile * location, GtrWindow * window, GError ** error)
* Create a page to add to our list of open files
*/
tab = gtr_window_create_tab (window, po);
- //gtr_window_set_active_tab (window, GTK_WIDGET (tab));
/*
* Activate the upload file icon if the po file is in the appropriate
diff --git a/src/gtr-window.c b/src/gtr-window.c
index a3472b03..e4b305d4 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -519,15 +519,11 @@ gtr_window_remove_tab (GtrWindow * window)
GtrWindowPrivate *priv = gtr_window_get_instance_private(window);
if (priv->active_tab != NULL)
{
- //gtk_container_remove(GTK_CONTAINER(window), GTK_WIDGET(priv->active_tab));
- g_object_unref(priv->active_tab);
+ if (gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "poeditor"))
+ gtk_stack_remove (GTK_STACK (priv->stack), GTK_WIDGET (priv->active_tab));
+
+ priv->active_tab = NULL;
}
- //as set_window_title not working in gtr_window_create_tab that's why we are removing whole child of stack
and again adding it in gtr_window_create_tab
- /*if (gtk_stack_get_child_by_name(priv->header_stack,"poeditor") != NULL)
- {
- //gtk_container_remove(GTK_CONTAINER(window),
GTK_WIDGET(gtk_stack_get_child_by_name(priv->header_stack,"poeditor")));
- g_object_unref ()
- }*/
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]