[glade] Added GladeLevelBarEditor



commit 67b013bc1eb6b51662f13d993f9ed6ac1a2111a5
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 18 19:23:59 2013 +0900

    Added GladeLevelBarEditor

 plugins/gtk+/Makefile.am                       |    4 +
 plugins/gtk+/glade-gtk-level-bar.c             |   40 ++++
 plugins/gtk+/glade-gtk-resources.gresource.xml |    1 +
 plugins/gtk+/glade-level-bar-editor.c          |   74 ++++++
 plugins/gtk+/glade-level-bar-editor.h          |   57 +++++
 plugins/gtk+/glade-level-bar-editor.ui         |  294 ++++++++++++++++++++++++
 plugins/gtk+/gtk+.xml.in                       |    9 +-
 po/POTFILES.in                                 |    3 +
 8 files changed, 480 insertions(+), 2 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index d55eda5..aad5557 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -76,6 +76,7 @@ libgladegtk_la_SOURCES =              \
        glade-gtk-image-menu-item.c     \
        glade-gtk-info-bar.c            \
        glade-gtk-label.c               \
+       glade-gtk-level-bar.c           \
        glade-gtk-list-store.c          \
        glade-gtk-menu.c                \
        glade-gtk-menu-bar.c            \
@@ -114,6 +115,7 @@ libgladegtk_la_SOURCES =            \
        glade-image-editor.c            \
        glade-image-item-editor.c       \
        glade-label-editor.c            \
+       glade-level-bar-editor.c        \
        glade-message-dialog-editor.c   \
        glade-model-data.c              \
        glade-notebook-editor.c         \
@@ -180,6 +182,7 @@ noinst_HEADERS =                    \
        glade-image-editor.h            \
        glade-image-item-editor.h       \
        glade-label-editor.h            \
+       glade-level-bar-editor.h        \
        glade-message-dialog-editor.h   \
        glade-model-data.h              \
        glade-notebook-editor.h         \
@@ -245,6 +248,7 @@ UI_FILES =                          \
        glade-grid-editor.ui            \
        glade-image-editor.ui           \
        glade-label-editor.ui           \
+       glade-level-bar-editor.ui       \
        glade-message-dialog-editor.ui  \
        glade-notebook-editor.ui        \
        glade-progress-bar-editor.ui    \
