[glade] Added GladeSpinButtonEditor



commit b1de8f23efc7421952f91c944046cc067f8d5e29
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 11 20:05:08 2013 +0900

    Added GladeSpinButtonEditor

 plugins/gtk+/Makefile.am                       |    7 +-
 plugins/gtk+/glade-gtk-resources.gresource.xml |    1 +
 plugins/gtk+/glade-gtk-spin-button.c           |   12 +
 plugins/gtk+/glade-spin-button-editor.c        |   47 ++++
 plugins/gtk+/glade-spin-button-editor.h        |   57 ++++
 plugins/gtk+/glade-spin-button-editor.ui       |  329 ++++++++++++++++++++++++
 plugins/gtk+/gtk+.xml.in                       |   14 +-
 po/POTFILES.in                                 |    2 +
 8 files changed, 463 insertions(+), 6 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index e5c811e..dc16386 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -108,6 +108,7 @@ libgladegtk_la_SOURCES =            \
        glade-message-dialog-editor.c   \
        glade-model-data.c              \
        glade-notebook-editor.c         \
+       glade-spin-button-editor.c      \
        glade-recent-action-editor.c \
        glade-recent-chooser-dialog-editor.c \
        glade-recent-chooser-editor.c   \
@@ -165,7 +166,8 @@ noinst_HEADERS =                    \
        glade-message-dialog-editor.h   \
        glade-model-data.h              \
        glade-notebook-editor.h         \
-       glade-recent-action-editor.h \
+       glade-spin-button-editor.h      \
+       glade-recent-action-editor.h    \
        glade-recent-chooser-dialog-editor.h \
        glade-recent-chooser-editor.h   \
        glade-recent-chooser-menu-editor.h \
@@ -220,7 +222,8 @@ UI_FILES =                          \
        glade-label-editor.ui           \
        glade-message-dialog-editor.ui  \
        glade-notebook-editor.ui        \
-       glade-recent-action-editor.ui \
+       glade-spin-button-editor.ui     \
+       glade-recent-action-editor.ui   \
        glade-recent-chooser-dialog-editor.ui \
        glade-recent-chooser-editor.ui  \
        glade-recent-chooser-menu-editor.ui \
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index fb0b527..603f960 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -20,6 +20,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-label-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-message-dialog-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-notebook-editor.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">glade-spin-button-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-recent-action-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-recent-chooser-dialog-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-recent-chooser-editor.ui</file>
diff --git a/plugins/gtk+/glade-gtk-spin-button.c b/plugins/gtk+/glade-gtk-spin-button.c
index 003c9a3..be6c1d2 100644
--- a/plugins/gtk+/glade-gtk-spin-button.c
+++ b/plugins/gtk+/glade-gtk-spin-button.c
@@ -25,6 +25,18 @@
 #include <glib/gi18n-lib.h>
 #include <gladeui/glade.h>
 
