[gtksourceview] Completion: use GResource for the XML UI description



commit c6d76ed0481789e114a8d6e719d595d0f6e50e6f
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Mon Apr 23 23:37:42 2012 +0200

    Completion: use GResource for the XML UI description
    
    There were two translatable strings in the UI description that were not
    extracted into the PO files.
    
    GTK+ 3.4 is required, as well as GIO 2.32.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674643

 configure.ac                              |    5 +-
 gtksourceview/Makefile.am                 |    8 +-
 gtksourceview/gtksourcecompletion.c       |    8 +-
 gtksourceview/gtksourcecompletion.ui      |  157 ++++++++++++++++++++++++++++
 gtksourceview/gtksourcecompletionui.h     |  162 -----------------------------
 gtksourceview/gtksourceview.gresource.xml |    6 +
 po/POTFILES.in                            |    1 +
 7 files changed, 176 insertions(+), 171 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7e422a0..3aa408b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,7 +30,7 @@ LT_INIT([disable-static])
 AC_CHECK_HEADERS([unistd.h])
 
 # Dependencies
-GTK_REQUIRED_VERSION=3.3.8
+GTK_REQUIRED_VERSION=3.4.0
 LIBXML_REQUIRED_VERSION=2.6.0
 GLADE_UI_REQUIRED=3.9
 
@@ -41,6 +41,7 @@ AC_SUBST(LIBXML_REQUIRED_VERSION)
 # Pull glib-genmarshal & co.
 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
+AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
 
 # Compile warnings
 GNOME_COMPILE_WARNINGS([maximum])
@@ -69,7 +70,7 @@ if test "$enable_deprecations" = "yes"; then
 fi
 
 PKG_CHECK_MODULES(DEP, [
-	gio-2.0 >= 2.28.0
+	gio-2.0 >= 2.32.0
 	gtk+-3.0 >= $GTK_REQUIRED_VERSION
 	libxml-2.0 >= $LIBXML_REQUIRED_VERSION
 ])
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index a882200..2d015ea 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -14,6 +14,7 @@ INCLUDES = 				\
 BUILT_SOURCES = 			\
 	gtksourceview-marshal.c 	\
 	gtksourceview-marshal.h		\
+	gtksourceview-resources.c	\
 	gtksourceview-typebuiltins.c	\
 	gtksourceview-typebuiltins.h
 
@@ -47,7 +48,6 @@ libgtksourceview_headers =			\
 NOINST_H_FILES = \
 	gtksourcecompletionmodel.h		\
 	gtksourcecompletion-private.h		\
-	gtksourcecompletionui.h			\
 	gtksourcecompletionutils.h		\
 	gtksourcecontextengine.h		\
 	gtksourceengine.h			\
@@ -128,6 +128,9 @@ gtksourceview-marshal.c: gtksourceview-marshal.list $(GLIB_GENMARSHAL)
 	$(AM_V_GEN) echo "#include \"gtksourceview-marshal.h\"" > $@ && \
 	$(GLIB_GENMARSHAL) $< --body --prefix=_gtksourceview_marshal >> $@
 
+gtksourceview-resources.c: gtksourceview.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies $(srcdir)/gtksourceview.gresource.xml)
+	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $(srcdir)/gtksourceview.gresource.xml
+
 gtksourceview-typebuiltins.c: stamp-gtksourceview-typebuiltins.c
 	@true
 stamp-gtksourceview-typebuiltins.c: Makefile.am $(libgtksourceview_headers)
@@ -170,7 +173,8 @@ stamp-gtksourceview-typebuiltins.h: Makefile.am $(libgtksourceview_headers)
 	&& rm -f xgen-gth && echo stamp > $(@F)
 
 EXTRA_DIST = 					\
-	gtksourceview-marshal.list
+	gtksourceview-marshal.list		\
+	gtksourceview.gresource.xml
 
 CLEANFILES = 					\
 	$(BUILT_SOURCES)			\
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index cd0c695..863775d 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -37,7 +37,6 @@
 #include <gtksourceview/gtksourceview.h>
 #include "gtksourcecompletion-private.h"
 #include "gtksourcecompletioncontext.h"
