[gnome-tweak-tool] Make logout notification persistant



commit a5654d95fc802d28918991512b3b3a9374de19d7
Author: John Stowers <john stowers gmail com>
Date:   Sun Aug 4 17:16:17 2013 +0200

    Make logout notification persistant

 gtweak/tweakview.py |   10 +++++++---
 gtweak/utils.py     |   17 +++++++++++++----
 2 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index 957897a..2a7b155 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -23,7 +23,7 @@ from gi.repository import Gtk, Gdk, GObject
 
 import gtweak.tweakmodel
 from gtweak.tweakmodel import TweakModel
-from gtweak.utils import Notification
+from gtweak.utils import LogoutNotification
 from gtweak.widgets import Title
 
 DEFAULT_TWEAKGROUP = gtweak.tweakmodel.TWEAK_GROUP_APPEARANCE
@@ -232,8 +232,12 @@ class Window(Gtk.ApplicationWindow):
         #the main window
         
         if need_logout:
-            notification = Notification()
-            notification.show()
+            try:
+                notification = LogoutNotification()
+                notification.show()
+                return
+            except:
+                pass
         
         info = Gtk.InfoBar()
         info.get_content_area().add(Gtk.Label(desc))
diff --git a/gtweak/utils.py b/gtweak/utils.py
index fba9e54..7a46b23 100644
--- a/gtweak/utils.py
+++ b/gtweak/utils.py
@@ -312,14 +312,23 @@ class XSettingsOverrides:
     def get_enable_primary_paste(self):
         self._get_override('Gtk/EnablePrimaryPaste', True)
 
-class Notification:
-    def __init__(self):       
+class LogoutNotification:
+    def __init__(self):
         self.notification = None
         if Notify.is_initted() or Notify.init("GNOME Tweak Tool"):
             self.notification = Notify.Notification.new("Configuration changes requiere restart","Your 
session needs to be restarted for settings to take effect", 'gnome-tweak-tool')
-            self.notification.add_action("restart", "Restart Session",self.logout,None,None)
+            self.notification.add_action(
+                                "restart",
+                                "Restart Session",
+                                self.logout,None,None)
+            self.notification.set_hint(
+                                "resident",
+                                GLib.Variant('b', True))
+            self.notification.set_hint(
+                                "desktop-entry",
+                                GLib.Variant('s', 'gnome-tweak-tool'))
         else:
-            print "Error: Could not create the notification"
+            raise Exception("Not Supported")
 
     def show(self):
         if self.notification:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]