[Libreoffice-commits] core.git: extras/CustomTarget_glade.mk extras/Module_extras.mk extras/Package_glade.mk extras/source

Mathias Hasselmann mathias at openismus.com
Thu Mar 14 06:47:01 PDT 2013


 extras/CustomTarget_glade.mk                   |   26 +++++
 extras/Module_extras.mk                        |    1 
 extras/Package_glade.mk                        |    2 
 extras/source/glade/libreoffice-catalog.xml    |  124 -------------------------
 extras/source/glade/libreoffice-catalog.xml.in |  124 +++++++++++++++++++++++++
 extras/source/glade/makewidgetgroup.xslt       |   50 ++++++++++
 6 files changed, 202 insertions(+), 125 deletions(-)

New commits:
commit 0f972e94a2fcbc6b227a2ae7b5d435438f6dbdc1
Author: Mathias Hasselmann <mathias at openismus.com>
Date:   Thu Mar 14 12:54:17 2013 +0100

    Show LibreOffice controls in Glade's tool palette
    
    Glade didn't show any LibreOffice controls in its tool palette
    because the catalog didn't have any glade-widget-group element.
    This adds a XSLT script to automatically generate such element.
    
    A better version of the script would create separate groups for
    each module/namespace, but currently I have no idea how to do
    this with libxslt, as it doesn't provide fn::distinct-values().
    
    Change-Id: Iaa3e4b0471b58c48838e000e6d78a73b0c6a4bd3
    Reviewed-on: https://gerrit.libreoffice.org/2724
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/extras/CustomTarget_glade.mk b/extras/CustomTarget_glade.mk
new file mode 100644
index 0000000..89d452e
--- /dev/null
+++ b/extras/CustomTarget_glade.mk
@@ -0,0 +1,26 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,extras/glade))
+
+#
+# Rules
+#
+
+$(call gb_CustomTarget_get_workdir,extras/source/glade)/libreoffice-catalog.xml : \
+        $(SRCDIR)/extras/source/glade/libreoffice-catalog.xml.in \
+        $(SRCDIR)/extras/source/glade/makewidgetgroup.xslt \
+        | $(call gb_ExternalExecutable_get_dependencies,xsltproc)
+	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSLT,4)
+	$(call gb_Helper_abbreviate_dirs, \
+	$(call gb_ExternalExecutable_get_command,xsltproc) --nonet \
+		-o $@ $(SRCDIR)/extras/source/glade/makewidgetgroup.xslt $< \
+	)
+
+# vim: set noet sw=4 ts=4:
diff --git a/extras/Module_extras.mk b/extras/Module_extras.mk
index 7144265..c3cb14b 100644
--- a/extras/Module_extras.mk
+++ b/extras/Module_extras.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_Module_Module,extras))
 $(eval $(call gb_Module_add_targets,extras,\
 	AllLangZip_autotextshare \
 	CustomTarget_autocorr \
+	CustomTarget_glade \
 	Package_fonts \
 	Package_glade \
 	Package_labels \
diff --git a/extras/Package_glade.mk b/extras/Package_glade.mk
index 9621aa9..1ac1f69 100644
--- a/extras/Package_glade.mk
+++ b/extras/Package_glade.mk
@@ -7,7 +7,7 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_Package_Package,extras_glade,$(SRCDIR)/extras/source/glade))
+$(eval $(call gb_Package_Package,extras_glade,$(call gb_CustomTarget_get_workdir,extras/source/glade)))
 
 $(eval $(call gb_Package_add_file,extras_glade,pck/libreoffice-catalog.xml,libreoffice-catalog.xml))
 
