[gtksourceview/gtksourcecompletion] Add completion ui in header instead of separate installed file



commit d6bf242f6c0103df41b6214978455c45aab8407d
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sun Sep 27 13:41:28 2009 +0200

    Add completion ui in header instead of separate installed file

 gtksourceview/Makefile.am             |    4 +-
 gtksourceview/completion.ui           |  131 ---------------------------
 gtksourceview/gtksourcecompletion.c   |   12 +--
 gtksourceview/gtksourcecompletionui.h |  161 +++++++++++++++++++++++++++++++++
 4 files changed, 167 insertions(+), 141 deletions(-)
---
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index 26ef4a7..f9752aa 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -44,6 +44,7 @@ NOINST_H_FILES = \
 	gtksourcecompletionmodel.h	\
 	gtksourcecompletion-private.h	\
 	gtksourcecompletionutils.h	\
+	gtksourcecompletionui.h		\
 	gtksourcecontextengine.h	\
 	gtksourcegutter-private.h	\
 	gtksourcelanguage-private.h	\
@@ -100,9 +101,6 @@ libgtksourceview_2_0_include_HEADERS =		\
 	$(libgtksourceview_headers)		\
 	gtksourceview-typebuiltins.h
 
-uidir = $(datadir)/gtksourceview-2.0/ui
-ui_DATA = completion.ui
-
 gtksourceview-marshal.h: gtksourceview-marshal.list $(GLIB_GENMARSHAL)
 	$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=_gtksourceview_marshal > $@
 
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index c40ae36..ffe1cc0 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -38,6 +38,7 @@
 #include <gtksourceview/gtksourceview.h>
 #include "gtksourcecompletion-private.h"
 #include "gtksourcecompletioncontext.h"
+#include "gtksourcecompletionui.h"
 #include <stdarg.h>
 
 #define WINDOW_WIDTH 350
@@ -2588,13 +2589,10 @@ initialize_ui (GtkSourceCompletion *completion)
 	
 	builder = gtk_builder_new ();
 	
-	if (!gtk_builder_add_from_file (builder, 
-	                                DATADIR "/gtksourceview-2.0/ui/completion.ui",
-	                                NULL))
-	{
-		g_error ("Could not load UI file for completion");
-		return;
-	}
+	gtk_builder_add_from_string (builder,
+	                             gtk_source_completion_ui,
+	                             -1,
+	                             NULL);
 	
 	completion->priv->window = 
 		GTK_WIDGET (gtk_builder_get_object (builder, 
diff --git a/gtksourceview/gtksourcecompletionui.h b/gtksourceview/gtksourcecompletionui.h
new file mode 100644
index 0000000..6aa233b
--- /dev/null
+++ b/gtksourceview/gtksourcecompletionui.h
@@ -0,0 +1,161 @@
+/*
+ * gtksourcecompletionui.h
+ * This file is part of gtksourceview
+ *
+ * Copyright (C) 2009 - Jesse van den Kieboom
+ *
+ * gtksourceview 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.
+ *
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gtksourceview; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+#ifndef __GTK_SOURCE_COMPLETION_UI_H__
+#define __GTK_SOURCE_COMPLETION_UI_H__
+
+static gchar gtk_source_completion_ui[] =
+"<?xml version=\"1.0\"?>"
+"<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=\"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=\"GtkVBox\" 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>"
+"                <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=\"GtkHBox\" 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=\"GtkHBox\" 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>";
+
+#endif /* __GTK_SOURCE_COMPLETION_UI_H__ */



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