[glade] Added GladeFontChooserWidgetEditor



commit 96f1642b80e84a01d72a186d5a72baa8448235dd
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 4 23:04:36 2013 +0900

    Added GladeFontChooserWidgetEditor
    
    Embeds GladeEditorTable and GladeFontChooserEditor.

 plugins/gtk+/Makefile.am                         |    4 ++
 plugins/gtk+/glade-font-chooser-widget-editor.c  |   48 ++++++++++++++++++
 plugins/gtk+/glade-font-chooser-widget-editor.h  |   57 ++++++++++++++++++++++
 plugins/gtk+/glade-font-chooser-widget-editor.ui |   38 ++++++++++++++
 plugins/gtk+/glade-gtk-font-chooser-widget.c     |   40 +++++++++++++++
 plugins/gtk+/glade-gtk-resources.gresource.xml   |    1 +
 plugins/gtk+/gtk+.xml.in                         |   26 ++++++++++-
 po/POTFILES.in                                   |    2 +
 8 files changed, 215 insertions(+), 1 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 5bb85d5..2170d1c 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -38,6 +38,7 @@ libgladegtk_la_SOURCES =              \
        glade-fixed.c                   \
        glade-font-chooser-dialog-editor.c \
        glade-font-chooser-editor.c     \
+       glade-font-chooser-widget-editor.c \
        glade-gtk-about-dialog.c        \
        glade-gtk-action.c              \
        glade-gtk-action-group.c        \
@@ -57,6 +58,7 @@ libgladegtk_la_SOURCES =              \
        glade-gtk-expander.c            \
        glade-gtk-file-chooser-widget.c \
        glade-gtk-fixed-layout.c        \
+       glade-gtk-font-chooser-widget.c \
        glade-gtk-frame.c               \
        glade-gtk-grid.c                \
        glade-gtk-icon-factory.c        \
@@ -125,6 +127,7 @@ noinst_HEADERS =                    \
        glade-fixed.h                   \
        glade-font-chooser-dialog-editor.h \
        glade-font-chooser-editor.h     \
+       glade-font-chooser-widget-editor.h \
        glade-gtk.h                     \
        glade-gtk-action-widgets.h      \
        glade-gtk-button.h              \
@@ -182,6 +185,7 @@ UI_FILES =                          \
        glade-file-chooser-widget-editor.ui \
        glade-font-chooser-dialog-editor.ui \
        glade-font-chooser-editor.ui    \
+       glade-font-chooser-widget-editor.ui \
        glade-image-editor.ui           \
        glade-label-editor.ui           \
        glade-tool-button-editor.ui     \
