1. Replace ptk-ui-xml with GtkBuilder.
authorHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Fri, 5 Dec 2008 08:41:17 +0000 (08:41 +0000)
committerHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Fri, 5 Dec 2008 08:41:17 +0000 (08:41 +0000)
2. Add popup menu for app menu items.
3. Some bug fixes.

20 files changed:
AUTHORS
configure.ac
data/Makefile.am
data/ui/panel-pref.glade
src/Makefile.am
src/configurator.c
src/panel.c
src/panel.h
src/plugins/batt/batt.c
src/plugins/dclock.c
src/plugins/dirmenu.c
src/plugins/kbled/kbled.c
src/plugins/launchbar.c
src/plugins/menu.c
src/plugins/wincmd.c
src/ptk-ui-xml/ptk-ui-xml.c [deleted file]
src/ptk-ui-xml/ptk-ui-xml.h [deleted file]
src/ptk-ui-xml/ptk-xml-tree.c [deleted file]
src/ptk-ui-xml/ptk-xml-tree.h [deleted file]
src/xml-purge.c [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index 61fdbed..6a5ad60 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -24,5 +24,8 @@ Asviyan and Peter Zelezny, the original creator for this little panel. And
 the most important, thank free software, which gives us the freedom to 
 modify existing projects to serve our needs. :-)
 
+src/plugins/menu.c contains few pieces of code from menu.c of gnome-panel.
+
 [1] fbpanel, http://fbpanel.sourceforge.net/
 [2] fspanel, http://freshmeat.net/projects/fspanel/
+
index 7d41371..a37ec3a 100644 (file)
@@ -15,7 +15,7 @@ AC_PROG_LIBTOOL
 AC_PROG_INTLTOOL(, [no-xml])
 
 # Checks for libraries.
-pkg_modules="gtk+-2.0 >= 2.6.0 \
+pkg_modules="gtk+-2.0 >= 2.12.0 \
              gthread-2.0 \
              libmenu-cache"
 #             libstartup-notification-1.0"
@@ -23,6 +23,13 @@ PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
 AC_SUBST(PACKAGE_CFLAGS)
 AC_SUBST(PACKAGE_LIBS)
 
