[glade] Revert "Remove GtkSwitch and GtkInfoBar support"



commit 61e1c035c3f69cff8c2b0bb753be54032c3de38e
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Wed Apr 6 11:59:05 2011 -0300

    Revert "Remove GtkSwitch and GtkInfoBar support"
    
    This reverts commit 746553e2029e3b646e75682804f874fa048d68ae.

 plugins/gtk+/Makefile.am             |    2 +
 plugins/gtk+/glade-gtk-info-bar.c    |   53 +++++++++++++++++++++++++
 plugins/gtk+/glade-gtk-switch.c      |   71 ++++++++++++++++++++++++++++++++++
 plugins/gtk+/glade-gtk.c             |    2 +-
 plugins/gtk+/gtk+.xml.in             |   40 +++++++++++++++++++
 plugins/gtk+/icons/16x16/Makefile.am |    2 +
 plugins/gtk+/icons/22x22/Makefile.am |    2 +
 7 files changed, 171 insertions(+), 1 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index ac1d2b3..19364b1 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -45,7 +45,9 @@ libgladegtk_la_SOURCES = \
 	glade-gtk-table.c \
 	glade-gtk-grid.c \
 	glade-gtk-action-widgets.c \
+	glade-gtk-info-bar.c \
 	glade-gtk-activatable.c \
+	glade-gtk-switch.c \
 	glade-gtk-marshallers.c
 
 libgladegtk_la_LDFLAGS     = -module -avoid-version $(AM_LDFLAGS)
