Continuing move away from custom glade stuff

This commit is contained in:
Yevgen Muntyan 2008-08-30 03:00:08 -05:00
parent 5074bb82df
commit f79ba38656
23 changed files with 591 additions and 821 deletions

View File

@ -16,7 +16,10 @@ libmooapp_SOURCES_ = $(mooapp_sources)
BUILT_SOURCES += mooapp-credits.h
GLADE_FILES = glade/mooappabout.glade
GLADE2_FILES = \
glade/mooappabout-dialog.glade \
glade/mooappabout-license.glade \
glade/mooappabout-credits.glade
AM_CFLAGS_ = $(MOO_CFLAGS)
AM_CXXFLAGS_ = $(MOO_CXXFLAGS)

View File

@ -0,0 +1,137 @@
<?xml version="1.0"?>
<glade-interface>
<widget class="GtkDialog" id="CreditsDialog">
<property name="title" translatable="yes" context="yes" comments="Translators: do not translate the part before |">Dialog title|Credits</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="default_width">360</property>
<property name="default_height">260</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<child>
<widget class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<widget class="GtkTextView" id="thanks">
<property name="visible">True</property>
<property name="left_margin">3</property>
<property name="right_margin">3</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Tab label in Credits dialog">Thanks</property>
</widget>
<packing>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<widget class="GtkTextView" id="written_by:MooHtml">
<property name="visible">True</property>
<property name="editable">False</property>
<property name="left_margin">3</property>
<property name="right_margin">3</property>
<property name="cursor_visible">False</property>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Tab label in Credits dialog">Written by</property>
</widget>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="page_translator_credits">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<widget class="GtkTextView" id="translated_by:MooHtml">
<property name="visible">True</property>
<property name="editable">False</property>
<property name="left_margin">3</property>
<property name="right_margin">3</property>
<property name="cursor_visible">False</property>
</widget>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Tab label in Credits dialog">Translated by</property>
</widget>
<packing>
<property name="position">2</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="close">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">-6</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -0,0 +1,176 @@
<?xml version="1.0"?>
<glade-interface>
<widget class="GtkDialog" id="AboutDialog">
<property name="title" translatable="yes" context="yes" comments="Translators: do not translate the part before |">Dialog title|About</property>
<property name="resizable">False</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="spacing">8</property>
<child>
<widget class="GtkImage" id="logo">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
<property name="icon_size">6</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="name">
<property name="visible">True</property>
<property name="label" context="yes">&lt;span size="xx-large"&gt;&lt;b&gt;The App&lt;/b&gt;&lt;/span&gt;</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="description">
<property name="visible">True</property>
<property name="label" context="yes">The App is an app</property>
<property name="selectable">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="copyright">
<property name="visible">True</property>
<property name="label" context="yes">&lt;small&gt;&#xA9; 2004-2006 The Author&lt;/small&gt;</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xscale">0</property>
<child>
<widget class="GtkLabel" id="url:MooLinkLabel">
<property name="visible">True</property>
<property name="label" context="yes">&lt;span foreground="#0000FF"&gt;http://somesite.org&lt;/span&gt;</property>
<property name="use_markup">True</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="credits_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="focus_on_click">False</property>
<property name="response_id">0</property>
<child>
<widget class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="label" translatable="yes" context="yes" comments="Credits button label in About dialog">C_redits</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="license_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label" translatable="yes" context="yes" comments="License button label in About dialog">_License</property>
<property name="use_underline">True</property>
<property name="focus_on_click">False</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="close_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label" context="yes">gtk-close</property>
<property name="use_stock">True</property>
<property name="focus_on_click">False</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<glade-interface>
<widget class="GtkDialog" id="LicenseDialog">
<property name="title" translatable="yes" context="yes" comments="Translators: do not translate the part before |">Dialog title|License</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="default_width">420</property>
<property name="default_height">320</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<widget class="GtkTextView" id="textview">
<property name="visible">True</property>
<property name="editable">False</property>
<property name="cursor_visible">False</property>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="close1">
<property name="visible">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">-6</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -1,415 +0,0 @@
<?xml version="1.0"?>
<glade-interface>
<widget class="GtkDialog" id="dialog">
<property name="title" translatable="yes" context="yes" comments="Translators: do not translate the part before |">Dialog title|About</property>
<property name="resizable">False</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="spacing">8</property>
<child>
<widget class="GtkImage" id="logo">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
<property name="icon_size">6</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="name">
<property name="visible">True</property>
<property name="label" context="yes">&lt;span size="xx-large"&gt;&lt;b&gt;The App&lt;/b&gt;&lt;/span&gt;</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="description">
<property name="visible">True</property>
<property name="label" context="yes">The App is an app</property>
<property name="selectable">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="copyright">
<property name="visible">True</property>
<property name="label" context="yes">&lt;small&gt;&#xA9; 2004-2006 The Author&lt;/small&gt;</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xscale">0</property>
<child>
<widget class="GtkLabel" id="url:MooLinkLabel">
<property name="visible">True</property>
<property name="label" context="yes">&lt;span foreground="#0000FF"&gt;http://somesite.org&lt;/span&gt;</property>
<property name="use_markup">True</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="credits_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="response_id">0</property>
<child>
<widget class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="label" translatable="yes" context="yes" comments="Credits button label in About dialog">C_redits</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="license_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label" translatable="yes" context="yes" comments="License button label in About dialog">_License</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="close_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label" context="yes">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="system">
<property name="title" translatable="yes" context="yes" comments="System Info dialog title, do not translate the part before the |">Dialog title|System Info</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="default_width">360</property>
<property name="default_height">260</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox3">
<property name="visible">True</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<widget class="GtkTextView" id="textview1">
<property name="visible">True</property>
<property name="editable">False</property>
<property name="wrap_mode">GTK_WRAP_CHAR</property>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="close2">
<property name="visible">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="label" context="yes">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">-6</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="license">
<property name="title" translatable="yes" context="yes" comments="Translators: do not translate the part before |">Dialog title|License</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="default_width">420</property>
<property name="default_height">320</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<widget class="GtkTextView" id="textview">
<property name="visible">True</property>
<property name="editable">False</property>
<property name="cursor_visible">False</property>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="close1">
<property name="visible">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">-6</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="credits">
<property name="title" translatable="yes" context="yes" comments="Translators: do not translate the part before |">Dialog title|Credits</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="default_width">360</property>
<property name="default_height">260</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<child>
<widget class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<widget class="GtkTextView" id="thanks">
<property name="visible">True</property>
<property name="left_margin">3</property>
<property name="right_margin">3</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Tab label in Credits dialog">Thanks</property>
</widget>
<packing>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<widget class="GtkTextView" id="written_by:MooHtml">
<property name="visible">True</property>
<property name="editable">False</property>
<property name="left_margin">3</property>
<property name="right_margin">3</property>
<property name="cursor_visible">False</property>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Tab label in Credits dialog">Written by</property>
</widget>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow5">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<widget class="GtkTextView" id="translated_by:MooHtml">
<property name="visible">True</property>
<property name="editable">False</property>
<property name="left_margin">3</property>
<property name="right_margin">3</property>
<property name="cursor_visible">False</property>
</widget>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Tab label in Credits dialog">Translated by</property>
</widget>
<packing>
<property name="position">2</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="close">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">-6</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -1050,13 +1050,6 @@ install_common_actions (void)
"closure-callback", moo_app_help,
NULL);
moo_window_class_new_action (klass, "SystemInfo", NULL,
/* menu item label */
"label", _("System Info"),
"no-accel", TRUE,
"closure-callback", moo_app_system_info_dialog,
NULL);
moo_window_class_new_action (klass, "Quit", NULL,
"display-name", GTK_STOCK_QUIT,
"label", GTK_STOCK_QUIT,

View File

@ -77,7 +77,6 @@ MooEditor *moo_app_get_editor (MooApp *app);
void moo_app_prefs_dialog (GtkWidget *parent);
void moo_app_about_dialog (GtkWidget *parent);
void moo_app_system_info_dialog (GtkWidget *parent);
char *moo_app_get_system_info (MooApp *app);
MooUIXML *moo_app_get_ui_xml (MooApp *app);

View File

@ -10,7 +10,6 @@
* See COPYING file that comes with this distribution.
*/
#include "glade/mooappabout-glade.h"
#include "mooappabout.h"
#include "mooapp.h"
#include "mooapp-credits.h"
@ -24,6 +23,9 @@
#include "mooutils/moodialogs.h"
#include "mooutils/moohelp.h"
#include "help-sections.h"
#include "glade/mooappabout-dialog-gxml.h"
#include "glade/mooappabout-license-gxml.h"
#include "glade/mooappabout-credits-gxml.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <string.h>
@ -34,7 +36,6 @@
static gpointer about_dialog;
static gpointer credits_dialog;
static gpointer system_info_dialog;
#ifndef MOO_USE_XML
@ -44,11 +45,9 @@ static gpointer system_info_dialog;
#endif
static void
set_translator_credits (MooGladeXML *xml)
set_translator_credits (CreditsDialogXml *gxml)
{
GtkWidget *notebook, *page;
const char *credits, *credits_markup;
GtkTextView *view;
/* Translators: this goes into About box, under Translated by tab,
do not ignore it, markup isn't always used. It should be something
@ -62,21 +61,18 @@ set_translator_credits (MooGladeXML *xml)
if (!strcmp (credits, "translator-credits"))
{
notebook = moo_glade_xml_get_widget (xml, "notebook");
page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 2);
gtk_widget_hide (page);
gtk_widget_hide (GTK_WIDGET (gxml->page_translator_credits));
return;
}
view = moo_glade_xml_get_widget (xml, "translated_by");
#if defined(MOO_USE_XML) && !defined(__WIN32__)
if (strcmp (credits_markup, "translator-credits-markup") != 0)
_moo_html_load_memory (view, credits_markup, -1, NULL, NULL);
_moo_html_load_memory (GTK_TEXT_VIEW (gxml->translated_by),
credits_markup, -1, NULL, NULL);
else
#endif
{
GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (gxml->translated_by));
gtk_text_buffer_insert_at_cursor (buffer, credits, -1);
}
}
@ -84,9 +80,7 @@ set_translator_credits (MooGladeXML *xml)
static void
show_credits (void)
{
MooGladeXML *xml;
GtkTextView *written_by;
GtkTextView *thanks;
CreditsDialogXml *gxml;
GtkTextBuffer *buffer;
if (credits_dialog)
@ -98,33 +92,30 @@ show_credits (void)
}
moo_glade_xml_register_type (MOO_TYPE_HTML);
xml = moo_glade_xml_new_from_buf (mooappabout_glade_xml, -1, "credits",
GETTEXT_PACKAGE, NULL);
gxml = credits_dialog_xml_new ();
credits_dialog = moo_glade_xml_get_widget (xml, "credits");
credits_dialog = gxml->CreditsDialog;
g_return_if_fail (credits_dialog != NULL);
g_object_add_weak_pointer (G_OBJECT (credits_dialog), &credits_dialog);
g_signal_connect (credits_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
written_by = moo_glade_xml_get_widget (xml, "written_by");
#if defined(MOO_USE_XML) && !defined(__WIN32__)
_moo_html_load_memory (written_by,
_moo_html_load_memory (GTK_TEXT_VIEW (gxml->written_by),
"Yevgen Muntyan <a href=\"mailto://muntyan@tamu.edu\">"
"&lt;muntyan@tamu.edu&gt;</a>",
-1, NULL, NULL);
#else
/* XXX */
{
buffer = gtk_text_view_get_buffer (written_by);
buffer = gtk_text_view_get_buffer (gxml->written_by);
gtk_text_buffer_insert_at_cursor (buffer,
"Yevgen Muntyan <muntyan@tamu.edu>", -1);
}
#endif
set_translator_credits (xml);
set_translator_credits (gxml);
thanks = moo_glade_xml_get_widget (xml, "thanks");
buffer = gtk_text_view_get_buffer (thanks);
buffer = gtk_text_view_get_buffer (gxml->thanks);
gtk_text_buffer_insert_at_cursor (buffer, MOO_APP_CREDITS, -1);
if (about_dialog)
@ -161,59 +152,44 @@ about_dialog_key_press (GtkWidget *dialog,
static GtkWidget *
create_about_dialog (void)
{
MooGladeXML *xml;
GtkWidget *dialog, *logo, *button;
AboutDialogXml *gxml;
GtkWidget *dialog;
char *markup;
GtkLabel *label;
MooLinkLabel *url;
GtkStockItem dummy;
moo_glade_xml_register_type (MOO_TYPE_LINK_LABEL);
xml = moo_glade_xml_new_from_buf (mooappabout_glade_xml, -1, "dialog",
GETTEXT_PACKAGE, NULL);
g_return_val_if_fail (xml != NULL, NULL);
gxml = about_dialog_xml_new ();
dialog = moo_glade_xml_get_widget (xml, "dialog");
dialog = GTK_WIDGET (gxml->AboutDialog);
g_signal_connect (dialog, "key-press-event", G_CALLBACK (about_dialog_key_press), NULL);
g_object_add_weak_pointer (G_OBJECT (dialog), &about_dialog);
g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
label = moo_glade_xml_get_widget (xml, "name");
markup = g_strdup_printf ("<span size=\"xx-large\"><b>%s-%s</b></span>",
MOO_APP_FULL_NAME, MOO_APP_VERSION);
gtk_label_set_markup (label, markup);
gtk_label_set_markup (gxml->name, markup);
g_free (markup);
label = moo_glade_xml_get_widget (xml, "description");
gtk_label_set_text (label, MOO_APP_DESCRIPTION);
gtk_label_set_text (gxml->description, MOO_APP_DESCRIPTION);
label = moo_glade_xml_get_widget (xml, "copyright");
markup = g_strdup_printf ("<small>%s</small>", copyright);
gtk_label_set_markup (label, markup);
gtk_label_set_markup (gxml->copyright, markup);
g_free (markup);
url = moo_glade_xml_get_widget (xml, "url");
_moo_link_label_set_url (url, MOO_APP_WEBSITE);
_moo_link_label_set_text (url, MOO_APP_WEBSITE_LABEL);
logo = moo_glade_xml_get_widget (xml, "logo");
_moo_link_label_set_url (gxml->url, MOO_APP_WEBSITE);
_moo_link_label_set_text (gxml->url, MOO_APP_WEBSITE_LABEL);
if (gtk_stock_lookup (MOO_APP_LOGO, &dummy))
gtk_image_set_from_stock (GTK_IMAGE (logo), MOO_APP_LOGO,
gtk_image_set_from_stock (gxml->logo, MOO_APP_LOGO,
GTK_ICON_SIZE_DIALOG);
else
gtk_image_set_from_icon_name (GTK_IMAGE (logo), MOO_APP_LOGO,
gtk_image_set_from_icon_name (gxml->logo, MOO_APP_LOGO,
GTK_ICON_SIZE_DIALOG);
button = moo_glade_xml_get_widget (xml, "credits_button");
g_signal_connect (button, "clicked", G_CALLBACK (show_credits), NULL);
button = moo_glade_xml_get_widget (xml, "license_button");
g_signal_connect (button, "clicked", G_CALLBACK (license_clicked), NULL);
button = moo_glade_xml_get_widget (xml, "close_button");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_hide), dialog);
g_object_unref (xml);
g_signal_connect (gxml->credits_button, "clicked", G_CALLBACK (show_credits), NULL);
g_signal_connect (gxml->license_button, "clicked", G_CALLBACK (license_clicked), NULL);
g_signal_connect_swapped (gxml->close_button, "clicked", G_CALLBACK (gtk_widget_hide), dialog);
return dialog;
}
@ -235,33 +211,6 @@ moo_app_about_dialog (GtkWidget *parent)
}
static void
create_system_info_dialog (void)
{
MooGladeXML *xml;
GtkTextView *textview;
GtkTextBuffer *buffer;
char *text;
if (system_info_dialog != NULL)
return;
xml = moo_glade_xml_new_from_buf (mooappabout_glade_xml, -1,
"system", GETTEXT_PACKAGE, NULL);
system_info_dialog = moo_glade_xml_get_widget (xml, "system");
g_return_if_fail (system_info_dialog != NULL);
g_object_add_weak_pointer (G_OBJECT (system_info_dialog), &system_info_dialog);
g_signal_connect (system_info_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
textview = moo_glade_xml_get_widget (xml, "textview");
buffer = gtk_text_view_get_buffer (textview);
text = moo_app_get_system_info (moo_app_get_instance ());
gtk_text_buffer_set_text (buffer, text, -1);
g_free (text);
}
char *
moo_app_get_system_info (MooApp *app)
{
@ -350,18 +299,3 @@ moo_app_get_system_info (MooApp *app)
return g_string_free (text, FALSE);
}
void
moo_app_system_info_dialog (GtkWidget *parent)
{
create_system_info_dialog ();
if (parent)
parent = gtk_widget_get_toplevel (parent);
if (parent && GTK_IS_WINDOW (parent))
moo_window_set_parent (system_info_dialog, parent);
gtk_window_present (GTK_WINDOW (system_info_dialog));
}

View File

@ -82,7 +82,6 @@
<child>
<widget class="GtkCheckButton" id="ellipsize">
<property name="visible">True</property>
<property name="moo_sensitive">!wrap</property>
<property name="label" translatable="yes">Ellipsize long lines</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
@ -188,7 +187,6 @@
<child>
<widget class="GtkAlignment" id="header_alignment">
<property name="visible">True</property>
<property name="moo_sensitive">print_header</property>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
@ -353,7 +351,6 @@
<child>
<widget class="GtkAlignment" id="footer_alignment">
<property name="visible">True</property>
<property name="moo_sensitive">print_header</property>
<child>
<widget class="GtkVBox" id="vbox8">
<property name="visible">True</property>

View File

@ -1911,14 +1911,14 @@ static GtkWidget *
moo_print_operation_create_custom_widget (G_GNUC_UNUSED GtkPrintOperation *operation)
{
PrintWidgetXml *xml;
GtkWidget *font, *line_numbers_hbox;
xml = print_widget_xml_new ();
font = GTK_WIDGET (xml->font);
moo_bind_sensitive (GTK_WIDGET (xml->use_custom_font), &font, 1, FALSE);
line_numbers_hbox = GTK_WIDGET (xml->line_numbers_hbox);
moo_bind_sensitive (GTK_WIDGET (xml->line_numbers), &line_numbers_hbox, 1, FALSE);
moo_bind_sensitive (GTK_WIDGET (xml->wrap), GTK_WIDGET (xml->ellipsize), TRUE);
moo_bind_sensitive (GTK_WIDGET (xml->print_header), GTK_WIDGET (xml->header_alignment), FALSE);
moo_bind_sensitive (GTK_WIDGET (xml->print_footer), GTK_WIDGET (xml->footer_alignment), FALSE);
moo_bind_sensitive (GTK_WIDGET (xml->use_custom_font), GTK_WIDGET (xml->font), FALSE);
moo_bind_sensitive (GTK_WIDGET (xml->line_numbers), GTK_WIDGET (xml->line_numbers_hbox), FALSE);
set_options (xml);
return GTK_WIDGET (xml->PrintWidget);

View File

@ -26,10 +26,8 @@ endif
# fileselector
#
GLADE_FILES += \
plugins/moofileselector-prefs.glade
GLADE2_FILES += \
plugins/moofileselector-prefs.glade
plugins/moofileselector-new-file.glade \
plugins/moofileselector-save-as.glade

View File

@ -11,13 +11,13 @@
*/
#include "moofileselector.h"
#include "plugins/moofileselector-prefs-glade.h"
#include "mooutils/mooprefsdialogpage.h"
#include "mooutils/mooutils-treeview.h"
#include "mooutils/mooi18n.h"
#include "mooutils/moostock.h"
#include "mooutils/moohelp.h"
#include "help-sections.h"
#include "plugins/moofileselector-prefs-gxml.h"
#include <gtk/gtk.h>
#include <string.h>
@ -31,8 +31,8 @@ enum {
};
static void prefs_page_apply (MooGladeXML *xml);
static void prefs_page_init (MooGladeXML *xml);
static void prefs_page_apply (PrefsPageXml *gxml);
static void prefs_page_init (PrefsPageXml *gxml);
static gboolean helper_new_row (MooTreeHelper *helper,
GtkTreeModel *model,
@ -44,7 +44,7 @@ static gboolean helper_move_row (MooTreeHelper *helper,
GtkTreeModel *model,
GtkTreePath *old_path,
GtkTreePath *new_path);
static void helper_update_widgets (MooGladeXML *xml,
static void helper_update_widgets (PrefsPageXml *gxml,
GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter);
@ -52,31 +52,28 @@ static void helper_update_model (MooTreeHelper *helper,
GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
MooGladeXML *xml);
PrefsPageXml *gxml);
GtkWidget *
_moo_file_selector_prefs_page (MooPlugin *plugin)
{
MooPrefsDialogPage *page;
GtkWidget *treeview;
GtkWidget *page;
GtkTreeViewColumn *column;
GtkCellRenderer *cell;
GtkListStore *store;
MooTreeHelper *helper;
PrefsPageXml *gxml;
page = moo_prefs_dialog_page_new_from_xml (_("File Selector"), MOO_STOCK_FILE_SELECTOR,
NULL, moofileselector_prefs_glade_xml,
"page", NULL);
page = moo_prefs_dialog_page_new (_("File Selector"), MOO_STOCK_FILE_SELECTOR);
gxml = prefs_page_xml_new_with_root (page);
g_signal_connect_swapped (page, "apply", G_CALLBACK (prefs_page_apply), page->xml);
g_signal_connect_swapped (page, "init", G_CALLBACK (prefs_page_init), page->xml);
g_signal_connect_swapped (page, "apply", G_CALLBACK (prefs_page_apply), gxml);
g_signal_connect_swapped (page, "init", G_CALLBACK (prefs_page_init), gxml);
moo_help_set_id (GTK_WIDGET (page), HELP_SECTION_PREFS_FILE_SELECTOR);
treeview = moo_glade_xml_get_widget (page->xml, "treeview");
column = gtk_tree_view_column_new ();
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
gtk_tree_view_append_column (gxml->treeview, column);
cell = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, cell, TRUE);
@ -84,27 +81,27 @@ _moo_file_selector_prefs_page (MooPlugin *plugin)
store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
gtk_tree_view_set_model (gxml->treeview, GTK_TREE_MODEL (store));
g_object_unref (store);
helper = _moo_tree_helper_new (treeview,
moo_glade_xml_get_widget (page->xml, "new"),
moo_glade_xml_get_widget (page->xml, "delete"),
moo_glade_xml_get_widget (page->xml, "up"),
moo_glade_xml_get_widget (page->xml, "down"));
helper = _moo_tree_helper_new (GTK_WIDGET (gxml->treeview),
GTK_WIDGET (gxml->new_),
GTK_WIDGET (gxml->delete_),
GTK_WIDGET (gxml->up),
GTK_WIDGET (gxml->down));
g_signal_connect (helper, "new-row", G_CALLBACK (helper_new_row), NULL);
g_signal_connect (helper, "delete-row", G_CALLBACK (helper_delete_row), NULL);
g_signal_connect (helper, "move-row", G_CALLBACK (helper_move_row), NULL);
g_signal_connect_swapped (helper, "update-widgets",
G_CALLBACK (helper_update_widgets),
page->xml);
gxml);
g_signal_connect (helper, "update-model",
G_CALLBACK (helper_update_model),
page->xml);
g_object_set_data_full (G_OBJECT (page->xml), "moo-tree-helper", helper, g_object_unref);
gxml);
g_object_set_data_full (G_OBJECT (gxml->xml), "moo-tree-helper", helper, g_object_unref);
g_object_set_data (G_OBJECT (page->xml), "moo-file-selector-plugin", plugin);
g_object_set_data (G_OBJECT (gxml->xml), "moo-file-selector-plugin", plugin);
return GTK_WIDGET (page);
}
@ -197,15 +194,14 @@ save_store (MooTreeHelper *helper,
static void
prefs_page_apply (MooGladeXML *xml)
prefs_page_apply (PrefsPageXml *gxml)
{
GtkTreeView *treeview = moo_glade_xml_get_widget (xml, "treeview");
gpointer store = gtk_tree_view_get_model (treeview);
MooTreeHelper *helper = g_object_get_data (G_OBJECT (xml), "moo-tree-helper");
gpointer store = gtk_tree_view_get_model (gxml->treeview);
MooTreeHelper *helper = g_object_get_data (G_OBJECT (gxml->xml), "moo-tree-helper");
_moo_tree_helper_update_model (helper, NULL, NULL);
save_store (helper, store);
_moo_file_selector_update_tools (g_object_get_data (G_OBJECT (xml), "moo-file-selector-plugin"));
_moo_file_selector_update_tools (g_object_get_data (G_OBJECT (gxml->xml), "moo-file-selector-plugin"));
}
@ -266,14 +262,13 @@ populate_store (GtkListStore *store)
static void
prefs_page_init (MooGladeXML *xml)
prefs_page_init (PrefsPageXml *gxml)
{
GtkWidget *treeview = moo_glade_xml_get_widget (xml, "treeview");
gpointer store = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
gpointer store = gtk_tree_view_get_model (gxml->treeview);
populate_store (store);
_moo_tree_view_select_first (GTK_TREE_VIEW (treeview));
_moo_tree_helper_update_widgets (g_object_get_data (G_OBJECT (xml), "moo-tree-helper"));
_moo_tree_helper_set_modified (g_object_get_data (G_OBJECT (xml), "moo-tree-helper"), FALSE);
_moo_tree_view_select_first (gxml->treeview);
_moo_tree_helper_update_widgets (g_object_get_data (G_OBJECT (gxml->xml), "moo-tree-helper"));
_moo_tree_helper_set_modified (g_object_get_data (G_OBJECT (gxml->xml), "moo-tree-helper"), FALSE);
}
@ -343,10 +338,10 @@ helper_move_row (MooTreeHelper *helper,
static void
helper_update_widgets (MooGladeXML *xml,
GtkTreeModel *model,
helper_update_widgets (PrefsPageXml *gxml,
GtkTreeModel *model,
G_GNUC_UNUSED GtkTreePath *path,
GtkTreeIter *iter)
GtkTreeIter *iter)
{
char *label = NULL, *command = NULL, *extensions = NULL, *mimetypes = NULL;
gboolean sensitive = FALSE;
@ -360,15 +355,11 @@ helper_update_widgets (MooGladeXML *xml,
COLUMN_MIMETYPES, &mimetypes, -1);
}
gtk_entry_set_text (moo_glade_xml_get_widget (xml, "label"),
label ? label : "");
gtk_entry_set_text (moo_glade_xml_get_widget (xml, "command"),
command ? command : "");
gtk_entry_set_text (moo_glade_xml_get_widget (xml, "extensions"),
extensions ? extensions : "");
gtk_entry_set_text (moo_glade_xml_get_widget (xml, "mimetypes"),
mimetypes ? mimetypes : "");
gtk_widget_set_sensitive (moo_glade_xml_get_widget (xml, "table"), sensitive);
gtk_entry_set_text (gxml->label, label ? label : "");
gtk_entry_set_text (gxml->command, command ? command : "");
gtk_entry_set_text (gxml->extensions, extensions ? extensions : "");
gtk_entry_set_text (gxml->mimetypes, mimetypes ? mimetypes : "");
gtk_widget_set_sensitive (GTK_WIDGET (gxml->table), sensitive);
g_free (label);
g_free (command);
@ -378,18 +369,18 @@ helper_update_widgets (MooGladeXML *xml,
static void
helper_update_model (MooTreeHelper *helper,
helper_update_model (MooTreeHelper *helper,
G_GNUC_UNUSED GtkTreeModel *model,
G_GNUC_UNUSED GtkTreePath *path,
GtkTreeIter *iter,
MooGladeXML *xml)
GtkTreeIter *iter,
PrefsPageXml *gxml)
{
const char *label, *command, *extensions, *mimetypes;
label = gtk_entry_get_text (moo_glade_xml_get_widget (xml, "label"));
command = gtk_entry_get_text (moo_glade_xml_get_widget (xml, "command"));
extensions = gtk_entry_get_text (moo_glade_xml_get_widget (xml, "extensions"));
mimetypes = gtk_entry_get_text (moo_glade_xml_get_widget (xml, "mimetypes"));
label = gtk_entry_get_text (gxml->label);
command = gtk_entry_get_text (gxml->command);
extensions = gtk_entry_get_text (gxml->extensions);
mimetypes = gtk_entry_get_text (gxml->mimetypes);
_moo_tree_helper_set (helper, iter,
COLUMN_LABEL, label[0] ? label : NULL,

View File

@ -4,7 +4,7 @@
<property name="visible">True</property>
<property name="title">window1</property>
<child>
<widget class="GtkVBox" id="page">
<widget class="GtkVBox" id="PrefsPage">
<property name="visible">True</property>
<child>
<widget class="GtkNotebook" id="notebook1">

View File

@ -48,14 +48,6 @@
)
)
(define-function system_info_dialog
(c-name "moo_app_system_info_dialog")
(return-type "none")
(parameters
'("GtkWidget*" "parent" (null-ok) (default "NULL"))
)
)
(define-method get_system_info
(of-object "MooApp")
(c-name "moo_app_get_system_info")

View File

@ -1770,8 +1770,7 @@
(parameters
'("GtkWidget*" "toggle_btn")
'("GtkWidget*" "dependent")
'("int" "num_dependent")
'("gboolean" "invert")
'("gboolean" "invert" (default "FALSE"))
)
)

View File

@ -737,27 +737,6 @@ _wrap_moo_file_dialog (G_GNUC_UNUSED PyObject *self, PyObject *args, PyObject *k
return_None;
}
%%
override moo_bind_sensitive kwargs
static PyObject *
_wrap_moo_bind_sensitive (G_GNUC_UNUSED PyObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "toggle_btn", "dependent", "invert", NULL };
PyGObject *toggle_btn, *dependent;
int invert = FALSE;
GtkWidget *widget;
if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O!O!|i:moo_bind_sensitive", kwlist,
&PyGtkWidget_Type, &toggle_btn,
&PyGtkWidget_Type, &dependent,
&invert))
return NULL;
widget = GTK_WIDGET (dependent->obj);
moo_bind_sensitive (GTK_WIDGET (toggle_btn->obj), &widget, 1, invert);
return_None;
}
%%
override-slot MooGladeXML.tp_getattr
static PyObject *
_wrap_moo_glade_xml_tp_getattr (PyObject *self, char *attr)

View File

@ -171,10 +171,8 @@ EXTRA_DIST += \
pixmaps/attach.png \
pixmaps/keepontop.png
GLADE_FILES = \
glade/mooaccelprefs.glade
GLADE2_FILES = \
glade/mooaccelprefs.glade
glade/mooaccelbutton.glade \
glade/moologwindow.glade

View File

@ -1,74 +1,9 @@
<?xml version="1.0"?>
<glade-interface>
<widget class="GtkDialog" id="dialog">
<property name="title" translatable="yes">Configure Shortcuts</property>
<property name="default_height">350</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<child>
<widget class="GtkAlignment" id="page_holder">
<property name="visible">True</property>
<property name="top_padding">3</property>
<property name="bottom_padding">3</property>
<property name="left_padding">3</property>
<property name="right_padding">3</property>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancel">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="focus_on_click">False</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="focus_on_click">False</property>
<property name="response_id">-5</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkWindow" id="window">
<widget class="GtkWindow" id="window1">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="page">
<widget class="GtkVBox" id="AccelPrefsPage">
<property name="visible">True</property>
<property name="border_width">3</property>
<property name="spacing">3</property>

View File

@ -12,7 +12,6 @@
#include "mooutils/mooaccelprefs.h"
#include "mooutils/mooaccel.h"
#include "glade/mooaccelprefs-glade.h"
#include "mooutils/mooprefsdialog.h"
#include "mooutils/mooaccelbutton.h"
#include "mooutils/mooglade.h"
@ -22,6 +21,7 @@
#include "mooutils/mooaction-private.h"
#include "mooutils/mooactiongroup.h"
#include "mooutils/mootype-macros.h"
#include "glade/mooaccelprefs-gxml.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <string.h>
@ -33,15 +33,9 @@ typedef struct {
GtkAction *current_action;
GtkTreeRowReference *current_row;
GtkWidget *shortcut_frame;
GtkTreeView *treeview;
AccelPrefsPageXml *gxml;
GtkTreeSelection *selection;
GtkTreeStore *store;
GtkToggleButton *shortcut_default;
GtkToggleButton *shortcut_none;
GtkToggleButton *shortcut_custom;
MooAccelButton *shortcut;
GtkLabel *default_label;
GHashTable *changed; /* Gtkction* -> Shortcut* */
GPtrArray *actions; /* GtkActionGroup* */
@ -129,44 +123,44 @@ _moo_accel_prefs_page_class_init (MooAccelPrefsPageClass *klass)
static void
row_activated (MooAccelPrefsPage *page)
{
if (GTK_WIDGET_IS_SENSITIVE (page->shortcut))
gtk_button_clicked (GTK_BUTTON (page->shortcut));
if (GTK_WIDGET_IS_SENSITIVE (page->gxml->shortcut))
gtk_button_clicked (GTK_BUTTON (page->gxml->shortcut));
}
static void
block_accel_set (MooAccelPrefsPage *page)
{
g_signal_handlers_block_matched (page->shortcut, G_SIGNAL_MATCH_FUNC,
g_signal_handlers_block_matched (page->gxml->shortcut, G_SIGNAL_MATCH_FUNC,
0, 0, 0, (gpointer) accel_set, 0);
}
static void
unblock_accel_set (MooAccelPrefsPage *page)
{
g_signal_handlers_unblock_matched (page->shortcut, G_SIGNAL_MATCH_FUNC,
g_signal_handlers_unblock_matched (page->gxml->shortcut, G_SIGNAL_MATCH_FUNC,
0, 0, 0, (gpointer) accel_set, 0);
}
static void
block_radio (MooAccelPrefsPage *page)
{
g_signal_handlers_block_matched (page->shortcut_none, G_SIGNAL_MATCH_FUNC,
g_signal_handlers_block_matched (page->gxml->shortcut_none, G_SIGNAL_MATCH_FUNC,
0, 0, 0, (gpointer) shortcut_none_toggled, 0);
g_signal_handlers_block_matched (page->shortcut_default, G_SIGNAL_MATCH_FUNC,
g_signal_handlers_block_matched (page->gxml->shortcut_default, G_SIGNAL_MATCH_FUNC,
0, 0, 0, (gpointer) shortcut_default_toggled, 0);
g_signal_handlers_block_matched (page->shortcut_custom, G_SIGNAL_MATCH_FUNC,
g_signal_handlers_block_matched (page->gxml->shortcut_custom, G_SIGNAL_MATCH_FUNC,
0, 0, 0, (gpointer) shortcut_custom_toggled, 0);
}
static void
unblock_radio (MooAccelPrefsPage *page)
{
g_signal_handlers_unblock_matched (page->shortcut_none, G_SIGNAL_MATCH_FUNC,
g_signal_handlers_unblock_matched (page->gxml->shortcut_none, G_SIGNAL_MATCH_FUNC,
0, 0, 0, (gpointer) shortcut_none_toggled, 0);
g_signal_handlers_unblock_matched (page->shortcut_default, G_SIGNAL_MATCH_FUNC,
g_signal_handlers_unblock_matched (page->gxml->shortcut_default, G_SIGNAL_MATCH_FUNC,
0, 0, 0, (gpointer) shortcut_default_toggled, 0);
g_signal_handlers_unblock_matched (page->shortcut_custom, G_SIGNAL_MATCH_FUNC,
g_signal_handlers_unblock_matched (page->gxml->shortcut_custom, G_SIGNAL_MATCH_FUNC,
0, 0, 0, (gpointer) shortcut_custom_toggled, 0);
}
@ -176,7 +170,6 @@ _moo_accel_prefs_page_init (MooAccelPrefsPage *page)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
MooGladeXML *xml;
page->changed = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
(GDestroyNotify) shortcut_free);
@ -185,66 +178,53 @@ _moo_accel_prefs_page_init (MooAccelPrefsPage *page)
(GDestroyNotify) g_free,
(GDestroyNotify) gtk_tree_row_reference_free);
xml = moo_glade_xml_new_empty (GETTEXT_PACKAGE);
moo_glade_xml_fill_widget (xml, GTK_WIDGET (page),
mooaccelprefs_glade_xml, -1,
"page", NULL);
page->gxml = accel_prefs_page_xml_new_with_root (GTK_WIDGET (page));
g_object_set (page, "label", "Shortcuts", "icon-stock-id", MOO_STOCK_KEYBOARD, NULL);
page->treeview = moo_glade_xml_get_widget (xml, "treeview");
gtk_tree_view_set_search_column (page->treeview, 0);
gtk_tree_view_set_search_column (page->gxml->treeview, 0);
g_signal_connect_swapped (page->treeview, "row-activated",
g_signal_connect_swapped (page->gxml->treeview, "row-activated",
G_CALLBACK (row_activated),
page);
page->shortcut_frame = moo_glade_xml_get_widget (xml, "shortcut_frame");
page->shortcut_default = moo_glade_xml_get_widget (xml, "shortcut_default");
page->shortcut_none = moo_glade_xml_get_widget (xml, "shortcut_none");
page->shortcut_custom = moo_glade_xml_get_widget (xml, "shortcut_custom");
page->shortcut = moo_glade_xml_get_widget (xml, "shortcut");
page->default_label = moo_glade_xml_get_widget (xml, "default_label");
g_object_unref (xml);
page->store = gtk_tree_store_new (N_COLUMNS,
G_TYPE_STRING,
GTK_TYPE_ACTION,
G_TYPE_STRING);
gtk_tree_view_set_model (page->treeview, GTK_TREE_MODEL (page->store));
gtk_tree_view_set_model (page->gxml->treeview, GTK_TREE_MODEL (page->store));
g_object_unref (page->store);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Action", renderer,
"text", COLUMN_ACTION_NAME,
NULL);
gtk_tree_view_append_column (page->treeview, column);
gtk_tree_view_append_column (page->gxml->treeview, column);
gtk_tree_view_column_set_sort_column_id (column, COLUMN_ACTION_NAME);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Shortcut", renderer,
"text", COLUMN_ACCEL,
NULL);
gtk_tree_view_append_column (page->treeview, column);
gtk_tree_view_append_column (page->gxml->treeview, column);
gtk_tree_view_column_set_sort_column_id (column, COLUMN_ACCEL);
page->selection = gtk_tree_view_get_selection (page->treeview);
page->selection = gtk_tree_view_get_selection (page->gxml->treeview);
gtk_tree_selection_set_mode (page->selection, GTK_SELECTION_SINGLE);
g_signal_connect_swapped (page->selection, "changed",
G_CALLBACK (tree_selection_changed),
page);
g_signal_connect_swapped (page->shortcut, "accel-set",
g_signal_connect_swapped (page->gxml->shortcut, "accel-set",
G_CALLBACK (accel_set),
page);
g_signal_connect_swapped (page->shortcut_none, "toggled",
g_signal_connect_swapped (page->gxml->shortcut_none, "toggled",
G_CALLBACK (shortcut_none_toggled),
page);
g_signal_connect_swapped (page->shortcut_default, "toggled",
g_signal_connect_swapped (page->gxml->shortcut_default, "toggled",
G_CALLBACK (shortcut_default_toggled),
page);
g_signal_connect_swapped (page->shortcut_custom, "toggled",
g_signal_connect_swapped (page->gxml->shortcut_custom, "toggled",
G_CALLBACK (shortcut_custom_toggled),
page);
}
@ -392,7 +372,7 @@ moo_accel_prefs_page_init (MooPrefsDialogPage *prefs_page)
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (page->store),
COLUMN_ACTION_NAME,
GTK_SORT_ASCENDING);
gtk_tree_view_expand_all (page->treeview);
gtk_tree_view_expand_all (page->gxml->treeview);
tree_selection_changed (page);
}
@ -406,7 +386,7 @@ tree_selection_changed (MooAccelPrefsPage *page)
GtkTreePath *path;
char *default_label;
const char *default_accel, *new_accel = "";
GtkToggleButton *new_button = NULL;
GtkRadioButton *new_button = NULL;
Shortcut *shortcut;
if (gtk_tree_selection_get_selected (page->selection, NULL, &iter))
@ -423,8 +403,8 @@ tree_selection_changed (MooAccelPrefsPage *page)
if (!selected_action)
{
gtk_label_set_text (page->default_label, "");
gtk_widget_set_sensitive (page->shortcut_frame, FALSE);
gtk_label_set_text (page->gxml->default_label, "");
gtk_widget_set_sensitive (GTK_WIDGET (page->gxml->shortcut_frame), FALSE);
return;
}
@ -432,15 +412,15 @@ tree_selection_changed (MooAccelPrefsPage *page)
page->current_row = gtk_tree_row_reference_new (GTK_TREE_MODEL (page->store), path);
gtk_tree_path_free (path);
gtk_widget_set_sensitive (page->shortcut_frame, TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (page->gxml->shortcut_frame), TRUE);
default_accel = _moo_get_default_accel (_moo_action_get_accel_path (action));
default_label = _moo_get_accel_label (default_accel);
if (!default_label || !default_label[0])
gtk_label_set_text (page->default_label, "None");
gtk_label_set_text (page->gxml->default_label, "None");
else
gtk_label_set_text (page->default_label, default_label);
gtk_label_set_text (page->gxml->default_label, default_label);
block_radio (page);
block_accel_set (page);
@ -452,17 +432,17 @@ tree_selection_changed (MooAccelPrefsPage *page)
switch (shortcut->choice)
{
case NONE:
new_button = page->shortcut_none;
new_button = page->gxml->shortcut_none;
new_accel = NULL;
break;
case DEFAULT:
new_button = page->shortcut_default;
new_button = page->gxml->shortcut_default;
new_accel = default_accel;
break;
case CUSTOM:
new_button = page->shortcut_custom;
new_button = page->gxml->shortcut_custom;
new_accel = shortcut->accel;
break;
@ -476,23 +456,23 @@ tree_selection_changed (MooAccelPrefsPage *page)
if (!strcmp (accel, default_accel))
{
new_button = page->shortcut_default;
new_button = page->gxml->shortcut_default;
new_accel = default_accel;
}
else if (!accel[0])
{
new_button = page->shortcut_none;
new_button = page->gxml->shortcut_none;
new_accel = NULL;
}
else
{
new_button = page->shortcut_custom;
new_button = page->gxml->shortcut_custom;
new_accel = accel;
}
}
gtk_toggle_button_set_active (new_button, TRUE);
_moo_accel_button_set_accel (page->shortcut, new_accel);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (new_button), TRUE);
_moo_accel_button_set_accel (page->gxml->shortcut, new_accel);
unblock_radio (page);
unblock_accel_set (page);
@ -513,7 +493,7 @@ accel_set (MooAccelPrefsPage *page)
g_return_if_fail (page->current_row != NULL && page->current_action != NULL);
block_radio (page);
gtk_toggle_button_set_active (page->shortcut_custom, TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->gxml->shortcut_custom), TRUE);
unblock_radio (page);
path = gtk_tree_row_reference_get_path (page->current_row);
@ -525,8 +505,8 @@ accel_set (MooAccelPrefsPage *page)
}
gtk_tree_path_free (path);
accel = _moo_accel_button_get_accel (page->shortcut);
label = gtk_button_get_label (GTK_BUTTON (page->shortcut));
accel = _moo_accel_button_get_accel (page->gxml->shortcut);
label = gtk_button_get_label (GTK_BUTTON (page->gxml->shortcut));
gtk_tree_store_set (page->store, &iter, COLUMN_ACCEL, label, -1);
if (accel && accel[0])
@ -548,7 +528,7 @@ shortcut_none_toggled (MooAccelPrefsPage *page)
g_return_if_fail (page->current_row != NULL && page->current_action != NULL);
if (!gtk_toggle_button_get_active (page->shortcut_none))
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->gxml->shortcut_none)))
return;
path = gtk_tree_row_reference_get_path (page->current_row);
@ -565,7 +545,7 @@ shortcut_none_toggled (MooAccelPrefsPage *page)
page->current_action,
shortcut_new (NONE, ""));
block_accel_set (page);
_moo_accel_button_set_accel (page->shortcut, "");
_moo_accel_button_set_accel (page->gxml->shortcut, "");
unblock_accel_set (page);
}
@ -580,7 +560,7 @@ shortcut_default_toggled (MooAccelPrefsPage *page)
g_return_if_fail (page->current_row != NULL && page->current_action != NULL);
if (!gtk_toggle_button_get_active (page->shortcut_default))
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->gxml->shortcut_default)))
return;
path = gtk_tree_row_reference_get_path (page->current_row);
@ -622,7 +602,7 @@ shortcut_default_toggled (MooAccelPrefsPage *page)
current_shortcut->accel = g_strdup (default_accel);
block_accel_set (page);
_moo_accel_button_set_accel (page->shortcut, default_accel);
_moo_accel_button_set_accel (page->gxml->shortcut, default_accel);
unblock_accel_set (page);
}
@ -636,7 +616,7 @@ shortcut_custom_toggled (MooAccelPrefsPage *page)
g_return_if_fail (page->current_row != NULL && page->current_action != NULL);
if (!gtk_toggle_button_get_active (page->shortcut_custom))
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->gxml->shortcut_custom)))
return;
path = gtk_tree_row_reference_get_path (page->current_row);
@ -655,18 +635,18 @@ shortcut_custom_toggled (MooAccelPrefsPage *page)
if (shortcut)
{
block_accel_set (page);
_moo_accel_button_set_accel (page->shortcut, shortcut->accel);
_moo_accel_button_set_accel (page->gxml->shortcut, shortcut->accel);
unblock_accel_set (page);
gtk_tree_store_set (page->store, &iter, COLUMN_ACCEL,
gtk_button_get_label (GTK_BUTTON (page->shortcut)),
gtk_button_get_label (GTK_BUTTON (page->gxml->shortcut)),
-1);
shortcut->choice = CUSTOM;
}
else
{
gtk_button_clicked (GTK_BUTTON (page->shortcut));
gtk_button_clicked (GTK_BUTTON (page->gxml->shortcut));
}
}
@ -711,26 +691,21 @@ static GtkWidget*
_moo_accel_prefs_dialog_new (MooActionCollection *collection)
{
MooAccelPrefsPage *page;
GtkWidget *dialog, *page_holder;
MooGladeXML *xml;
xml = moo_glade_xml_new_from_buf (mooaccelprefs_glade_xml, -1,
"dialog", GETTEXT_PACKAGE, NULL);
g_return_val_if_fail (xml != NULL, NULL);
dialog = moo_glade_xml_get_widget (xml, "dialog");
page = _moo_accel_prefs_page_new (collection);
gtk_widget_show (GTK_WIDGET (page));
page_holder = moo_glade_xml_get_widget (xml, "page_holder");
gtk_container_add (GTK_CONTAINER (page_holder), GTK_WIDGET (page));
g_object_unref (xml);
GtkWidget *dialog;
dialog = gtk_dialog_new_with_buttons (_("Configure Shortcuts"), NULL, 0,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 400);
page = _moo_accel_prefs_page_new (collection);
gtk_widget_show (GTK_WIDGET (page));
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), GTK_WIDGET (page), TRUE, TRUE, 0);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (dialog_response), page);