+# Gtk Builder
+AC_PATH_PROG([GTK_BUILDER_CONVERT],[gtk-builder-convert],[false])
+if test "$GTK_BUILDER_CONVERT" = "false"; then
+  AC_MSG_ERROR([gtk-builder-convert not found])
+fi
+
+
 AC_ARG_ENABLE([cast-checks],
     AS_HELP_STRING([--enable-cast-checks],
                [enable Glib casting checks (default: disable)]),
index 8cc008c..5f69be1 100644 (file)
@@ -7,12 +7,19 @@ default_config_DATA = \
 default_configdir = $(datadir)/lxpanel/profile/default
 
 default_config_panel_DATA = \
-        default/panels/panel
+       default/panels/panel
 default_config_paneldir = $(datadir)/lxpanel/profile/default/panels
 
 uidir=$(datadir)/lxpanel/ui
-ui_DATA= \
-        ui/panel-pref.glade
+ui_in_files= \
+       ui/panel-pref.glade
+ui_DATA = $(ui_in_files:.glade=.ui)
+
+# Generate GtkBuilder UI files from Glade files
+%.ui: %.glade
+       $(GTK_BUILDER_CONVERT) $< $@
+       $(top_builddir)/src/xml-purge $@
+
 
 lxpanel_images_DATA = \
        images/my-computer.png \
index 97aa82b..b07fcb4 100644 (file)
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"><glade-interface><widget class="GtkDialog" id="panel_pref"><property name="visible">True</property><property name="title" translatable="yes">Panel Preferences</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="GtkNotebook" id="notebook"><property name="visible">True</property><property name="can_focus">True</property><child><widget class="GtkVBox" id="vbox1"><property name="visible">True</property><property name="border_width">6</property><property name="spacing">4</property><child><widget class="GtkHBox" id="hbox6"><property name="visible">True</property><child><widget class="GtkFrame" id="frame1"><property name="visible">True</property><property name="label_xalign">0</property><property name="shadow_type">GTK_SHADOW_NONE</property><child><widget class="GtkAlignment" id="alignment1"><property name="visible">True</property><property name="left_padding">8</property><child><widget class="GtkTable" id="table1"><property name="visible">True</property><property name="n_rows">3</property><property name="n_columns">2</property><property name="row_spacing">2</property><child><widget class="GtkLabel" id="label7"><property name="visible">True</property><property name="xalign">0</property><property name="label" translatable="yes">Edge:</property></widget><packing><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child><child><widget class="GtkLabel" id="label8"><property name="visible">True</property><property name="xalign">0</property><property name="label" translatable="yes">Alignment:</property></widget><packing><property name="top_attach">1</property><property name="bottom_attach">2</property><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child><child><widget class="GtkLabel" id="label9"><property name="visible">True</property><property name="xalign">0</property><property name="label" translatable="yes">Margin:</property></widget><packing><property name="top_attach">2</property><property name="bottom_attach">3</property><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child><child><widget class="GtkComboBox" id="align"><property name="visible">True</property><property name="items" translatable="yes">Left
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="panel_pref">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Panel Preferences</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="urgency_hint">False</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <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_btn">
+             <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>
+             <property name="response_id">-7</property>
+           </widget>
+         </child>
+       </widget>
+       <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>
+       <widget class="GtkNotebook" id="notebook">
+         <property name="visible">True</property>
+         <property name="can_focus">True</property>
+         <property name="show_tabs">True</property>
+         <property name="show_border">True</property>
+         <property name="tab_pos">GTK_POS_TOP</property>
+         <property name="scrollable">False</property>
+         <property name="enable_popup">False</property>
+
+         <child>
+           <widget class="GtkVBox" id="vbox1">
+             <property name="border_width">6</property>
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">4</property>
+
+             <child>
+               <widget class="GtkHBox" id="hbox6">
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">0</property>
+
+                 <child>
+                   <widget class="GtkFrame" id="frame1">
+                     <property name="visible">True</property>
+                     <property name="label_xalign">0</property>
+                     <property name="label_yalign">0.5</property>
+                     <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+                     <child>
+                       <widget class="GtkAlignment" id="alignment1">
+                         <property name="visible">True</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xscale">1</property>
+                         <property name="yscale">1</property>
+                         <property name="top_padding">0</property>
+                         <property name="bottom_padding">0</property>
+                         <property name="left_padding">8</property>
+                         <property name="right_padding">0</property>
+
+                         <child>
+                           <widget class="GtkTable" id="table1">
+                             <property name="visible">True</property>
+                             <property name="n_rows">3</property>
+                             <property name="n_columns">2</property>
+                             <property name="homogeneous">False</property>
+                             <property name="row_spacing">2</property>
+                             <property name="column_spacing">0</property>
+
+                             <child>
+                               <widget class="GtkLabel" id="label7">
+                                 <property name="visible">True</property>
+                                 <property name="label" translatable="yes">Edge:</property>
+                                 <property name="use_underline">False</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">0</property>
+                                 <property name="right_attach">1</property>
+                                 <property name="top_attach">0</property>
+                                 <property name="bottom_attach">1</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkLabel" id="label8">
+                                 <property name="visible">True</property>
+                                 <property name="label" translatable="yes">Alignment:</property>
+                                 <property name="use_underline">False</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">0</property>
+                                 <property name="right_attach">1</property>
+                                 <property name="top_attach">1</property>
+                                 <property name="bottom_attach">2</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkLabel" id="label9">
+                                 <property name="visible">True</property>
+                                 <property name="label" translatable="yes">Margin:</property>
+                                 <property name="use_underline">False</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">0</property>
+                                 <property name="right_attach">1</property>
+                                 <property name="top_attach">2</property>
+                                 <property name="bottom_attach">3</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkComboBox" id="align">
+                                 <property name="visible">True</property>
+                                 <property name="items" translatable="yes">Left
 Center
-Right</property></widget><packing><property name="left_attach">1</property><property name="right_attach">2</property><property name="top_attach">1</property><property name="bottom_attach">2</property><property name="x_options">GTK_FILL</property><property name="y_options">GTK_FILL</property></packing></child><child><widget class="GtkComboBox" id="edge"><property name="visible">True</property><property name="items" translatable="yes">Left
+Right</property>
+                                 <property name="add_tearoffs">False</property>
+                                 <property name="focus_on_click">True</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">1</property>
+                                 <property name="right_attach">2</property>
+                                 <property name="top_attach">1</property>
+                                 <property name="bottom_attach">2</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkComboBox" id="edge">
+                                 <property name="visible">True</property>
+                                 <property name="items" translatable="yes">Left
 Right
 Top
-Bottom</property></widget><packing><property name="left_attach">1</property><property name="right_attach">2</property><property name="x_options">GTK_FILL</property><property name="y_options">GTK_FILL</property></packing></child><child><widget class="GtkSpinButton" id="margin"><property name="visible">True</property><property name="can_focus">True</property><property name="adjustment">0 0 32767 1 10 10</property><property name="climb_rate">1</property></widget><packing><property name="left_attach">1</property><property name="right_attach">2</property><property name="top_attach">2</property><property name="bottom_attach">3</property><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child></widget></child></widget></child><child><widget class="GtkLabel" id="label5"><property name="visible">True</property><property name="label" translatable="yes">&lt;b&gt;Position&lt;/b&gt;</property><property name="use_markup">True</property></widget><packing><property name="type">label_item</property></packing></child></widget></child><child><widget class="GtkFrame" id="frame2"><property name="visible">True</property><property name="label_xalign">0</property><property name="shadow_type">GTK_SHADOW_NONE</property><child><widget class="GtkAlignment" id="alignment2"><property name="visible">True</property><property name="left_padding">8</property><child><widget class="GtkTable" id="table2"><property name="visible">True</property><property name="n_rows">2</property><property name="n_columns">3</property><property name="row_spacing">2</property><child><widget class="GtkLabel" id="label10"><property name="visible">True</property><property name="xalign">0</property><property name="label" translatable="yes">Width:</property></widget><packing><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child><child><widget class="GtkLabel" id="label11"><property name="visible">True</property><property name="xalign">0</property><property name="label" translatable="yes">Height:</property></widget><packing><property name="top_attach">1</property><property name="bottom_attach">2</property><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child><child><widget class="GtkComboBox" id="height_unit"><property name="visible">True</property><property name="items" translatable="yes">Pixels</property></widget><packing><property name="left_attach">2</property><property name="right_attach">3</property><property name="top_attach">1</property><property name="bottom_attach">2</property><property name="x_options">GTK_FILL</property><property name="y_options">GTK_FILL</property></packing></child><child><widget class="GtkSpinButton" id="width"><property name="visible">True</property><property name="can_focus">True</property><property name="adjustment">0 0 100 1 10 10</property><property name="climb_rate">1</property></widget><packing><property name="left_attach">1</property><property name="right_attach">2</property><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child><child><widget class="GtkSpinButton" id="height"><property name="visible">True</property><property name="can_focus">True</property><property name="adjustment">0 0 100 1 10 10</property><property name="climb_rate">1</property></widget><packing><property name="left_attach">1</property><property name="right_attach">2</property><property name="top_attach">1</property><property name="bottom_attach">2</property><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child><child><widget class="GtkComboBox" id="width_unit"><property name="visible">True</property><property name="items" translatable="yes">Dynamic
+Bottom</property>
+                                 <property name="add_tearoffs">False</property>
+                                 <property name="focus_on_click">True</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">1</property>
+                                 <property name="right_attach">2</property>
+                                 <property name="top_attach">0</property>
+                                 <property name="bottom_attach">1</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkSpinButton" id="margin">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">True</property>
+                                 <property name="climb_rate">1</property>
+                                 <property name="digits">0</property>
+                                 <property name="numeric">False</property>
+                                 <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+                                 <property name="snap_to_ticks">False</property>
+                                 <property name="wrap">False</property>
+                                 <property name="adjustment">0 0 32767 1 10 10</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">1</property>
+                                 <property name="right_attach">2</property>
+                                 <property name="top_attach">2</property>
+                                 <property name="bottom_attach">3</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+                           </widget>
+                         </child>
+                       </widget>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="label5">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">&lt;b&gt;Position&lt;/b&gt;</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">True</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</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>
+                       </widget>
+                       <packing>
+                         <property name="type">label_item</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkFrame" id="frame2">
+                     <property name="visible">True</property>
+                     <property name="label_xalign">0</property>
+                     <property name="label_yalign">0.5</property>
+                     <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+                     <child>
+                       <widget class="GtkAlignment" id="alignment2">
+                         <property name="visible">True</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xscale">1</property>
+                         <property name="yscale">1</property>
+                         <property name="top_padding">0</property>
+                         <property name="bottom_padding">0</property>
+                         <property name="left_padding">8</property>
+                         <property name="right_padding">0</property>
+
+                         <child>
+                           <widget class="GtkTable" id="table2">
+                             <property name="visible">True</property>
+                             <property name="n_rows">2</property>
+                             <property name="n_columns">3</property>
+                             <property name="homogeneous">False</property>
+                             <property name="row_spacing">2</property>
+                             <property name="column_spacing">0</property>
+
+                             <child>
+                               <widget class="GtkLabel" id="label10">
+                                 <property name="visible">True</property>
+                                 <property name="label" translatable="yes">Width:</property>
+                                 <property name="use_underline">False</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">0</property>
+                                 <property name="right_attach">1</property>
+                                 <property name="top_attach">0</property>
+                                 <property name="bottom_attach">1</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkLabel" id="label11">
+                                 <property name="visible">True</property>
+                                 <property name="label" translatable="yes">Height:</property>
+                                 <property name="use_underline">False</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">0</property>
+                                 <property name="right_attach">1</property>
+                                 <property name="top_attach">1</property>
+                                 <property name="bottom_attach">2</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkComboBox" id="height_unit">
+                                 <property name="visible">True</property>
+                                 <property name="items" translatable="yes">Pixels</property>
+                                 <property name="add_tearoffs">False</property>
+                                 <property name="focus_on_click">True</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">2</property>
+                                 <property name="right_attach">3</property>
+                                 <property name="top_attach">1</property>
+                                 <property name="bottom_attach">2</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkSpinButton" id="width">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">True</property>
+                                 <property name="climb_rate">1</property>
+                                 <property name="digits">0</property>
+                                 <property name="numeric">False</property>
+                                 <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+                                 <property name="snap_to_ticks">False</property>
+                                 <property name="wrap">False</property>
+                                 <property name="adjustment">0 0 100 1 10 10</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">1</property>
+                                 <property name="right_attach">2</property>
+                                 <property name="top_attach">0</property>
+                                 <property name="bottom_attach">1</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkSpinButton" id="height">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">True</property>
+                                 <property name="climb_rate">1</property>
+                                 <property name="digits">0</property>
+                                 <property name="numeric">False</property>
+                                 <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+                                 <property name="snap_to_ticks">False</property>
+                                 <property name="wrap">False</property>
+                                 <property name="adjustment">0 0 100 1 10 10</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">1</property>
+                                 <property name="right_attach">2</property>
+                                 <property name="top_attach">1</property>
+                                 <property name="bottom_attach">2</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkComboBox" id="width_unit">
+                                 <property name="visible">True</property>
+                                 <property name="items" translatable="yes">Dynamic
 Pixels
-% Percent</property></widget><packing><property name="left_attach">2</property><property name="right_attach">3</property><property name="x_options">GTK_FILL</property><property name="y_options">GTK_FILL</property></packing></child></widget></child></widget></child><child><widget class="GtkLabel" id="label6"><property name="visible">True</property><property name="label" translatable="yes">&lt;b&gt;Size&lt;/b&gt;</property><property name="use_markup">True</property></widget><packing><property name="type">label_item</property></packing></child></widget><packing><property name="position">1</property></packing></child></widget><packing><property name="expand">False</property></packing></child><child><widget class="GtkFrame" id="frame4"><property name="visible">True</property><property name="label_xalign">0</property><property name="shadow_type">GTK_SHADOW_NONE</property><child><widget class="GtkAlignment" id="alignment4"><property name="visible">True</property><property name="left_padding">8</property><child><widget class="GtkVBox" id="vbox4"><property name="visible">True</property><property name="spacing">2</property><child><widget class="GtkRadioButton" id="bg_none"><property name="visible">True</property><property name="can_focus">True</property><property name="label" translatable="yes">None (Use system theme)</property><property name="use_underline">True</property><property name="response_id">0</property><property name="draw_indicator">True</property></widget><packing><property name="expand">False</property><property name="fill">False</property></packing></child><child><widget class="GtkHBox" id="hbox2"><property name="visible">True</property><property name="spacing">12</property><child><widget class="GtkRadioButton" id="bg_transparency"><property name="visible">True</property><property name="can_focus">True</property><property name="label" translatable="yes">Enable Transparency</property><property name="use_underline">True</property><property name="response_id">0</property><property name="draw_indicator">True</property><property name="group">bg_none</property></widget><packing><property name="expand">False</property><property name="fill">False</property></packing></child><child><widget class="GtkHBox" id="hbox3"><property name="visible">True</property><property name="spacing">2</property><child><widget class="GtkLabel" id="label20"><property name="visible">True</property><property name="label" translatable="yes">Tint color:</property></widget><packing><property name="expand">False</property><property name="fill">False</property></packing></child><child><widget class="GtkColorButton" id="tint_clr"><property name="visible">True</property><property name="can_focus">True</property><property name="response_id">0</property><property name="use_alpha">True</property></widget><packing><property name="expand">False</property><property name="fill">False</property><property name="position">1</property></packing></child></widget><packing><property name="expand">False</property><property name="position">1</property></packing></child></widget><packing><property name="expand">False</property><property name="fill">False</property><property name="position">1</property></packing></child><child><widget class="GtkHBox" id="hbox4"><property name="visible">True</property><child><widget class="GtkRadioButton" id="bg_image"><property name="visible">True</property><property name="can_focus">True</property><property name="label" translatable="yes">Enable Image:</property><property name="use_underline">True</property><property name="response_id">0</property><property name="draw_indicator">True</property><property name="group">bg_none</property></widget><packing><property name="expand">False</property><property name="fill">False</property></packing></child><child><widget class="GtkFileChooserButton" id="img_file"><property name="visible">True</property><property name="title" translatable="yes">Select an image file</property></widget><packing><property name="position">1</property></packing></child></widget><packing><property name="expand">False</property><property name="fill">False</property><property name="position">2</property></packing></child></widget></child></widget></child><child><widget class="GtkLabel" id="label18"><property name="visible">True</property><property name="label" translatable="yes">&lt;b&gt;Background&lt;/b&gt;</property><property name="use_markup">True</property></widget><packing><property name="type">label_item</property></packing></child></widget><packing><property name="expand">False</property><property name="position">1</property></packing></child><child><widget class="GtkFrame" id="frame5"><property name="visible">True</property><property name="label_xalign">0</property><property name="shadow_type">GTK_SHADOW_NONE</property><child><widget class="GtkAlignment" id="alignment5"><property name="visible">True</property><property name="left_padding">8</property><child><widget class="GtkHBox" id="hbox1"><property name="visible">True</property><property name="spacing">2</property><child><widget class="GtkCheckButton" id="use_font_clr"><property name="visible">True</property><property name="can_focus">True</property><property name="label" translatable="yes">Custom Color</property><property name="use_underline">True</property><property name="response_id">0</property><property name="draw_indicator">True</property></widget><packing><property name="expand">False</property><property name="fill">False</property></packing></child><child><widget class="GtkColorButton" id="font_clr"><property name="visible">True</property><property name="can_focus">True</property><property name="response_id">0</property></widget><packing><property name="expand">False</property><property name="fill">False</property><property name="position">1</property></packing></child></widget></child></widget></child><child><widget class="GtkLabel" id="label19"><property name="visible">True</property><property name="label" translatable="yes">&lt;b&gt;Font&lt;/b&gt;</property><property name="use_markup">True</property></widget><packing><property name="type">label_item</property></packing></child></widget><packing><property name="expand">False</property><property name="position">2</property></packing></child></widget></child><child><widget class="GtkLabel" id="label1"><property name="visible">True</property><property name="label" translatable="yes">General</property></widget><packing><property name="type">tab</property><property name="tab_fill">False</property></packing></child><child><widget class="GtkHBox" id="hbox5"><property name="visible">True</property><property name="spacing">2</property><child><widget class="GtkVBox" id="vbox5"><property name="visible">True</property><child><widget class="GtkScrolledWindow" id="scrolledwindow1"><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><child><widget class="GtkTreeView" id="plugin_list"><property name="visible">True</property><property name="can_focus">True</property><property name="rules_hint">True</property></widget></child></widget></child><child><widget class="GtkLabel" id="plugin_desc"><property name="visible">True</property><property name="can_focus">True</property><property name="xalign">0</property><property name="wrap">True</property><property name="selectable">True</property><property name="ellipsize">PANGO_ELLIPSIZE_END</property></widget><packing><property name="expand">False</property><property name="fill">False</property><property name="position">1</property></packing></child></widget></child><child><widget class="GtkVBox" id="vbox6"><property name="visible">True</property><property name="border_width">2</property><property name="spacing">2</property><child><widget class="GtkButton" id="add_btn"><property name="visible">True</property><property name="can_focus">True</property><property name="label">gtk-add</property><property name="use_stock">True</property><property name="response_id">0</property></widget><packing><property name="expand">False</property><property name="fill">False</property></packing></child><child><widget class="GtkButton" id="remove_btn"><property name="visible">True</property><property name="can_focus">True</property><property name="label">gtk-remove</property><property name="use_stock">True</property><property name="response_id">0</property></widget><packing><property name="expand">False</property><property name="fill">False</property><property name="position">1</property></packing></child><child><widget class="GtkButton" id="edit_btn"><property name="visible">True</property><property name="can_focus">True</property><property name="label">gtk-edit</property><property name="use_stock">True</property><property name="response_id">0</property></widget><packing><property name="expand">False</property><property name="fill">False</property><property name="position">2</property></packing></child><child><widget class="GtkButton" id="moveup_btn"><property name="visible">True</property><property name="can_focus">True</property><property name="response_id">0</property><child><widget class="GtkImage" id="image1"><property name="visible">True</property><property name="stock">gtk-go-up</property></widget></child></widget><packing><property name="expand">False</property><property name="fill">False</property><property name="position">3</property></packing></child><child><widget class="GtkButton" id="movedown_btn"><property name="visible">True</property><property name="can_focus">True</property><property name="response_id">0</property><child><widget class="GtkImage" id="image2"><property name="visible">True</property><property name="stock">gtk-go-down</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="expand">False</property><property name="position">1</property></packing></child></widget><packing><property name="position">1</property></packing></child><child><widget class="GtkLabel" id="label3"><property name="visible">True</property><property name="label" translatable="yes">Panel Applets</property></widget><packing><property name="type">tab</property><property name="position">1</property><property name="tab_fill">False</property></packing></child><child><widget class="GtkVBox" id="vbox3"><property name="visible">True</property><property name="border_width">6</property><property name="spacing">4</property><child><widget class="GtkFrame" id="frame6"><property name="visible">True</property><property name="label_xalign">0</property><property name="shadow_type">GTK_SHADOW_NONE</property><child><widget class="GtkAlignment" id="alignment6"><property name="visible">True</property><property name="left_padding">8</property><child><widget class="GtkTable" id="table3"><property name="visible">True</property><property name="border_width">2</property><property name="n_rows">3</property><property name="n_columns">2</property><property name="row_spacing">2</property><child><widget class="GtkEntry" id="logout"><property name="visible">True</property><property name="can_focus">True</property><property name="invisible_char">●</property></widget><packing><property name="left_attach">1</property><property name="right_attach">2</property><property name="top_attach">2</property><property name="bottom_attach">3</property><property name="y_options"></property></packing></child><child><widget class="GtkEntry" id="term"><property name="visible">True</property><property name="can_focus">True</property><property name="invisible_char">●</property></widget><packing><property name="left_attach">1</property><property name="right_attach">2</property><property name="top_attach">1</property><property name="bottom_attach">2</property><property name="y_options"></property></packing></child><child><widget class="GtkEntry" id="file_manager"><property name="visible">True</property><property name="can_focus">True</property><property name="invisible_char">●</property></widget><packing><property name="left_attach">1</property><property name="right_attach">2</property><property name="y_options"></property></packing></child><child><widget class="GtkLabel" id="logout_label"><property name="visible">True</property><property name="xalign">0</property><property name="label" translatable="yes">Logout Command:</property></widget><packing><property name="top_attach">2</property><property name="bottom_attach">3</property><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child><child><widget class="GtkLabel" id="label24"><property name="visible">True</property><property name="xalign">0</property><property name="label" translatable="yes">Terminal Emulator:</property></widget><packing><property name="top_attach">1</property><property name="bottom_attach">2</property><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child><child><widget class="GtkLabel" id="label23"><property name="visible">True</property><property name="xalign">0</property><property name="label" translatable="yes">File Manager:</property></widget><packing><property name="x_options">GTK_FILL</property><property name="y_options"></property></packing></child></widget></child></widget></child><child><widget class="GtkLabel" id="label22"><property name="visible">True</property><property name="label" translatable="yes">&lt;b&gt;Set Preferred Applications&lt;/b&gt;</property><property name="use_markup">True</property></widget><packing><property name="type">label_item</property></packing></child></widget><packing><property name="expand">False</property></packing></child><child><widget class="GtkFrame" id="frame3"><property name="visible">True</property><property name="label_xalign">0</property><property name="shadow_type">GTK_SHADOW_NONE</property><child><widget class="GtkAlignment" id="alignment3"><property name="visible">True</property><property name="left_padding">8</property><child><widget class="GtkVBox" id="vbox2"><property name="visible">True</property><child><widget class="GtkCheckButton" id="as_dock"><property name="visible">True</property><property name="can_focus">True</property><property name="label" translatable="yes">Make window managers treat the panel as dock</property><property name="use_underline">True</property><property name="response_id">0</property><property name="draw_indicator">True</property></widget><packing><property name="expand">False</property><property name="fill">False</property></packing></child><child><widget class="GtkCheckButton" id="reserve_space"><property name="visible">True</property><property name="can_focus">True</property><property name="label" translatable="yes">Reserve space, and not covered by maximized windows</property><property name="use_underline">True</property><property name="response_id">0</property><property name="draw_indicator">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><child><widget class="GtkLabel" id="label15"><property name="visible">True</property><property name="label" translatable="yes">&lt;b&gt;Properties&lt;/b&gt;</property><property name="use_markup">True</property></widget><packing><property name="type">label_item</property></packing></child></widget><packing><property name="expand">False</property><property name="position">1</property></packing></child></widget><packing><property name="position">2</property></packing></child><child><widget class="GtkLabel" id="label4"><property name="visible">True</property><property name="label" translatable="yes">Advanced</property></widget><packing><property name="type">tab</property><property name="position">2</property><property name="tab_fill">False</property></packing></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="close_btn"><property name="visible">True</property><property name="can_focus">True</property><property name="can_default">True</property><property name="label">gtk-close</property><property name="use_stock">True</property><property name="response_id">-7</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>
+% Percent</property>
+                                 <property name="add_tearoffs">False</property>
+                                 <property name="focus_on_click">True</property>
+                               </widget>
+                               <packing>
+                                 <property name="left_attach">2</property>
+                                 <property name="right_attach">3</property>
+                                 <property name="top_attach">0</property>
+                                 <property name="bottom_attach">1</property>
+                                 <property name="x_options"></property>
+                                 <property name="y_options"></property>
+                               </packing>
+                             </child>
+                           </widget>
+                         </child>
+                       </widget>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="label6">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">&lt;b&gt;Size&lt;/b&gt;</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">True</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</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>
+                       </widget>
+                       <packing>
+                         <property name="type">label_item</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkFrame" id="frame4">
+                 <property name="visible">True</property>
+                 <property name="label_xalign">0</property>
+                 <property name="label_yalign">0.5</property>
+                 <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+                 <child>
+                   <widget class="GtkAlignment" id="alignment4">
+                     <property name="visible">True</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xscale">1</property>
+                     <property name="yscale">1</property>
+                     <property name="top_padding">0</property>
+                     <property name="bottom_padding">0</property>
+                     <property name="left_padding">8</property>
+                     <property name="right_padding">0</property>
+
+                     <child>
+                       <widget class="GtkVBox" id="vbox4">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">2</property>
+
+                         <child>
+                           <widget class="GtkRadioButton" id="bg_none">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="label" translatable="yes">None (Use system theme)</property>
+                             <property name="use_underline">True</property>
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
+                             <property name="focus_on_click">True</property>
+                             <property name="active">False</property>
+                             <property name="inconsistent">False</property>
+                             <property name="draw_indicator">True</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkHBox" id="hbox2">
+                             <property name="visible">True</property>
+                             <property name="homogeneous">False</property>
+                             <property name="spacing">12</property>
+
+                             <child>
+                               <widget class="GtkRadioButton" id="bg_transparency">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">True</property>
+                                 <property name="label" translatable="yes">Enable Transparency</property>
+                                 <property name="use_underline">True</property>
+                                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                                 <property name="focus_on_click">True</property>
+                                 <property name="active">False</property>
+                                 <property name="inconsistent">False</property>
+                                 <property name="draw_indicator">True</property>
+                                 <property name="group">bg_none</property>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">False</property>
+                                 <property name="fill">False</property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkHBox" id="hbox3">
+                                 <property name="visible">True</property>
+                                 <property name="homogeneous">False</property>
+                                 <property name="spacing">2</property>
+
+                                 <child>
+                                   <widget class="GtkLabel" id="label20">
+                                     <property name="visible">True</property>
+                                     <property name="label" translatable="yes">Tint color:</property>
+                                     <property name="use_underline">False</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.5</property>
+                                     <property name="yalign">0.5</property>
+                                     <property name="xpad">0</property>
+                                     <property name="ypad">0</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>
+                                   </widget>
+                                   <packing>
+                                     <property name="padding">0</property>
+                                     <property name="expand">False</property>
+                                     <property name="fill">False</property>
+                                   </packing>
+                                 </child>
+
+                                 <child>
+                                   <widget class="GtkColorButton" id="tint_clr">
+                                     <property name="visible">True</property>
+                                     <property name="can_focus">True</property>
+                                     <property name="use_alpha">True</property>
+                                     <property name="focus_on_click">True</property>
+                                   </widget>
+                                   <packing>
+                                     <property name="padding">0</property>
+                                     <property name="expand">False</property>
+                                     <property name="fill">False</property>
+                                   </packing>
+                                 </child>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">False</property>
+                                 <property name="fill">True</property>
+                               </packing>
+                             </child>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkHBox" id="hbox4">
+                             <property name="visible">True</property>
+                             <property name="homogeneous">False</property>
+                             <property name="spacing">0</property>
+
+                             <child>
+                               <widget class="GtkRadioButton" id="bg_image">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">True</property>
+                                 <property name="label" translatable="yes">Enable Image:</property>
+                                 <property name="use_underline">True</property>
+                                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                                 <property name="focus_on_click">True</property>
+                                 <property name="active">False</property>
+                                 <property name="inconsistent">False</property>
+                                 <property name="draw_indicator">True</property>
+                                 <property name="group">bg_none</property>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">False</property>
+                                 <property name="fill">False</property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkFileChooserButton" id="img_file">
+                                 <property name="visible">True</property>
+                                 <property name="title" translatable="yes">Select an image file</property>
+                                 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+                                 <property name="local_only">True</property>
+                                 <property name="show_hidden">False</property>
+                                 <property name="do_overwrite_confirmation">False</property>
+                                 <property name="width_chars">-1</property>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">True</property>
+                                 <property name="fill">True</property>
+                               </packing>
+                             </child>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+
+                 <child>
+                   <widget class="GtkLabel" id="label18">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">&lt;b&gt;Background&lt;/b&gt;</property>
+                     <property name="use_underline">False</property>
+                     <property name="use_markup">True</property>
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap">False</property>
+                     <property name="selectable">False</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</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>
+                   </widget>
+                   <packing>
+                     <property name="type">label_item</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkFrame" id="frame5">
+                 <property name="visible">True</property>
+                 <property name="label_xalign">0</property>
+                 <property name="label_yalign">0.5</property>
+                 <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+                 <child>
+                   <widget class="GtkAlignment" id="alignment5">
+                     <property name="visible">True</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xscale">1</property>
+                     <property name="yscale">1</property>
+                     <property name="top_padding">0</property>
+                     <property name="bottom_padding">0</property>
+                     <property name="left_padding">8</property>
+                     <property name="right_padding">0</property>
+
+                     <child>
+                       <widget class="GtkHBox" id="hbox1">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">2</property>
+
+                         <child>
+                           <widget class="GtkCheckButton" id="use_font_clr">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="label" translatable="yes">Custom Color</property>
+                             <property name="use_underline">True</property>
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
+                             <property name="focus_on_click">True</property>
+                             <property name="active">False</property>
+                             <property name="inconsistent">False</property>
+                             <property name="draw_indicator">True</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkColorButton" id="font_clr">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="use_alpha">False</property>
+                             <property name="focus_on_click">True</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+
+                 <child>
+                   <widget class="GtkLabel" id="label19">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">&lt;b&gt;Font&lt;/b&gt;</property>
+                     <property name="use_underline">False</property>
+                     <property name="use_markup">True</property>
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap">False</property>
+                     <property name="selectable">False</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</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>
+                   </widget>
+                   <packing>
+                     <property name="type">label_item</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="tab_expand">False</property>
+             <property name="tab_fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label1">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">General</property>
+             <property name="use_underline">False</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.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</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>
+           </widget>
+           <packing>
+             <property name="type">tab</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkHBox" id="hbox5">
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">2</property>
+
+             <child>
+               <widget class="GtkVBox" id="vbox5">
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">0</property>
+
+                 <child>
+                   <widget class="GtkScrolledWindow" id="scrolledwindow1">
+                     <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>
+                       <widget class="GtkTreeView" id="plugin_list">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="headers_visible">True</property>
+                         <property name="rules_hint">True</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>
+                       </widget>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkLabel" id="plugin_desc">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label" translatable="yes"></property>
+                     <property name="use_underline">False</property>
+                     <property name="use_markup">False</property>
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap">True</property>
+                     <property name="selectable">True</property>
+                     <property name="xalign">0</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</property>
+                     <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+                     <property name="width_chars">-1</property>
+                     <property name="single_line_mode">False</property>
+                     <property name="angle">0</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">True</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkVBox" id="vbox6">
+                 <property name="border_width">2</property>
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">2</property>
+
+                 <child>
+                   <widget class="GtkButton" id="add_btn">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label">gtk-add</property>
+                     <property name="use_stock">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="focus_on_click">True</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkButton" id="remove_btn">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label">gtk-remove</property>
+                     <property name="use_stock">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="focus_on_click">True</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkButton" id="edit_btn">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="label">gtk-edit</property>
+                     <property name="use_stock">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="focus_on_click">True</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkButton" id="moveup_btn">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="focus_on_click">True</property>
+
+                     <child>
+                       <widget class="GtkImage" id="image1">
+                         <property name="visible">True</property>
+                         <property name="stock">gtk-go-up</property>
+                         <property name="icon_size">4</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkButton" id="movedown_btn">
+                     <property name="visible">True</property>
+                     <property name="can_focus">True</property>
+                     <property name="relief">GTK_RELIEF_NORMAL</property>
+                     <property name="focus_on_click">True</property>
+
+                     <child>
+                       <widget class="GtkImage" id="image2">
+                         <property name="visible">True</property>
+                         <property name="stock">gtk-go-down</property>
+                         <property name="icon_size">4</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="tab_expand">False</property>
+             <property name="tab_fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label3">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Panel Applets</property>
+             <property name="use_underline">False</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.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</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>
+           </widget>
+           <packing>
+             <property name="type">tab</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkVBox" id="vbox3">
+             <property name="border_width">6</property>
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">4</property>
+
+             <child>
+               <widget class="GtkFrame" id="frame6">
+                 <property name="visible">True</property>
+                 <property name="label_xalign">0</property>
+                 <property name="label_yalign">0.5</property>
+                 <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+                 <child>
+                   <widget class="GtkAlignment" id="alignment6">
+                     <property name="visible">True</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xscale">1</property>
+                     <property name="yscale">1</property>
+                     <property name="top_padding">0</property>
+                     <property name="bottom_padding">0</property>
+                     <property name="left_padding">8</property>
+                     <property name="right_padding">0</property>
+
+                     <child>
+                       <widget class="GtkTable" id="table3">
+                         <property name="border_width">2</property>
+                         <property name="visible">True</property>
+                         <property name="n_rows">3</property>
+                         <property name="n_columns">2</property>
+                         <property name="homogeneous">False</property>
+                         <property name="row_spacing">2</property>
+                         <property name="column_spacing">0</property>
+
+                         <child>
+                           <widget class="GtkEntry" id="logout">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="editable">True</property>
+                             <property name="visibility">True</property>
+                             <property name="max_length">0</property>
+                             <property name="text" translatable="yes"></property>
+                             <property name="has_frame">True</property>
+                             <property name="invisible_char">●</property>
+                             <property name="activates_default">False</property>
+                           </widget>
+                           <packing>
+                             <property name="left_attach">1</property>
+                             <property name="right_attach">2</property>
+                             <property name="top_attach">2</property>
+                             <property name="bottom_attach">3</property>
+                             <property name="y_options"></property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkEntry" id="term">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="editable">True</property>
+                             <property name="visibility">True</property>
+                             <property name="max_length">0</property>
+                             <property name="text" translatable="yes"></property>
+                             <property name="has_frame">True</property>
+                             <property name="invisible_char">●</property>
+                             <property name="activates_default">False</property>
+                           </widget>
+                           <packing>
+                             <property name="left_attach">1</property>
+                             <property name="right_attach">2</property>
+                             <property name="top_attach">1</property>
+                             <property name="bottom_attach">2</property>
+                             <property name="y_options"></property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkEntry" id="file_manager">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="editable">True</property>
+                             <property name="visibility">True</property>
+                             <property name="max_length">0</property>
+                             <property name="text" translatable="yes"></property>
+                             <property name="has_frame">True</property>
+                             <property name="invisible_char">●</property>
+                             <property name="activates_default">False</property>
+                           </widget>
+                           <packing>
+                             <property name="left_attach">1</property>
+                             <property name="right_attach">2</property>
+                             <property name="top_attach">0</property>
+                             <property name="bottom_attach">1</property>
+                             <property name="y_options"></property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkLabel" id="logout_label">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Logout Command:</property>
+                             <property name="use_underline">False</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
+                           </widget>
+                           <packing>
+                             <property name="left_attach">0</property>
+                             <property name="right_attach">1</property>
+                             <property name="top_attach">2</property>
+                             <property name="bottom_attach">3</property>
+                             <property name="x_options"></property>
+                             <property name="y_options"></property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkLabel" id="label24">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Terminal Emulator:</property>
+                             <property name="use_underline">False</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
+                           </widget>
+                           <packing>
+                             <property name="left_attach">0</property>
+                             <property name="right_attach">1</property>
+                             <property name="top_attach">1</property>
+                             <property name="bottom_attach">2</property>
+                             <property name="x_options"></property>
+                             <property name="y_options"></property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkLabel" id="label23">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">File Manager:</property>
+                             <property name="use_underline">False</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                             <property name="width_chars">-1</property>
+                             <property name="single_line_mode">False</property>
+                             <property name="angle">0</property>
+                           </widget>
+                           <packing>
+                             <property name="left_attach">0</property>
+                             <property name="right_attach">1</property>
+                             <property name="top_attach">0</property>
+                             <property name="bottom_attach">1</property>
+                             <property name="x_options"></property>
+                             <property name="y_options"></property>
+                           </packing>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+
+                 <child>
+                   <widget class="GtkLabel" id="label22">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">&lt;b&gt;Set Preferred Applications&lt;/b&gt;</property>
+                     <property name="use_underline">False</property>
+                     <property name="use_markup">True</property>
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap">False</property>
+                     <property name="selectable">False</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</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>
+                   </widget>
+                   <packing>
+                     <property name="type">label_item</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkFrame" id="frame3">
+                 <property name="visible">True</property>
+                 <property name="label_xalign">0</property>
+                 <property name="label_yalign">0.5</property>
+                 <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+                 <child>
+                   <widget class="GtkAlignment" id="alignment3">
+                     <property name="visible">True</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xscale">1</property>
+                     <property name="yscale">1</property>
+                     <property name="top_padding">0</property>
+                     <property name="bottom_padding">0</property>
+                     <property name="left_padding">8</property>
+                     <property name="right_padding">0</property>
+
+                     <child>
+                       <widget class="GtkVBox" id="vbox2">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">0</property>
+
+                         <child>
+                           <widget class="GtkCheckButton" id="as_dock">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="label" translatable="yes">Make window managers treat the panel as dock</property>
+                             <property name="use_underline">True</property>
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
+                             <property name="focus_on_click">True</property>
+                             <property name="active">False</property>
+                             <property name="inconsistent">False</property>
+                             <property name="draw_indicator">True</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkCheckButton" id="reserve_space">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="label" translatable="yes">Reserve space, and not covered by maximized windows</property>
+                             <property name="use_underline">True</property>
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
+                             <property name="focus_on_click">True</property>
+                             <property name="active">False</property>
+                             <property name="inconsistent">False</property>
+                             <property name="draw_indicator">True</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+
+                 <child>
+                   <widget class="GtkLabel" id="label15">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">&lt;b&gt;Properties&lt;/b&gt;</property>
+                     <property name="use_underline">False</property>
+                     <property name="use_markup">True</property>
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap">False</property>
+                     <property name="selectable">False</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</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>
+                   </widget>
+                   <packing>
+                     <property name="type">label_item</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="tab_expand">False</property>
+             <property name="tab_fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label4">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Advanced</property>
+             <property name="use_underline">False</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.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</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>
+           </widget>
+           <packing>
+             <property name="type">tab</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>
index eb7ef06..d39c348 100644 (file)
@@ -7,7 +7,6 @@ bin_PROGRAMS = lxpanel lxpanelctl
 INCLUDES = \
        -I$(top_srcdir) \
        -I$(top_srcdir)/src/plugins \
-       -I$(top_srcdir)/src/ptk-ui-xml \
        -DPACKAGE_LIB_DIR=\""$(libdir)"\" \
        -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
        -DPACKAGE_BIN_DIR=\""$(bindir)"\" \
@@ -17,12 +16,6 @@ INCLUDES = \
 
 BUILTIN_PLUGINS = $(top_builddir)/src/plugins/libbuiltin_plugins.a
 
-PTK_UI_XML_SOURCES=\
-       ptk-ui-xml/ptk-ui-xml.c \
-        ptk-ui-xml/ptk-ui-xml.h \
-       ptk-ui-xml/ptk-xml-tree.c \
-        ptk-ui-xml/ptk-xml-tree.h
-
 TRAY_SOURCES= \
        systray/eggmarshalers.c systray/eggmarshalers.h \
        systray/eggtraymanager.c systray/eggtraymanager.h \
@@ -30,7 +23,6 @@ TRAY_SOURCES= \
        systray/tray.c
 
 lxpanel_SOURCES = \
-       $(PTK_UI_XML_SOURCES) \
        glib-mem.h \
        misc.c misc.h \
        $(TRAY_SOURCES) \
@@ -56,5 +48,11 @@ lxpanel_LDADD = \
 lxpanelctl_SOURCES = lxpanelctl.c lxpanelctl.h
 lxpanelctl_LDADD = -lX11 $(INTLLIBS)
 
+noinst_PROGRAMS=xml-purge
+xml_purge_SOURCES=xml-purge.c
+xml_purge_CFLAGS=@PACKAGE_CFLAGS@
+xml_purge_LDADD=@PACKAGE_LIBS@
+
+
 EXTRA_DIST = \
        plugins/icon.xpm
index 328fc3e..02720b8 100644 (file)
@@ -33,8 +33,6 @@
 
 #include "dbg.h"
 
-#include "ptk-ui-xml.h"
-
 enum{
     COL_NAME,
     COL_EXPAND,
@@ -199,8 +197,7 @@ set_height( GtkSpinButton* spin, Panel* p )
     update_panel_geometry(p);
 }
 
-static void
-set_width_type( GtkWidget *item, Panel* p )
+static void set_width_type( GtkWidget *item, Panel* p )
 {
     GtkWidget* spin;
     int widthtype;
@@ -208,7 +205,7 @@ set_width_type( GtkWidget *item, Panel* p )
     widthtype = gtk_combo_box_get_active(GTK_COMBO_BOX(item)) + 1;
     p->widthtype = widthtype;
 
-    spin = ptk_ui_xml_get_widget( gtk_widget_get_toplevel(item), "width" );
+    spin = (GtkWidget*)g_object_get_data(item, "width_spin" );
     t = (widthtype != WIDTH_REQUEST);
     gtk_widget_set_sensitive( spin, t );
     if (widthtype == WIDTH_PERCENT) {
@@ -223,11 +220,10 @@ set_width_type( GtkWidget *item, Panel* p )
     update_panel_geometry(p);
 }
 
-static void
-transparency_toggle( GtkWidget *b, Panel* p)
+static void transparency_toggle( GtkWidget *b, Panel* p)
 {
-    GtkWidget* tr = ptk_ui_xml_get_widget( gtk_widget_get_toplevel(b), "tint_clr");
-       gboolean t;
+    GtkWidget* tr = (GtkWidget*)g_object_get_data(b, "tint_clr");
+    gboolean t;
 
     ENTER;
 
@@ -247,10 +243,9 @@ transparency_toggle( GtkWidget *b, Panel* p)
     RET();
 }
 
-static void
-background_toggle( GtkWidget *b, Panel* p)
+static void background_toggle( GtkWidget *b, Panel* p)
 {
-    GtkWidget* fc = ptk_ui_xml_get_widget( gtk_widget_get_toplevel(b), "img_file" );
+    GtkWidget* fc = (GtkWidget*)g_object_get_data(b, "img_file" );
     gtk_widget_set_sensitive( fc, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(b)));
     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(b))) {
         if (!p->background) {
@@ -263,10 +258,9 @@ background_toggle( GtkWidget *b, Panel* p)
     }
 }
 