diff --git a/plugins/gtk+/glade-gtk-level-bar.c b/plugins/gtk+/glade-gtk-level-bar.c
new file mode 100644
index 0000000..71840ee
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-level-bar.c
@@ -0,0 +1,40 @@
+/*
+ * glade-gtk-level-bar.c - GladeWidgetAdaptor for GtkLevelBar
+ *
+ * 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-level-bar-editor.h"
+
+GladeEditable *
+glade_gtk_level_bar_create_editable (GladeWidgetAdaptor * adaptor,
+                                    GladeEditorPageType type)
+{
+  if (type == GLADE_PAGE_GENERAL)
+    {
+      return (GladeEditable *)glade_level_bar_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 85d5b1b..ae5901a 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -22,6 +22,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-grid-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-level-bar-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-message-dialog-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-progress-bar-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-notebook-editor.ui</file>
diff --git a/plugins/gtk+/glade-level-bar-editor.c b/plugins/gtk+/glade-level-bar-editor.c
new file mode 100644
index 0000000..c18ea63
--- /dev/null
+++ b/plugins/gtk+/glade-level-bar-editor.c
@@ -0,0 +1,74 @@
+/*
+ * 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-level-bar-editor.h"
+
+struct _GladeLevelBarEditorPrivate
+{
+  GtkWidget *embed;
+};
+
+static void glade_level_bar_editor_grab_focus (GtkWidget * widget);
+
+G_DEFINE_TYPE (GladeLevelBarEditor, glade_level_bar_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_level_bar_editor_class_init (GladeLevelBarEditorClass * klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  widget_class->grab_focus = glade_level_bar_editor_grab_focus;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/gladegtk/glade-level-bar-editor.ui");
+  gtk_widget_class_bind_child (widget_class, GladeLevelBarEditorPrivate, embed);
+
+  g_type_class_add_private (object_class, sizeof (GladeLevelBarEditorPrivate));
+}
+
+static void
+glade_level_bar_editor_init (GladeLevelBarEditor * self)
+{
+  self->priv = 
+    G_TYPE_INSTANCE_GET_PRIVATE (self,
+                                GLADE_TYPE_LEVEL_BAR_EDITOR,
+                                GladeLevelBarEditorPrivate);
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+static void
+glade_level_bar_editor_grab_focus (GtkWidget * widget)
+{
+  GladeLevelBarEditor *pbar_editor = GLADE_LEVEL_BAR_EDITOR (widget);
+
+  gtk_widget_grab_focus (pbar_editor->priv->embed);
+}
+
+GtkWidget *
+glade_level_bar_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_LEVEL_BAR_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-level-bar-editor.h b/plugins/gtk+/glade-level-bar-editor.h
new file mode 100644
index 0000000..dad5a44
--- /dev/null
+++ b/plugins/gtk+/glade-level-bar-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_LEVEL_BAR_EDITOR_H_
+#define _GLADE_LEVEL_BAR_EDITOR_H_
+
+#include <gtk/gtk.h>
+#include <gladeui/glade.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_LEVEL_BAR_EDITOR                (glade_level_bar_editor_get_type ())
+#define GLADE_LEVEL_BAR_EDITOR(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_LEVEL_BAR_EDITOR, GladeLevelBarEditor))
+#define GLADE_LEVEL_BAR_EDITOR_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_LEVEL_BAR_EDITOR, GladeLevelBarEditorClass))
+#define GLADE_IS_LEVEL_BAR_EDITOR(obj)     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_LEVEL_BAR_EDITOR))
+#define GLADE_IS_LEVEL_BAR_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GLADE_TYPE_LEVEL_BAR_EDITOR))
+#define GLADE_LEVEL_BAR_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GLADE_TYPE_LEVEL_BAR_EDITOR, GladeLevelBarEditorClass))
+
+typedef struct _GladeLevelBarEditor        GladeLevelBarEditor;
+typedef struct _GladeLevelBarEditorClass   GladeLevelBarEditorClass;
+typedef struct _GladeLevelBarEditorPrivate GladeLevelBarEditorPrivate;
+
+struct _GladeLevelBarEditor
+{
+  GladeEditorSkeleton  parent;
+
+  GladeLevelBarEditorPrivate *priv;
+};
+
+struct _GladeLevelBarEditorClass
+{
+  GladeEditorSkeletonClass parent;
+};
+
+GType            glade_level_bar_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_level_bar_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_LEVEL_BAR_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-level-bar-editor.ui b/plugins/gtk+/glade-level-bar-editor.ui
new file mode 100644
index 0000000..bd8b653
--- /dev/null
+++ b/plugins/gtk+/glade-level-bar-editor.ui
@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+  <!-- interface-requires gladeui 0.0 -->
+  <!-- interface-requires gtk+ 3.10 -->
+  <template class="GladeLevelBarEditor" parent="GladeEditorSkeleton">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkGrid" id="grid">
+        <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="GladeEditorTable" id="embed">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </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="GtkLabel" id="title">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">start</property>
+            <property name="label" translatable="yes">Level Bar Attributes</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+            <property name="width">6</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>
+          </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="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">2</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="mode_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">mode</property>
+            <property name="custom_text" translatable="yes">Indicator Mode:</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="GladePropertyLabel" id="min_value_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">end</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">min-value</property>
+            <property name="custom_text" translatable="yes">Minimum:</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="mode_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">mode</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">3</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="min_value_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">min-value</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">5</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="inverted_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">inverted</property>
+            <property name="editor_type">GladeEpropCheck</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">4</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="max_value_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">end</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">max-value</property>
+            <property name="custom_text" translatable="yes">Maximum:</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="GladePropertyLabel" id="value_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">end</property>
+            <property name="margin_left">12</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">value</property>
+            <property name="custom_text" translatable="yes">Value:</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="max_value_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">max-value</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">6</property>
+            <property name="width">1</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">7</property>
+            <property name="width">1</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>
+        <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>
+    <child-editors>
+      <editor id="embed"/>
+      <editor id="orientation_label"/>
+      <editor id="orientation_editor"/>
+      <editor id="mode_label"/>
+      <editor id="min_value_label"/>
+      <editor id="mode_editor"/>
+      <editor id="min_value_editor"/>
+      <editor id="inverted_editor"/>
+      <editor id="max_value_label"/>
+      <editor id="value_label"/>
+      <editor id="max_value_editor"/>
+      <editor id="value_editor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 82546c7..3d95e3a 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1653,9 +1653,14 @@ range of values</_tooltip>
     </glade-widget-class>
 
     <glade-widget-class name="GtkLevelBar" generic-name="levelbar" _title="Level Bar" since="3.6">
+      <create-editable-function>glade_gtk_level_bar_create_editable</create-editable-function>
       <properties>
-       <property id="inverted" since="3.8"/>
-       <property id="mode">
+       <property id="orientation" custom-layout="True"/>
+       <property id="value" custom-layout="True"/>
+       <property id="min-value" custom-layout="True"/>
+       <property id="max-value" custom-layout="True"/>
+       <property id="inverted" since="3.8" custom-layout="True"/>
+       <property id="mode" custom-layout="True">
          <displayable-values>
            <value id="GTK_LEVEL_BAR_MODE_CONTINUOUS" _name="Continuous"/>
            <value id="GTK_LEVEL_BAR_MODE_DISCRETE" _name="Discrete"/>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index da8bdea..ad24c2f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -105,6 +105,7 @@ plugins/gtk+/glade-gtk-image.c
 plugins/gtk+/glade-gtk-image-menu-item.c
 plugins/gtk+/glade-gtk-info-bar.c
 plugins/gtk+/glade-gtk-label.c
+plugins/gtk+/glade-gtk-level-bar.c
 plugins/gtk+/glade-gtk-list-store.c
 plugins/gtk+/glade-gtk-menu.c
 plugins/gtk+/glade-gtk-menu-bar.c
@@ -143,6 +144,7 @@ plugins/gtk+/glade-icon-sources.c
 plugins/gtk+/glade-image-editor.c
 plugins/gtk+/glade-image-item-editor.c
 plugins/gtk+/glade-label-editor.c
+plugins/gtk+/glade-level-bar-editor.c
 plugins/gtk+/glade-message-dialog-editor.c
 plugins/gtk+/glade-model-data.c
 plugins/gtk+/glade-notebook-editor.c
@@ -186,6 +188,7 @@ plugins/gtk+/gtk+.xml.in
 [type: gettext/glade]plugins/gtk+/glade-grid-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-image-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-label-editor.ui
+[type: gettext/glade]plugins/gtk+/glade-level-bar-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-progress-bar-editor.ui


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