[glade] Added GladeFontChooserDialog editor.



commit 1de549357c9a30d4c79d920d547dafeaf12aa7c3
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 4 22:53:01 2013 +0900

    Added GladeFontChooserDialog editor.
    
    A GladeWindowEditor which embeds the GladeFontChooserEditor

 plugins/gtk+/Makefile.am                         |    3 +
 plugins/gtk+/glade-font-chooser-dialog-editor.c  |   48 ++++++++++++++++++
 plugins/gtk+/glade-font-chooser-dialog-editor.h  |   57 ++++++++++++++++++++++
 plugins/gtk+/glade-font-chooser-dialog-editor.ui |   32 ++++++++++++
 plugins/gtk+/glade-gtk-resources.gresource.xml   |    1 +
 plugins/gtk+/glade-gtk-window.c                  |    3 +
 plugins/gtk+/gtk+.xml.in                         |   11 ++++-
 plugins/gtk-private/glade-gtk-private.xml        |    3 +
 po/POTFILES.in                                   |    2 +
 9 files changed, 158 insertions(+), 2 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index abc3562..5bb85d5 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -36,6 +36,7 @@ libgladegtk_la_SOURCES =              \
        glade-file-chooser-editor.c     \
        glade-file-chooser-widget-editor.c \
        glade-fixed.c                   \
+       glade-font-chooser-dialog-editor.c \
        glade-font-chooser-editor.c     \
        glade-gtk-about-dialog.c        \
        glade-gtk-action.c              \
@@ -122,6 +123,7 @@ noinst_HEADERS =                    \
        glade-file-chooser-editor.h     \
        glade-file-chooser-widget-editor.h \
        glade-fixed.h                   \
+       glade-font-chooser-dialog-editor.h \
        glade-font-chooser-editor.h     \
        glade-gtk.h                     \
        glade-gtk-action-widgets.h      \
@@ -178,6 +180,7 @@ UI_FILES =                          \
        glade-file-chooser-dialog-editor.ui \
        glade-file-chooser-editor.ui    \
        glade-file-chooser-widget-editor.ui \
+       glade-font-chooser-dialog-editor.ui \
        glade-font-chooser-editor.ui    \
        glade-image-editor.ui           \
        glade-label-editor.ui           \