+#include "glade-spin-button-editor.h"
+
+GladeEditable *
+glade_gtk_spin_button_create_editable (GladeWidgetAdaptor * adaptor,
+                                      GladeEditorPageType type)
+{
+  if (type == GLADE_PAGE_GENERAL)
+    return (GladeEditable *) glade_spin_button_editor_new ();
+
+  return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
+}
+
 static void
 glade_gtk_spin_button_set_adjustment (GObject * object, const GValue * value)
 {
diff --git a/plugins/gtk+/glade-spin-button-editor.c b/plugins/gtk+/glade-spin-button-editor.c
new file mode 100644
index 0000000..a8225da
--- /dev/null
+++ b/plugins/gtk+/glade-spin-button-editor.c
@@ -0,0 +1,47 @@
+/*
+ * 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-spin-button-editor.h"
+
+G_DEFINE_TYPE (GladeSpinButtonEditor, glade_spin_button_editor, GLADE_TYPE_ENTRY_EDITOR)
+
+static void
+glade_spin_button_editor_class_init (GladeSpinButtonEditorClass * klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/gladegtk/glade-spin-button-editor.ui");
+}
+
+static void
+glade_spin_button_editor_init (GladeSpinButtonEditor * self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+glade_spin_button_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_SPIN_BUTTON_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-spin-button-editor.h b/plugins/gtk+/glade-spin-button-editor.h
new file mode 100644
index 0000000..c144003
--- /dev/null
+++ b/plugins/gtk+/glade-spin-button-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_SPIN_BUTTON_EDITOR_H_
+#define _GLADE_SPIN_BUTTON_EDITOR_H_
+
+#include <gtk/gtk.h>
+#include "glade-entry-editor.h"
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_SPIN_BUTTON_EDITOR              (glade_spin_button_editor_get_type ())
+#define GLADE_SPIN_BUTTON_EDITOR(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_SPIN_BUTTON_EDITOR, GladeSpinButtonEditor))
+#define GLADE_SPIN_BUTTON_EDITOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_SPIN_BUTTON_EDITOR, GladeSpinButtonEditorClass))
+#define GLADE_IS_SPIN_BUTTON_EDITOR(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GLADE_TYPE_SPIN_BUTTON_EDITOR))
+#define GLADE_IS_SPIN_BUTTON_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GLADE_TYPE_SPIN_BUTTON_EDITOR))
+#define GLADE_SPIN_BUTTON_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GLADE_TYPE_SPIN_BUTTON_EDITOR, GladeSpinButtonEditorClass))
+
+typedef struct _GladeSpinButtonEditor        GladeSpinButtonEditor;
+typedef struct _GladeSpinButtonEditorClass   GladeSpinButtonEditorClass;
+typedef struct _GladeSpinButtonEditorPrivate GladeSpinButtonEditorPrivate;
+
+struct _GladeSpinButtonEditor
+{
+  GladeEntryEditor  parent;
+
+  GladeSpinButtonEditorPrivate *priv;
+};
+
+struct _GladeSpinButtonEditorClass
+{
+  GladeEntryEditorClass parent;
+};
+
+GType            glade_spin_button_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_spin_button_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_SPIN_BUTTON_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-spin-button-editor.ui b/plugins/gtk+/glade-spin-button-editor.ui
new file mode 100644
index 0000000..b6d84ea
--- /dev/null
+++ b/plugins/gtk+/glade-spin-button-editor.ui
@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+  <!-- interface-requires gladeui 0.0 -->
+  <!-- interface-requires gtk+ 3.10 -->
+  <!-- interface-requires glade-gtk-plugin 0.0 -->
+  <template class="GladeSpinButtonEditor" parent="GladeEntryEditor">
+    <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="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="title">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">center</property>
+                <property name="label" translatable="yes">Spin Button Attributes</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">6</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyLabel" id="adj_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">12</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">adjustment</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyShell" id="adj_editor">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">adjustment</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyLabel" id="orientation_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">12</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">orientation</property>
+                <property name="custom_text" translatable="yes">Button Orientation:</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">5</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyShell" id="orientation_editor">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">orientation</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">5</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyLabel" id="policy_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">12</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">update-policy</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">6</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyShell" id="policy_editor">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">update-policy</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">6</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyLabel" id="climb_rate_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">12</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">climb-rate</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">4</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyShell" id="climb_rate_editor">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">climb-rate</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">4</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyLabel" id="digits_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">12</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">digits</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyShell" id="digits_editor">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">digits</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">3</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyShell" id="snap_to_ticks_editor">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">snap-to-ticks</property>
+                <property name="editor_type">GladeEpropCheck</property>
+              </object>
+              <packing>
+                <property name="left_attach">3</property>
+                <property name="top_attach">7</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyShell" id="numeric_editor">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">12</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">numeric</property>
+                <property name="editor_type">GladeEpropCheck</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">7</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyShell" id="wrap_editor">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">wrap</property>
+                <property name="editor_type">GladeEpropCheck</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">7</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyLabel" id="value_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">12</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">value</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GladePropertyShell" id="value_editor">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">False</property>
+                <property name="property_name">value</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </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="adj_label"/>
+      <editor id="adj_editor"/>
+      <editor id="orientation_label"/>
+      <editor id="orientation_editor"/>
+      <editor id="policy_label"/>
+      <editor id="policy_editor"/>
+      <editor id="climb_rate_label"/>
+      <editor id="climb_rate_editor"/>
+      <editor id="digits_label"/>
+      <editor id="digits_editor"/>
+      <editor id="snap_to_ticks_editor"/>
+      <editor id="numeric_editor"/>
+      <editor id="wrap_editor"/>
+      <editor id="value_label"/>
+      <editor id="value_editor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index e3f34d2..c139db5 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1265,6 +1265,7 @@ embedded in another object</_tooltip>
     <glade-widget-class name="GtkSpinButton" generic-name="spinbutton" _title="Spin Button">
       <post-create-function>empty</post-create-function>
       <set-property-function>glade_gtk_spin_button_set_property</set-property-function>
+      <create-editable-function>glade_gtk_spin_button_create_editable</create-editable-function>
 
       <signals>
        <signal id="wrapped" since="2.10"/>
@@ -1272,10 +1273,15 @@ embedded in another object</_tooltip>
       </signals>
 
       <properties>
-        <property id="text" disabled="True"/>
-        <property id="value" disabled="True"/>
-        <property id="adjustment" default="0 0 100 1 10 0"/>
-        <property id="update-policy">
+       <property id="snap-to-ticks" custom-layout="True"/>
+       <property id="climb-rate" custom-layout="True"/>
+       <property id="digits" custom-layout="True"/>
+       <property id="numeric" custom-layout="True"/>
+       <property id="value" custom-layout="True"/>
+       <property id="wrap" custom-layout="True"/>
+       <property id="orientation" custom-layout="True"/>
+        <property id="adjustment" default="0 0 100 1 10 0" custom-layout="True"/>
+        <property id="update-policy" custom-layout="True">
          <displayable-values>
            <value id="GTK_UPDATE_ALWAYS" _name="Always"/>
            <value id="GTK_UPDATE_IF_VALID" _name="If Valid"/>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 56606e1..6e442da 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -137,6 +137,7 @@ plugins/gtk+/glade-label-editor.c
 plugins/gtk+/glade-message-dialog-editor.c
 plugins/gtk+/glade-model-data.c
 plugins/gtk+/glade-notebook-editor.c
+plugins/gtk+/glade-spin-button-editor.c
 plugins/gtk+/glade-recent-action-editor.c
 plugins/gtk+/glade-recent-chooser-dialog-editor.c
 plugins/gtk+/glade-recent-chooser-editor.c
@@ -170,6 +171,7 @@ plugins/gtk+/gtk+.xml.in
 [type: gettext/glade]plugins/gtk+/glade-label-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-message-dialog-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-notebook-editor.ui
+[type: gettext/glade]plugins/gtk+/glade-spin-button-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-recent-action-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-recent-chooser-dialog-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-recent-chooser-editor.ui


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