diff --git a/extras/source/glade/libreoffice-catalog.xml b/extras/source/glade/libreoffice-catalog.xml
deleted file mode 100644
index 435449c..0000000
--- a/extras/source/glade/libreoffice-catalog.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
--->
-<!--
- * To get glade to use this, put this .xml into a dir e.g. ~/glade
- * and
- * export GLADE_CATALOG_SEARCH_PATH=~/glade
- * for system-wide installation copy into /usr/share/glade/catalogs/
--->
-<glade-catalog name="LibreOffice" domain="glade-3" depends="gtk+" version="1.0">
-  <glade-widget-classes>
-    <glade-widget-class title="Thesaurus View" name="cuilo-ThesaurusAlternativesCtrl"
-                        generic-name="ThesaurusAlternativesCtrl" parent="GtkTextView"
-                        icon-name="widget-gtk-textview"/>
-    <glade-widget-class title="Thesaurus Edit" name="cuilo-ReplaceEdit"
-                        generic-name="ReplaceEdit" parent="GtkEntry"
-                        icon-name="widget-gtk-textentry"/>
-    <glade-widget-class title="Thesaurus Lookup" name="cuilo-LookUpComboBox"
-                        generic-name="LookUpComboBox" parent="GtkEntry"
-                        icon-name="widget-gtk-comboboxtext"/>
-    <glade-widget-class title="Hyphen Edit" name="cuilo-HyphenEdit"
-                        generic-name="ReplaceEdit" parent="GtkEntry"
-                        icon-name="widget-gtk-textentry"/>
-    <glade-widget-class title="Color ListBox" name="svtlo-ColorListBox"
-                        generic-name="LookUpComboBox" parent="GtkComboBox"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Font Name ListBox" name="svtlo-FontNameBox"
-                        generic-name="Font name ListBox" parent="GtkComboBox"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Font Size ListBox" name="svtlo-FontSizeBox"
-                        generic-name="Font Size ListBox" parent="GtkComboBox"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Line ListBox" name="svtlo-LineListBox"
-                        generic-name="Line ListBox" parent="GtkComboBox"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Language ListBox" name="svxcorelo-SvxLanguageBox"
-                        generic-name="LanguageBox" parent="GtkComboBox"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Font ListBox" name="svtlo-FontStyleBox"
-                        generic-name="FontStyleBox" parent="GtkComboBox"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Text Encoding ListBox" name="svxlo-SvxTextEncodingBox"
-                        generic-name="TextEncodingBox" parent="GtkComboBox"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Limit ListBox" name="dbulo-LimitBox"
-                        generic-name="LimitBox" parent="GtkComboBox"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Font Preview" name="svxlo-SvxFontPrevWindow"
-                        generic-name="Font Preview Window" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="Frame Selector" name="svxlo-SvxFrameSelector"
-                        generic-name="Frame Border Preview Window" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="ValueSet" name="svtlo-ValueSet"
-                        generic-name="Set of Value Options" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="ValueSet" name="swuilo-ColumnValueSet"
-                        generic-name="Set of Value Options" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="CsvTableBox" name="sclo-ScCsvTableBox"
-                        generic-name="CSV Table Box" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="Table Container" name="svxcorelo-SvxSimpleTableContainer"
-                        generic-name="Simple Table Container" parent="GtkTreeView"
-                        icon-name="widget-gtk-treeview"/>
-    <glade-widget-class title="Page Preview" name="svxlo-SvxPageWindow"
-                        generic-name="Page Preview Window" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="Page Preview" name="swlo-SwColExample"
-                        generic-name="Page Preview Window" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="Page Preview" name="swlo-SwColumnOnlyExample"
-                        generic-name="Page Preview Window" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="Table Preview" name="swuilo-AutoFmtPreview"
-                        generic-name="Table Preview Window" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="Text Direction ListBox" name="svxlo-FrameDirectionListBox"
-                        generic-name="FrameDirectionListBox" parent="GtkComboBox"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Bookmark Combo" name="swuilo-BookmarkCombo"
-                        generic-name="BookmarkComboBox" parent="GtkTreeView"
-                        icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Category Edit" name="swuilo-FEdit"
-                        generic-name="CategoryEdit" parent="GtkEntry"
-                        icon-name="widget-gtk-textentry"/>
-    <glade-widget-class title="Glossary List" name="swuilo-SwGlossaryGroupTLB"
-                        generic-name="Glossary List" parent="GtkTreeView"
-                        icon-name="widget-gtk-treeview"/>
-
-    <glade-widget-class title="VclComboBoxText" name="VclComboBoxText"
-                        generic-name="ComboBoxText" parent="GtkComboBoxText"
-                        icon-name="widget-gtk-comboboxtext">
-      <properties>
-        <property save="True" query="False" id="max-width-chars" default="-1" name="Maximum Width in Characters">
-          <parameter-spec>
-            <type>GParamInt</type>
-            <min>-1</min>
-          </parameter-spec>
-          <tooltip>The desired maximum width of the ComboBox, in characters</tooltip>
-        </property>
-      </properties>
-    </glade-widget-class>
-
-    <glade-widget-class title="VclComboBoxNumeric" name="VclComboBoxNumeric"
-                        generic-name="ComboBoxNumeric" parent="VclComboBoxText"
-                        icon-name="widget-gtk-comboboxtext"/>
-
-    <glade-widget-class title="Reference Button" name="foruilo-RefButton"
-                        generic-name="Reference Button" parent="GtkButton"
-                        icon-name="widget-gtk-button"/>
-
-    <glade-widget-class title="Reference Edit" name="foruilo-RefEdit"
-                        generic-name="Reference Edit" parent="GtkEntry"
-                        icon-name="widget-gtk-textentry"/>
-
-  </glade-widget-classes>
-</glade-catalog>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
new file mode 100644
index 0000000..435449c
--- /dev/null
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+<!--
+ * To get glade to use this, put this .xml into a dir e.g. ~/glade
+ * and
+ * export GLADE_CATALOG_SEARCH_PATH=~/glade
+ * for system-wide installation copy into /usr/share/glade/catalogs/
+-->
+<glade-catalog name="LibreOffice" domain="glade-3" depends="gtk+" version="1.0">
+  <glade-widget-classes>
+    <glade-widget-class title="Thesaurus View" name="cuilo-ThesaurusAlternativesCtrl"
+                        generic-name="ThesaurusAlternativesCtrl" parent="GtkTextView"
+                        icon-name="widget-gtk-textview"/>
+    <glade-widget-class title="Thesaurus Edit" name="cuilo-ReplaceEdit"
+                        generic-name="ReplaceEdit" parent="GtkEntry"
+                        icon-name="widget-gtk-textentry"/>
+    <glade-widget-class title="Thesaurus Lookup" name="cuilo-LookUpComboBox"
+                        generic-name="LookUpComboBox" parent="GtkEntry"
+                        icon-name="widget-gtk-comboboxtext"/>
+    <glade-widget-class title="Hyphen Edit" name="cuilo-HyphenEdit"
+                        generic-name="ReplaceEdit" parent="GtkEntry"
+                        icon-name="widget-gtk-textentry"/>
+    <glade-widget-class title="Color ListBox" name="svtlo-ColorListBox"
+                        generic-name="LookUpComboBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Font Name ListBox" name="svtlo-FontNameBox"
+                        generic-name="Font name ListBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Font Size ListBox" name="svtlo-FontSizeBox"
+                        generic-name="Font Size ListBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Line ListBox" name="svtlo-LineListBox"
+                        generic-name="Line ListBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Language ListBox" name="svxcorelo-SvxLanguageBox"
+                        generic-name="LanguageBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Font ListBox" name="svtlo-FontStyleBox"
+                        generic-name="FontStyleBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Text Encoding ListBox" name="svxlo-SvxTextEncodingBox"
+                        generic-name="TextEncodingBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Limit ListBox" name="dbulo-LimitBox"
+                        generic-name="LimitBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Font Preview" name="svxlo-SvxFontPrevWindow"
+                        generic-name="Font Preview Window" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Frame Selector" name="svxlo-SvxFrameSelector"
+                        generic-name="Frame Border Preview Window" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="ValueSet" name="svtlo-ValueSet"
+                        generic-name="Set of Value Options" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="ValueSet" name="swuilo-ColumnValueSet"
+                        generic-name="Set of Value Options" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="CsvTableBox" name="sclo-ScCsvTableBox"
+                        generic-name="CSV Table Box" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Table Container" name="svxcorelo-SvxSimpleTableContainer"
+                        generic-name="Simple Table Container" parent="GtkTreeView"
+                        icon-name="widget-gtk-treeview"/>
+    <glade-widget-class title="Page Preview" name="svxlo-SvxPageWindow"
+                        generic-name="Page Preview Window" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Page Preview" name="swlo-SwColExample"
+                        generic-name="Page Preview Window" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Page Preview" name="swlo-SwColumnOnlyExample"
+                        generic-name="Page Preview Window" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Table Preview" name="swuilo-AutoFmtPreview"
+                        generic-name="Table Preview Window" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Text Direction ListBox" name="svxlo-FrameDirectionListBox"
+                        generic-name="FrameDirectionListBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Bookmark Combo" name="swuilo-BookmarkCombo"
+                        generic-name="BookmarkComboBox" parent="GtkTreeView"
+                        icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Category Edit" name="swuilo-FEdit"
+                        generic-name="CategoryEdit" parent="GtkEntry"
+                        icon-name="widget-gtk-textentry"/>
+    <glade-widget-class title="Glossary List" name="swuilo-SwGlossaryGroupTLB"
+                        generic-name="Glossary List" parent="GtkTreeView"
+                        icon-name="widget-gtk-treeview"/>
+
+    <glade-widget-class title="VclComboBoxText" name="VclComboBoxText"
+                        generic-name="ComboBoxText" parent="GtkComboBoxText"
+                        icon-name="widget-gtk-comboboxtext">
+      <properties>
+        <property save="True" query="False" id="max-width-chars" default="-1" name="Maximum Width in Characters">
+          <parameter-spec>
+            <type>GParamInt</type>
+            <min>-1</min>
+          </parameter-spec>
+          <tooltip>The desired maximum width of the ComboBox, in characters</tooltip>
+        </property>
+      </properties>
+    </glade-widget-class>
+
+    <glade-widget-class title="VclComboBoxNumeric" name="VclComboBoxNumeric"
+                        generic-name="ComboBoxNumeric" parent="VclComboBoxText"
+                        icon-name="widget-gtk-comboboxtext"/>
+
+    <glade-widget-class title="Reference Button" name="foruilo-RefButton"
+                        generic-name="Reference Button" parent="GtkButton"
+                        icon-name="widget-gtk-button"/>
+
+    <glade-widget-class title="Reference Edit" name="foruilo-RefEdit"
+                        generic-name="Reference Edit" parent="GtkEntry"
+                        icon-name="widget-gtk-textentry"/>
+
+  </glade-widget-classes>
+</glade-catalog>
diff --git a/extras/source/glade/makewidgetgroup.xslt b/extras/source/glade/makewidgetgroup.xslt
new file mode 100644
index 0000000..c7d97d7
--- /dev/null
+++ b/extras/source/glade/makewidgetgroup.xslt
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
+
+  <!-- work arround apparently broken output indenting in libxslt -->
+  <xsl:param name="indent" select="'  '"/>
+
+  <xsl:template match="/glade-catalog">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+
+      <xsl:text>
</xsl:text>
+      <xsl:value-of select="$indent"/>
+      <glade-widget-group name="libreoffice" title="LibreOffice">
+      <xsl:text>
</xsl:text>
+
+        <xsl:for-each select="//glade-widget-class">
+          <xsl:value-of select="concat($indent,$indent)"/>
+          <glade-widget-class-ref name="{@name}"/>
+          <xsl:text>
</xsl:text>
+        </xsl:for-each>
+
+      <xsl:value-of select="$indent"/>
+      </glade-widget-group>
+      <xsl:text>
</xsl:text>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>


More information about the Libreoffice-commits mailing list