[pessulus] [pessulus] Port to GtkBuilder
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pessulus] [pessulus] Port to GtkBuilder
- Date: Tue, 11 Aug 2009 15:16:46 +0000 (UTC)
commit 28d0bb46ff000b7805f6d41b724b8b713264a5a9
Author: Vincent Untz <vuntz gnome org>
Date: Tue Aug 11 17:15:25 2009 +0200
[pessulus] Port to GtkBuilder
Pessulus/Makefile.am | 2 +-
Pessulus/config.py.in | 2 +-
Pessulus/lockdownbutton.py | 5 +-
Pessulus/main.py | 2 -
Pessulus/maindialog.py | 34 ++--
data/Makefile.am | 6 +-
data/pessulus.glade | 566 --------------------------------------------
data/pessulus.ui | 418 ++++++++++++++++++++++++++++++++
8 files changed, 444 insertions(+), 591 deletions(-)
---
diff --git a/Pessulus/Makefile.am b/Pessulus/Makefile.am
index ace8dc9..ab191c4 100644
--- a/Pessulus/Makefile.am
+++ b/Pessulus/Makefile.am
@@ -25,7 +25,7 @@ config.py: config.py.in Makefile
$(AM_V_GEN)sed \
-e s!\ LOCALEDIR\@!$(datadir)/locale! \
-e s!\ DATADIR\@!$(datadir)! \
- -e s!\ GLADEDIR\@!$(pkgdatadir)/glade! \
+ -e s!\ BUILDERDIR\@!$(pkgdatadir)/ui! \
-e s!\ GCONF_MANDATORY_SOURCE\@! GCONF_MANDATORY_SOURCE@! \
-e s!\ PACKAGE_NAME\@!$(PACKAGE_NAME)! \
-e s!\ PACKAGE_VERSION\@!$(PACKAGE_VERSION)! \
diff --git a/Pessulus/config.py.in b/Pessulus/config.py.in
index e37a8b6..abdaf7c 100644
--- a/Pessulus/config.py.in
+++ b/Pessulus/config.py.in
@@ -25,6 +25,6 @@ VERSION = "@PACKAGE_VERSION@"
LOCALEDIR = "@LOCALEDIR@"
DATADIR = "@DATADIR@"
-GLADEDIR = "@GLADEDIR@"
+BUILDERDIR = "@BUILDERDIR@"
GCONF_MANDATORY_SOURCE = "@GCONF_MANDATORY_SOURCE@"
diff --git a/Pessulus/lockdownbutton.py b/Pessulus/lockdownbutton.py
index 8bf7cbb..7f51921 100644
--- a/Pessulus/lockdownbutton.py
+++ b/Pessulus/lockdownbutton.py
@@ -58,7 +58,10 @@ class PessulusLockdownButton (gobject.GObject):
lockdownbutton = PessulusLockdownButton ()
lockdownbutton.button = button
- button.remove (button.get_child ())
+ child = button.get_child ()
+
+ if child is not None:
+ button.remove (child)
lockdownbutton.__connect_and_update ()
return lockdownbutton
diff --git a/Pessulus/main.py b/Pessulus/main.py
index cd51dfb..421b43e 100644
--- a/Pessulus/main.py
+++ b/Pessulus/main.py
@@ -28,7 +28,6 @@ def main (args):
import pygtk; pygtk.require('2.0');
import gtk
- import gtk.glade
import maindialog
import lockdownappliergconf
@@ -39,7 +38,6 @@ def main (args):
except locale.Error:
print >> sys.stderr, "Warning: unsupported locale"
gettext.install (config.PACKAGE, config.LOCALEDIR)
- gtk.glade.bindtextdomain (config.PACKAGE, config.LOCALEDIR)
gtk.window_set_default_icon_name ("pessulus")
diff --git a/Pessulus/maindialog.py b/Pessulus/maindialog.py
index 8013436..543b0b7 100644
--- a/Pessulus/maindialog.py
+++ b/Pessulus/maindialog.py
@@ -23,7 +23,6 @@ import gconf
import gettext
import gobject
import gtk
-import gtk.glade
from xml.sax.saxutils import escape as escape_pango
@@ -89,10 +88,11 @@ class PessulusMainDialog:
for gconfdir in gconfdirs:
globalvar.applier.add_dir (gconfdir, gconf.CLIENT_PRELOAD_NONE)
- self.glade_file = os.path.join (GLADEDIR, "pessulus.glade")
- self.xml = gtk.glade.XML (self.glade_file, "dialogEditor", PACKAGE)
+ self.builder = gtk.Builder()
+ self.builder.set_translation_domain(PACKAGE)
+ self.builder.add_from_file(os.path.join (BUILDERDIR, "pessulus.ui"))
- self.window = self.xml.get_widget ("dialogEditor")
+ self.window = self.builder.get_object ("dialogEditor")
self.window.connect ("response", self.__on_dialog_response)
if self.quit_on_close:
@@ -111,30 +111,30 @@ class PessulusMainDialog:
for (key, string, box_str) in lockdownbuttons:
button = lockdowncheckbutton.PessulusLockdownCheckbutton.new (key,
string)
- box = self.xml.get_widget (box_str)
+ box = self.builder.get_object (box_str)
box.pack_start (button.get_widget (), False)
def __init_disabledapplets (self):
- treeview = self.xml.get_widget ("treeviewDisabledApplets")
- button = self.xml.get_widget ("buttonDisabledApplets")
+ treeview = self.builder.get_object ("treeviewDisabledApplets")
+ button = self.builder.get_object ("buttonDisabledApplets")
ldbutton = lockdownbutton.PessulusLockdownButton.new_with_widget (button)
self.disabledapplets = disabledapplets.PessulusDisabledApplets (treeview,
ldbutton)
def __init_safeprotocols (self):
- button = self.xml.get_widget ("buttonDisableUnsafeProtocols")
- checkbutton = self.xml.get_widget ("checkbuttonDisableUnsafeProtocols")
+ button = self.builder.get_object ("buttonDisableUnsafeProtocols")
+ checkbutton = self.builder.get_object ("checkbuttonDisableUnsafeProtocols")
lockdown = lockdowncheckbutton.PessulusLockdownCheckbutton.new_with_widgets (
"/apps/epiphany/lockdown/disable_unsafe_protocols",
button, checkbutton)
- hbox = self.xml.get_widget ("hboxSafeProtocols")
+ hbox = self.builder.get_object ("hboxSafeProtocols")
- treeview = self.xml.get_widget ("treeviewSafeProtocols")
- addbutton = self.xml.get_widget ("buttonSafeProtocolAdd")
- editbutton = self.xml.get_widget ("buttonSafeProtocolEdit")
- removebutton = self.xml.get_widget ("buttonSafeProtocolRemove")
+ treeview = self.builder.get_object ("treeviewSafeProtocols")
+ addbutton = self.builder.get_object ("buttonSafeProtocolAdd")
+ editbutton = self.builder.get_object ("buttonSafeProtocolEdit")
+ removebutton = self.builder.get_object ("buttonSafeProtocolRemove")
self.safeprotocols = safeprotocols.PessulusSafeProtocols (lockdown.get_lockdownbutton (),
treeview,
@@ -152,14 +152,14 @@ class PessulusMainDialog:
else:
store = gtk.ListStore (str, str, int)
- notebook = self.xml.get_widget ("notebook2")
+ notebook = self.builder.get_object ("notebook2")
children = notebook.get_children ()
for (name, icon, widgetname) in pages:
i = 0
found = False
for child in children:
- if child == self.xml.get_widget (widgetname):
+ if child == self.builder.get_object (widgetname):
found = True
break
i += 1
@@ -177,7 +177,7 @@ class PessulusMainDialog:
self.COLUMN_NAME, name,
self.COLUMN_PAGENUMBER, i)
- pageselector = self.xml.get_widget ("pageselector")
+ pageselector = self.builder.get_object ("pageselector")
pageselector.set_model (store)
col = gtk.TreeViewColumn ()
diff --git a/data/Makefile.am b/data/Makefile.am
index bf19edd..9b4d3cc 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,5 +1,5 @@
-gladedir = $(pkgdatadir)/glade
-glade_DATA = pessulus.glade
+uidir = $(pkgdatadir)/ui
+ui_DATA = pessulus.ui
desktopdir = $(datadir)/applications
desktop_in_files = pessulus.desktop.in
@@ -9,7 +9,7 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
EXTRA_DIST = \
$(desktop_in_files) \
- $(glade_DATA) \
+ $(ui_DATA) \
pessulus-16.png pessulus-22.png \
pessulus-24.png pessulus-32.png \
pessulus-48.png pessulus.svg
diff --git a/data/pessulus.ui b/data/pessulus.ui
new file mode 100644
index 0000000..c140ad7
--- /dev/null
+++ b/data/pessulus.ui
@@ -0,0 +1,418 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="dialogEditor">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Lockdown Editor</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="pageselector">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="notebook2">
+ <property name="visible">True</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
+ <child>
+ <object class="GtkVBox" id="vbox7">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox12">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkVBox" id="vbox8">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox13">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="buttonDisabledApplets">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="relief">none</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Disabled Applets</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeviewDisabledApplets">
+ <property name="width_request">375</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vboxEpiphany">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkVBox" id="vbox9">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox14">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Safe Protocols</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox10">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="buttonDisableUnsafeProtocols">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="relief">none</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="checkbuttonDisableUnsafeProtocols">
+ <property name="label" translatable="yes">Disable _unsafe protocols</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hboxSafeProtocols">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeviewSafeProtocols">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox11">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkButton" id="buttonSafeProtocolAdd">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="buttonSafeProtocolEdit">
+ <property name="label">gtk-edit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="buttonSafeProtocolRemove">
+ <property name="label">gtk-remove</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox15">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="helpbutton">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="closebutton">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-11">helpbutton</action-widget>
+ <action-widget response="-7">closebutton</action-widget>
+ </action-widgets>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]