[meld] Move recent files management off the app
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Move recent files management off the app
- Date: Mon, 30 Dec 2013 21:22:44 +0000 (UTC)
commit b6f671440273492a944900da2fef611bba39276d
Author: Kai Willadsen <kai willadsen gmail com>
Date: Tue Dec 31 06:38:16 2013 +1000
Move recent files management off the app
meld/meldapp.py | 4 ----
meld/meldwindow.py | 10 +++++-----
meld/recent.py | 4 +---
3 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/meld/meldapp.py b/meld/meldapp.py
index 0a03fe0..fe41e9c 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -20,7 +20,6 @@ from __future__ import print_function
import optparse
import os
-import sys
from gettext import gettext as _
from gi.repository import Gio
@@ -29,10 +28,8 @@ from gi.repository import Gdk
from gi.repository import Gtk
import meld.conf
-import meld.filters
import meld.preferences
import meld.ui.util
-import meld.recent
class MeldApp(Gtk.Application):
@@ -43,7 +40,6 @@ class MeldApp(Gtk.Application):
self.set_application_id("org.gnome.meld")
GObject.set_application_name("Meld")
Gtk.Window.set_default_icon_name("meld")
- self.recent_comparisons = meld.recent.RecentFiles()
self.window = None
def do_startup(self):
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index de3e329..11e17eb 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -36,7 +36,7 @@ from .ui import gnomeglade
from .ui import notebooklabel
from .util.compat import string_types
-from .meldapp import app
+from meld.recent import recent_comparisons
from meld.settings import interface_settings, settings
@@ -147,7 +147,7 @@ class MeldWindow(gnomeglade.Component):
recent_action = Gtk.RecentAction("Recent", _("Open Recent"),
_("Open recent files"), None)
recent_action.set_show_private(True)
- recent_action.set_filter(app.recent_comparisons.recent_filter)
+ recent_action.set_filter(recent_comparisons.recent_filter)
recent_action.set_sort_type(Gtk.RecentSortType.MRU)
recent_action.connect("item-activated", self.on_action_recent)
self.actiongroup.add_action(recent_action)
@@ -678,7 +678,7 @@ class MeldWindow(gnomeglade.Component):
return doc
def append_recent(self, uri):
- comparison_type, files, flags = app.recent_comparisons.read(uri)
+ comparison_type, files, flags = recent_comparisons.read(uri)
if comparison_type == recent.TYPE_MERGE:
tab = self.append_filemerge(files)
elif comparison_type == recent.TYPE_FOLDER:
@@ -689,7 +689,7 @@ class MeldWindow(gnomeglade.Component):
else: # comparison_type == recent.TYPE_FILE:
tab = self.append_filediff(files)
self.notebook.set_current_page(self.notebook.page_num(tab.widget))
- app.recent_comparisons.add(tab)
+ recent_comparisons.add(tab)
return tab
def _single_file_open(self, path):
@@ -717,7 +717,7 @@ class MeldWindow(gnomeglade.Component):
elif len(paths) in (2, 3):
tab = self.append_diff(paths, auto_compare, auto_merge)
if tab:
- app.recent_comparisons.add(tab)
+ recent_comparisons.add(tab)
return tab
def current_doc(self):
diff --git a/meld/recent.py b/meld/recent.py
index 0f0318d..5ddc8c3 100644
--- a/meld/recent.py
+++ b/meld/recent.py
@@ -228,6 +228,4 @@ class RecentFiles(object):
return "\n".join(descriptions)
-if __name__ == "__main__":
- recent = RecentFiles()
- print(recent)
+recent_comparisons = RecentFiles()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]