[glade] Added GladeArrowEditor



commit a456f2141483b2b01a261634b471f51231e47a49
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun May 19 18:19:54 2013 +0900

    Added GladeArrowEditor
    
    A simple editor which embeds the GladeMiscEditor.

 plugins/gtk+/Makefile.am                       |    4 +
 plugins/gtk+/glade-arrow-editor.c              |   77 ++++++++++++++++++++++++
 plugins/gtk+/glade-arrow-editor.h              |   68 +++++++++++++++++++++
 plugins/gtk+/glade-arrow-editor.ui             |   39 ++++++++++++
 plugins/gtk+/glade-gtk-arrow.c                 |   42 +++++++++++++
 plugins/gtk+/glade-gtk-resources.gresource.xml |    1 +
 plugins/gtk+/gtk+.xml.in                       |   28 ++++++---
 po/POTFILES.in                                 |    3 +
 8 files changed, 253 insertions(+), 9 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 20651a1..2a93918 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -29,6 +29,7 @@ libgladegtk_la_SOURCES =              \
        glade-activatable-editor.c      \
        glade-app-chooser-button-editor.c \
        glade-app-chooser-widget-editor.c \
+       glade-arrow-editor.c            \
        glade-attributes.c              \
        glade-box-editor.c              \
        glade-button-editor.c           \
@@ -54,6 +55,7 @@ libgladegtk_la_SOURCES =              \
        glade-gtk-adjustment.c          \
        glade-gtk-app-chooser-button.c  \
        glade-gtk-app-chooser-widget.c  \
+       glade-gtk-arrow.c               \
        glade-gtk-assistant.c           \
        glade-gtk-box.c                 \
        glade-gtk-button.c              \
@@ -158,6 +160,7 @@ noinst_HEADERS =                    \
        glade-activatable-editor.h      \
        glade-app-chooser-button-editor.h \
        glade-app-chooser-widget-editor.h \
+       glade-arrow-editor.h            \
        glade-attributes.h              \
        glade-box-editor.h              \
        glade-button-editor.h           \
@@ -250,6 +253,7 @@ UI_FILES =                          \
        glade-activatable-editor.ui     \
        glade-app-chooser-button-editor.ui \
        glade-app-chooser-widget-editor.ui \
+       glade-arrow-editor.ui           \
        glade-box-editor.ui             \
        glade-button-editor.ui          \
        glade-combo-box-editor.ui       \
