[glade] Added GladeComboBoxTextEditor



commit bf0f4e00378e1b829c17359646fa60a65e2d9a76
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun May 12 21:36:33 2013 +0900

    Added GladeComboBoxTextEditor

 plugins/gtk+/Makefile.am                       |    3 +
 plugins/gtk+/glade-combo-box-text-editor.c     |   74 +++++++++
 plugins/gtk+/glade-combo-box-text-editor.h     |   56 +++++++
 plugins/gtk+/glade-combo-box-text-editor.ui    |  203 ++++++++++++++++++++++++
 plugins/gtk+/glade-gtk-combo-box-text.c        |   14 ++
 plugins/gtk+/glade-gtk-resources.gresource.xml |    1 +
 plugins/gtk+/gtk+.xml.in                       |   19 ++-
 po/POTFILES.in                                 |    2 +
 8 files changed, 371 insertions(+), 1 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 8f8cfd3..0c17213 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -34,6 +34,7 @@ libgladegtk_la_SOURCES =              \
        glade-button-editor.c           \
        glade-cell-renderer-editor.c    \
        glade-column-types.c            \
+       glade-combo-box-text-editor.c   \
        glade-entry-editor.c            \
        glade-file-chooser-button-editor.c \
        glade-file-chooser-dialog-editor.c \
@@ -143,6 +144,7 @@ noinst_HEADERS =                    \
        glade-button-editor.h           \
        glade-cell-renderer-editor.h    \
        glade-column-types.h            \
+       glade-combo-box-text-editor.h   \
        glade-entry-editor.h            \
        glade-file-chooser-button-editor.h \
        glade-file-chooser-dialog-editor.h \
@@ -218,6 +220,7 @@ UI_FILES =                          \
        glade-app-chooser-widget-editor.ui \
        glade-box-editor.ui             \
        glade-button-editor.ui          \
+       glade-combo-box-text-editor.ui  \
        glade-entry-editor.ui           \
        glade-file-chooser-button-editor.ui \
        glade-file-chooser-dialog-editor.ui \