diff --git a/plugins/gtk+/glade-font-chooser-widget-editor.c b/plugins/gtk+/glade-font-chooser-widget-editor.c
new file mode 100644
index 0000000..496fc38
--- /dev/null
+++ b/plugins/gtk+/glade-font-chooser-widget-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-widget-editor.h"
+
+G_DEFINE_TYPE (GladeFontChooserWidgetEditor, glade_font_chooser_widget_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_font_chooser_widget_editor_class_init (GladeFontChooserWidgetEditorClass * klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/gladegtk/glade-font-chooser-widget-editor.ui");
+}
+
+static void
+glade_font_chooser_widget_editor_init (GladeFontChooserWidgetEditor * self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+glade_font_chooser_widget_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_FONT_CHOOSER_WIDGET_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-font-chooser-widget-editor.h b/plugins/gtk+/glade-font-chooser-widget-editor.h
new file mode 100644
index 0000000..5e9e09e
--- /dev/null
+++ b/plugins/gtk+/glade-font-chooser-widget-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_WIDGET_EDITOR_H_
+#define _GLADE_FONT_CHOOSER_WIDGET_EDITOR_H_
+
+#include <gtk/gtk.h>
+#include "glade-window-editor.h"
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_FONT_CHOOSER_WIDGET_EDITOR              (glade_font_chooser_widget_editor_get_type ())
+#define GLADE_FONT_CHOOSER_WIDGET_EDITOR(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_FONT_CHOOSER_WIDGET_EDITOR, GladeFontChooserWidgetEditor))
+#define GLADE_FONT_CHOOSER_WIDGET_EDITOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_FONT_CHOOSER_WIDGET_EDITOR, GladeFontChooserWidgetEditorClass))
+#define GLADE_IS_FONT_CHOOSER_WIDGET_EDITOR(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GLADE_TYPE_FONT_CHOOSER_WIDGET_EDITOR))
+#define GLADE_IS_FONT_CHOOSER_WIDGET_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GLADE_TYPE_FONT_CHOOSER_WIDGET_EDITOR))
+#define GLADE_FONT_CHOOSER_WIDGET_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GLADE_TYPE_FONT_CHOOSER_WIDGET_EDITOR, GladeFontChooserWidgetEditorClass))
+
+typedef struct _GladeFontChooserWidgetEditor        GladeFontChooserWidgetEditor;
+typedef struct _GladeFontChooserWidgetEditorClass   GladeFontChooserWidgetEditorClass;
+typedef struct _GladeFontChooserWidgetEditorPrivate GladeFontChooserWidgetEditorPrivate;
+
+struct _GladeFontChooserWidgetEditor
+{
+  GladeEditorSkeleton  parent;
+
+  GladeFontChooserWidgetEditorPrivate *priv;
+};
+
+struct _GladeFontChooserWidgetEditorClass
+{
+  GladeEditorSkeletonClass parent;
+};
+
+GType            glade_font_chooser_widget_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_font_chooser_widget_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_FONT_CHOOSER_WIDGET_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-font-chooser-widget-editor.ui 
b/plugins/gtk+/glade-font-chooser-widget-editor.ui
new file mode 100644
index 0000000..bfbe211
--- /dev/null
+++ b/plugins/gtk+/glade-font-chooser-widget-editor.ui
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+  <!-- interface-requires glade-gtk-plugin 0.0 -->
+  <!-- interface-requires gladeui 0.0 -->
+  <template class="GladeFontChooserWidgetEditor" parent="GladeEditorSkeleton">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GladeEditorTable" id="embed">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <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">1</property>
+      </packing>
+    </child>
+    <child-editors>
+      <editor id="embed"/>
+      <editor id="fontchoosereditor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/glade-gtk-font-chooser-widget.c b/plugins/gtk+/glade-gtk-font-chooser-widget.c
new file mode 100644
index 0000000..a97a28b
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-font-chooser-widget.c
@@ -0,0 +1,40 @@
+/*
+ * glade-gtk-font-chooser-widget.c - GladeWidgetAdaptor for GtkFontChooserWidget
+ *
+ * Copyright (C) 2013 Tristan Van Berkom
+ *
+ * Authors:
+ *      Tristan Van Berkom <tristan van berkom gmail com>
+ *
+ * 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.
+ */
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+#include <gladeui/glade.h>
+
+#include "glade-font-chooser-widget-editor.h"
+
+GladeEditable *
+glade_gtk_font_chooser_widget_create_editable (GladeWidgetAdaptor * adaptor,
+                                              GladeEditorPageType type)
+{
+  if (type == GLADE_PAGE_GENERAL)
+    {
+      return (GladeEditable *) glade_font_chooser_widget_editor_new ();
+    }
+
+  return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
+}
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index be096b6..af34cdd 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -11,6 +11,7 @@
     <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-font-chooser-widget-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>
     <file compressed="true" preprocess="xml-stripblanks">glade-tool-button-editor.ui</file>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index fc104b3..1b01c72 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1387,6 +1387,13 @@ embedded in another object</_tooltip>
       <properties>
         <property id="size" default="1" query="False" />
 
+       <!-- Disable GtkBox stuff -->
+       <property id="size" disabled="True"/>
+       <property id="homogeneous" disabled="True"/>
+       <property id="orientation" disabled="True"/>
+       <property id="spacing" disabled="True"/>
+       <property id="baseline-position" disabled="True"/>
+
        <!-- GtkFileChooser properties are custom-layout, handled in GladeFileChooserEditor -->
        <property id="extra-widget" parentless-widget="True" custom-layout="True"/>
        <property id="preview-widget" parentless-widget="True" custom-layout="True"/>
@@ -2277,7 +2284,24 @@ embedded in another object</_tooltip>
     <glade-widget-class name="GtkColorChooserDialog" generic-name="colorchooserdialog"
                        _title="Color Chooser Dialog" icon-name="widget-gtk-colorselectiondialog" 
since="3.4"/>
     <glade-widget-class name="GtkFontChooserWidget" generic-name="fontchooserwidget"
-                       _title="Font Chooser Widget" icon-name="widget-gtk-fontselection" since="3.2"/>
+                       _title="Font Chooser Widget" icon-name="widget-gtk-fontselection" since="3.2">
+      <create-editable-function>glade_gtk_font_chooser_widget_create_editable</create-editable-function>
+      <properties>
+
+       <!-- Disable GtkBox stuff -->
+       <property id="size" disabled="True"/>
+       <property id="homogeneous" disabled="True"/>
+       <property id="orientation" disabled="True"/>
+       <property id="spacing" disabled="True"/>
+       <property id="baseline-position" disabled="True"/>
+
+       <!-- 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="GtkFontChooserDialog" generic-name="fontchooserdialog"
                        _title="Font Chooser Dialog" icon-name="widget-gtk-fontselectiondialog" since="3.2">
       <properties>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0cebbe7..dc4ba84 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -67,6 +67,7 @@ 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-font-chooser-widget-editor.c
 plugins/gtk+/glade-gtk-about-dialog.c
 plugins/gtk+/glade-gtk-action.c
 plugins/gtk+/glade-gtk-action-group.c
@@ -86,6 +87,7 @@ plugins/gtk+/glade-gtk-entry-buffer.c
 plugins/gtk+/glade-gtk-expander.c
 plugins/gtk+/glade-gtk-file-chooser-widget.c
 plugins/gtk+/glade-gtk-fixed-layout.c
+plugins/gtk+/glade-gtk-font-chooser-widget.c
 plugins/gtk+/glade-gtk-frame.c
 plugins/gtk+/glade-gtk-grid.c
 plugins/gtk+/glade-gtk-icon-factory.c


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