commit 7bb5af86b404d3e89f92019dba224e6fe258f7ea Author: Balló György Date: Sun Jan 5 16:54:41 2014 +0100 Port Lock screen dialog to GTK+ 3 diff --git a/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.glade b/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.glade deleted file mode 100644 index a4200f9..0000000 --- a/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.glade +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - False - 6 - dialog - - - True - False - 6 - - - True - False - end - - - gtk-cancel - True - True - True - False - True - - - False - False - 0 - - - - - gtk-ok - True - True - True - False - True - - - False - False - 1 - - - - - False - True - 3 - end - 0 - - - - - True - False - gtk-missing-image - - - False - True - 3 - 1 - - - - - True - False - label - - - False - True - 3 - 2 - - - - - True - False - - - True - False - label - - - False - True - 0 - - - - - True - False - - - True - False - <b>"</b> - True - - - False - True - 0 - - - - - True - True - - True - False - False - True - True - - - True - True - 1 - - - - - True - False - <b>"</b> - True - - - False - True - 2 - - - - - True - True - 1 - - - - - True - True - 3 - 3 - - - - - - diff --git a/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.py b/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.py index f6f3ad1..72cdf4f 100755 --- a/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.py +++ b/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.py @@ -3,8 +3,7 @@ import sys import os import gettext -import gtk -import gtk.glade +from gi.repository import Gtk import pwd import socket @@ -25,32 +24,32 @@ class MainWindow: if real_name == "": real_name = username - gladefile = "/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.glade" - self.wTree = gtk.glade.XML(gladefile, "main_dialog") + self.builder = Gtk.Builder() + self.builder.add_from_file("/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.ui") - self.window = self.wTree.get_widget("main_dialog") - self.button_cancel = self.wTree.get_widget("button_cancel") - self.button_ok = self.wTree.get_widget("button_ok") - self.entry = self.wTree.get_widget("entry_away_message") - self.image = self.wTree.get_widget("image_face") + self.window = self.builder.get_object("main_dialog") + self.button_cancel = self.builder.get_object("button_cancel") + self.button_ok = self.builder.get_object("button_ok") + self.entry = self.builder.get_object("entry_away_message") + self.image = self.builder.get_object("image_face") self.window.set_title(_("Lock screen")) self.window.set_icon_from_file("/usr/lib/cinnamon-settings/data/icons/screensaver.svg") - self.wTree.get_widget("label_description").set_markup("%s" % _("Please type an away message for the lock screen")) - self.wTree.get_widget("label_away_message").set_markup("%s: " % real_name) + self.builder.get_object("label_description").set_markup("%s" % _("Please type an away message for the lock screen")) + self.builder.get_object("label_away_message").set_markup("%s: " % real_name) if os.path.exists("%s/.face" % home_dir): self.image.set_from_file("%s/.face" % home_dir) else: self.image.set_from_file("/usr/share/pixmaps/nobody.png") - self.window.connect("destroy", gtk.main_quit) - self.button_cancel.connect("clicked", gtk.main_quit) + self.window.connect("destroy", Gtk.main_quit) + self.button_cancel.connect("clicked", Gtk.main_quit) self.button_ok.connect('clicked', self.lock_screen) self.entry.connect('activate', self.lock_screen) - self.wTree.get_widget("dialog-action_area1").set_focus_chain((self.button_ok, self.button_cancel)) + self.builder.get_object("dialog-action_area1").set_focus_chain((self.button_ok, self.button_cancel)) self.window.show() @@ -60,8 +59,8 @@ class MainWindow: os.system("cinnamon-screensaver-command --lock --away-message \"%s\" &" % self.entry.get_text()) else: os.system("cinnamon-screensaver-command --lock &") - gtk.main_quit() + Gtk.main_quit() if __name__ == "__main__": MainWindow() - gtk.main() + Gtk.main() diff --git a/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.ui b/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.ui new file mode 100644 index 0000000..30700b9 --- /dev/null +++ b/files/usr/lib/cinnamon-screensaver-lock-dialog/cinnamon-screensaver-lock-dialog.ui @@ -0,0 +1,165 @@ + + + + + + False + 6 + dialog + + + True + False + 6 + + + True + False + end + + + gtk-cancel + True + True + True + False + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + False + True + + + False + False + 1 + + + + + False + True + 3 + end + 0 + + + + + True + False + gtk-missing-image + + + False + True + 3 + 1 + + + + + True + False + label + + + False + True + 3 + 2 + + + + + True + False + + + True + False + label + + + False + True + 0 + + + + + True + False + + + True + False + <b>"</b> + True + + + False + True + 0 + + + + + True + True + + True + False + False + True + True + + + True + True + 1 + + + + + True + False + <b>"</b> + True + + + False + True + 2 + + + + + True + True + 1 + + + + + True + True + 3 + 3 + + + + + +