devhelp r1199 - in trunk: . data/ui src



Author: rhult
Date: Fri Oct 10 18:55:21 2008
New Revision: 1199
URL: http://svn.gnome.org/viewvc/devhelp?rev=1199&view=rev

Log:
2008-10-10  Richard Hult  <richard imendio com>

	* configure.in:
	* data/ui/Makefile.am:
	* data/ui/devhelp.glade:
	* data/ui/devhelp.builder:
	* src/dh-util.[ch] (dh_util_glade_connect,
	dh_util_glade_get_file):
	* src/dh-preferences.c (dh_preferences_show_dialog): Use
	GtkBuilder instead of libglade.


Added:
   trunk/data/ui/devhelp.builder
Removed:
   trunk/data/ui/devhelp.glade
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/data/ui/Makefile.am
   trunk/src/dh-preferences.c
   trunk/src/dh-util.c
   trunk/src/dh-util.h

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Fri Oct 10 18:55:21 2008
@@ -52,7 +52,6 @@
 PKG_CHECK_MODULES(LIBDEVHELP, [
   gthread-2.0 >= 2.10.0
   gtk+-2.0 >= 2.10.0
-  libglade-2.0 >= 2.4.0
   $gconf_pkgconfig
   $libwnck_pkgconfig
   $igemacintegration_pkgconfig

Modified: trunk/data/ui/Makefile.am
==============================================================================
--- trunk/data/ui/Makefile.am	(original)
+++ trunk/data/ui/Makefile.am	Fri Oct 10 18:55:21 2008
@@ -3,12 +3,8 @@
 
 uidir = $(datadir)/devhelp/ui
 ui_DATA = 				\
-	window.ui
-
-gladedir = $(datadir)/devhelp
-glade_DATA =                            \
-	devhelp.glade
+	window.ui			\
+	devhelp.builder
 
 EXTRA_DIST = $(image_DATA) 		\
-	     $(ui_DATA)                 \
-	     $(glade_DATA)
+	     $(ui_DATA)

Added: trunk/data/ui/devhelp.builder
==============================================================================
--- (empty file)
+++ trunk/data/ui/devhelp.builder	Fri Oct 10 18:55:21 2008
@@ -0,0 +1,254 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+  <object class="GtkDialog" id="preferences_dialog">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">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">False</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">False</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="homogeneous">False</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <object class="GtkButton" id="close_button">
+                <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>
+              </object>
+            </child>
+          </object>
+          <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>
+          <object class="GtkVBox" id="outer_vbox">
+            <property name="border_width">5</property>
+            <property name="visible">True</property>
+            <property name="homogeneous">False</property>
+            <property name="spacing">18</property>
+            <child>
+              <object class="GtkVBox" id="font_vbox">
+                <property name="visible">True</property>
+                <property name="homogeneous">False</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label6">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Fonts&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</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>
+                  </object>
+                  <packing>
+                    <property name="padding">0</property>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object 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">12</property>
+                    <property name="right_padding">0</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox3">
+                        <property name="visible">True</property>
+                        <property name="homogeneous">False</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkCheckButton" id="system_fonts_button">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">_Use system fonts</property>
+                            <property name="use_underline">True</property>
+                            <property name="relief">GTK_RELIEF_NORMAL</property>
+                            <property name="focus_on_click">True</property>
+                            <property name="active">True</property>
+                            <property name="inconsistent">False</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="padding">0</property>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkTable" id="fonts_table">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="n_rows">2</property>
+                            <property name="n_columns">2</property>
+                            <property name="homogeneous">False</property>
+                            <property name="row_spacing">6</property>
+                            <property name="column_spacing">6</property>
+                            <child>
+                              <object class="GtkLabel" id="label8">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Variable width: </property>
+                                <property name="use_underline">True</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="mnemonic_widget">variable_font_button</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>
+                              </object>
+                              <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">fill</property>
+                                <property name="y_options"/>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label9">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Fixed width:</property>
+                                <property name="use_underline">True</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="mnemonic_widget">fixed_font_button</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>
+                              </object>
+                              <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">fill</property>
+                                <property name="y_options"/>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkFontButton" id="variable_font_button">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="show_style">True</property>
+                                <property name="show_size">True</property>
+                                <property name="use_font">True</property>
+                                <property name="use_size">False</property>
+                                <property name="focus_on_click">True</property>
+                              </object>
+                              <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"/>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkFontButton" id="fixed_font_button">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="show_style">True</property>
+                                <property name="show_size">True</property>
+                                <property name="use_font">True</property>
+                                <property name="use_size">False</property>
+                                <property name="focus_on_click">True</property>
+                              </object>
+                              <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"/>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="padding">0</property>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="padding">0</property>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="padding">0</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="padding">0</property>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-7">close_button</action-widget>
+    </action-widgets>
+  </object>
+</interface>

Modified: trunk/src/dh-preferences.c
==============================================================================
--- trunk/src/dh-preferences.c	(original)
+++ trunk/src/dh-preferences.c	Fri Oct 10 18:55:21 2008
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include <glade/glade.h>
 #include <gtk/gtk.h>
 #include <string.h>
 #include "dh-util.h" 
@@ -299,9 +298,10 @@
 void
 dh_preferences_show_dialog (GtkWindow *parent)
 {
-	gboolean  use_system_fonts;
-	gchar    *var_font_name, *fixed_font_name;
-	GladeXML *gui;
+        gchar      *path;
+	GtkBuilder *builder;
+	gboolean    use_system_fonts;
+	gchar      *var_font_name, *fixed_font_name;
 
         preferences_init ();
 
@@ -310,8 +310,11 @@
 		return;
 	}
 
-	gui = dh_util_glade_get_file (
-                DATADIR "/devhelp/devhelp.glade",
+        path = dh_util_build_data_filename ("devhelp", "ui",
+                                            "devhelp.builder",
+                                            NULL);
+	builder = dh_util_builder_get_file (
+                path,
                 "preferences_dialog",
                 NULL,
                 "preferences_dialog", &prefs->dialog,
@@ -320,9 +323,10 @@
                 "variable_font_button", &prefs->variable_font_button,
                 "fixed_font_button", &prefs->fixed_font_button,
                 NULL);
+        g_free (path);
 
-	dh_util_glade_connect (
-                gui,
+	dh_util_builder_connect (
+                builder,
                 prefs,
                 "variable_font_button", "font_set", preferences_font_set_cb,
                 "fixed_font_button", "font_set", preferences_font_set_cb,
@@ -351,7 +355,7 @@
 		g_free (fixed_font_name);
 	}
 	
-	g_object_unref (gui);
+	g_object_unref (builder);
 	
 	gtk_window_set_transient_for (GTK_WINDOW (prefs->dialog), parent); 
 	gtk_widget_show_all (prefs->dialog);

Modified: trunk/src/dh-util.c
==============================================================================
--- trunk/src/dh-util.c	(original)
+++ trunk/src/dh-util.c	Fri Oct 10 18:55:21 2008
@@ -26,68 +26,69 @@
 #include "ige-conf.h"
 #include "dh-util.h"
 
-static GladeXML *
-get_glade_file (const gchar *filename,
-                const gchar *root,
-                const gchar *domain,
-                const gchar *first_required_widget,
-                va_list args)
-{
-        GladeXML   *gui;
-        const char *name;
-        GtkWidget **widget_ptr;
-
-        gui = glade_xml_new (filename, root, domain);
-        if (!gui) {
-                g_warning ("Couldn't find necessary glade file '%s'", filename);
+static GtkBuilder *
+get_builder_file (const gchar *filename,
+                  const gchar *root,
+                  const gchar *domain,
+                  const gchar *first_required_widget,
+                  va_list args)
+{
+        GtkBuilder  *builder;
+        const char  *name;
+        GObject    **object_ptr;
+
+        builder = gtk_builder_new ();
+        if (!gtk_builder_add_from_file (builder, filename, NULL)) {
+                g_warning ("Couldn't find necessary UI file '%s'", filename);
+                g_object_unref (builder);
                 return NULL;
         }
 
         for (name = first_required_widget; name; name = va_arg (args, char *)) {
-                widget_ptr = va_arg (args, void *);
-                *widget_ptr = glade_xml_get_widget (gui, name);
+                object_ptr = va_arg (args, void *);
+                *object_ptr = gtk_builder_get_object (builder, name);
 
-                if (!*widget_ptr) {
-                        g_warning ("Glade file '%s' is missing widget '%s'.",
+                if (!*object_ptr) {
+                        g_warning ("UI file '%s' is missing widget '%s'.",
                                    filename, name);
                         continue;
                 }
         }
 
-        return gui;
+        return builder;
 }
 
-GladeXML *
-dh_util_glade_get_file (const gchar *filename,
-                        const gchar *root,
-                        const gchar *domain,
-                        const gchar *first_required_widget,
-                        ...)
+GtkBuilder *
+dh_util_builder_get_file (const gchar *filename,
+                          const gchar *root,
+                          const gchar *domain,
+                          const gchar *first_required_widget,
+                          ...)
 {
-        va_list   args;
-        GladeXML *gui;
+        va_list     args;
+        GtkBuilder *builder;
 
         va_start (args, first_required_widget);
-        gui = get_glade_file (filename,
-                              root,
-                              domain,
-                              first_required_widget,
-                              args);
+        builder = get_builder_file (filename,
+                                    root,
+                                    domain,
+                                    first_required_widget,
+                                    args);
         va_end (args);
 
-        return gui;
+        return builder;
 }
 
 void
-dh_util_glade_connect (GladeXML *gui,
-                       gpointer  user_data,
-                       gchar    *first_widget,
-                       ...)
+dh_util_builder_connect (GtkBuilder *builder,
+                         gpointer    user_data,
+                         gchar     *first_widget,
+                         ...)
 {
         va_list      args;
         const gchar *name;
         const gchar *signal;
-        GtkWidget   *widget;
+        GObject     *object;
         gpointer    *callback;
 
         va_start (args, first_widget);
@@ -96,14 +97,14 @@
                 signal = va_arg (args, void *);
                 callback = va_arg (args, void *);
 
-                widget = glade_xml_get_widget (gui, name);
-                if (!widget) {
-                        g_warning ("Glade file is missing widget '%s', aborting",
+                object = gtk_builder_get_object (builder, name);
+                if (!object) {
+                        g_warning ("UI file is missing widget '%s', aborting",
                                    name);
                         continue;
                 }
 
-                g_signal_connect (widget,
+                g_signal_connect (object,
                                   signal,
                                   G_CALLBACK (callback),
                                   user_data);

Modified: trunk/src/dh-util.h
==============================================================================
--- trunk/src/dh-util.h	(original)
+++ trunk/src/dh-util.h	Fri Oct 10 18:55:21 2008
@@ -22,14 +22,14 @@
 #ifndef __DH_UTIL_H__
 #define __DH_UTIL_H__
 
-#include <glade/glade.h>
+#include <gtk/gtk.h>
 
-GladeXML *   dh_util_glade_get_file               (const gchar *filename,
+GtkBuilder * dh_util_builder_get_file             (const gchar *filename,
                                                    const gchar *root,
                                                    const gchar *domain,
                                                    const gchar *first_required_widget,
                                                    ...);
-void         dh_util_glade_connect                (GladeXML    *gui,
+void         dh_util_builder_connect              (GtkBuilder  *gui,
                                                    gpointer     user_data,
                                                    gchar       *first_widget,
                                                    ...);



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