diff --git a/plugins/gtk+/glade-combo-box-text-editor.c b/plugins/gtk+/glade-combo-box-text-editor.c
new file mode 100644
index 0000000..368c56e
--- /dev/null
+++ b/plugins/gtk+/glade-combo-box-text-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-combo-box-text-editor.h"
+
+static void glade_combo_box_text_editor_grab_focus (GtkWidget * widget);
+
+struct _GladeComboBoxTextEditorPrivate
+{
+  GtkWidget *embed;
+};
+
+G_DEFINE_TYPE (GladeComboBoxTextEditor, glade_combo_box_text_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_combo_box_text_editor_class_init (GladeComboBoxTextEditorClass * klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  widget_class->grab_focus = glade_combo_box_text_editor_grab_focus;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/gladegtk/glade-combo-box-text-editor.ui");
+  gtk_widget_class_bind_child (widget_class, GladeComboBoxTextEditorPrivate, embed);
+
+  g_type_class_add_private (object_class, sizeof (GladeComboBoxTextEditorPrivate));  
+}
+
+static void
+glade_combo_box_text_editor_init (GladeComboBoxTextEditor * self)
+{
+  self->priv = 
+    G_TYPE_INSTANCE_GET_PRIVATE (self,
+                                GLADE_TYPE_COMBO_BOX_TEXT_EDITOR,
+                                GladeComboBoxTextEditorPrivate);
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+static void
+glade_combo_box_text_editor_grab_focus (GtkWidget * widget)
+{
+  GladeComboBoxTextEditor *combo_editor = GLADE_COMBO_BOX_TEXT_EDITOR (widget);
+
+  gtk_widget_grab_focus (combo_editor->priv->embed);
+}
+
+GtkWidget *
+glade_combo_box_text_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_COMBO_BOX_TEXT_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-combo-box-text-editor.h b/plugins/gtk+/glade-combo-box-text-editor.h
new file mode 100644
index 0000000..8579973
--- /dev/null
+++ b/plugins/gtk+/glade-combo-box-text-editor.h
@@ -0,0 +1,56 @@
+/*
+ * 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_COMBO_BOX_TEXT_EDITOR_H_
+#define _GLADE_COMBO_BOX_TEXT_EDITOR_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_COMBO_BOX_TEXT_EDITOR                 (glade_combo_box_text_editor_get_type ())
+#define GLADE_COMBO_BOX_TEXT_EDITOR(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_COMBO_BOX_TEXT_EDITOR, GladeComboBoxTextEditor))
+#define GLADE_COMBO_BOX_TEXT_EDITOR_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_COMBO_BOX_TEXT_EDITOR, GladeComboBoxTextEditorClass))
+#define GLADE_IS_COMBO_BOX_TEXT_EDITOR(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GLADE_TYPE_COMBO_BOX_TEXT_EDITOR))
+#define GLADE_IS_COMBO_BOX_TEXT_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GLADE_TYPE_COMBO_BOX_TEXT_EDITOR))
+#define GLADE_COMBO_BOX_TEXT_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GLADE_TYPE_COMBO_BOX_TEXT_EDITOR, GladeComboBoxTextEditorClass))
+
+typedef struct _GladeComboBoxTextEditor        GladeComboBoxTextEditor;
+typedef struct _GladeComboBoxTextEditorClass   GladeComboBoxTextEditorClass;
+typedef struct _GladeComboBoxTextEditorPrivate GladeComboBoxTextEditorPrivate;
+
+struct _GladeComboBoxTextEditor
+{
+  GladeEditorSkeleton  parent;
+
+  GladeComboBoxTextEditorPrivate *priv;
+};
+
+struct _GladeComboBoxTextEditorClass
+{
+  GladeEditorSkeletonClass parent;
+};
+
+GType            glade_combo_box_text_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_combo_box_text_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_COMBO_BOX_TEXT_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-combo-box-text-editor.ui b/plugins/gtk+/glade-combo-box-text-editor.ui
new file mode 100644
index 0000000..53b5dc4
--- /dev/null
+++ b/plugins/gtk+/glade-combo-box-text-editor.ui
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+  <!-- interface-requires gladeui 0.0 -->
+  <!-- interface-requires gtk+ 3.10 -->
+  <template class="GladeComboBoxTextEditor" 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">center</property>
+            <property name="label" translatable="yes">Combo Box Text 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="items_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">glade-items</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="items_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="property_name">glade-items</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+            <property name="width">6</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="focus_on_click_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">focus-on-click</property>
+            <property name="editor_type">GladeEpropCheck</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="popup_fixed_width_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">popup-fixed-width</property>
+            <property name="editor_type">GladeEpropCheck</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">6</property>
+            <property name="width">3</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="active_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">active</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="GladePropertyLabel" id="active_id_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">active-id</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="active_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">active</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">4</property>
+            <property name="width">3</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="active_id_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">active-id</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">5</property>
+            <property name="width">3</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>
+      </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="items_label"/>
+      <editor id="items_editor"/>
+      <editor id="focus_on_click_editor"/>
+      <editor id="popup_fixed_width_editor"/>
+      <editor id="active_label"/>
+      <editor id="active_id_label"/>
+      <editor id="active_editor"/>
+      <editor id="active_id_editor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/glade-gtk-combo-box-text.c b/plugins/gtk+/glade-gtk-combo-box-text.c
index 2553796..b8b97a9 100644
--- a/plugins/gtk+/glade-gtk-combo-box-text.c
+++ b/plugins/gtk+/glade-gtk-combo-box-text.c
@@ -26,10 +26,24 @@
 #include <gladeui/glade.h>
 
 #include "glade-string-list.h"
+#include "glade-combo-box-text-editor.h"
 
 #define GLADE_TAG_ITEMS  "items"
 #define GLADE_TAG_ITEM   "item"
 
+
+GladeEditable *
+glade_gtk_combo_box_text_create_editable (GladeWidgetAdaptor * adaptor,
+                                         GladeEditorPageType type)
+{
+  if (type == GLADE_PAGE_GENERAL)
+    {
+      return (GladeEditable *) glade_combo_box_text_editor_new ();
+    }
+
+  return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
+}
+
 void
 glade_gtk_combo_box_text_post_create (GladeWidgetAdaptor *adaptor,
                                      GObject            *object, 
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index 3ed45ef..8698b32 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -8,6 +8,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-app-chooser-widget-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-text-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-entry-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-file-chooser-button-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-file-chooser-dialog-editor.ui</file>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index ec006df..5d49a40 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1567,6 +1567,7 @@ range of values</_tooltip>
 
 
     <glade-widget-class name="GtkComboBoxText" generic-name="comboboxtext" _title="Combo Box Text">
+      <create-editable-function>glade_gtk_combo_box_text_create_editable</create-editable-function>
       <post-create-function>glade_gtk_combo_box_text_post_create</post-create-function>
       
<create-editor-property-function>glade_gtk_combo_box_text_create_eprop</create-editor-property-function>
       <string-from-value-function>glade_gtk_combo_box_text_string_from_value</string-from-value-function>
@@ -1576,7 +1577,23 @@ range of values</_tooltip>
 
       <properties>
         <property id="model" disabled="True"/>
-       <property id="glade-items" _name="Items" save="False" since="2.24">
+       <property id="wrap-width" disabled="True"/>
+       <property id="row-span-column" disabled="True"/>
+       <property id="column-span-column" disabled="True"/>
+       <property id="add-tearoffs" disabled="True"/>
+       <property id="has-frame" disabled="True"/>
+       <property id="tearoff-title" disabled="True"/>
+       <property id="has-entry" disabled="True"/>
+       <property id="button-sensitivity" disabled="True"/>
+       <property id="entry-text-column" disabled="True"/>
+       <property id="id-column" disabled="True"/>
+       <property id="cell-area" disabled="True"/>
+
+       <property id="active" custom-layout="True"/>
+       <property id="active-id" custom-layout="True"/>
+       <property id="focus-on-click" custom-layout="True"/>
+       <property id="popup-fixed-width" custom-layout="True"/>
+       <property id="glade-items" _name="Items" save="False" since="2.24" custom-layout="True">
          <parameter-spec>
            <type>GParamBoxed</type>
            <value-type>GladeStringList</value-type>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 241f957..a639e42 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -63,6 +63,7 @@ plugins/gtk+/glade-box-editor.c
 plugins/gtk+/glade-button-editor.c
 plugins/gtk+/glade-cell-renderer-editor.c
 plugins/gtk+/glade-column-types.c
+plugins/gtk+/glade-combo-box-text-editor.c
 plugins/gtk+/glade-entry-editor.c
 plugins/gtk+/glade-file-chooser-button-editor.c
 plugins/gtk+/glade-file-chooser-dialog-editor.c
@@ -165,6 +166,7 @@ plugins/gtk+/gtk+.xml.in
 [type: gettext/glade]plugins/gtk+/glade-app-chooser-widget-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-text-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-entry-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-file-chooser-button-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-file-chooser-dialog-editor.ui


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