diff --git a/plugins/gtk+/glade-font-chooser-dialog-editor.c b/plugins/gtk+/glade-font-chooser-dialog-editor.c
new file mode 100644
index 0000000..76fba35
--- /dev/null
+++ b/plugins/gtk+/glade-font-chooser-dialog-editor.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 Tristan Van Berkom.
+ *
+ * This library 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.
+ *
+ * This library 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 program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ *   Tristan Van Berkom <tvb gnome org>
+ */
+
+#include <config.h>
+#include <gladeui/glade.h>
+#include <glib/gi18n-lib.h>
+
+#include "glade-font-chooser-dialog-editor.h"
+
+G_DEFINE_TYPE (GladeFontChooserDialogEditor, glade_font_chooser_dialog_editor, GLADE_TYPE_WINDOW_EDITOR)
+
+static void
+glade_font_chooser_dialog_editor_class_init (GladeFontChooserDialogEditorClass * klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/gladegtk/glade-font-chooser-dialog-editor.ui");
+}
+
+static void
+glade_font_chooser_dialog_editor_init (GladeFontChooserDialogEditor * self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+glade_font_chooser_dialog_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_FONT_CHOOSER_DIALOG_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-font-chooser-dialog-editor.h b/plugins/gtk+/glade-font-chooser-dialog-editor.h
new file mode 100644
index 0000000..c91f8a2
--- /dev/null
+++ b/plugins/gtk+/glade-font-chooser-dialog-editor.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2013 Tristan Van Berkom.
+ *
+ * This library 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.
+ *
+ * This library 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 program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ *   Tristan Van Berkom <tvb gnome org>
+ */
+#ifndef _GLADE_FONT_CHOOSER_DIALOG_EDITOR_H_
+#define _GLADE_FONT_CHOOSER_DIALOG_EDITOR_H_
+
+#include <gtk/gtk.h>
+#include "glade-window-editor.h"
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_FONT_CHOOSER_DIALOG_EDITOR              (glade_font_chooser_dialog_editor_get_type ())
+#define GLADE_FONT_CHOOSER_DIALOG_EDITOR(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_FONT_CHOOSER_DIALOG_EDITOR, GladeFontChooserDialogEditor))
+#define GLADE_FONT_CHOOSER_DIALOG_EDITOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_FONT_CHOOSER_DIALOG_EDITOR, GladeFontChooserDialogEditorClass))
+#define GLADE_IS_FONT_CHOOSER_DIALOG_EDITOR(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GLADE_TYPE_FONT_CHOOSER_DIALOG_EDITOR))
+#define GLADE_IS_FONT_CHOOSER_DIALOG_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GLADE_TYPE_FONT_CHOOSER_DIALOG_EDITOR))
+#define GLADE_FONT_CHOOSER_DIALOG_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GLADE_TYPE_FONT_CHOOSER_DIALOG_EDITOR, GladeFontChooserDialogEditorClass))
+
+typedef struct _GladeFontChooserDialogEditor        GladeFontChooserDialogEditor;
+typedef struct _GladeFontChooserDialogEditorClass   GladeFontChooserDialogEditorClass;
+typedef struct _GladeFontChooserDialogEditorPrivate GladeFontChooserDialogEditorPrivate;
+
+struct _GladeFontChooserDialogEditor
+{
+  GladeWindowEditor  parent;
+
+  GladeFontChooserDialogEditorPrivate *priv;
+};
+
+struct _GladeFontChooserDialogEditorClass
+{
+  GladeWindowEditorClass parent;
+};
+
+GType            glade_font_chooser_dialog_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_font_chooser_dialog_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_FONT_CHOOSER_DIALOG_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-font-chooser-dialog-editor.ui 
b/plugins/gtk+/glade-font-chooser-dialog-editor.ui
new file mode 100644
index 0000000..6b5eb7f
--- /dev/null
+++ b/plugins/gtk+/glade-font-chooser-dialog-editor.ui
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires glade-gtk-plugin 0.0 -->
+  <!-- interface-requires gtk+ 3.10 -->
+  <template class="GladeFontChooserDialogEditor" parent="GladeWindowEditor">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <child internal-child="extension_port">
+      <object class="GtkBox" id="extension_port">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GladeFontChooserEditor" id="fontchoosereditor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child-editors>
+      <editor id="fontchoosereditor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index f23d474..be096b6 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -9,6 +9,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-file-chooser-dialog-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-file-chooser-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-file-chooser-widget-editor.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">glade-font-chooser-dialog-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-font-chooser-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-image-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-label-editor.ui</file>
diff --git a/plugins/gtk+/glade-gtk-window.c b/plugins/gtk+/glade-gtk-window.c
index f598def..d94d3d8 100644
--- a/plugins/gtk+/glade-gtk-window.c
+++ b/plugins/gtk+/glade-gtk-window.c
@@ -28,6 +28,7 @@
 #include "glade-window-editor.h"
 #include "glade-about-dialog-editor.h"
 #include "glade-file-chooser-dialog-editor.h"
+#include "glade-font-chooser-dialog-editor.h"
 #include "glade-gtk.h"
 
 #define GLADE_TAG_ACCEL_GROUPS "accel-groups"
@@ -170,6 +171,8 @@ glade_gtk_window_create_editable (GladeWidgetAdaptor * adaptor,
        editable = (GladeEditable *) glade_about_dialog_editor_new ();
       else if (g_type_is_a (window_type, GTK_TYPE_FILE_CHOOSER_DIALOG))
        editable = (GladeEditable *) glade_file_chooser_dialog_editor_new ();
+      else if (g_type_is_a (window_type, GTK_TYPE_FONT_CHOOSER_DIALOG))
+       editable = (GladeEditable *) glade_font_chooser_dialog_editor_new ();
       else
        editable = (GladeEditable *) glade_window_editor_new ();
     }
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index d4a92fb..fc104b3 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -2279,8 +2279,15 @@ embedded in another object</_tooltip>
     <glade-widget-class name="GtkFontChooserWidget" generic-name="fontchooserwidget"
                        _title="Font Chooser Widget" icon-name="widget-gtk-fontselection" since="3.2"/>
     <glade-widget-class name="GtkFontChooserDialog" generic-name="fontchooserdialog"
-                       _title="Font Chooser Dialog" icon-name="widget-gtk-fontselectiondialog" since="3.2"/>
-    
+                       _title="Font Chooser Dialog" icon-name="widget-gtk-fontselectiondialog" since="3.2">
+      <properties>
+       <!-- Claim the GladeFontChooserEditor properties -->
+       <property id="font" custom-layout="True"/>
+       <property id="preview-text" custom-layout="True"/>
+       <property id="show-preview-entry" custom-layout="True"/>
+      </properties>
+    </glade-widget-class>    
+
     <glade-widget-class name="GtkFontSelection" deprecated="True" generic-name="fontselection" _title="Font 
Selection"/>
     
     <glade-widget-class name="GtkAssistant" generic-name="assistant" _title="Assistant" since="2.10">
diff --git a/plugins/gtk-private/glade-gtk-private.xml b/plugins/gtk-private/glade-gtk-private.xml
index f806535..11477e7 100644
--- a/plugins/gtk-private/glade-gtk-private.xml
+++ b/plugins/gtk-private/glade-gtk-private.xml
@@ -9,6 +9,8 @@
                        icon-name="widget-gtk-button"/>
     <glade-widget-class name="GladeFileChooserEditor" generic-name="filechoosereditor" title="File Chooser 
Editor"
                        icon-name="widget-gtk-filechooserwidget"/>
+    <glade-widget-class name="GladeFontChooserEditor" generic-name="fontchoosereditor" title="Font Chooser 
Editor"
+                       icon-name="widget-gtk-fontselection"/>
     <glade-widget-class name="GladeWindowEditor" generic-name="windoweditor" title="Window Editor"
                        icon-name="widget-gtk-window">
       <post-create-function>glade_window_editor_post_create</post-create-function>
@@ -28,6 +30,7 @@
     <glade-widget-class-ref name="GladeActivatableEditor"/>
     <glade-widget-class-ref name="GladeButtonEditor"/>
     <glade-widget-class-ref name="GladeFileChooserEditor"/>
+    <glade-widget-class-ref name="GladeFontChooserEditor"/>
     <glade-widget-class-ref name="GladeWindowEditor"/>
   </glade-widget-group>
 </glade-catalog>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index eac50ba..0cebbe7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -65,6 +65,7 @@ plugins/gtk+/glade-file-chooser-dialog-editor.c
 plugins/gtk+/glade-file-chooser-editor.c
 plugins/gtk+/glade-file-chooser-widget-editor.c
 plugins/gtk+/glade-fixed.c
+plugins/gtk+/glade-font-chooser-dialog-editor.c
 plugins/gtk+/glade-font-chooser-editor.c
 plugins/gtk+/glade-gtk-about-dialog.c
 plugins/gtk+/glade-gtk-action.c
@@ -143,6 +144,7 @@ plugins/gtk+/gtk+.xml.in
 [type: gettext/glade]plugins/gtk+/glade-file-chooser-dialog-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-file-chooser-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-file-chooser-widget-editor.ui
+[type: gettext/glade]plugins/gtk+/glade-font-chooser-dialog-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-font-chooser-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-image-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-label-editor.ui


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