Commit 27dd59e9 authored by Alex Muñoz's avatar Alex Muñoz Committed by John Stowers

Notifications with the logout option

parent 7a7c2f7a
......@@ -22,6 +22,7 @@ from gi.repository import Gtk, Gdk, GObject
import gtweak.tweakmodel
from gtweak.tweakmodel import TweakModel
from gtweak.utils import Notification
WIDGET_SORT_ORDER = (Gtk.Switch, Gtk.SpinButton, Gtk.ComboBox, Gtk.Box, Gtk.VBox, Gtk.HBox)
......@@ -116,7 +117,11 @@ class TweakView:
def _on_tweak_notify(self, tweak, desc, error, btn, func, need_logout):
#if need to log out, do this as a notification area thing, not a note inside
#the main window
if need_logout:
notification = Notification()
info = Gtk.InfoBar()
......@@ -20,6 +20,7 @@ import logging
import tempfile
import shutil
import subprocess
import dbus
import gtweak
from gtweak.gsettings import GSettingsSetting
......@@ -27,6 +28,8 @@ from gtweak.gsettings import GSettingsSetting
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gio
from gi.repository import Notify
def singleton(cls):
Singleton decorator that works with GObject derived types. The 'recommended'
......@@ -309,6 +312,23 @@ class XSettingsOverrides:
def get_enable_primary_paste(self):
self._get_override('Gtk/EnablePrimaryPaste', True)
class Notification:
def __init__(self):
self.notification = None
if Notify.is_initted() or Notify.init("GNOME Tweak Tool"):
self.notification ="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)
print "Error: Could not create the notification"
def show(self):
if self.notification:
def logout(self, btn, action, unknown):
bus = dbus.SessionBus()
serviceManager = bus.get_object('org.gnome.SessionManager', '/org/gnome/SessionManager')
if __name__ == "__main__":
gtweak.DATA_DIR = "/usr/share"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment