[gnome-menus] [editor] Port to GtkBuilder
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-menus] [editor] Port to GtkBuilder
- Date: Sat, 20 Jun 2009 19:29:41 -0400 (EDT)
commit d504fabf22e5303abd631e5a868fb5f45f4c7b05
Author: Pedro Fragoso <ember ubuntu com>
Date: Sun Jun 21 01:17:26 2009 +0200
[editor] Port to GtkBuilder
(with a few tweaks by me to make it work)
http://bugzilla.gnome.org/show_bug.cgi?id=580158
po/POTFILES.in | 2 +-
simple-editor/GMenuSimpleEditor/config.py.in | 2 +-
simple-editor/GMenuSimpleEditor/main.py | 2 -
simple-editor/GMenuSimpleEditor/maindialog.py | 16 +-
simple-editor/Makefile.am | 6 +-
simple-editor/gmenu-simple-editor.glade | 232 -------------------------
simple-editor/gmenu-simple-editor.ui | 217 +++++++++++++++++++++++
7 files changed, 230 insertions(+), 247 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 687e9b7..185d971 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -21,7 +21,7 @@ desktop-directories/X-GNOME-Menu-Applications.directory.in
desktop-directories/X-GNOME-Menu-System.directory.in
desktop-directories/X-GNOME-Other.directory.in
simple-editor/gmenu-simple-editor.desktop.in
-simple-editor/gmenu-simple-editor.glade
+simple-editor/gmenu-simple-editor.ui
simple-editor/GMenuSimpleEditor/maindialog.py
simple-editor/GMenuSimpleEditor/menufilewriter.py
util/test-menu-spec.c
diff --git a/simple-editor/GMenuSimpleEditor/config.py.in b/simple-editor/GMenuSimpleEditor/config.py.in
index 1d15fbf..092b0d7 100644
--- a/simple-editor/GMenuSimpleEditor/config.py.in
+++ b/simple-editor/GMenuSimpleEditor/config.py.in
@@ -25,4 +25,4 @@ VERSION = "@PACKAGE_VERSION@"
DATADIR = "@DATADIR@"
LOCALEDIR = "@LOCALEDIR@"
-GLADEDIR = os.path.join (DATADIR, PACKAGE, "glade")
+UI_DIR = os.path.join (DATADIR, PACKAGE, "ui")
diff --git a/simple-editor/GMenuSimpleEditor/main.py b/simple-editor/GMenuSimpleEditor/main.py
index 6cdb91d..95539a8 100644
--- a/simple-editor/GMenuSimpleEditor/main.py
+++ b/simple-editor/GMenuSimpleEditor/main.py
@@ -26,14 +26,12 @@ def main (args):
from gobject.option import OptionParser, make_option
import gtk
- import gtk.glade
import maindialog
import config
locale.setlocale (locale.LC_ALL, "")
gettext.install (config.PACKAGE, config.LOCALEDIR)
- gtk.glade.bindtextdomain (config.PACKAGE, config.LOCALEDIR)
parser = OptionParser (
option_list = [
diff --git a/simple-editor/GMenuSimpleEditor/maindialog.py b/simple-editor/GMenuSimpleEditor/maindialog.py
index b8c61b7..3cd9a31 100644
--- a/simple-editor/GMenuSimpleEditor/maindialog.py
+++ b/simple-editor/GMenuSimpleEditor/maindialog.py
@@ -18,7 +18,6 @@
import os.path
import gtk
-import gtk.glade
import gmenu
from config import *
@@ -28,19 +27,20 @@ import menufilewriter
class MenuEditorDialog:
def __init__ (self, menu_files):
- glade_file = os.path.join (GLADEDIR, "gmenu-simple-editor.glade")
- self.xml = gtk.glade.XML (glade_file, "menu_editor_dialog", PACKAGE)
-
- self.window = self.xml.get_widget ("menu_editor_dialog")
+ ui_file = os.path.join (UI_DIR, "gmenu-simple-editor.ui")
+ self.ui = gtk.Builder()
+ self.ui.set_translation_domain (PACKAGE)
+ self.ui.add_from_file(ui_file)
+ self.window = self.ui.get_object ("menu_editor_dialog")
self.window.connect ("destroy", gtk.main_quit)
self.window.set_default_response (gtk.RESPONSE_ACCEPT)
self.window.set_icon_name ("gnome-main-menu")
- self.help_button = self.xml.get_widget ("help_button")
+ self.help_button = self.ui.get_object ("help_button")
self.help_button.set_sensitive (False)
- self.menus_tree = self.xml.get_widget ("menus_treeview")
- self.entries_list = self.xml.get_widget ("applications_treeview")
+ self.menus_tree = self.ui.get_object ("menus_treeview")
+ self.entries_list = self.ui.get_object ("applications_treeview")
self.menu_tree_model = menutreemodel.MenuTreeModel (menu_files)
diff --git a/simple-editor/Makefile.am b/simple-editor/Makefile.am
index e304dbd..6a72b7d 100644
--- a/simple-editor/Makefile.am
+++ b/simple-editor/Makefile.am
@@ -8,8 +8,8 @@ gmenu-simple-editor: gmenu-simple-editor.in
$(QUIET_GEN)sed -e s!\ pyexecdir\@! pyexecdir@! -e s!\ PYTHON\@! PYTHON@! < $< > $@ && \
chmod a+x $@
-gladedir = $(pkgdatadir)/glade
-glade_DATA = gmenu-simple-editor.glade
+uidir = $(pkgdatadir)/ui
+ui_DATA = gmenu-simple-editor.ui
desktopdir = $(datadir)/applications
desktop_in_files = gmenu-simple-editor.desktop.in
@@ -20,7 +20,7 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
EXTRA_DIST = \
gmenu-simple-editor.in \
gmenu-simple-editor.desktop.in \
- gmenu-simple-editor.glade
+ gmenu-simple-editor.ui
CLEANFILES = \
gmenu-simple-editor \
diff --git a/simple-editor/gmenu-simple-editor.ui b/simple-editor/gmenu-simple-editor.ui
new file mode 100644
index 0000000..82c98cc
--- /dev/null
+++ b/simple-editor/gmenu-simple-editor.ui
@@ -0,0 +1,217 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+ <object class="GtkDialog" id="menu_editor_dialog">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Edit Menus</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <object class="GtkButton" id="help_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-help</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="defaults_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Defaults</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHPaned" id="hpaned1">
+ <property name="border_width">5</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkVBox" id="menus_vbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="menus_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Menus:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">menus_treeview</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="menus_scrolled">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+ <child>
+ <object class="GtkTreeView" id="menus_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
+ <property name="hover_selection">False</property>
+ <property name="hover_expand">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="shrink">True</property>
+ <property name="resize">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="applications_vbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="applications_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Applications:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">applications_treeview</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="applications_scrolled">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+ <child>
+ <object class="GtkTreeView" id="applications_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
+ <property name="hover_selection">False</property>
+ <property name="hover_expand">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="shrink">True</property>
+ <property name="resize">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-11">help_button</action-widget>
+ <action-widget response="-2">defaults_button</action-widget>
+ <action-widget response="-3">close_button</action-widget>
+ </action-widgets>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]