-#include "gtksourcecompletionui.h"
 #include <stdarg.h>
 
 #define WINDOW_WIDTH 350
@@ -2942,10 +2941,9 @@ initialize_ui (GtkSourceCompletion *completion)
 
 	builder = gtk_builder_new ();
 
-	gtk_builder_add_from_string (builder,
-	                             gtk_source_completion_ui,
-	                             -1,
-	                             NULL);
+	gtk_builder_add_from_resource (builder,
+				       "/org/gnome/gtksourceview/ui/gtksourcecompletion.ui",
+				       NULL);
 
 	completion->priv->window =
 		GTK_WIDGET (gtk_builder_get_object (builder,
diff --git a/gtksourceview/gtksourcecompletion.ui b/gtksourceview/gtksourcecompletion.ui
new file mode 100644
index 0000000..721a73f
--- /dev/null
+++ b/gtksourceview/gtksourcecompletion.ui
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+gtksourcecompletion.ui
+This file is part of GtkSourceView
+
+Copyright (C) 2009 - Jesse van den Kieboom <jessevdk gnome org>
+
+GtkSourceView is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+GtkSourceView 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+-->
+
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="window_completion">
+    <property name="border_width">1</property>
+    <property name="type">popup</property>
+    <property name="type_hint">combo</property>
+    <property name="resizable">False</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="skip_pager_hint">True</property>
+    <property name="accept_focus">False</property>
+    <property name="focus_on_map">False</property>
+    <property name="decorated">False</property>
+    <child>
+      <object class="GtkBox" id="vbox_completion">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolled_window_completion">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hscrollbar_policy">automatic</property>
+            <property name="vscrollbar_policy">automatic</property>
+            <child>
+              <object class="GtkTreeView" id="tree_view_completion">
+                <property name="visible">True</property>
+                <property name="headers_visible">False</property>
+                <property name="headers_clickable">False</property>
+                <property name="enable_search">False</property>
+                <property name="fixed_height_mode">True</property>
+                <property name="show_expanders">False</property>
+                <property name="vexpand">True</property>
+                <child>
+                  <object class="GtkTreeViewColumn" id="tree_view_column_proposal">
+                    <property name="sizing">fixed</property>
+                    <property name="expand">False</property>
+                    <child>
+                      <object class="GtkCellRendererPixbuf" id="cell_renderer_icon"/>
+                    </child>
+                    <child>
+                      <object class="GtkCellRendererText" id="cell_renderer_proposal"/>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="tree_view_column_accelerator">
+                    <property name="sizing">fixed</property>
+                    <property name="expand">False</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cell_renderer_accelerator"/>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="hbox_bottom_bar">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkToggleButton" id="toggle_button_info">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="receives_default">True</property>
+                <property name="tooltip_text" translatable="yes">Show detailed proposal information</property>
+                <property name="focus_on_click">False</property>
+                <property name="relief">GTK_RELIEF_NONE</property>
+                <child>
+                  <object class="GtkBox" id="hbox_info">
+                    <property name="visible">True</property>
+                    <property name="spacing">2</property>
+                    <child>
+                      <object class="GtkImage" id="image_info">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-info</property>
+                      </object>
+                      <packing>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label_info">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Details...</property>
+                        <property name="use_markup">True</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="image_selection">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="pack_type">end</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_selection">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="padding">6</property>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/gtksourceview/gtksourceview.gresource.xml b/gtksourceview/gtksourceview.gresource.xml
new file mode 100644
index 0000000..8c8d5f0
--- /dev/null
+++ b/gtksourceview/gtksourceview.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/gtksourceview/ui">
+    <file preprocess="xml-stripblanks">gtksourcecompletion.ui</file>
+  </gresource>
+</gresources>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6b1abb2..7bf905e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -102,6 +102,7 @@ data/styles/tango.xml
 gtksourceview/completion-providers/words/gtksourcecompletionwords.c
 gtksourceview/gtksourcebuffer.c
 gtksourceview/gtksourcecompletion.c
+[type: gettext/glade]gtksourceview/gtksourcecompletion.ui
 gtksourceview/gtksourcecompletioncontext.c
 gtksourceview/gtksourcecompletioninfo.c
 gtksourceview/gtksourcecompletionitem.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]