-static void
-background_changed(GtkFileChooser *file_chooser,  Panel* p )
+static void background_changed(GtkFileChooser *file_chooser,  Panel* p )
 {
-    GtkWidget* btn = ptk_ui_xml_get_widget( p->pref_dialog, "bg_image" );
+    GtkWidget* btn = (GtkWidget*)g_object_get_data( file_chooser, "bg_image" );
     char* file;
 
     file = g_strdup(gtk_file_chooser_get_filename(file_chooser));
@@ -738,11 +732,10 @@ update_toggle_button(GtkWidget *w, gboolean n)
     RET();
 }
 
-void
-panel_configure( Panel* p, int sel_page  )
+void panel_configure( Panel* p, int sel_page )
 {
-    PtkUIXml* xml;
-    GtkWidget *w, *w2;
+    GtkBuilder* builder;
+    GtkWidget *w, *w2, *width, *tint_clr, *img_file;
 
     if( p->pref_dialog )
     {
@@ -750,28 +743,34 @@ panel_configure( Panel* p, int sel_page  )
         return;
     }
 
-    p->pref_dialog = ptk_ui_xml_create_widget_from_file( PACKAGE_DATA_DIR "/lxpanel/ui/panel-pref.glade" );
-    g_signal_connect(p->pref_dialog, "response",     (GCallback) response_event, p);
+    builder = gtk_builder_new();
+    if( !gtk_builder_add_from_file(builder, PACKAGE_DATA_DIR "/lxpanel/ui/panel-pref.ui", NULL) )
+    {
+        g_object_unref(builder);
+        return;
+    }
+
+    p->pref_dialog = (GtkWidget*)gtk_builder_get_object( builder, "panel_pref" );
+    g_signal_connect(p->pref_dialog, "response", (GCallback) response_event, p);
     g_object_add_weak_pointer( p->pref_dialog, &p->pref_dialog );
     gtk_window_set_position( (GtkWindow*)p->pref_dialog, GTK_WIN_POS_CENTER );
 
-    xml = ptk_ui_xml_get( p->pref_dialog );
     /* position */
-    w = ptk_ui_xml_lookup( xml, "edge" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "edge" );
     update_opt_menu( w, p->edge - 1 );
     g_signal_connect( w, "changed", G_CALLBACK(set_edge), p);
 
-    w = ptk_ui_xml_lookup( xml, "align" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "align" );
     update_opt_menu( w, p->allign - 1 );
     g_signal_connect( w, "changed", G_CALLBACK(set_allign), p);
 
-    w = ptk_ui_xml_lookup( xml, "margin" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "margin" );
     gtk_spin_button_set_value( (GtkSpinButton*)w, p->margin );
     g_signal_connect( w, "value-changed",
                       G_CALLBACK(set_margin), p);
 
     /* size */
-    w = ptk_ui_xml_lookup( xml, "width" );
+    width = w = (GtkWidget*)gtk_builder_get_object( builder, "width" );
     gtk_widget_set_sensitive( w, p->widthtype != WIDTH_REQUEST );
     if( p->widthtype == WIDTH_PERCENT) {
         gtk_spin_button_set_range( (GtkSpinButton*)w, 0, 100 );
@@ -781,16 +780,17 @@ panel_configure( Panel* p, int sel_page  )
     gtk_spin_button_set_value( (GtkSpinButton*)w, p->width );
     g_signal_connect( w, "value-changed", G_CALLBACK(set_width), p );
 
-    w = ptk_ui_xml_lookup( xml, "width_unit" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "width_unit" );
     update_opt_menu( w, p->widthtype - 1 );
+    g_object_set_data(w, "width_spin", width );
     g_signal_connect( w, "changed",
                      G_CALLBACK(set_width_type), p);
 
-    w = ptk_ui_xml_lookup( xml, "height" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "height" );
     gtk_spin_button_set_value( (GtkSpinButton*)w, p->height );
     g_signal_connect( w, "value-changed", G_CALLBACK(set_height), p );
 
-    w = ptk_ui_xml_lookup( xml, "height_unit" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "height_unit" );
     update_opt_menu( w, HEIGHT_PIXEL - 1);
     //g_signal_connect( w, "changed", G_CALLBACK(set_height_type), NULL);
 
@@ -803,7 +803,7 @@ panel_configure( Panel* p, int sel_page  )
         lightweight window managers. These dockapps are probably being
         treated in some special way.
     */
-    w = ptk_ui_xml_lookup( xml, "as_dock" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "as_dock" );
     update_toggle_button( w, p->setdocktype );
     g_signal_connect( w, "toggled",
                       G_CALLBACK(set_dock_type), p );
@@ -817,13 +817,13 @@ panel_configure( Panel* p, int sel_page  )
         be accessed by other applications.
         GNOME Panel acts this way, too.
     */
-    w = ptk_ui_xml_lookup( xml, "reserve_space" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "reserve_space" );
     update_toggle_button( w, p->setstrut );
     g_signal_connect( w, "toggled",
                       G_CALLBACK(set_struct), p );
 
     /* transparancy */
-    w = ptk_ui_xml_lookup( xml, "tint_clr" );
+    tint_clr = w = (GtkWidget*)gtk_builder_get_object( builder, "tint_clr" );
     gtk_color_button_set_color((GtkColorButton*)w, &p->gtintcolor);
     gtk_color_button_set_alpha((GtkColorButton*)w, 256*p->alpha);
     if ( ! p->transparent )
@@ -833,14 +833,11 @@ panel_configure( Panel* p, int sel_page  )
     {
         GtkWidget* none, *trans, *img;
         GSList* group;
-        none = ptk_ui_xml_lookup( xml, "bg_none" );
-        trans = ptk_ui_xml_lookup( xml, "bg_transparency" );
-        img = ptk_ui_xml_lookup( xml, "bg_image" );
+        none = (GtkWidget*)gtk_builder_get_object( builder, "bg_none" );
+        trans = (GtkWidget*)gtk_builder_get_object( builder, "bg_transparency" );
+        img = (GtkWidget*)gtk_builder_get_object( builder, "bg_image" );
 
-        group = gtk_radio_button_get_group( (GtkRadioButton*)none );
-        gtk_radio_button_set_group( (GtkRadioButton*)trans, group );
-        group = gtk_radio_button_get_group( (GtkRadioButton*)trans );
-        gtk_radio_button_set_group( (GtkRadioButton*)img, group );
+        g_object_set_data(trans, "tint_clr", tint_clr);
 
         if (p->background)
             gtk_toggle_button_set_active( (GtkToggleButton*)img, TRUE);
@@ -853,27 +850,24 @@ panel_configure( Panel* p, int sel_page  )
         g_signal_connect(trans, "toggled", G_CALLBACK(transparency_toggle), p);
         g_signal_connect(img, "toggled", G_CALLBACK(background_toggle), p);
 
-        w = ptk_ui_xml_lookup( xml, "img_file" );
+        img_file = w = (GtkWidget*)gtk_builder_get_object( builder, "img_file" );
+        g_object_set_data(img, "img_file", img_file);
         gtk_file_chooser_set_current_folder( (GtkFileChooser*)w, PACKAGE_DATA_DIR "/lxpanel/images");
         if (p->background_file)
             gtk_file_chooser_set_filename( (GtkFileChooser*)w, p->background_file);
 
         if (!p->background)
             gtk_widget_set_sensitive( w, FALSE);
-
-        /* NOTE: Important!! */
-        /* "file-set" signal of GtkFileChooserButton is only available in gtk+ >= 2.12 */
-        /* So we use some dirty tricks here and make things more complicated. :-( */
-        g_signal_connect( w, "selection-changed", G_CALLBACK (background_changed), p);
-        /* g_signal_connect( w, "file-set", G_CALLBACK (background_changed), p); */
+        g_object_set_data( w, "bg_image", img );
+        g_signal_connect( w, "file-set", G_CALLBACK (background_changed), p);
     }
 
     /* font color */
-    w = ptk_ui_xml_lookup( xml, "font_clr" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "font_clr" );
     gtk_color_button_set_color( (GtkColorButton*)w, &p->gfontcolor );
     g_signal_connect( w, "color-set", G_CALLBACK( on_font_color_set ), p );
 
-    w2 = ptk_ui_xml_lookup( xml, "use_font_clr" );
+    w2 = (GtkWidget*)gtk_builder_get_object( builder, "use_font_clr" );
     gtk_toggle_button_set_active( (GtkToggleButton*)w2, p->usefontcolor );
     g_object_set_data( w2, "clr", w );
     g_signal_connect(w2, "toggled", G_CALLBACK(on_use_font_color_toggled), p);
@@ -882,35 +876,35 @@ panel_configure( Panel* p, int sel_page  )
 
     /* plugin list */
     {
-        GtkWidget* plugin_list = ptk_ui_xml_lookup( xml, "plugin_list" );
+        GtkWidget* plugin_list = (GtkWidget*)gtk_builder_get_object( builder, "plugin_list" );
 
         /* buttons used to edit plugin list */
-        w = ptk_ui_xml_lookup( xml, "add_btn" );
+        w = (GtkWidget*)gtk_builder_get_object( builder, "add_btn" );
         g_signal_connect( w, "clicked", G_CALLBACK(on_add_plugin), plugin_list );
 
-        w = ptk_ui_xml_lookup( xml, "edit_btn" );
+        w = (GtkWidget*)gtk_builder_get_object( builder, "edit_btn" );
         g_signal_connect_swapped( w, "clicked", G_CALLBACK(modify_plugin), plugin_list );
         g_object_set_data( G_OBJECT(plugin_list), "edit_btn", w );
 
-        w = ptk_ui_xml_lookup( xml, "remove_btn" );
+        w = (GtkWidget*)gtk_builder_get_object( builder, "remove_btn" );
         g_signal_connect( w, "clicked", G_CALLBACK(on_remove_plugin), plugin_list );
-        w = ptk_ui_xml_lookup( xml, "moveup_btn" );
+        w = (GtkWidget*)gtk_builder_get_object( builder, "moveup_btn" );
         g_signal_connect( w, "clicked", G_CALLBACK(on_moveup_plugin), plugin_list );
-        w = ptk_ui_xml_lookup( xml, "movedown_btn" );
+        w = (GtkWidget*)gtk_builder_get_object( builder, "movedown_btn" );
         g_signal_connect( w, "clicked", G_CALLBACK(on_movedown_plugin), plugin_list );
 
-        w = ptk_ui_xml_lookup( xml, "plugin_desc" );
+        w = (GtkWidget*)gtk_builder_get_object( builder, "plugin_desc" );
         init_plugin_list( p, (GtkTreeView*)plugin_list, w );
     }
     /* advanced, applications */
-    w = ptk_ui_xml_lookup( xml, "file_manager" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "file_manager" );
     if (file_manager_cmd)
         gtk_entry_set_text( (GtkEntry*)w, file_manager_cmd );
     g_signal_connect( w, "changed",
                       G_CALLBACK(on_entry_changed),
                       &file_manager_cmd);
 
-    w = ptk_ui_xml_lookup( xml, "term" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "term" );
     if (terminal_cmd)
         gtk_entry_set_text( (GtkEntry*)w, terminal_cmd );
     g_signal_connect( w, "changed",
@@ -918,10 +912,10 @@ panel_configure( Panel* p, int sel_page  )
                       &terminal_cmd);
 
     /* If we are under LXSession, setting logout command is not necessary. */
-    w = ptk_ui_xml_lookup( xml, "logout" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "logout" );
     if( getenv("_LXSESSION_PID") ) {
         gtk_widget_hide( w );
-        w = ptk_ui_xml_lookup( xml, "logout_label" );
+        w = (GtkWidget*)gtk_builder_get_object( builder, "logout_label" );
         gtk_widget_hide( w );
     }
     else {
@@ -933,8 +927,10 @@ panel_configure( Panel* p, int sel_page  )
     }
 
     gtk_widget_show((GtkWindow*)p->pref_dialog);
-    w = ptk_ui_xml_get_widget( p->pref_dialog, "notebook" );
+    w = (GtkWidget*)gtk_builder_get_object( builder, "notebook" );
     gtk_notebook_set_current_page( (GtkNotebook*)w, sel_page );
+
+    g_object_unref(builder);
 }
 
 void
index d4ea00d..a4f61ae 100644 (file)
@@ -912,14 +912,6 @@ panel_start_gui(Panel *p)
     gdk_window_move_resize(p->topgwin->window, p->ax, p->ay, p->aw, p->ah);
     panel_set_wm_strut(p);
 
-    p->tooltips = gtk_tooltips_new();
-#if GLIB_CHECK_VERSION( 2, 10, 0 )
-    g_object_ref_sink( p->tooltips );
-#else
-    g_object_ref( p->tooltips );
-    gtk_object_sink( p->tooltips );
-#endif
-
     RET();
 }
 
