Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jangernert/FeedReader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lukas Gernert <jangernert@gmail.com>2017-10-16 00:06:15 +0300
committerJan Lukas Gernert <jangernert@gmail.com>2017-10-16 00:06:15 +0300
commit196361f61743227d7c029ef3ac703321291735d8 (patch)
tree56be737b5027a09dca1c7e507d4d0a2a2951bc1f
parent251d0af7cf07e64de12d695297726fbbe4628c72 (diff)
more disconnecting of signals in destructors
-rw-r--r--src/Widgets/ArticleRow.vala35
-rw-r--r--src/Widgets/CategorieRow.vala25
-rw-r--r--src/Widgets/FeedRow.vala57
3 files changed, 82 insertions, 35 deletions
diff --git a/src/Widgets/ArticleRow.vala b/src/Widgets/ArticleRow.vala
index dd04e7aa..cc2ac08e 100644
--- a/src/Widgets/ArticleRow.vala
+++ b/src/Widgets/ArticleRow.vala
@@ -19,6 +19,7 @@ public class FeedReader.ArticleRow : Gtk.ListBoxRow {
private Gtk.Label m_label;
private Gtk.Image m_icon;
private Gtk.Revealer m_revealer;
+ private Gtk.EventBox m_eventBox;
private Gtk.EventBox m_unread_eventbox;
private Gtk.EventBox m_marked_eventbox;
private Gtk.Stack m_unread_stack;
@@ -46,7 +47,21 @@ public class FeedReader.ArticleRow : Gtk.ListBoxRow {
~ArticleRow()
{
+ m_unread_eventbox.enter_notify_event.disconnect(unreadIconEnter);
+ m_unread_eventbox.leave_notify_event.disconnect(unreadIconLeave);
+ m_unread_eventbox.button_press_event.disconnect(unreadIconClicked);
+ m_marked_eventbox.enter_notify_event.disconnect(markedIconEnter);
+ m_marked_eventbox.leave_notify_event.disconnect(markedIconLeave);
+ m_marked_eventbox.button_press_event.disconnect(markedIconClicked);
+
+ m_eventBox.enter_notify_event.disconnect(rowEnter);
+ m_eventBox.leave_notify_event.disconnect(rowLeave);
+ m_eventBox.button_press_event.disconnect(rowClick);
+
+ this.drag_begin.disconnect(onDragBegin);
+ this.drag_data_get.disconnect(onDragDataGet);
+ this.drag_failed.disconnect(onDragFailed);
}
private bool populate()
@@ -179,15 +194,15 @@ public class FeedReader.ArticleRow : Gtk.ListBoxRow {
box.pack_start(icon_box, false, false, 8);
box.pack_start(text_box, true, true, 0);
- var eventbox = new Gtk.EventBox();
- eventbox.set_events(Gdk.EventMask.ENTER_NOTIFY_MASK);
- eventbox.set_events(Gdk.EventMask.LEAVE_NOTIFY_MASK);
- eventbox.set_events(Gdk.EventMask.BUTTON_PRESS_MASK);
- eventbox.enter_notify_event.connect(rowEnter);
- eventbox.leave_notify_event.connect(rowLeave);
- eventbox.button_press_event.connect(rowClick);
- eventbox.add(box);
- eventbox.show_all();
+ m_eventBox = new Gtk.EventBox();
+ m_eventBox.set_events(Gdk.EventMask.ENTER_NOTIFY_MASK);
+ m_eventBox.set_events(Gdk.EventMask.LEAVE_NOTIFY_MASK);
+ m_eventBox.set_events(Gdk.EventMask.BUTTON_PRESS_MASK);
+ m_eventBox.enter_notify_event.connect(rowEnter);
+ m_eventBox.leave_notify_event.connect(rowLeave);
+ m_eventBox.button_press_event.connect(rowClick);
+ m_eventBox.add(box);
+ m_eventBox.show_all();
// Make the this widget a DnD source.
if(!Settings.general().get_boolean("only-feeds")
@@ -210,7 +225,7 @@ public class FeedReader.ArticleRow : Gtk.ListBoxRow {
this.drag_failed.connect(onDragFailed);
}
- m_revealer.add(eventbox);
+ m_revealer.add(m_eventBox);
m_populated = true;
return false;
}
diff --git a/src/Widgets/CategorieRow.vala b/src/Widgets/CategorieRow.vala
index 5c4588db..fab49726 100644
--- a/src/Widgets/CategorieRow.vala
+++ b/src/Widgets/CategorieRow.vala
@@ -45,7 +45,6 @@ public class FeedReader.CategoryRow : Gtk.ListBoxRow {
public CategoryRow(string name, string categorieID, int orderID, uint unread_count, string parentID, int level, bool expanded)
{
-
this.get_style_context().add_class("fr-sidebar-row");
m_level = level;
m_parentID = parentID;
@@ -198,6 +197,30 @@ public class FeedReader.CategoryRow : Gtk.ListBoxRow {
}
}
+ ~CategoryRow()
+ {
+ activateUnreadEventbox(false);
+
+ m_expandBox.button_press_event.disconnect(onExpandClick);
+ m_expandBox.enter_notify_event.disconnect(onExpandEnter);
+ m_expandBox.leave_notify_event.disconnect(onExpandLeave);
+
+ m_eventBox.button_press_event.disconnect(onClick);
+
+ this.drag_begin.disconnect(onDragBegin);
+ this.drag_data_get.disconnect(onDragDataGet);
+
+ this.drag_motion.disconnect(onDragMotion);
+ this.drag_leave.disconnect(onDragLeave);
+ this.drag_drop.disconnect(onDragDrop);
+ this.drag_data_received.disconnect(onDragDataReceived);
+
+ this.drag_motion.disconnect(onDragMotion);
+ this.drag_leave.disconnect(onDragLeave);
+ this.drag_drop.disconnect(onDragDrop);
+ this.drag_data_received.disconnect(onDragDataReceived);
+ }
+
//------------- Drag Source Functions ----------------------------------------------
private void onDragBegin(Gtk.Widget widget, Gdk.DragContext context)
diff --git a/src/Widgets/FeedRow.vala b/src/Widgets/FeedRow.vala
index 72fcdc8d..18d777b2 100644
--- a/src/Widgets/FeedRow.vala
+++ b/src/Widgets/FeedRow.vala
@@ -122,6 +122,14 @@ public class FeedReader.FeedRow : Gtk.ListBoxRow {
}
}
+ ~FeedRow()
+ {
+ activateUnreadEventbox(false);
+ m_eventBox.button_press_event.disconnect(onClick);
+ this.drag_begin.disconnect(onDragBegin);
+ this.drag_data_get.disconnect(onDragDataGet);
+ }
+
private void onDragBegin(Gtk.Widget widget, Gdk.DragContext context)
{
Logger.debug("FeedRow: onDragBegin");
@@ -196,23 +204,7 @@ public class FeedReader.FeedRow : Gtk.ListBoxRow {
}
var remove_action = new GLib.SimpleAction("deleteFeed", null);
- remove_action.activate.connect(() => {
- if(this.is_selected())
- moveUP();
-
- uint time = 300;
- this.reveal(false, time);
-
- var notification = MainWindow.get_default().showNotification(_("Feed \"%s\" removed").printf(m_feed.getTitle()));
- ulong eventID = notification.dismissed.connect(() => {
- FeedReaderBackend.get_default().removeFeed(m_feed.getFeedID());
- });
- notification.action.connect(() => {
- notification.disconnect(eventID);
- this.reveal(true, time);
- notification.dismiss();
- });
- });
+ remove_action.activate.connect(RemoveThisFeed);
var markAsRead_action = new GLib.SimpleAction("markFeedAsRead", null);
markAsRead_action.activate.connect(() => {
@@ -232,11 +224,10 @@ public class FeedReader.FeedRow : Gtk.ListBoxRow {
var rename_action = new GLib.SimpleAction("renameFeed", null);
rename_action.activate.connect(showRenamePopover);
- var app = FeedReaderApp.get_default();
- app.add_action(markAsRead_action);
- app.add_action(copyFeedURL_action);
- app.add_action(rename_action);
- app.add_action(remove_action);
+ FeedReaderApp.get_default().add_action(markAsRead_action);
+ FeedReaderApp.get_default().add_action(copyFeedURL_action);
+ FeedReaderApp.get_default().add_action(rename_action);
+ FeedReaderApp.get_default().add_action(remove_action);
@@ -257,10 +248,9 @@ public class FeedReader.FeedRow : Gtk.ListBoxRow {
pop.closed.connect(() => {
this.unset_state_flags(Gtk.StateFlags.PRELIGHT);
});
+
pop.show();
this.set_state_flags(Gtk.StateFlags.PRELIGHT, false);
-
-
return true;
}
@@ -442,4 +432,23 @@ public class FeedReader.FeedRow : Gtk.ListBoxRow {
m_unreadBox.leave_notify_event.disconnect(onUnreadLeave);
}
}
+
+ private void RemoveThisFeed(Variant? parameter)
+ {
+ if(this.is_selected())
+ moveUP();
+
+ uint time = 300;
+ this.reveal(false, time);
+
+ var notification = MainWindow.get_default().showNotification(_("Feed removed: %s").printf(m_feed.getTitle()));
+ ulong eventID = notification.dismissed.connect(() => {
+ FeedReaderBackend.get_default().removeFeed(m_feed.getFeedID());
+ });
+ notification.action.connect(() => {
+ notification.disconnect(eventID);
+ this.reveal(true, time);
+ notification.dismiss();
+ });
+ }
}