diff --git a/plugins/gtk+/glade-gtk-info-bar.c b/plugins/gtk+/glade-gtk-info-bar.c
new file mode 100644
index 0000000..ba45dc9
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-info-bar.c
@@ -0,0 +1,53 @@
+/*
+ * glade-gtk-info-bar.c
+ *
+ * Copyright (C) 2011 Juan Pablo Ugarte.
+ *
+ * Author:
+ *   Juan Pablo Ugarte <juanpablougarte 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 <gladeui/glade.h>
+#include "glade-gtk-action-widgets.h"
+
+void
+glade_gtk_info_bar_read_child (GladeWidgetAdaptor *adaptor,
+                               GladeWidget *widget,
+                               GladeXmlNode *node)
+{
+  GWA_GET_CLASS (GTK_TYPE_CONTAINER)->read_child (adaptor, widget, node);
+
+  node = glade_xml_node_get_parent (node);
+  
+  glade_gtk_action_widgets_read_child (widget, node, "action_area");
+}
+
+void
+glade_gtk_info_bar_write_child (GladeWidgetAdaptor *adaptor,
+                                GladeWidget *widget,
+                                GladeXmlContext *context,
+                                GladeXmlNode *node)
+{
+  GladeWidget *parent = glade_widget_get_parent (widget);
+
+  GWA_GET_CLASS (GTK_TYPE_BOX)->write_child (adaptor, widget, context, node);
+
+  if (parent && GTK_IS_INFO_BAR (glade_widget_get_object (parent)))
+    glade_gtk_action_widgets_write_child (parent, context, node, "action_area");
+}
diff --git a/plugins/gtk+/glade-gtk-switch.c b/plugins/gtk+/glade-gtk-switch.c
new file mode 100644
index 0000000..5dba443
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-switch.c
@@ -0,0 +1,71 @@
+/*
+ * glade-gtk-switch.c
+ *
+ * Copyright (C) 2011 Juan Pablo Ugarte.
+ *
+ * Author:
+ *   Juan Pablo Ugarte <juanpablougarte 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 "glade-gtk-activatable.h"
+#include "glade-activatable-editor.h"
+
+GladeEditable *
+glade_gtk_switch_create_editable (GladeWidgetAdaptor *adaptor,
+                                  GladeEditorPageType type)
+{
+  GladeEditable *editable;
+
+  /* Get base editable */
+  editable = GWA_GET_CLASS (GTK_TYPE_WIDGET)->create_editable (adaptor, type);
+
+  if (type == GLADE_PAGE_GENERAL)
+    return (GladeEditable *) glade_activatable_editor_new (adaptor, editable);
+
+  return editable;
+}
+
+void
+glade_gtk_switch_post_create (GladeWidgetAdaptor *adaptor,
+                              GObject *widget,
+                              GladeCreateReason reason)
+{
+  GladeWidget *gwidget;
+  
+  if (reason != GLADE_CREATE_LOAD) return;
+
+  g_return_if_fail (GTK_IS_SWITCH (widget));
+  gwidget = glade_widget_get_from_gobject (widget);
+  g_return_if_fail (GLADE_IS_WIDGET (gwidget));
+
+  g_signal_connect (glade_widget_get_project (gwidget), "parse-finished",
+                    G_CALLBACK (glade_gtk_activatable_parse_finished),
+                    gwidget);
+}
+
+void
+glade_gtk_switch_set_property (GladeWidgetAdaptor *adaptor,
+                               GObject *object,
+                               const gchar *id,
+                               const GValue *value)
+{
+  glade_gtk_activatable_evaluate_property_sensitivity (object, id, value);
+
+  GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value);
+}
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index b10521d..0f3f8ba 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -3939,7 +3939,7 @@ glade_gtk_dialog_post_create (GladeWidgetAdaptor *adaptor,
   if (reason == GLADE_CREATE_USER)
     {
       /* HIG complient spacing defaults on dialogs */
-      glade_widget_property_set (vbox_widget, _("spacing"), 2);
+      glade_widget_property_set (vbox_widget, "spacing", 2);
 
       if (GTK_IS_ABOUT_DIALOG (object) ||
           GTK_IS_FILE_CHOOSER_DIALOG (object))
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 3676ebf..0b6e5a1 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1112,6 +1112,22 @@ embedded in another object</_tooltip>
       </properties>
     </glade-widget-class>
 
+    <glade-widget-class name="GtkSwitch" generic-name="switch" _title="Switch">
+      <post-create-function>glade_gtk_switch_post_create</post-create-function>
+      <set-property-function>glade_gtk_switch_set_property</set-property-function>
+      <create-editable-function>glade_gtk_switch_create_editable</create-editable-function>
+      <properties>
+        <!-- GtkActivatable -->
+        <property id="related-action" _name="Related Action" custom-layout="True">
+      	  <parameter-spec>
+	    <type>GParamObject</type>
+	    <value-type>GtkToggleAction</value-type>
+          </parameter-spec>
+        </property>
+        <property id="use-action-appearance" _name="Use Action Appearance" custom-layout="True" default="False"/>
+      </properties>
+    </glade-widget-class>
+
     <glade-widget-class name="GtkFileChooserButton" generic-name="filechooserbutton" _title="File Chooser Button">
       <set-property-function>glade_gtk_file_chooser_button_set_property</set-property-function>
 
@@ -1758,6 +1774,27 @@ embedded in another object</_tooltip>
     </glade-widget-class>
     
     <glade-widget-class name="GtkDrawingArea" generic-name="drawingarea" _title="Drawing Area"/>
+    
+    <glade-widget-class name="GtkInfoBar" generic-name="infobar" _title="Info Bar">
+      <read-child-function>glade_gtk_info_bar_read_child</read-child-function>
+      <write-child-function>glade_gtk_info_bar_write_child</write-child-function>
+      <internal-children>
+        <object name="action_area"/>
+        <object name="content_area"/>
+      </internal-children>
+      <properties>
+	<property id="message-type">
+  	  <displayable-values>
+	    <value id="GTK_MESSAGE_INFO" _name="Info"/>
+	    <value id="GTK_MESSAGE_WARNING" _name="Warning"/>
+	    <value id="GTK_MESSAGE_QUESTION" _name="Question"/>
+	    <value id="GTK_MESSAGE_ERROR" _name="Error"/>
+	    <value id="GTK_MESSAGE_OTHER" _name="Other"/>
+	  </displayable-values>
+	</property>
+        <property id="size" query="True" ignore="True" disabled="True"/>
+      </properties>
+    </glade-widget-class>
 
     <glade-widget-class name="GtkEventBox" generic-name="eventbox" _title="Event Box"/>
 
@@ -3736,6 +3773,7 @@ embedded in another object</_tooltip>
     <glade-widget-class-ref name="GtkToggleButton"/>
     <glade-widget-class-ref name="GtkCheckButton"/>
     <glade-widget-class-ref name="GtkRadioButton"/>
+    <glade-widget-class-ref name="GtkSwitch"/>
 
     <glade-widget-class-ref name="GtkEntry"/>
     <glade-widget-class-ref name="GtkSpinButton"/>
@@ -3774,6 +3812,8 @@ embedded in another object</_tooltip>
     <glade-widget-class-ref name="GtkSeparator"/>
     <glade-widget-class-ref name="GtkArrow"/>
     <glade-widget-class-ref name="GtkDrawingArea"/>
+
+    <glade-widget-class-ref name="GtkInfoBar"/>
   </glade-widget-group>
 
   <glade-widget-group name="gtk-composite" _title="Composite Widgets">
diff --git a/plugins/gtk+/icons/16x16/Makefile.am b/plugins/gtk+/icons/16x16/Makefile.am
index c0d1008..d91bfc3 100644
--- a/plugins/gtk+/icons/16x16/Makefile.am
+++ b/plugins/gtk+/icons/16x16/Makefile.am
@@ -61,6 +61,7 @@ icons_DATA = \
         widget-gtk-iconview.png \
         widget-gtk-image.png \
         widget-gtk-imagemenuitem.png \
+	widget-gtk-infobar.png \
         widget-gtk-inputdialog.png \
         widget-gtk-label.png \
         widget-gtk-layout.png \
@@ -103,6 +104,7 @@ icons_DATA = \
 	widget-gtk-texttagtable.png \
         widget-gtk-textview.png \
         widget-gtk-togglebutton.png \
+        widget-gtk-switch.png \
         widget-gtk-toggletoolbutton.png \
         widget-gtk-toolbar.png \
         widget-gtk-toolbutton.png \
diff --git a/plugins/gtk+/icons/22x22/Makefile.am b/plugins/gtk+/icons/22x22/Makefile.am
index 128a8f0..d8fbeff 100644
--- a/plugins/gtk+/icons/22x22/Makefile.am
+++ b/plugins/gtk+/icons/22x22/Makefile.am
@@ -61,6 +61,7 @@ icons_DATA = \
         widget-gtk-iconview.png \
         widget-gtk-image.png \
         widget-gtk-imagemenuitem.png \
+	widget-gtk-infobar.png \
         widget-gtk-inputdialog.png \
         widget-gtk-label.png \
         widget-gtk-layout.png \
@@ -103,6 +104,7 @@ icons_DATA = \
 	widget-gtk-texttagtable.png \
         widget-gtk-textview.png \
         widget-gtk-togglebutton.png \
+	widget-gtk-switch.png \
         widget-gtk-toggletoolbutton.png \
         widget-gtk-toolbar.png \
         widget-gtk-toolbutton.png \



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