View File

@ -412,7 +412,7 @@ set_moo_sensitive (MooGladeXML *xml,
btn = moo_glade_xml_get_widget (xml, value);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (btn));
moo_bind_sensitive (btn, &widget, 1, invert);
moo_bind_sensitive (btn, widget, invert);
}
@ -468,7 +468,7 @@ connect_special_signal (MooGladeXML *xml,
G_STRLOC, signal->object);
}
moo_bind_sensitive (btn, &node->widget, 1, invert);
moo_bind_sensitive (btn, node->widget, invert);
return TRUE;
}

View File

@ -1771,17 +1771,13 @@ _moo_sync_bool_property (gpointer slave,
void
moo_bind_sensitive (GtkWidget *btn,
GtkWidget **dependent,
int num_dependent,
gboolean invert)
moo_bind_sensitive (GtkWidget *btn,
GtkWidget *dependent,
gboolean invert)
{
int i;
g_return_if_fail (G_IS_OBJECT (btn));
for (i = 0; i < num_dependent; ++i)
moo_bind_bool_property (dependent[i], "sensitive", btn, "active", invert);
g_return_if_fail (G_IS_OBJECT (dependent));
moo_bind_bool_property (dependent, "sensitive", btn, "active", invert);
}

View File

@ -119,8 +119,7 @@ MooObjectWatch *_moo_object_watch_alloc (gsize size,
((Type_*) _moo_object_watch_alloc (sizeof (Type_), klass_, src_, tgt_, notify_, data_))
void moo_bind_sensitive (GtkWidget *toggle_btn,
GtkWidget **dependent,
int num_dependent,
GtkWidget *dependent,
gboolean invert);
guint moo_bind_bool_property (gpointer target,

View File

@ -4,6 +4,7 @@ import sys
import getopt
import xml.dom
import xml.dom.minidom as minidom
import StringIO
def name_is_nice(name):
return name[-1:] not in "0123456789"
@ -26,9 +27,12 @@ class GladeXml(object):
assert root is not None
self.root = root
self.rootName = root.getAttribute("id")
self.buffer = buffer
self.rootName = root.getAttribute("id")
if ':' in self.rootName:
self.rootName, real_class_name = self.rootName.split(':')
self.widgets = []
def check_node(node):
if node.tagName != "widget":
@ -44,11 +48,15 @@ class GladeXml(object):
return None
walk_node(root, False, check_node)
def print_buffer(self, out):
def format_buffer(self):
out = StringIO.StringIO()
for l in self.buffer.splitlines():
out.write('"')
out.write(l.replace('\\', '\\\\').replace('"', '\\"'))
out.write('"\n')
ret = out.getvalue()
out.close()
return ret
class ConvertParams(object):
def __init__(self):
@ -88,23 +96,20 @@ def find_root(dom, root_name):
check_node, root_name)
def write_file(gxml, params, out):
tmpl1 = """\
tmpl = """\
#include <mooutils/mooglade.h>
#include <mooutils/mooi18n.h>
#include <gtk/gtk.h>
const char %(glade_xml)s[] =
"""
tmpl2 = """\
%(glade_xml_content)s
;
typedef struct %(XmlStruct)s %(XmlStruct)s;
struct %(XmlStruct)s {
MooGladeXML *xml;
"""
tmpl3 = """\
%(glade_xml_widgets_decl)s
};
static void
@ -123,15 +128,26 @@ G_GNUC_UNUSED static %(XmlStruct)s *
return g_object_get_data (widget, "moo-generated-glade-xml");
}
static void
_%(xml_struct)s_finish_build (%(XmlStruct)s *xml)
{
%(glade_xml_widgets_defs)s
g_object_set_data_full (G_OBJECT (xml->%(root)s), "moo-generated-glade-xml",
xml, (GDestroyNotify) _%(xml_struct)s_free);
}
static void
%(xml_struct)s_build (%(XmlStruct)s *xml)
{
moo_glade_xml_parse_memory (xml->xml, %(glade_xml)s, -1, "%(root)s", NULL);
"""
_%(xml_struct)s_finish_build (xml);
}
tmpl4 = """\
g_object_set_data_full (G_OBJECT (xml->%(root)s), "moo-generated-glade-xml",
xml, (GDestroyNotify) _%(xml_struct)s_free);
static void
%(xml_struct)s_fill (%(XmlStruct)s *xml, GtkWidget *root)
{
moo_glade_xml_fill_widget (xml->xml, root, %(glade_xml)s, -1, "%(root)s", NULL);
_%(xml_struct)s_finish_build (xml);
}
static %(XmlStruct)s *
@ -139,9 +155,7 @@ static %(XmlStruct)s *
{
%(XmlStruct)s *xml = g_new0 (%(XmlStruct)s, 1);
xml->xml = moo_glade_xml_new_empty (GETTEXT_PACKAGE);
"""
tmpl5 = """\
%(glade_xml_widgets_map)s
return xml;
}
@ -152,21 +166,19 @@ G_GNUC_UNUSED static %(XmlStruct)s *
%(xml_struct)s_build (xml);
return xml;
}
G_GNUC_UNUSED static %(XmlStruct)s *
%(xml_struct)s_new_with_root (GtkWidget *root)
{
%(XmlStruct)s *xml = %(xml_struct)s_new_empty ();
%(xml_struct)s_fill (xml, root);
return xml;
}
"""
dic = {
'glade_xml': '_' + params.struct_name + '_glade_xml',
'root': gxml.rootName,
'XmlStruct': params.StructName,
'xml_struct': params.struct_name,
}
out.write(tmpl1 % dic)
gxml.print_buffer(out)
out.write(tmpl2 % dic)
buf = StringIO.StringIO()
if gxml.widgets:
print >> out, ''
print >> buf, ''
for w in gxml.widgets:
name = w.name
ct = params.id_map.get(name)
@ -174,24 +186,39 @@ G_GNUC_UNUSED static %(XmlStruct)s *
class_name = w.class_name
else:
class_name = ct[0]
print >> out, ' %s *%s;' % (class_name, name)
out.write(tmpl3 % dic)
print >> buf, ' %s *%s;' % (class_name, name)
glade_xml_widgets_decl = buf.getvalue()
buf.close()
buf = StringIO.StringIO()
for w in gxml.widgets:
print >> out, ' xml->%s = moo_glade_xml_get_widget (xml->xml, "%s");' % (w.name, w.real_name)
out.write(tmpl4 % dic)
print >> buf, ' xml->%s = moo_glade_xml_get_widget (xml->xml, "%s");' % (w.name, w.real_name)
glade_xml_widgets_defs = buf.getvalue()
buf.close()
buf = StringIO.StringIO()
for id in params.id_map:
ct = params.id_map.get(id)
if ct[1]:
type_name = ct[1]
else:
type_name = 'g_type_from_name ("%s")' % (ct[0],)
print >> out, ' moo_glade_xml_map_id (xml->xml, "%s", %s);' % (id, type_name)
print >> buf, ' moo_glade_xml_map_id (xml->xml, "%s", %s);' % (id, type_name)
glade_xml_widgets_map = buf.getvalue()
buf.close()
out.write(tmpl5 % dic)
dic = {
'glade_xml': '_' + params.struct_name + '_glade_xml',
'glade_xml_content': gxml.format_buffer(),
'root': gxml.rootName,
'XmlStruct': params.StructName,
'xml_struct': params.struct_name,
'glade_xml_widgets_decl': glade_xml_widgets_decl,
'glade_xml_widgets_defs': glade_xml_widgets_defs,
'glade_xml_widgets_map': glade_xml_widgets_map,
}
out.write(tmpl % dic)
def convert_buffer(buf, params, output):
dom = minidom.parseString(buf)
@ -201,7 +228,7 @@ def convert_buffer(buf, params, output):
gxml = GladeXml(root, buf, params)
if not params.StructName:
params.StructName = params.root + 'Xml'
params.StructName = gxml.rootName + 'Xml'
if not params.struct_name:
def S2s(name):
ret = ''