@@ -1206,9 +1198,6 @@ void panel_destroy(Panel *p)
 
     gtk_window_group_remove_window(win_grp, p->topgwin);
 
-    if( p->tooltips )
-        g_object_unref( p->tooltips );
-
     if( p->topgwin )
         gtk_widget_destroy(p->topgwin);
     g_free(p->workarea);
index b6e1cf7..8c3f7b7 100644 (file)
@@ -94,8 +94,6 @@ struct _Panel{
 
     GSList* system_menus;
 
-    /* tooltip controller shared by many plugins */
-    GtkTooltips *tooltips;
     GtkWidget* pref_dialog; /* preference dialog */
 };
 
index 2969a4a..6b9cd10 100644 (file)
@@ -83,7 +83,6 @@ typedef struct {
         *gc1,
         *gc2;
     GdkPixmap *pixmap;
-    GtkTooltips *tooltip;
     GtkWidget *drawingArea;
     int orientation;
     unsigned int alarmTime,
@@ -409,7 +408,7 @@ void update_display(batt *b, gboolean repaint) {
             }
         }
 
-        gtk_tooltips_set_tip(b->tooltip, b->drawingArea, tooltip, NULL);
+        gtk_widget_set_tooltip(b->drawingArea, tooltip, NULL);
 
         int chargeLevel = capacity ?
                 charge * (b->length - 2 * b->border) / capacity : 0;