diff --git a/plugins/gtk+/glade-arrow-editor.c b/plugins/gtk+/glade-arrow-editor.c
new file mode 100644
index 0000000..a34455b
--- /dev/null
+++ b/plugins/gtk+/glade-arrow-editor.c
@@ -0,0 +1,77 @@
+/*
+ * 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 <gdk/gdkkeysyms.h>
+
+#include "glade-arrow-editor.h"
+
+/* GtkWidgetClass */
+static void glade_arrow_editor_grab_focus    (GtkWidget          *widget);
+
+struct _GladeArrowEditorPrivate
+{
+  GtkWidget *embed;
+};
+
+G_DEFINE_TYPE (GladeArrowEditor, glade_arrow_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_arrow_editor_class_init (GladeArrowEditorClass * klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  widget_class->grab_focus = glade_arrow_editor_grab_focus;
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladegtk/glade-arrow-editor.ui");
+  gtk_widget_class_bind_child (widget_class, GladeArrowEditorPrivate, embed);
+
+  g_type_class_add_private (object_class, sizeof (GladeArrowEditorPrivate));  
+}
+
+static void
+glade_arrow_editor_init (GladeArrowEditor * self)
+{
+  self->priv = 
+    G_TYPE_INSTANCE_GET_PRIVATE (self,
+                                GLADE_TYPE_ARROW_EDITOR,
+                                GladeArrowEditorPrivate);
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+static void
+glade_arrow_editor_grab_focus (GtkWidget * widget)
+{
+  GladeArrowEditor        *arrow_editor = GLADE_ARROW_EDITOR (widget);
+  GladeArrowEditorPrivate *priv = arrow_editor->priv;
+
+  gtk_widget_grab_focus (priv->embed);
+}
+
+GtkWidget *
+glade_arrow_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_ARROW_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-arrow-editor.h b/plugins/gtk+/glade-arrow-editor.h
new file mode 100644
index 0000000..0bd14f9
--- /dev/null
+++ b/plugins/gtk+/glade-arrow-editor.h
@@ -0,0 +1,68 @@
+/*
+ * 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_ARROW_EDITOR_H_
+#define _GLADE_ARROW_EDITOR_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_ARROW_EDITOR                    (glade_arrow_editor_get_type ())
+#define GLADE_ARROW_EDITOR(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_ARROW_EDITOR, GladeArrowEditor))
+#define GLADE_ARROW_EDITOR_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_ARROW_EDITOR, GladeArrowEditorClass))
+#define GLADE_IS_ARROW_EDITOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_ARROW_EDITOR))
+#define GLADE_IS_ARROW_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_ARROW_EDITOR))
+#define GLADE_ARROW_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_ARROW_EDITOR, 
GladeArrowEditorClass))
+
+typedef struct _GladeArrowEditor        GladeArrowEditor;
+typedef struct _GladeArrowEditorClass   GladeArrowEditorClass;
+typedef struct _GladeArrowEditorPrivate GladeArrowEditorPrivate;
+
+typedef enum {
+  GLADE_ARROW_MODE_ATTRIBUTES = 0, /* default */
+  GLADE_ARROW_MODE_MARKUP,
+  GLADE_ARROW_MODE_PATTERN
+} GladeArrowContentMode;
+
+typedef enum {
+  GLADE_ARROW_WRAP_FREE = 0, /* default */
+  GLADE_ARROW_SINGLE_LINE,
+  GLADE_ARROW_WRAP_MODE
+} GladeArrowWrapMode;
+
+struct _GladeArrowEditor
+{
+  GladeEditorSkeleton parent;
+
+  GladeArrowEditorPrivate *priv;
+};
+
+struct _GladeArrowEditorClass
+{
+  GladeEditorSkeletonClass parent;
+};
+
+GType            glade_arrow_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_arrow_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_ARROW_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-arrow-editor.ui b/plugins/gtk+/glade-arrow-editor.ui
new file mode 100644
index 0000000..3842560
--- /dev/null
+++ b/plugins/gtk+/glade-arrow-editor.ui
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires glade-gtk-plugin 0.0 -->
+  <!-- interface-requires gladeui 0.0 -->
+  <template class="GladeArrowEditor" 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="GladeMiscEditor" id="misc_editor">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</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="misc_editor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/glade-gtk-arrow.c b/plugins/gtk+/glade-gtk-arrow.c
new file mode 100644
index 0000000..042fc80
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-arrow.c
@@ -0,0 +1,42 @@
+/*
+ * glade-gtk-arrow.c - GladeWidgetAdaptor for GtkArrow
+ *
+ * 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-arrow-editor.h"
+
+GladeEditable *
+glade_gtk_arrow_create_editable (GladeWidgetAdaptor * adaptor,
+                                 GladeEditorPageType type)
+{
+  GladeEditable *editable;
+
+  if (type == GLADE_PAGE_GENERAL)
+    editable = (GladeEditable *) glade_arrow_editor_new ();
+  else
+    editable = GWA_GET_CLASS (GTK_TYPE_WIDGET)->create_editable (adaptor, type);
+
+  return editable;
+}
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index 02d0427..d0698d0 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -6,6 +6,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-activatable-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-app-chooser-button-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-app-chooser-widget-editor.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">glade-arrow-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-box-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-button-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-combo-box-editor.ui</file>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index e251e7f..cb1c8ae 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -974,11 +974,6 @@ embedded in another object</_tooltip>
          </parameter-spec>
          <_tooltip>The pango attributes for this label</_tooltip>
        </property>
-
-       <property id="xalign" custom-layout="True"/>
-       <property id="yalign" custom-layout="True"/>
-       <property id="xpad" custom-layout="True"/>
-       <property id="ypad" custom-layout="True"/>
        <property id="pattern" custom-layout="True"/>
        <property id="use-markup" custom-layout="True"/>
        <property id="ellipsize" custom-layout="True"/>
@@ -1007,6 +1002,12 @@ embedded in another object</_tooltip>
          </displayable-values>
        </property>
        <property id="track-visited-links" since="2.18" custom-layout="True"/>
+
+       <!-- GtkMisc properties -->
+       <property id="xalign" custom-layout="True"/>
+       <property id="yalign" custom-layout="True"/>
+       <property id="xpad" custom-layout="True"/>
+       <property id="ypad" custom-layout="True"/>
       </properties>
 
       <signals>
@@ -1721,10 +1722,6 @@ range of values</_tooltip>
        <property id="pixbuf" _name="File Name" custom-layout="True"/>
        <property id="resource" _name="Resource Name" custom-layout="True" ignore="True" since="3.8"/>
        <property id="pixel-size" custom-layout="True"/>
-       <property id="xalign" custom-layout="True"/>
-       <property id="yalign" custom-layout="True"/>
-       <property id="xpad" custom-layout="True"/>
-       <property id="ypad" custom-layout="True"/>
        <!-- We have to save/load icon-size as int, and fake the enum -->
        <property id="icon-size" _name="Icon Size" custom-layout="True" 
                  default="GTK_ICON_SIZE_BUTTON" save="False">
@@ -1740,6 +1737,12 @@ range of values</_tooltip>
        <property id="pixmap" disabled="True"/>
        <property id="image" disabled="True"/>
        <property id="mask" disabled="True"/>
+
+       <!-- GtkMisc properties -->
+       <property id="xalign" custom-layout="True"/>
+       <property id="yalign" custom-layout="True"/>
+       <property id="xpad" custom-layout="True"/>
+       <property id="ypad" custom-layout="True"/>
       </properties>
     </glade-widget-class>
 
@@ -2171,6 +2174,7 @@ range of values</_tooltip>
     <glade-widget-class name="GtkAccelLabel" generic-name="accellabel" _title="Accel Label"/>
 
     <glade-widget-class name="GtkArrow" generic-name="arrow" _title="Arrow">
+      <create-editable-function>glade_gtk_arrow_create_editable</create-editable-function>
       <properties>
        <property id="arrow-type">
          <displayable-values>
@@ -2181,6 +2185,12 @@ range of values</_tooltip>
            <value id="GTK_ARROW_NONE" _name="None"/>
          </displayable-values>
        </property>
+
+       <!-- GtkMisc properties -->
+       <property id="xalign" custom-layout="True"/>
+       <property id="yalign" custom-layout="True"/>
+       <property id="xpad" custom-layout="True"/>
+       <property id="ypad" custom-layout="True"/>
       </properties>
     </glade-widget-class>
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5476680..3fb0b3b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -58,6 +58,7 @@ plugins/gtk+/glade-action-editor.c
 plugins/gtk+/glade-activatable-editor.c
 plugins/gtk+/glade-app-chooser-button-editor.c
 plugins/gtk+/glade-app-chooser-widget-editor.c
+plugins/gtk+/glade-arrow-editor.c
 plugins/gtk+/glade-attributes.c
 plugins/gtk+/glade-box-editor.c
 plugins/gtk+/glade-button-editor.c
@@ -83,6 +84,7 @@ plugins/gtk+/glade-gtk-action-widgets.c
 plugins/gtk+/glade-gtk-adjustment.c
 plugins/gtk+/glade-gtk-app-chooser-button.c
 plugins/gtk+/glade-gtk-app-chooser-widget.c
+plugins/gtk+/glade-gtk-arrow.c
 plugins/gtk+/glade-gtk-assistant.c
 plugins/gtk+/glade-gtk-box.c
 plugins/gtk+/glade-gtk-button.c
@@ -182,6 +184,7 @@ plugins/gtk+/gtk+.xml.in
 [type: gettext/glade]plugins/gtk+/glade-activatable-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-app-chooser-button-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-app-chooser-widget-editor.ui
+[type: gettext/glade]plugins/gtk+/glade-arrow-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-box-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-button-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-combo-box-editor.ui


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