From cf848436b4ecbfbc205a34e31b363e7a58f42d60 Mon Sep 17 00:00:00 2001 From: Patrick Ulbrich Date: Tue, 18 Oct 2011 19:19:33 +0200 Subject: [PATCH] drop gtk2 workaround code --- Mailnag/config_window.py | 2 -- Mailnag/keyring.py | 7 +------ Mailnag/mailnag.py | 30 ++++++------------------------ data/keyring_dialog.ui | 5 ++--- 4 files changed, 9 insertions(+), 35 deletions(-) diff --git a/Mailnag/config_window.py b/Mailnag/config_window.py index 6a654e5..3dc2fed 100644 --- a/Mailnag/config_window.py +++ b/Mailnag/config_window.py @@ -24,8 +24,6 @@ PACKAGE_NAME = "mailnag" -__builtins__.USE_GTK3 = True # make keyring.py use GTK3 - from gi.repository import GLib, GdkPixbuf, Gtk, GObject import os diff --git a/Mailnag/keyring.py b/Mailnag/keyring.py index 66c5ee4..c728080 100644 --- a/Mailnag/keyring.py +++ b/Mailnag/keyring.py @@ -22,12 +22,7 @@ # MA 02110-1301, USA. # -if __builtins__["USE_GTK3"]: - from gi.repository import GObject, GLib, GdkPixbuf, Gtk -else: - Gtk = __import__("gtk") - GLib = __import__("glib") - +from gi.repository import GObject, GLib, GdkPixbuf, Gtk import locale import gettext diff --git a/Mailnag/mailnag.py b/Mailnag/mailnag.py index 0993045..f1299c3 100644 --- a/Mailnag/mailnag.py +++ b/Mailnag/mailnag.py @@ -31,16 +31,7 @@ import subprocess PACKAGE_NAME = "mailnag" -# TODO : use gtk and glib from gi.repositrory -# (those conflict with pynotify and gi.repository.Notify is broken) -__builtins__.USE_GTK3 = False # (also prevents keyring.py from using GTK3) - -if __builtins__.USE_GTK3: - from gi.repository import GObject, GLib, GdkPixbuf, Gtk, Notify -else: - Gtk = __import__("gtk") - GObject = __import__("gobject") - import pynotify +from gi.repository import GObject, GLib, GdkPixbuf, Gtk, Notify import time import email @@ -501,21 +492,12 @@ class MailChecker: self.mails = Mails() # create Mails object self.reminder = Reminder() # create Reminder object - # TODO : gi.repository Notify seems to be unstable currently (set_hint and add_action crash) - # Notify.init(cfg.get('general', 'messagetray_label')) # initialize Notification - # self.notification = Notify.Notification.new(" ", None, None) # empty string will emit a gtk warning - # self.notification.set_hint("resident", GLib.Variant("b", True)) # don't close when the bubble or actions are clicked - # self.notification.set_category("email") - # self.notification.add_action("open", _("Open in mail reader"), self.__notification_action_handler, None, None) - # self.notification.add_action("close", _("Close"), self.__notification_action_handler, None, None) - - pynotify.init(cfg.get('general', 'messagetray_label')) # initialize Notification - - self.notification = pynotify.Notification(" ", None, None) # empty string will emit a gtk warning - self.notification.set_hint("resident", True) # don't close when the bubble or actions are clicked + Notify.init(cfg.get('general', 'messagetray_label')) # initialize Notification + self.notification = Notify.Notification.new(" ", None, None) # empty string will emit a gtk warning + self.notification.set_hint("resident", GLib.Variant("b", True)) # don't close when the bubble or actions are clicked self.notification.set_category("email") - self.notification.add_action("open", _("Open in mail reader"), self.__notification_action_handler) - self.notification.add_action("close", _("Close"), self.__notification_action_handler) + self.notification.add_action("open", _("Open in mail reader"), self.__notification_action_handler, None, None) + self.notification.add_action("close", _("Close"), self.__notification_action_handler, None, None) def timeout(self, firstcheck = False): diff --git a/data/keyring_dialog.ui b/data/keyring_dialog.ui index 5cd2044..de6c6c8 100644 --- a/data/keyring_dialog.ui +++ b/data/keyring_dialog.ui @@ -61,11 +61,10 @@ - - + True False - + vertical 6