[meld] First move towards using Gtk.Application
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] First move towards using Gtk.Application
- Date: Mon, 14 Oct 2013 21:09:45 +0000 (UTC)
commit e0788c14b7d2f429df8f891e0cc62ffae822feb1
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Oct 6 12:34:13 2013 +1000
First move towards using Gtk.Application
bin/meld | 6 ++----
meld/meldapp.py | 13 +++++++++----
2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index 4da0e54..0f04005 100755
--- a/bin/meld
+++ b/bin/meld
@@ -152,10 +152,8 @@ def main():
already_running, dbus_app = False, None
meld.meldapp.dbus_app = dbus_app
- app.create_window()
- new_window = app.parse_args(sys.argv[1:])
- if new_window or not already_running:
- Gtk.main()
+ status = app.run(sys.argv)
+ sys.exit(status)
if profiling:
import profile
diff --git a/meld/meldapp.py b/meld/meldapp.py
index e6d1d55..5b96f8f 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -34,7 +34,7 @@ from . import preferences
from . import recent
-class MeldApp(GObject.GObject):
+class MeldApp(Gtk.Application):
__gsignals__ = {
'file-filters-changed': (GObject.SignalFlags.RUN_FIRST,
@@ -44,7 +44,7 @@ class MeldApp(GObject.GObject):
}
def __init__(self):
- GObject.GObject.__init__(self)
+ Gtk.Application.__init__(self)
GObject.set_application_name("Meld")
Gtk.Window.set_default_icon_name("meld")
self.version = conf.__version__
@@ -56,9 +56,14 @@ class MeldApp(GObject.GObject):
filters.FilterEntry.REGEX)
self.recent_comparisons = recent.RecentFiles(sys.argv[0])
- def create_window(self):
+ def do_startup(self):
+ Gtk.Application.do_startup(self)
+
+ def do_activate(self):
+ # Should be meldwindow.MeldWindow(self), and rely on the Application
+ # to keep track
self.window = meldwindow.MeldWindow()
- return self.window
+ self.add_window(self.window.widget)
def on_preference_changed(self, key, val):
if key == "filters":
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]