[glade] Bug 351645 - Use a GladeEPropEnumInt for the response ID



commit 1888215191f02b6b0427f786c523c9d3128f0e9f
Author: Tristan Van Berkom <tristan vanberkom codethink co uk>
Date:   Sat Oct 29 22:17:32 2016 +0900

    Bug 351645 - Use a GladeEPropEnumInt for the response ID
    
    Also add displayable values for the response ID
    
    Patches contributed by Lukas K <lu 0x83 eu>

 plugins/gtk+/glade-gtk-button.c |   20 ++++++++++++++++++++
 plugins/gtk+/gtk+.xml.in        |   36 +++++++++++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-button.c b/plugins/gtk+/glade-gtk-button.c
index b980d6f..ae6918f 100644
--- a/plugins/gtk+/glade-gtk-button.c
+++ b/plugins/gtk+/glade-gtk-button.c
@@ -28,6 +28,7 @@
 #include "glade-button-editor.h"
 #include "glade-scale-button-editor.h"
 #include "glade-font-button-editor.h"
+#include "glade-eprop-enum-int.h"
 #include "glade-gtk.h"
 #include "glade-gtk-button.h"
 
@@ -319,6 +320,25 @@ glade_gtk_button_write_widget (GladeWidgetAdaptor * adaptor,
 
 }
 
+GladeEditorProperty *
+glade_gtk_button_create_eprop (GladeWidgetAdaptor * adaptor,
+                                      GladePropertyClass * klass, 
+                                      gboolean use_command)
+{
+  GladeEditorProperty *eprop;
+
+  if (strcmp (glade_property_class_id(klass), "response-id")==0)
+    {
+      eprop = glade_eprop_enum_int_new (klass, GTK_TYPE_RESPONSE_TYPE, use_command);
+    }
+  else
+    eprop = GWA_GET_CLASS
+        (GTK_TYPE_WIDGET)->create_eprop (adaptor, klass, use_command);
+
+  return eprop;
+}
+
+
 /* Shared with other classes */
 void 
 glade_gtk_sync_use_appearance (GladeWidget *gwidget)
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index ef88a91..0f73720 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1686,13 +1686,47 @@
 
       <glade-widget-class name="GtkButton" generic-name="button" _title="Button">
         <post-create-function>glade_gtk_button_post_create</post-create-function>
+        <create-editor-property-function>glade_gtk_button_create_eprop</create-editor-property-function>
         <create-editable-function>glade_gtk_button_create_editable</create-editable-function>
         <set-property-function>glade_gtk_button_set_property</set-property-function>
         <read-widget-function>glade_gtk_button_read_widget</read-widget-function>
         <write-widget-function>glade_gtk_button_write_widget</write-widget-function>
         
         <properties>
-          <property id="always-show-image" since="3.6" custom-layout="True"/>
+
+          <!-- HACK: Add unused property to register GtkResponseType displayable values  -->
+          <property id="register-response-id-displayables" visible="False" save="False">
+            <parameter-spec>
+              <type>GParamEnum</type>
+             <value-type>GtkResponseType</value-type>
+            </parameter-spec>
+            <displayable-values>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_NONE" _name="None"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_REJECT" _name="Reject"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_ACCEPT" _name="Accept"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_DELETE_EVENT" _name="Delete Event"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_OK" _name="OK"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_CANCEL" _name="Cancel"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_CLOSE" _name="Close"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_YES" _name="Yes"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_NO" _name="No"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_APPLY" _name="Apply"/>
+              <!-- GtkResponseType enumeration value -->
+              <value id="GTK_RESPONSE_HELP" _name="Help"/>
+            </displayable-values>
+         </property>
+
+         <property id="always-show-image" since="3.6" custom-layout="True"/>
           <property id="receives-default" save-always="True"/>
           <property id="image" parentless-widget="True" create-type="GtkImage" custom-layout="True"/>
           <property id="use-stock" visible="False" custom-layout="True"/>


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