@@ -453,7 +452,7 @@ void update_display(batt *b, gboolean repaint) {
     {
         char tip[ 256 ];
         g_snprintf( tip, 256, _("No batteries found") );
-        gtk_tooltips_set_tip(b->tooltip, b->drawingArea, tip, NULL);
+        gtk_widget_set_tooltip_text( b->drawingArea, tip );
     }
 
     if( repaint )
@@ -650,7 +649,6 @@ constructor(Plugin *p, char **fp)
     gtk_widget_set_size_request(b->drawingArea, b->width, b->height);
 
     gtk_widget_show(b->drawingArea);
-    b->tooltip = p->panel->tooltips;
 
     b->bg = gdk_gc_new(p->panel->topgwin->window);
     b->gc1 = gdk_gc_new(p->panel->topgwin->window);
index b09181f..9feaa04 100644 (file)
@@ -41,7 +41,6 @@ typedef struct {
     GtkWidget *main;
     GtkWidget *clockw;
     GtkWidget *calwin;
-    GtkTooltips *tip;
     char *tfmt;
     char *cfmt;
     char *action;
@@ -157,7 +156,7 @@ clock_update(gpointer data )
         strftime (output, sizeof(output),
                   (dc->tfmt ? dc->tfmt : DEFAULT_TIP_FORMAT), detail);
             if ((utf8 = g_locale_to_utf8(output, -1, NULL, NULL, NULL))) {
-                gtk_tooltips_set_tip(dc->tip, dc->main, utf8, NULL);
+                gtk_widget_set_tooltip_text(dc->main, utf8);
                 g_free(utf8);
             }
     }
@@ -221,14 +220,6 @@ dclock_constructor(Plugin *p, char** fp)
     gtk_container_add(GTK_CONTAINER(dc->main), dc->clockw);
     gtk_widget_show_all(dc->main);
 
-    dc->tip = p->panel->tooltips;
-#if GLIB_CHECK_VERSION( 2, 10, 0 )
-    g_object_ref_sink( dc->tip );
-#else
-    g_object_ref( dc->tip );
-    gtk_object_sink( dc->tip );
-#endif
-
     dc->timer = g_timeout_add(1000, (GSourceFunc) clock_update, (gpointer)dc);
 
     clock_update( dc );
index 25a788e..e84dfd3 100644 (file)
@@ -69,6 +69,7 @@ static void on_open_dir( GtkWidget* item, Plugin* p )
 
 static void open_in_term( Plugin* p, const char* path )
 {
+    /* FIXME: open in terminal */
     char* term = g_strdup( lxpanel_get_terminal() );
     char* sp = strchr( term, ' ' );
     if( sp )
@@ -347,9 +348,8 @@ dirmenu_constructor(Plugin *p, char **fp)
     g_free(fname);
 
     fname = dm->path ? expand_tilda(dm->path) : NULL;
-    gtk_tooltips_set_tip(GTK_TOOLTIPS (dm->panel->tooltips),
-                         dm->button,
-                         fname ? fname : g_get_home_dir(), NULL);
+    gtk_widget_set_tooltip_text( dm->button,
+                                 fname ? fname : g_get_home_dir());
     g_free( fname );
 
     /* store the created plugin widget in plugin->pwid */
index 086f2d8..538d885 100644 (file)
@@ -57,7 +57,6 @@ static int xkb_error_base = 0;
 typedef struct _KbLed{
     GtkWidget *mainw;
     GtkWidget *img[3];
-    GtkTooltips* tooltips;
     int old_state;
     gboolean visible[3];
 } KbLed;
@@ -140,8 +139,6 @@ kbled_destructor(Plugin *p)
     KbLed *kl = (KbLed*)p->priv;
 
     gdk_window_remove_filter(NULL, (GdkFilterFunc)event_filter, p);
-
-    g_object_unref( kl->tooltips );
     g_free( kl );
 }
 
@@ -239,7 +236,6 @@ static int kbled_constructor(Plugin *p, char **fp)
     gdk_window_add_filter(NULL, (GdkFilterFunc)event_filter, p );
 
     gtk_widget_show(kl->mainw);
-    kl->tooltips = g_object_ref( p->panel->tooltips );
     //gtk_tooltips_set_tip (vol->tooltips, vol->mainw, _("Volume control"), NULL);
 
     return TRUE;
index 2e9f7a5..7bccb74 100644 (file)
@@ -74,7 +74,7 @@ typedef struct btn_t {
     gchar *action;
     gchar *tooltip;
 /*  NOTE: Users can override the values specified in desktop file,
-          and we should process these special cease. */
+          and we should process these special cases. */
     guchar customize_image : 1;
     guchar customize_action : 1;
     guchar customize_tooltip : 1;
@@ -90,6 +90,14 @@ typedef struct launchbar {
 
 void panel_config_save(Panel* panel);
 
+#if 0
+/* used in menu.c to find the launchbar with most buttons */
+int launchbar_get_n_btns( Plugin* pl )
+{
+    return g_slist_length(((launchbar*)pl->priv)->btns);
+}
+#endif
+
 void btn_free( btn_t* btn )
 {
     g_free( btn->desktop_id );
@@ -335,9 +343,9 @@ read_button(Plugin *p, char** fp)
 
     g_free(fname);
 
-    // tooltip
+    /* tooltip */
     if ( btn->tooltip ) {
-        gtk_tooltips_set_tip(GTK_TOOLTIPS (lb->tips), button, btn->tooltip, NULL);
+        gtk_widget_set_tooltip_text(button, btn->tooltip);
     }
     RET(1);
 
@@ -388,10 +396,6 @@ launchbar_constructor(Plugin *p, char **fp)
     gtk_container_set_border_width (GTK_CONTAINER (lb->box), 0);
     gtk_widget_show(GTK_WIDGET(lb->box));
 
-    /* Use the shared tooltip object provided by the panel, and
-       we don't need to create a new one. */
-    lb->tips = p->panel->tooltips;
-
     if  (p->panel->orientation == ORIENT_HORIZ)
         lb->iconsize = GTK_WIDGET(p->panel->box)->allocation.height;
     else
index e37e1c8..c23a0be 100644 (file)
 
 #include <menu-cache.h>
 
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
 #include "panel.h"
 #include "misc.h"
 #include "plugin.h"
@@ -61,6 +65,9 @@ static guint idle_loader = 0;
 
 GQuark SYS_MENU_ITEM_ID = 0;
 
+/* a single-linked list storing all panels */
+extern GSList* all_panels;
+
 
 static void
 menu_destructor(Plugin *p)
@@ -183,24 +190,198 @@ static void on_menu_item_style_set(GtkWidget* mi, GtkStyle* prev, MenuCacheItem*
     /* g_debug("style set!"); */
 }
 
-static gboolean on_menu_button_press(GtkWidget* mi, GdkEventButton* evt, MenuCacheItem* item)
+static void on_add_menu_item_to_desktop(GtkMenuItem* item, MenuCacheApp* app)
+{
+    char* dest;
+    char* src;
+    g_debug("app: %p", app);
+    const char* desktop = g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP);
+    int dir_len = strlen(desktop);
+    int basename_len = strlen(menu_cache_item_get_id(app));
+    int dest_fd;
+
+    dest = g_malloc( dir_len + basename_len + 6 + 1 + 1 );
+    memcpy(dest, desktop, dir_len);
+    dest[dir_len] = '/';
+    memcpy(dest + dir_len + 1, menu_cache_item_get_id(app), basename_len + 1);
+
+    /* if the destination file already exists, make a unique name. */
+    if( g_file_test( dest, G_FILE_TEST_EXISTS ) )
+    {
+        memcpy( dest + dir_len + 1 + basename_len - 8 /* .desktop */, "XXXXXX.desktop", 15 );
+        dest_fd = g_mkstemp(dest);
+        if( dest_fd >= 0 )
+            chmod(dest, 0600);
+    }
+    else
+    {
+        dest_fd = creat(dest, 0600);
+    }
+
+    if( dest_fd >=0 )
+    {
+        char* data;
+        gsize len;
+        src = g_build_filename(menu_cache_app_get_file_dirname(app),
+                               menu_cache_item_get_id(app), NULL);
+        if( g_file_get_contents(src, &data, &len, NULL) )
+        {
+            write( dest_fd, data, len );
+            g_free(data);
+        }
+        close(dest_fd);
+        g_free(src);
+    }
+    g_free(dest);
+}
+
+static void on_add_menu_item_to_panel(GtkMenuItem* item, MenuCacheApp* app)
 {
-    if( evt->button == 3 )  // right
+    /* Find a penel containing launchbar applet.
+     * The launchbar with most buttons will be choosen if
+     * there are several launchbar applets loaded.
+     */
+    GSList* l;
+    Plugin* lb = NULL;
+    int n_btns = -1;
+
+    for(l = all_panels; !lb && l; l = l->next)
+    {
+        Panel* panel = (Panel*)l->data;
+        GList* pl;
+        for(pl=panel->plugins; pl; pl = pl->next)
+        {
+            Plugin* plugin = (Plugin*)pl;
+            if( strcmp(plugin->class->type, "launchbar") == 0 )
+            {
+                /* FIXME: should we let the users choose which launcherbar to add the btn? */
+                break;
+#if 0
+                int n = launchbar_get_n_btns(plugin);
+                if( n > n_btns )
+                {
+                    lb = plugin;
+                    n_btns = n;
+                }
+#endif
+            }
+        }
+    }
+
+    if( ! lb ) /* launchbar is not currently in use */
     {
-        g_debug("right click!");
+        /* FIXME: add a launchbar plugin to the panel which has a menu, too. */
+    }
+
+    if( lb )
+    {
+
+    }
+}
+
+static void on_menu_item_properties(GtkMenuItem* item, MenuCacheApp* app)
+{
+    char* file = g_build_filename(menu_cache_app_get_file_dirname(app),
+                                  menu_cache_item_get_id(app), NULL);
+    char** argv[] = {
+        "lxshortcut",
+        "-i",
+        NULL,
+        NULL};
+    argv[2] = file;
+    g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL );
+    g_free( file );
+}
+
+/* This following function restore_grabs is taken from menu.c of
+ * gnome-panel.
+ */
+/*most of this function stolen from the real gtk_menu_popup*/
+static void restore_grabs(GtkWidget *w, gpointer data)
+{
+    GtkWidget *menu_item = data;
+    GtkMenu *menu = GTK_MENU(menu_item->parent);
+    GtkWidget *xgrab_shell;
+    GtkWidget *parent;
+
+    /* Find the last viewable ancestor, and make an X grab on it
+    */
+    parent = GTK_WIDGET (menu);
+    xgrab_shell = NULL;
+    while (parent)
+    {
+        gboolean viewable = TRUE;
+        GtkWidget *tmp = parent;
+
+        while (tmp)
+        {
+            if (!GTK_WIDGET_MAPPED (tmp))
+            {
+                viewable = FALSE;
+                break;
+            }
+            tmp = tmp->parent;
+        }
+
+        if (viewable)
+            xgrab_shell = parent;
+
+        parent = GTK_MENU_SHELL (parent)->parent_menu_shell;
+    }
+
+    /*only grab if this HAD a grab before*/
+    if (xgrab_shell && (GTK_MENU_SHELL (xgrab_shell)->have_xgrab))
+    {
+        if (gdk_pointer_grab (xgrab_shell->window, TRUE,
+                    GDK_BUTTON_PRESS_MASK |
+                    GDK_BUTTON_RELEASE_MASK |
+                    GDK_ENTER_NOTIFY_MASK |
+                    GDK_LEAVE_NOTIFY_MASK,
+                    NULL, NULL, 0) == 0)
+        {
+            if (gdk_keyboard_grab (xgrab_shell->window, TRUE,
+                    GDK_CURRENT_TIME) == 0)
+                GTK_MENU_SHELL (xgrab_shell)->have_xgrab = TRUE;
+            else
+                gdk_pointer_ungrab (GDK_CURRENT_TIME);
+        }
+    }
+    gtk_grab_add (GTK_WIDGET (menu));
+}
+
+static gboolean on_menu_button_press(GtkWidget* mi, GdkEventButton* evt, MenuCacheItem* data)
+{
+    if( evt->button == 3 )  /* right */
+    {
+        char* tmp;
         GtkWidget* item;
         GtkMenu* p = gtk_menu_new();
+
         item = gtk_menu_item_new_with_label(_("Add to desktop panel"));
+        g_signal_connect(item, "activate", G_CALLBACK(on_add_menu_item_to_panel), data);
         gtk_menu_shell_append(p, item);
+
         item = gtk_menu_item_new_with_label(_("Add to desktop"));
+        g_signal_connect(item, "activate", G_CALLBACK(on_add_menu_item_to_desktop), data);
         gtk_menu_shell_append(p, item);
-        item = gtk_separator_menu_item_new();
-        gtk_menu_shell_append(p, item);
-        item = gtk_menu_item_new_with_label(_("Properties"));
-        gtk_menu_shell_append(p, item);
+
+        tmp = g_find_program_in_path("lxshortcut");
+        if( tmp )
+        {
+            item = gtk_separator_menu_item_new();
+            gtk_menu_shell_append(p, item);
+
+            item = gtk_menu_item_new_with_label(_("Properties"));
+            g_signal_connect(item, "activate", G_CALLBACK(on_menu_item_properties), data);
+            gtk_menu_shell_append(p, item);
+            g_free(tmp);
+        }
+        g_signal_connect(p, "selection-done", G_CALLBACK(gtk_widget_destroy), NULL);
+        g_signal_connect(p, "deactivate", G_CALLBACK(restore_grabs), mi);
+
         gtk_widget_show_all(p);
-        gtk_menu_popup(p, NULL, NULL, NULL, NULL, NULL, evt->time );
-//        return TRUE;
+        gtk_menu_popup(p, NULL, NULL, NULL, NULL, NULL, evt->time);
+        return TRUE;
     }
     return FALSE;
 }
index 19f0740..b7491e4 100644 (file)
@@ -27,7 +27,6 @@
 #include "dbg.h"
 
 typedef struct {
-    GtkTooltips *tips;
     char* image;
     int button1, button2;
     int action1, action2;
@@ -190,16 +189,6 @@ wincmd_constructor(Plugin *p, char **fp)
     wc = g_new0(wincmd, 1);
     g_return_val_if_fail(wc != NULL, 0);
 
-    wc->tips = p->panel->tooltips;
-/*
-    wc->tips = gtk_tooltips_new();
-#if GLIB_CHECK_VERSION( 2, 10, 0 )
-    g_object_ref_sink( wc->tips );
-#else
-    g_object_ref( wc->tips );
-    gtk_object_sink( wc->tips );
-#endif
-*/
     p->priv = wc;
     fname = NULL;
     if( fp )
@@ -253,7 +242,7 @@ wincmd_constructor(Plugin *p, char **fp)
     gtk_widget_show(button);
 
     g_free(fname);
-    gtk_tooltips_set_tip(GTK_TOOLTIPS (wc->tips), button, _("Left click to iconify all windows. Middle click to shade them"), NULL);
+    gtk_widget_set_tooltip_text( button, _("Left click to iconify all windows. Middle click to shade them") );
 
     /* store the created plugin widget in plugin->pwid */
     p->pwid = button;
diff --git a/src/ptk-ui-xml/ptk-ui-xml.c b/src/ptk-ui-xml/ptk-ui-xml.c
deleted file mode 100644 (file)
index b1f2f55..0000000
+++ /dev/null
@@ -1,964 +0,0 @@
-/*
- *      ptk-ui-xml.h -Lightweight parser for *.glade
- *
- *      Copyright 2008 PCMan <pcman.tw@gmail.com>
- *
- *      This program is free software; you can redistribute it and/or modify
- *      it under the terms of the GNU General Public License as published by
- *      the Free Software Foundation; either version 2 of the License, or
- *      (at your option) any later version.
- *
- *      This program is distributed in the hope that it will be useful,
- *      but WITHOUT ANY WARRANTY; without even the implied warranty of
- *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *      GNU General Public License for more details.
- *
- *      You should have received a copy of the GNU General Public License
- *      along with this program; if not, write to the Free Software
- *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- *      MA 02110-1301, USA.
- */
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "ptk-xml-tree.h"
-#include "ptk-ui-xml.h"
-
-#include "glib-mem.h" /* compatibility macros for g_slice API */
-
-struct _PtkUIXml
-{
-    guint n_ref;
-    GHashTable* hash;
-    GtkAccelGroup* acc;
-    GtkTooltips* tips;
-    GtkWidget* top_level;
-    GtkWidget* def;
-    GtkWidget* focus;
-};
-
-static GModule* this_mod = NULL;
-
-static GQuark ptk_ui_xml_id = 0;
-
-static PtkUIXml* ptk_ui_xml_new();
-static void ptk_ui_xml_free( PtkUIXml* xml );
-
-static GtkWidget* create_widget( GtkWidget* parent, XmlNode* node,
-                                const char* internal, PtkUIXml* xml );
-
-static gboolean strtobool( const char* str )
-{
-    return str && !strcmp(str, "True");
-}
-static gboolean enum_to_int( GType type, const char* name, int* val );
-
-static char* get_prop( XmlNode* node, const char* name )
-{
-    GSList* l;
-    for( l = node->children; l; l = l->next )
-    {
-        XmlNode* child = (XmlNode*)l->data;
-        const char* prop_name;
-        if( 0 == strcmp(child->name, "property") )
-        {
-            prop_name = xml_node_get_prop( child, "name" );
-            if( prop_name && 0 == strcmp(prop_name, name) )
-                return child->cdata;
-        }
-    }
-    return NULL;
-}
-
-static char* get_prop_name( XmlNode* prop_node )
-{
-    char **prop, ** val;
-    if( prop_node->name && (0 == strcmp( prop_node->name, "property" )) && prop_node->props )
-    {
-        for( prop = prop_node->props, val = prop_node->vals; *prop; ++prop, ++val )
-        {
-            if( 0 == strcmp( "name", *prop ) )
-                return *val;
-        }
-    }
-    return NULL;
-}
-
-static void init_combo_box( GtkComboBox* combo )
-{
-    GtkListStore* list;
-    GtkCellRenderer* cell;
-    list = gtk_list_store_new( 1, G_TYPE_STRING );
-    gtk_combo_box_set_model( combo, GTK_TREE_MODEL(list) );
-    g_object_unref( list );
-
-    if( GTK_IS_COMBO_BOX_ENTRY( combo ) )
-    {
-        gtk_combo_box_entry_set_text_column((GtkComboBoxEntry*)combo, 0);
-    }
-    else
-    {
-        /* Taken from gtkcombox.c of gtk+ */
-        cell = gtk_cell_renderer_text_new ();
-        gtk_cell_layout_pack_start( GTK_CELL_LAYOUT(combo),
-                                    cell, TRUE );
-        gtk_cell_layout_set_attributes( GTK_CELL_LAYOUT(combo),
-                                        cell,
-                                        "text", 0,
-                                        NULL);
-    }
-}
-
-static gboolean is_translatable( XmlNode* prop_node )
-{
-    const char* translatable = xml_node_get_prop( prop_node, "translatable");
-    return (translatable && 0 == strcmp(translatable, "yes" ) );
-}
-
-static void
-set_widget_special_property( GtkWidget* widget,
-                                         GSList* special_props,
-                                         PtkUIXml* xml )
-{
-    GSList* l;
-    XmlNode* prop_node;
-    const char* name;
-
-    for( l = special_props; l; l = l->next )
-    {
-        prop_node = (XmlNode*)l->data;
-        if( G_UNLIKELY( ! prop_node->cdata || ! *prop_node->cdata ) )
-            continue;
-        name = get_prop_name( prop_node );
-        if( name )
-        {
-            if( 0 == strcmp( name, "tooltip" ) )
-            {
-                if( G_UNLIKELY(! xml->tips ) )
-                {
-                    xml->tips = gtk_tooltips_new();
-        #if GTK_CHECK_VERSION(2, 10, 0)
-                    g_object_ref_sink( xml->tips );
-                    g_object_unref ( xml->tips );
-        #else
-                    gtk_object_sink( (GtkObject*)xml->tips );
-        #endif
-                }
-                if( is_translatable( prop_node ) )
-                    gtk_tooltips_set_tip( xml->tips, widget, _(prop_node->cdata), _(prop_node->cdata) );
-                else
-                    gtk_tooltips_set_tip( xml->tips, widget, prop_node->cdata, prop_node->cdata );
-           }
-            else if( 0 == strcmp( name, "text" ) && GTK_IS_TEXT_VIEW( widget ) )
-            {
-                GtkTextBuffer* buf = gtk_text_buffer_new( NULL );
-                const char* text = NULL;
-            if (is_translatable( prop_node ))
-            text = _(text);
-                gtk_text_buffer_set_text( buf, text, strlen(text) );
-                gtk_text_view_set_buffer( GTK_TEXT_VIEW(widget), buf );
-                g_object_unref( buf );
-            }
-            else if( 0 == strcmp( name, "display_options" ) && GTK_IS_CALENDAR( widget ) )
-            {
-                int val = 0;
-                if( enum_to_int( GTK_TYPE_CALENDAR_DISPLAY_OPTIONS, prop_node->cdata, &val ) )
-                    gtk_calendar_set_display_options( GTK_CALENDAR(widget), val);
-            }
-            else if( 0 == strcmp( name, "response_id" ) && GTK_IS_BUTTON(widget) )
-            {
-                if( G_LIKELY( GTK_IS_DIALOG( xml->top_level ) ) )
-                {
-                    int id = atoi( prop_node->cdata );
-                    if( id != 0 )
-                        gtk_dialog_add_action_widget( GTK_DIALOG(xml->top_level), widget, id );
-                }
-            }
-            else if( 0 == strcmp( name, "items" ) && GTK_IS_COMBO_BOX(widget) )
-            {
-                if( prop_node->cdata )
-                {
-                    const char* lines = is_translatable( prop_node ) ? _(prop_node->cdata) : prop_node->cdata;
-                    char** items = g_strsplit(lines, "\n", -1);
-                    char** item;
-
-                    for( item = items; *item ; ++item )
-                    {
-                        if( **item )
-                            gtk_combo_box_append_text( GTK_COMBO_BOX(widget),
-                                                    *item );
-                    }
-                    g_strfreev( items );
-                }
-            }
-            else if( GTK_IS_WINDOW( widget ) )
-            {
-                /*
-                if( 0 == strcmp( name, "wmclass_name" ) )
-                {
-                }
-                else if( 0 == strcmp( name, "wmclass_class" ) )
-                {
-                }
-                */
-                g_warning( "%s not supported", name );
-            }
-        }
-    }
-}
-
-gboolean enum_to_int( GType type, const char* name, int* val )
-{
-    gchar *endptr;
-    int ret;
-
-    if( G_UNLIKELY( !name || !*name ) )
-    {
-        *val = 0;
-        return TRUE;
-    }
-    ret = strtoul(name, &endptr, 0);
-    if (endptr != name) /* parsed a number */
-    {
-        *val = ret;
-        return TRUE;
-    }
-
-    if( !type ) /* guess the type */
-    {
-        if( g_str_has_prefix(name, "GTK_SHADOW") )
-            type = GTK_TYPE_SHADOW_TYPE;
-        else if( g_str_has_prefix(name, "GTK_SELECTION") )
-            type = GTK_TYPE_SELECTION_MODE;
-        else if( g_str_has_prefix(name, "GTK_TREE_VIEW") )
-            type = GTK_TYPE_TREE_VIEW_MODE;
-        else if( g_str_has_prefix(name, "GTK_METRIC") )
-            type = GTK_TYPE_METRIC_TYPE;
-        else if( g_str_has_prefix(name, "GTK_PREVIEW") )
-            type = GTK_TYPE_METRIC_TYPE;
-    }
-
-    if( G_LIKELY(type) )
-    {
-        gpointer klass = g_type_class_ref(type);
-        if( G_IS_ENUM_CLASS( klass ) )
-        {
-            GEnumClass *ec = (GEnumClass*)klass;
-            GEnumValue *ev;
-            ev = g_enum_get_value_by_name(ec, name);
-            if (!ev)
-                ev = g_enum_get_value_by_nick(ec, name);
-            if (ev)
-            {
-                ret = ev->value;
-                g_type_class_unref(klass);
-                *val = ret;
-                /* g_debug("ENUM: %s=%d", name, *val); */
-                return TRUE;
-            }
-        }
-        else if( G_IS_FLAGS_CLASS( klass ) )
-        {
-            GFlagsClass *fc = (GFlagsClass*)klass;
-            GFlagsValue *fv;
-            fv = g_flags_get_value_by_name(fc, name);
-            if (!fv)
-                fv = g_flags_get_value_by_nick(fc, name);
-            if (fv)
-            {
-                ret = fv->value;
-                g_type_class_unref(klass);
-                *val = ret;
-                /* g_debug("FLAG: %s=%d", name, *val); */
-                return TRUE;
-            }
-        }
-        g_type_class_unref(klass);
-    }
-    return FALSE;
-}
-
-static gboolean
-property_to_gparameter( GObjectClass* objcls,
-    const char* prop_name, XmlNode* prop_node, GParameter* param )
-{
-    GParamSpec* spec;
-    const char* translatable;
-    int ival;
-    GValue* gv = &param->value;
-
-    if( G_UNLIKELY( ! prop_node->cdata) )
-        return FALSE;
-    param->name = prop_name;
-
-    spec = g_object_class_find_property( objcls, param->name );
-    if( G_UNLIKELY( !spec ) )
-        goto failed;
-
-    g_value_init( gv, spec->value_type );
-    /* g_debug("property: %s, %s", param->name, G_VALUE_TYPE_NAME(gv)); */
-
-    switch( G_TYPE_FUNDAMENTAL( spec->value_type ) )
-    {
-        case G_TYPE_INT:
-            if( enum_to_int((GType)NULL, prop_node->cdata, &ival) )
-                g_value_set_int( gv, ival );
-            else
-                goto failed;
-            break;
-        case G_TYPE_UINT:
-            if( enum_to_int((GType)NULL, prop_node->cdata, &ival) )
-                g_value_set_uint( gv, ival );
-            else
-                goto failed;
-            break;
-        case G_TYPE_STRING:
-            translatable = xml_node_get_prop( prop_node, "translatable" );
-            if( translatable && 0 == strcmp("yes", translatable) )
-                g_value_set_string( gv, _( prop_node->cdata ) );
-            else
-                g_value_set_string( gv, prop_node->cdata );
-            break;
-        case G_TYPE_BOOLEAN:
-            g_value_set_boolean( gv, strtobool(prop_node->cdata) );
-            break;
-        case G_TYPE_DOUBLE:
-            g_value_set_double( gv,
-                        g_strtod(prop_node->cdata, NULL) );
-            break;
-        case G_TYPE_FLOAT:
-            g_value_set_float( gv,
-                        (gfloat)g_strtod(prop_node->cdata, NULL) );
-            break;
-        case G_TYPE_INT64:
-            g_value_set_int64( gv, (gint64)atol(prop_node->cdata) );
-            break;
-        case G_TYPE_UINT64:
-            g_value_set_uint64( gv, (guint64)atol(prop_node->cdata) );
-            break;
-        case G_TYPE_LONG:
-            g_value_set_long( gv, (glong)atol(prop_node->cdata) );
-            break;
-        case G_TYPE_ULONG:
-            g_value_set_ulong( gv, (gulong)atol(prop_node->cdata) );
-            break;
-        case G_TYPE_CHAR:
-            g_value_set_char( gv, prop_node->cdata[0] );
-            break;
-        case G_TYPE_UCHAR:
-            g_value_set_uchar( gv, g_utf8_get_char(prop_node->cdata) );
-            break;
-        case G_TYPE_ENUM:
-            if( enum_to_int( spec->value_type, prop_node->cdata, &ival ) )
-                g_value_set_enum( gv, ival );
-            else
-                goto failed;
-            break;
-        case G_TYPE_FLAGS:
-            {
-                char** flags = g_strsplit( prop_node->cdata, "| ", 0 );
-                int flags_val = 0;
-                if( flags )
-                {
-                    char** flag;
-                    for( flag = flags; *flag; ++flag )
-                    {
-                        if( enum_to_int( spec->value_type, *flag, &ival ) )
-                            flags_val |= ival;
-                    }
-                    g_value_set_flags( gv, flags_val );
-                    g_free( flags );
-                }
-                else
-                    goto failed;
-            }
-            break;
-        case G_TYPE_BOXED:
-            if( G_UNLIKELY( spec->value_type == GDK_TYPE_COLOR ) )
-            {
-                GdkColor clr;
-                gdk_color_parse( prop_node->cdata, &clr );
-                g_value_set_boxed( gv, &clr);
-            }
-            else if(  G_UNLIKELY( spec->value_type == G_TYPE_STRV )  )
-            {
-                char **strv;
-                if( is_translatable( prop_node ) )
-                    strv = g_strsplit ( _(prop_node->cdata), "\n", 0 );
-                else
-                    strv = g_strsplit ( prop_node->cdata, "\n", 0 );
-                g_value_take_boxed (gv, strv);
-            }
-            break;
-       case G_TYPE_OBJECT:
-            if( G_UNLIKELY( spec->value_type == GTK_TYPE_ADJUSTMENT ) )
-            {
-                float val, lower, upper, step, page_inc, page_size;
-                GtkObject* adj;
-                /* FIXME: There are some prolems here!! */
-                sscanf( prop_node->cdata, "%f %f %f %f %f %f",
-                        &val, &lower, &upper,
-                        &step, &page_inc, &page_size );
-                adj = gtk_adjustment_new( val, lower, upper,
-                                          step, page_inc, page_size );
-
-                g_value_set_object( gv, adj );
-
-#if GTK_CHECK_VERSION( 2, 10, 0 )
-                g_object_ref_sink( adj );
-#else
-                g_object_ref( adj );
-                gtk_object_sink(GTK_OBJECT(adj));
-#endif
-            }
-            else
-                goto failed;
-            break;
-        default:
-            g_warning("%s(%s) is not supported", g_type_name(G_TYPE_FUNDAMENTAL( spec->value_type )), G_VALUE_TYPE_NAME(gv) );
-            goto failed;
-            /*
-            if( enum_to_int( spec->value_type, prop_node->cdata, &val ) )
-                g_object_set(obj, name, val, NULL);
-            */
-            break;
-/*      unsupported
-        case G_TYPE_POINTER:
-        case G_TYPE_OBJECT:
-        case G_TYPE_BOXED:
-        default:
-            break;
-*/
-    };
-    return TRUE;
-failed:
-    param->name = NULL;
-    if( G_IS_VALUE( gv ) )
-        g_value_unset( gv );
-    return FALSE;
-}
-
-int strtoint( const char* str )
-{
-    return str ? atoi( str ) : 0;
-}
-
-static gboolean pack_widget( GtkWidget* parent,
-                      GtkWidget* widget, XmlNode* node )
-{
-    GSList* l;
-    GSList* pack_props = node->children;
-    const char* type = get_prop( node, "type");
-
-    if( G_UNLIKELY( type ) )
-    {
-        if( 0 == strcmp( type, "tab" ) )
-        {
-            GtkWidget* page;
-            int n = gtk_notebook_get_n_pages( GTK_NOTEBOOK(parent) );
-            if( n <= 0 )
-                return FALSE;
-            page = gtk_notebook_get_nth_page( GTK_NOTEBOOK(parent), n-1);
-            gtk_notebook_set_tab_label( GTK_NOTEBOOK(parent),
-                                        page, widget );
-        }
-        else if( 0 == strcmp( type, "label_item" ) )
-        {
-            if( GTK_IS_EXPANDER( parent ) )
-                gtk_expander_set_label_widget(  (GtkExpander*)parent, widget );
-            else if( GTK_IS_FRAME( parent ) )
-                gtk_frame_set_label_widget(  (GtkFrame*)parent, widget );
-        }
-    }
-
-    if( ! gtk_widget_is_ancestor( widget, parent ) )
-        gtk_container_add( (GtkContainer*)parent, widget );
-
-    for( l = pack_props; l; l = l->next )
-    {
-        XmlNode* node = (XmlNode*)l->data;
-        const char* name = NULL;
-        if( !node->name || strcmp( node->name, "property" ) )
-            continue;
-
-        name = xml_node_get_prop( node, "name" );
-        if( G_LIKELY( name ) )
-        {
-            GObjectClass* objcls;
-            GParamSpec* spec;
-
-            objcls = G_OBJECT_GET_CLASS(parent);
-            if( !objcls )
-                continue;
-            spec = gtk_container_class_find_child_property(
-                                         objcls, name );
-            if( !spec )
-                continue;
-
-            /* g_debug(  "PACK_CHILD_PROP: %s (%s)", name, g_type_name(spec->value_type) ); */
-            if( spec->value_type == G_TYPE_BOOLEAN )
-            {
-                gtk_container_child_set( (GtkContainer*)parent, widget,
-                                         name,
-                                         strtobool(node->cdata),
-                                         NULL );
-            }
-            else if( spec->value_type )
-            {
-                int val = 0;
-                if( enum_to_int( spec->value_type, node->cdata, &val ) )
-                    gtk_container_child_set( (GtkContainer*)parent, widget,
-                                             name, val, NULL );
-                /* g_debug( "PACKING: %s = %d", name, val ); */
-            }
-        }
-    }
-    return TRUE;
-}
-
-static void load_child_widget( GtkWidget* parent,
-                               XmlNode* child,
-                               PtkUIXml* xml )
-{
-    GSList* l;
-    GtkWidget* child_widget = NULL;
-    gboolean packing = FALSE;
-    const char* internal = xml_node_get_prop(child, "internal-child");
-
-    for( l = child->children; l; l = l->next )
-    {
-        XmlNode* child_node = (XmlNode*)l->data;
-        if( 0 == strcmp( "widget", child_node->name ) )
-            child_widget = create_widget( parent, child_node,
-                                          internal, xml );
-        else if( !packing && 0 == strcmp( "packing", child_node->name ) )
-        {
-            if( child_widget && parent )
-            {
-                packing = pack_widget( parent,
-                                       child_widget,
-                                       child_node );
-            }
-            child_widget = NULL;
-        }
-    }
-    /* g_debug( "PACK %s to %s", G_OBJECT_TYPE_NAME(child_widget), G_OBJECT_TYPE_NAME(parent) ); */
-    /* don't pack internal child */
-    if( !packing && child_widget && parent && !internal )
-    {
-        if( !gtk_widget_is_ancestor( child_widget, parent ) )
-            gtk_container_add( GTK_CONTAINER(parent), child_widget );
-    }
-}
-
-static void set_widget_accel( GtkWidget* parent, XmlNode* child )
-{
-#if 0
-    const char* key = xml_node_get_prop( child, "key" );
-    const char* mod = xml_node_get_prop( child, "modifiers" );
-    const char* signal = xml_node_get_prop( child, "signal" );
-/*
-    gtk_widget_add_accelerator( widget,
-                    signal,
-                    accel_group,
-                    stock_item.keyval,
-                    stock_item.modifier,
-                    GTK_ACCEL_VISIBLE);
-*/
-#endif
-}
-
-static GType load_type( const char* type_name )
-{
-    char func_name[ 256 ];
-    char* pname = func_name;
-    GType (*func)();
-    GType type = g_type_from_name( type_name );
-    if( type )
-        return type;
-
-    while( *type_name )
-    {
-        *pname = g_ascii_tolower(*type_name);
-        ++pname;
-        ++type_name;
-        if( g_ascii_isupper(*type_name) && !g_ascii_isupper(*(type_name-1)) )
-        {
-            *pname = '_';
-            ++pname;
-        }
-    }
-    strcpy( pname, "_get_type" );
-    if( g_module_symbol( this_mod, func_name, (gpointer*) (gpointer) &func ) )
-        return func();
-    return 0;
-}
-
-static GtkWidget* get_internal_child( GtkWidget* parent, const char* name )
-{
-    if( GTK_IS_DIALOG(parent) )
-    {
-        if( 0 == strcmp(name, "vbox") )
-            return GTK_DIALOG(parent)->vbox;
-        else if( 0 == strcmp(name, "action_area") )
-            return GTK_DIALOG(parent)->action_area;
-        if( G_UNLIKELY( GTK_IS_FONT_SELECTION_DIALOG(parent) ) )
-        {
-            if (0 == strcmp(name, "ok_button"))
-                return GTK_FONT_SELECTION_DIALOG(parent)->ok_button;
-            if (0 == strcmp(name, "cancel_button"))
-                return GTK_FONT_SELECTION_DIALOG(parent)->cancel_button;
-            if (0 == strcmp(name, "apply_button"))
-                return GTK_FONT_SELECTION_DIALOG(parent)->apply_button;
-            if (0 == strcmp(name, "font_selection"))
-                return GTK_FONT_SELECTION_DIALOG(parent)->fontsel;
-        }
-        else if( G_UNLIKELY( GTK_IS_FILE_SELECTION(parent) ) )
-        {
-            if (0 == strcmp(name, "ok_button"))
-                return GTK_FILE_SELECTION(parent)->ok_button;
-            if (0 == strcmp(name, "cancel_button"))
-                return GTK_FILE_SELECTION(parent)->cancel_button;
-            if (0 == strcmp(name, "help_button"))
-                return GTK_FILE_SELECTION(parent)->help_button;
-        }
-        else if( G_UNLIKELY( GTK_IS_COLOR_SELECTION_DIALOG(parent) ) )
-        {
-            if (0 == strcmp(name, "ok_button"))
-                return GTK_COLOR_SELECTION_DIALOG(parent)->ok_button;
-            if (0 == strcmp(name, "cancel_button"))
-                return GTK_COLOR_SELECTION_DIALOG(parent)->cancel_button;
-            if (0 == strcmp(name, "help_button"))
-                return GTK_COLOR_SELECTION_DIALOG(parent)->help_button;
-            if (0 == strcmp(name, "color_selection"))
-                return GTK_COLOR_SELECTION_DIALOG(parent)->colorsel;
-        }
-    }
-    else if( GTK_IS_SCROLLED_WINDOW(parent) )
-    {
-        if( 0 == strcmp(name, "vscrollbar") )
-            return GTK_SCROLLED_WINDOW(parent)->vscrollbar;
-        if( 0 == strcmp(name, "hscrollbar") )
-            return GTK_SCROLLED_WINDOW(parent)->hscrollbar;
-    }
-    else if( GTK_IS_COMBO_BOX_ENTRY(parent) )
-    {
-        if( 0 == strcmp(name, "entry") )
-            return gtk_bin_get_child(GTK_BIN(parent));
-    }
-    parent = gtk_widget_get_parent( parent );
-    return parent ? get_internal_child(parent, name) : NULL;
-}
-
-static int get_n_props( XmlNode* node )
-{
-    int n = 0;
-    GSList* l;
-    for( l = node->children; l; l = l->next )
-    {
-        XmlNode* child_node = (XmlNode*)l->data;
-        if( G_UNLIKELY( !child_node->name ) )
-            continue;
-        if( 0 == strcmp( "property", child_node->name ) )
-            ++n;
-    }
-    return n;
-}
-
-static gboolean delayed_unload_module( gpointer user_data )
-{
-    if( G_LIKELY(this_mod) )
-    {
-        g_module_close( this_mod );
-        this_mod = NULL;
-    }
-    return FALSE;
-}
-
-static gboolean is_id_meaningful( const char* class_name, const char* id )
-{
-    class_name += 3;    /* skip "Gtk" */
-    while( *class_name && *id )
-    {
-        if( g_ascii_tolower( *id ) != g_ascii_tolower( *class_name ) )
-            return TRUE;
-        ++id;
-        ++class_name;
-    }
-    if( ! *id || ! g_ascii_isdigit( *id ) )
-        return TRUE;
-    return FALSE;
-}
-
-static gboolean
-need_remove_from_hash( gpointer key, gpointer val, GtkWidget* widget )
-{
-    return (val == widget);
-}
-
-/* This is inefficient, but it's safer to do this */
-static void remove_widget_from_hash( PtkUIXml* xml, GtkWidget* widget )
-{
-    if( G_LIKELY(xml && xml->hash) )
-        g_hash_table_foreach_remove( xml->hash, (GHRFunc)need_remove_from_hash, widget );
-}
-
-GtkWidget* create_widget( GtkWidget* parent,
-                                 XmlNode* node,
-                                 const char* internal,
-                                 PtkUIXml* xml )
-{
-    GtkWidget* widget = NULL;
-    GSList* l, *special = NULL;
-    char **prop, **val;
-    char* class_name = NULL;
-    char* id = NULL;
-    GType type = 0;
-    gboolean visible = FALSE, has_default = FALSE, has_focus = FALSE;
-
-    if( G_UNLIKELY(!node->name || strcmp(node->name, "widget") ) )
-        return NULL;
-
-    if( G_UNLIKELY(internal) )  /* internal child */
-    {
-        widget = get_internal_child( parent, internal );
-        /* g_debug("INTERNAL: %s, %p", internal, widget);  */
-    }
-
-    if( G_LIKELY( !widget ) )
-    {
-        int n;
-        GParameter* params = NULL;
-        GObjectClass* objcls = NULL;
-
-        for( prop = node->props, val = node->vals; *prop; ++prop, ++val )
-        {
-            if( 0 == strcmp( "class", *prop ) )
-                class_name = *val;
-            else if( 0 == strcmp( "id", *prop ) )
-                id = *val;
-        }
-        /* g_debug("class_name: %s, id=%s", class_name, id); */
-        if( G_UNLIKELY(!class_name) )
-            return NULL;
-        type = load_type( class_name );
-        if( G_UNLIKELY(!type) )
-            return NULL;
-
-        objcls = g_type_class_ref(type);
-
-        if( G_UNLIKELY( ! objcls ) )
-            return NULL;
-
-        n = get_n_props( node );
-        params = g_new0( GParameter, n );
-        for( n = 0, l = node->children; l; l = l->next )
-        {
-            XmlNode* prop_node = (XmlNode*)l->data;
-            const char* prop_name;
-            if( ! prop_node->name || strcmp( prop_node->name, "property" ) )
-                continue;
-            prop_name = get_prop_name( prop_node );
-            if( ! prop_name )
-                continue;
-            if( G_UNLIKELY( strcmp( prop_name, "visible" ) == 0 ) )
-            {
-                visible = TRUE;
-                continue;
-            }
-            else if( G_UNLIKELY( strcmp( prop_name, "has_default" ) == 0 ) )
-            {
-                has_default = TRUE;
-                continue;
-            }
-            else if( G_UNLIKELY( strcmp( prop_name, "has_focus" ) == 0 ) )
-            {
-                has_focus = TRUE;
-                continue;
-            }            if( property_to_gparameter( objcls, prop_name, prop_node, &params[n] ) )
-                ++n;
-            else if( prop_node )
-                special = g_slist_prepend( special, prop_node );
-        }
-        widget = (GtkWidget*)g_object_newv( type, n, params );
-        while( n >=0 )
-        {
-            if( params[n].name )
-                g_value_unset( &params[n].value );
-            --n;
-        }
-        g_type_class_unref( objcls );
-        g_free( params );
-    }
-
-    if( G_UNLIKELY( !widget ) )
-    {
-        g_slist_free( special );
-        return NULL;
-    }
-
-    if( G_UNLIKELY( parent == NULL && ! xml->top_level ) )
-        xml->top_level = widget;
-
-    /* NOTE: Here is a little trick.
-     * is_id_meaningful() will check if the id is an meaningless id
-     *  automaitcally generated by glade.
-     *  meaningless names such as labal1, label2,...etc. will not be added.
-     */
-    if( G_LIKELY( id ) && G_UNLIKELY( is_id_meaningful(class_name, id) ) )
-    {
-        g_hash_table_insert( xml->hash, g_strdup(id), widget );
-        g_object_weak_ref( G_OBJECT(widget), (GWeakNotify)remove_widget_from_hash, xml);
-    }
-
-    /* create a simple text model for combo boxes */
-    if( GTK_IS_COMBO_BOX(widget))
-        init_combo_box( (GtkComboBox*)widget );
-
-    if( special )
-    {
-        set_widget_special_property( widget, special, xml );
-        g_slist_free( special );
-    }
-
-    for( l = node->children; l; l = l->next )
-    {
-        XmlNode* child_node = (XmlNode*)l->data;
-        if( G_UNLIKELY( ! child_node->name ) )
-            continue;
-        if( 0 == strcmp( "child", child_node->name ) )
-            load_child_widget( widget, child_node, xml );
-        else if( 0 == strcmp( "accelerator", child_node->name ) )
-            set_widget_accel( widget, child_node );
-    }
-
-    if( visible )
-        gtk_widget_show( widget );
-    if( has_default )
-        xml->def = widget;
-    if( has_focus )
-        xml->focus = widget;
-    return widget;
-}
-
-GtkWidget* ptk_ui_xml_create_widget( XmlNode* tree )
-{
-    GSList* l;
-    GtkWidget* widget;
-
-    if( !tree->children )
-        return NULL;
-
-    tree = (XmlNode*)tree->children->data;
-
-    if( !tree->children )
-        return NULL;
-
-    if( !tree->name || strcmp(tree->name, "glade-interface") )
-        return NULL;
-
-    if( G_LIKELY( ! this_mod ) )    /* load our own module for symbol lookup if it's not loaded */
-        this_mod = g_module_open( NULL, 0 );
-
-    widget = NULL;
-    for( l = tree->children; l; l = l->next )
-    {
-        XmlNode* node = (XmlNode*)l->data;
-        if( node->name && 0 == strcmp("widget", node->name) )
-        {
-            PtkUIXml* xml = ptk_ui_xml_new();
-            widget = create_widget( NULL, node, NULL, xml );
-
-            if( G_LIKELY(widget) )
-            {
-                ptk_ui_xml_ref( xml );
-                g_object_set_qdata_full( (GObject*)widget, ptk_ui_xml_id,
-                                     xml, (GDestroyNotify)ptk_ui_xml_unref );
-                if( xml->def )
-                    gtk_widget_grab_default( xml->def );
-                if( xml->focus )
-                    gtk_widget_grab_focus( xml->focus );
-            }
-            ptk_ui_xml_unref( xml );
-        }
-    }
-
-    /* Unload the module in idle handler. So if several widgets need to be created,
-        at the same time, we don't have to load/unload modules repeatedly. */
-    g_idle_add_full( G_PRIORITY_LOW, (GSourceFunc)delayed_unload_module, NULL, NULL );
-
-    return widget;
-}
-
-GtkWidget* ptk_ui_xml_create_widget_from_file( const char* file )
-{
-    XmlNode *tree;
-    GtkWidget* widget = NULL;
-
-    tree = xml_tree_load( file );
-   
-    if( G_LIKELY(tree) )
-    {
-        widget = ptk_ui_xml_create_widget( tree );
-        xml_tree_free( tree );
-    }
-    return widget;
-}
-
-PtkUIXml* ptk_ui_xml_new()
-{
-    PtkUIXml* xml = g_slice_new0( PtkUIXml );
-    xml->hash = g_hash_table_new_full( g_str_hash,
-                                       g_str_equal,
-                                       g_free, NULL );
-    xml->n_ref = 1;
-
-    if( G_UNLIKELY( ptk_ui_xml_id == 0) )
-        ptk_ui_xml_id = g_quark_from_static_string("ptk_ui_xml_id");
-    return xml;
-}
-
-void ptk_ui_xml_free( PtkUIXml* xml )
-{
-    g_hash_table_destroy( xml->hash );
-    if( xml->tips )
-        g_object_unref( xml->tips );
-    g_slice_free( PtkUIXml, xml );
-    /* g_debug("ptk_ui_XML_FREE"); */
-}
-
-PtkUIXml* ptk_ui_xml_get( GtkWidget* widget )
-{
-    return (PtkUIXml*)g_object_get_qdata( (GObject*)widget,
-                                          ptk_ui_xml_id );
-}
-
-void ptk_ui_xml_ref( PtkUIXml* xml )
-{
-    g_atomic_int_inc( (gint *) &xml->n_ref );
-}
-
-void ptk_ui_xml_unref( PtkUIXml* xml )
-{
-    if( g_atomic_int_dec_and_test( (gint *) &xml->n_ref) )
-        ptk_ui_xml_free( xml );
-}
-
-GtkWidget* ptk_ui_xml_lookup( PtkUIXml* xml,
-                              const char* name )
-{
-    return GTK_WIDGET( g_hash_table_lookup( xml->hash, name ) );
-}
-
-GtkWidget* ptk_ui_xml_get_widget( GtkWidget* top_widget,
-                                     const char* name )
-{
-    PtkUIXml* xml = ptk_ui_xml_get( top_widget );
-    if( !xml )
-        return NULL;
-    return GTK_WIDGET( g_hash_table_lookup( xml->hash, name ) );
-}
-
diff --git a/src/ptk-ui-xml/ptk-ui-xml.h b/src/ptk-ui-xml/ptk-ui-xml.h
deleted file mode 100644 (file)
index 56ba1a8..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *      ptk-ui-xml.h -Lightweight parser for *.glade
- *
- *      Copyright 2008 PCMan <pcman.tw@gmail.com>
- *
- *      This program is free software; you can redistribute it and/or modify
- *      it under the terms of the GNU General Public License as published by
- *      the Free Software Foundation; either version 2 of the License, or
- *      (at your option) any later version.
- *
- *      This program is distributed in the hope that it will be useful,
- *      but WITHOUT ANY WARRANTY; without even the implied warranty of
- *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *      GNU General Public License for more details.
- *
- *      You should have received a copy of the GNU General Public License
- *      along with this program; if not, write to the Free Software
- *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- *      MA 02110-1301, USA.
- */
-
-#ifndef _PTK_UI_XML_H_
-#define _PTK_UI_XML_H_
-
-#include <gtk/gtk.h>
-#include "ptk-xml-tree.h"
-
-G_BEGIN_DECLS
-
-typedef struct _PtkUIXml PtkUIXml;
-
-GtkWidget* ptk_ui_xml_create_widget( XmlNode* tree );
-GtkWidget* ptk_ui_xml_create_widget_from_file( const char* file );
-
-GtkWidget* ptk_ui_xml_get_widget( GtkWidget* top_widget, const char* name );
-
-PtkUIXml* ptk_ui_xml_get( GtkWidget* widget );
-PtkUIXml* ptk_ui_xml_destroy( PtkUIXml*xml );
-
-void ptk_ui_xml_ref( PtkUIXml* xml );
-void ptk_ui_xml_unref( PtkUIXml* xml );
-
-GtkWidget* ptk_ui_xml_lookup( PtkUIXml* xml,
-                              const char* name );
-
-
-G_END_DECLS
-
-#endif
diff --git a/src/ptk-ui-xml/ptk-xml-tree.c b/src/ptk-ui-xml/ptk-xml-tree.c
deleted file mode 100644 (file)
index f1165a9..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *      ptk-xml-tree.h - Over-simplified mini xml dom implementation
- *
- *      Copyright 2008 PCMan <pcman.tw@gmail.com>
- *
- *      This program is free software; you can redistribute it and/or modify
- *      it under the terms of the GNU General Public License as published by
- *      the Free Software Foundation; either version 2 of the License, or
- *      (at your option) any later version.
- *
- *      This program is distributed in the hope that it will be useful,
- *      but WITHOUT ANY WARRANTY; without even the implied warranty of
- *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *      GNU General Public License for more details.
- *
- *      You should have received a copy of the GNU General Public License
- *      along with this program; if not, write to the Free Software
- *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- *      MA 02110-1301, USA.
- */
-
-#include <string.h>
-#include "ptk-xml-tree.h"
-#include "glib-mem.h"
-
-typedef struct _ParseInfo ParseInfo;
-
-struct _ParseInfo
-{
-    XmlNode* tree;
-    GArray* parse_stack;
-};
-
-#define xml_node_new()    g_slice_new0(XmlNode);
-
-static void start_element( GMarkupParseContext *context,
-                    const gchar *element_name,
-                    const gchar **attribute_names,
-                    const gchar **attribute_values,
-                    gpointer user_data,
-                    GError **error )
-{
-    ParseInfo* info = (ParseInfo*)user_data;
-    XmlNode *cur_node, *parent;
-    if( info->parse_stack->len > 0 ) {
-        parent = g_array_index( info->parse_stack,
-                                XmlNode*,
-                                info->parse_stack->len - 1 );
-    } else {
-        parent = NULL;
-    }
-    cur_node = xml_node_new();
-    cur_node->name = g_strdup( element_name );
-    cur_node->props = g_strdupv( (gchar**)attribute_names );
-    cur_node->vals = g_strdupv( (gchar**)attribute_values );
-    if( parent )
-    {
-        cur_node->parent = parent;
-        parent->children = g_slist_prepend( parent->children, cur_node );
-    }
-    /* push current node to the stack */
-    g_array_append_val( info->parse_stack, cur_node );
-}
-
-static void end_element( GMarkupParseContext *context,
-                  const gchar *element_name,
-                  gpointer user_data,
-                  GError **error )
-{
-    ParseInfo* info = (ParseInfo*)user_data;
-    int i = info->parse_stack->len - 1;
-    XmlNode* cur_node = g_array_index( info->parse_stack,
-                                       XmlNode*, i );
-
-    if( cur_node->cdata )
-    {
-        GString* str = (GString*)cur_node->cdata;
-        cur_node->cdata = g_strdup( str->str );
-        g_string_free( str, TRUE );
-    }
-
-    if( cur_node->children )
-        cur_node->children = g_slist_reverse( cur_node->children );
-
-    /* begin tag is different from end tag, error! */
-    if( strcmp( cur_node->name, element_name ) )
-    {
-        g_markup_parse_context_end_parse( context, NULL );
-        return;
-    }
-
-    /* pop current node from the stack */
-    g_array_remove_index( info->parse_stack, i );
-}
-
-static void cdata( GMarkupParseContext *context,
-            const gchar *text,
-            gsize text_len,
-            gpointer user_data,
-            GError **error )
-{
-    ParseInfo* info = (ParseInfo*)user_data;
-    GString* str;
-    XmlNode* cur_node = g_array_index( info->parse_stack,
-                                       XmlNode*,
-                                       info->parse_stack->len - 1 );
-    if( !cur_node->cdata )
-    {
-        str = g_string_sized_new(256);
-        cur_node->cdata = (char*)str;
-    }
-    else
-        str = (GString*)cur_node->cdata;
-    g_string_append_len( str, text, text_len );
-}
-
-static void parse_error( GMarkupParseContext *context,
-                  GError *error, gpointer user_data )
-{
-    ParseInfo* info = (ParseInfo*)user_data;
-    XmlNode* cur_node = g_array_index( info->parse_stack,
-                                       XmlNode*,
-                                       info->parse_stack->len - 1 );
-    if( cur_node->cdata )
-    {
-        GString* str = (GString*)cur_node->cdata;
-        g_string_free( str, TRUE );
-        cur_node->cdata = NULL;
-    }
-    g_markup_parse_context_end_parse( context, NULL );
-}
-
-static GMarkupParser parser =
-    {
-        start_element,
-        end_element,
-        cdata,
-        NULL,
-        parse_error
-    };
-
-XmlNode* xml_tree_load( const char* filename )
-{
-    gsize data_len;
-    char* data;
-
-    if ( g_file_get_contents( filename, &data, &data_len, NULL ) )
-    {
-        GMarkupParseContext * ctx;
-        ParseInfo info;
-        info.tree = xml_node_new();
-        info.parse_stack = g_array_sized_new(FALSE, TRUE, sizeof(XmlNode*), 32);
-        g_array_append_val( info.parse_stack, info.tree );
-        ctx = g_markup_parse_context_new( &parser,
-                                          (GMarkupParseFlags)0,
-                                          &info, NULL );
-        if( !g_markup_parse_context_parse( ctx, data, data_len, NULL ) )
-        {
-            xml_tree_free( info.tree );
-            info.tree = NULL;
-        }
-        g_markup_parse_context_free( ctx );
-        g_array_free( info.parse_stack, TRUE );
-        return info.tree;
-    }
-    return NULL;
-}
-
-void xml_node_free( XmlNode* node )
-{
-    GSList* l;
-    XmlNode* child;
-
-    if( node->children )
-    {
-        for( l = node->children; l; l = l->next )
-        {
-            child = (XmlNode*)l->data;
-            /* break the linkage between parent and child,
-                or subsequent recursive call to xml_node_free on
-                the child node will try to remove it from the parent again. */
-            child->parent = NULL;
-            xml_node_free( child );
-        }
-        g_slist_free( node->children );
-    }
-
-    /* delete the child node from its parent, ifneeded */
-    if( G_LIKELY( node->parent && node->parent->children) )
-        node->parent->children = g_slist_remove( node->parent->children, node );
-
-    g_free( node->name );
-    g_free( node->cdata );
-    g_strfreev( node->props );
-    g_strfreev( node->vals );
-    g_slice_free( XmlNode, node );
-}
-
-const char* xml_node_get_prop( XmlNode* node, const char* name )
-{
-    char **prop, **val;
-    for( prop = node->props, val = node->vals; *prop; ++prop, ++val )
-    {
-        if( *prop && 0 == strcmp(name, *prop) )
-            return *val;
-    }
-    return NULL;
-}
diff --git a/src/ptk-ui-xml/ptk-xml-tree.h b/src/ptk-ui-xml/ptk-xml-tree.h
deleted file mode 100644 (file)
index a1dea54..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *      ptk-xml-tree.h - Over-simplified mini xml dom implementation
- *
- *      Copyright 2008 PCMan <pcman.tw@gmail.com>
- *
- *      This program is free software; you can redistribute it and/or modify
- *      it under the terms of the GNU General Public License as published by
- *      the Free Software Foundation; either version 2 of the License, or
- *      (at your option) any later version.
- *
- *      This program is distributed in the hope that it will be useful,
- *      but WITHOUT ANY WARRANTY; without even the implied warranty of
- *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *      GNU General Public License for more details.
- *
- *      You should have received a copy of the GNU General Public License
- *      along with this program; if not, write to the Free Software
- *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- *      MA 02110-1301, USA.
- */
-
-#ifndef _PTK_XML_TREE_H_
-#define _PTK_XML_TREE_H_
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-typedef struct _XmlNode XmlNode;
-struct _XmlNode
-{
-    char* name;
-    char** props;
-    char** vals;
-    char* cdata;
-    XmlNode* parent;
-    GSList* children;
-};
-
-XmlNode* xml_tree_load( const char* filename );
-/*
-XmlNode* xml_node_get_from_path( XmlNode* tree, const char* path );
-GSList* xml_node_get_elements_by_name( XmlNode* node, const char* tag_name );
-*/
-
-void xml_node_free( XmlNode* tree );
-#define xml_tree_free( tree )   xml_node_free( tree )
-const char* xml_node_get_tag_name( XmlNode* node );
-const char* xml_node_get_prop( XmlNode* node, const char* name );
-
-G_END_DECLS
-
-#endif
diff --git a/src/xml-purge.c b/src/xml-purge.c
new file mode 100644 (file)
index 0000000..411cd88
--- /dev/null
@@ -0,0 +1,123 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#define IS_BLANK(ch)   strchr(" \t\n\r", ch)
+
+static void purge_file( const char* file )
+{
+       struct stat statbuf;
+       int fd;
+       char* buf, *pbuf;
+       int in_tag = 0, in_quote = 0;
+       FILE* fo;
+
+       fd = open( file, O_RDONLY );
+       if( fd == -1 )
+               return;
+
+       if( fstat( fd, &statbuf) == -1 )
+               return;
+
+       if( buf = (char*)malloc( statbuf.st_size + 1 ) )
+       {
+               if( read( fd, buf, statbuf.st_size) == -1 )
+               {
+                       free( buf );
+                       return;
+               }
+               buf[ statbuf.st_size ] = '\0';
+       }
+       close( fd );
+
+       fo = fopen( file, "w" );
+       if( ! fo )
+               goto error;
+
+       for( pbuf = buf; *pbuf; ++pbuf )
+       {
+               if( in_tag > 0 )
+               {
+                       if( in_quote )
+                       {
+                               if( *pbuf == '\"' )
+                                       in_quote = 0;
+                       }
+                       else
+                       {
+                               if( *pbuf == '\"' )
+                                       ++in_quote;
+                               if( ! in_quote && IS_BLANK(*pbuf) )     /* skip unnecessary blanks */
+                               {
+                                       do{
+                                               ++pbuf;
+                                       }while( IS_BLANK( *pbuf ) );
+
+                                       if( *pbuf != '>' )
+                                               fputc( ' ', fo );
+                                       --pbuf;
+                                       continue;
+                               }
+                       }
+                       if( *pbuf == '>' )
+                               --in_tag;
+                       fputc( *pbuf, fo );
+               }
+               else
+               {
+                       if( *pbuf == '<' )
+                       {
+                               if( 0 == strncmp( pbuf, "<!--", 4 ) )   /* skip comments */
+                               {
+                                       pbuf = strstr( pbuf, "-->" );
+                                       if( ! pbuf )
+                                               goto error;
+                                       pbuf += 2;
+                                       continue;
+                               }
+                               ++in_tag;
+                               fputc( '<', fo );
+                       }
+                       else
+                       {
+                               char* tmp = pbuf;
+                               while( *tmp && IS_BLANK( *tmp ) && *tmp != '<' )
+                                       ++tmp;
+                               if( *tmp == '<' )       /* all cdata are blank characters */
+                                       pbuf = tmp - 1;
+                               else /* not blank, keep the cdata */
+                               {
+                                       if( tmp == pbuf )
+                                               fputc( *pbuf, fo );
+                                       else
+                                       {
+                                               fwrite( pbuf, 1, tmp - pbuf, fo );
+                                               pbuf = tmp - 1;
+                                       }
+                               }
+                       }
+               }
+       }
+       
+       fclose( fo );
+
+error:
+       free( buf );
+}
+
+int main( int argc, char** argv )
+{
+       int i;
+       if( argc < 2 )
+               return 1;
+
+       for( i = 1; i < argc; ++i )
+               purge_file( argv[ i] );
+
+       return 0;
+}