[gnome-notes] window-base: Close currently opened note when changing notebooks
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-notes] window-base: Close currently opened note when changing notebooks
- Date: Wed, 5 Jan 2022 13:02:41 +0000 (UTC)
commit 1460685ce6671287b7b03c80c299dffb50814b0c
Author: Jonathan Kang <jonathankang gnome org>
Date: Thu Aug 5 15:12:18 2021 +0800
window-base: Close currently opened note when changing notebooks
Close the currently opened note when changing among "All Notes",
different notebooks and "Trash".
https://gitlab.gnome.org/GNOME/gnome-notes/-/issues/154
src/bjb-window.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/src/bjb-window.c b/src/bjb-window.c
index dc429552..968d2979 100644
--- a/src/bjb-window.c
+++ b/src/bjb-window.c
@@ -102,6 +102,17 @@ static guint signals[N_SIGNALS];
static void
destroy_note_if_needed (BjbWindow *self)
{
+ if (self->note_deleted != 0)
+ {
+ g_signal_handler_disconnect (self->note, self->note_deleted);
+ self->note_deleted = 0;
+ }
+ if (self->note_trashed != 0)
+ {
+ g_signal_handler_disconnect (self->note, self->note_trashed);
+ self->note_trashed = 0;
+ }
+
g_clear_object (&self->note);
if (self->note_view && GTK_IS_WIDGET (self->note_view))
@@ -424,6 +435,7 @@ static void
show_all_notes (BjbWindow *self)
{
clear_text_in_search_entry (self);
+ destroy_note_if_needed (self);
/* Going back from a notebook. */
if (bjb_controller_get_notebook (self->controller) != NULL)
@@ -437,6 +449,7 @@ static void
show_trash (BjbWindow *self)
{
clear_text_in_search_entry (self);
+ destroy_note_if_needed (self);
bjb_controller_set_group (self->controller, BIJI_ARCHIVED_ITEMS);
gtk_label_set_text (GTK_LABEL (self->filter_label), _("Trash"));
@@ -454,6 +467,7 @@ on_show_notebook_cb (GSimpleAction *action,
BijiManager *manager;
clear_text_in_search_entry (self);
+ destroy_note_if_needed (self);
note_uuid = g_variant_get_string (variant, NULL);
if (g_strcmp0 (note_uuid, "ALL NOTES") == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]