[glade] Added GladeFileChooserButtonEditor



commit defbbe8706c995a936e8fafc6f2f58d17606a8d5
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 4 21:56:41 2013 +0900

    Added GladeFileChooserButtonEditor
    
    Embeds GladeFileChooserEditor and formats a few extra properties

 plugins/gtk+/Makefile.am                         |    3 +
 plugins/gtk+/glade-file-chooser-button-editor.c  |   48 ++++++
 plugins/gtk+/glade-file-chooser-button-editor.h  |   57 +++++++
 plugins/gtk+/glade-file-chooser-button-editor.ui |  185 ++++++++++++++++++++++
 plugins/gtk+/glade-gtk-file-chooser-widget.c     |   16 ++-
 plugins/gtk+/glade-gtk-resources.gresource.xml   |    1 +
 plugins/gtk+/gtk+.xml.in                         |   30 +++-
 po/POTFILES.in                                   |    2 +
 8 files changed, 334 insertions(+), 8 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 00be4ac..675764b 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -31,6 +31,7 @@ libgladegtk_la_SOURCES =              \
        glade-cell-renderer-editor.c    \
        glade-column-types.c            \
        glade-entry-editor.c            \
+       glade-file-chooser-button-editor.c \
        glade-file-chooser-dialog-editor.c \
        glade-file-chooser-editor.c     \
        glade-file-chooser-widget-editor.c \
@@ -115,6 +116,7 @@ noinst_HEADERS =                    \
        glade-cell-renderer-editor.h    \
        glade-column-types.h            \
        glade-entry-editor.h            \
+       glade-file-chooser-button-editor.h \
        glade-file-chooser-dialog-editor.h \
        glade-file-chooser-editor.h     \
        glade-file-chooser-widget-editor.h \
@@ -170,6 +172,7 @@ UI_FILES =                          \
        glade-activatable-editor.ui     \
        glade-button-editor.ui          \
        glade-entry-editor.ui           \
+       glade-file-chooser-button-editor.ui \
        glade-file-chooser-dialog-editor.ui \
        glade-file-chooser-editor.ui    \
        glade-file-chooser-widget-editor.ui \
diff --git a/plugins/gtk+/glade-file-chooser-button-editor.c b/plugins/gtk+/glade-file-chooser-button-editor.c
new file mode 100644
index 0000000..6f467b3
--- /dev/null
+++ b/plugins/gtk+/glade-file-chooser-button-editor.c
@@ -0,0 +1,48 @@
+/*
+ * 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-file-chooser-button-editor.h"
+
+G_DEFINE_TYPE (GladeFileChooserButtonEditor, glade_file_chooser_button_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_file_chooser_button_editor_class_init (GladeFileChooserButtonEditorClass * klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/gladegtk/glade-file-chooser-button-editor.ui");
+}
+
+static void
+glade_file_chooser_button_editor_init (GladeFileChooserButtonEditor * self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+glade_file_chooser_button_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_FILE_CHOOSER_BUTTON_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-file-chooser-button-editor.h b/plugins/gtk+/glade-file-chooser-button-editor.h
new file mode 100644
index 0000000..55e040a
--- /dev/null
+++ b/plugins/gtk+/glade-file-chooser-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_FILE_CHOOSER_BUTTON_EDITOR_H_
+#define _GLADE_FILE_CHOOSER_BUTTON_EDITOR_H_
+
+#include <gtk/gtk.h>
+#include <gladeui/glade.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_FILE_CHOOSER_BUTTON_EDITOR              (glade_file_chooser_button_editor_get_type ())
+#define GLADE_FILE_CHOOSER_BUTTON_EDITOR(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_FILE_CHOOSER_BUTTON_EDITOR, GladeFileChooserButtonEditor))
+#define GLADE_FILE_CHOOSER_BUTTON_EDITOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_FILE_CHOOSER_BUTTON_EDITOR, GladeFileChooserButtonEditorClass))
+#define GLADE_IS_FILE_CHOOSER_BUTTON_EDITOR(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GLADE_TYPE_FILE_CHOOSER_BUTTON_EDITOR))
+#define GLADE_IS_FILE_CHOOSER_BUTTON_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GLADE_TYPE_FILE_CHOOSER_BUTTON_EDITOR))
+#define GLADE_FILE_CHOOSER_BUTTON_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GLADE_TYPE_FILE_CHOOSER_BUTTON_EDITOR, GladeFileChooserButtonEditorClass))
+
+typedef struct _GladeFileChooserButtonEditor        GladeFileChooserButtonEditor;
+typedef struct _GladeFileChooserButtonEditorClass   GladeFileChooserButtonEditorClass;
+typedef struct _GladeFileChooserButtonEditorPrivate GladeFileChooserButtonEditorPrivate;
+
+struct _GladeFileChooserButtonEditor
+{
+  GladeEditorSkeleton  parent;
+
+  GladeFileChooserButtonEditorPrivate *priv;
+};
+
+struct _GladeFileChooserButtonEditorClass
+{
+  GladeEditorSkeletonClass parent;
+};
+
+GType            glade_file_chooser_button_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_file_chooser_button_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_FILE_CHOOSER_BUTTON_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-file-chooser-button-editor.ui 
b/plugins/gtk+/glade-file-chooser-button-editor.ui
new file mode 100644
index 0000000..1e8a309
--- /dev/null
+++ b/plugins/gtk+/glade-file-chooser-button-editor.ui
@@ -0,0 +1,185 @@
+<?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="GladeFileChooserButtonEditor" 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="GladeFileChooserEditor" id="filechoosereditor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">6</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">File Chooser Button</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="title_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">title</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="title_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="property_name">title</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">2</property>
+            <property name="width">4</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="dialog_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">dialog</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="dialog_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="property_name">dialog</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">3</property>
+            <property name="width">4</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyLabel" id="width_chars_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">width-chars</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="width_chars_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">width-chars</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="focus_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">5</property>
+            <property name="width">5</property>
+            <property name="height">1</property>
+          </packing>
+        </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="filechoosereditor"/>
+      <editor id="title_label"/>
+      <editor id="title_editor"/>
+      <editor id="dialog_label"/>
+      <editor id="dialog_editor"/>
+      <editor id="width_chars_label"/>
+      <editor id="width_chars_editor"/>
+      <editor id="focus_editor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/glade-gtk-file-chooser-widget.c b/plugins/gtk+/glade-gtk-file-chooser-widget.c
index 500bdab..664e53c 100644
--- a/plugins/gtk+/glade-gtk-file-chooser-widget.c
+++ b/plugins/gtk+/glade-gtk-file-chooser-widget.c
@@ -37,6 +37,17 @@ glade_gtk_file_chooser_widget_post_create (GladeWidgetAdaptor * adaptor,
                         glade_gtk_file_chooser_default_forall, NULL);
 }
 
+GladeEditable *
+glade_gtk_file_chooser_widget_create_editable (GladeWidgetAdaptor *adaptor,
+                                              GladeEditorPageType type)
+{
+  if (type == GLADE_PAGE_GENERAL)
+    return (GladeEditable *) glade_file_chooser_widget_editor_new ();
+
+  return GWA_GET_CLASS (GTK_TYPE_WIDGET)->create_editable (adaptor, type);
+}
+
+
 void
 glade_gtk_file_chooser_button_set_property (GladeWidgetAdaptor * adaptor,
                                             GObject * object,
@@ -54,12 +65,13 @@ glade_gtk_file_chooser_button_set_property (GladeWidgetAdaptor * adaptor,
   GWA_GET_CLASS (GTK_TYPE_BOX)->set_property (adaptor, object, id, value);
 }
 
+
 GladeEditable *
-glade_gtk_file_chooser_widget_create_editable (GladeWidgetAdaptor *adaptor,
+glade_gtk_file_chooser_button_create_editable (GladeWidgetAdaptor *adaptor,
                                               GladeEditorPageType type)
 {
   if (type == GLADE_PAGE_GENERAL)
-    return (GladeEditable *) glade_file_chooser_widget_editor_new ();
+    return (GladeEditable *) glade_file_chooser_button_editor_new ();
 
   return GWA_GET_CLASS (GTK_TYPE_WIDGET)->create_editable (adaptor, type);
 }
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index 6240536..0b7a1e6 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -5,6 +5,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-activatable-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-button-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>
     <file compressed="true" preprocess="xml-stripblanks">glade-file-chooser-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-file-chooser-widget-editor.ui</file>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 9c93158..d4a92fb 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1315,17 +1315,30 @@ embedded in another object</_tooltip>
 
     <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>
+      <create-editable-function>glade_gtk_file_chooser_button_create_editable</create-editable-function>
 
       <signals>
        <signal id="file-set" since="2.12"/>
       </signals>
 
       <properties>
-       <property id="title" translatable="True"/>
+       <property id="title" translatable="True" custom-layout="True"/>
+       <property id="dialog" parentless-widget="True" create-type="GtkFileChooserDialog" 
custom-layout="True"/>
+       <property id="focus-on-click" since="2.10" custom-layout="True"/>
+       <property id="width-chars" custom-layout="True"/>
+
+       <!-- Disable GtkBox stuff -->
        <property id="size" disabled="True"/>
-       <property id="dialog" parentless-widget="True" create-type="GtkFileChooserDialog" />
-       <property id="focus-on-click" since="2.10"/>
-        <property id="action">
+       <property id="homogeneous" disabled="True"/>
+       <property id="orientation" disabled="True"/>
+       <property id="spacing" disabled="True"/>
+       <property id="baseline-position" disabled="True"/>
+
+       <!-- GtkFileChooser properties are custom-layout, handled in GladeFileChooserEditor -->
+       <property id="extra-widget" parentless-widget="True" custom-layout="True"/>
+       <property id="preview-widget" parentless-widget="True" custom-layout="True"/>
+       <property id="create-folders" since="2.18" custom-layout="True"/>
+        <property id="action" custom-layout="True">
          <displayable-values>
            <value id="GTK_FILE_CHOOSER_ACTION_SAVE" _name="Save"/>
            <value id="GTK_FILE_CHOOSER_ACTION_OPEN" _name="Open"/>
@@ -1333,8 +1346,13 @@ embedded in another object</_tooltip>
            <value id="GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER" _name="Create Folder"/>
          </displayable-values>
         </property>
-       <property id="create-folders" since="2.18"/>
-       <property id="select-multiple" disabled="True"/>
+       <property id="filter" custom-layout="True"/>
+       <property id="local-only" custom-layout="True"/>
+       <property id="show-hidden" custom-layout="True"/>
+       <property id="do-overwrite-confirmation" custom-layout="True"/>
+       <property id="preview-widget-active" custom-layout="True"/>
+       <property id="use-preview-label" custom-layout="True"/>
+       <property id="select-multiple" custom-layout="True"/>
       </properties>
     </glade-widget-class>
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c8e5982..654ed1c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -60,6 +60,7 @@ plugins/gtk+/glade-button-editor.c
 plugins/gtk+/glade-cell-renderer-editor.c
 plugins/gtk+/glade-column-types.c
 plugins/gtk+/glade-entry-editor.c
+plugins/gtk+/glade-file-chooser-button-editor.c
 plugins/gtk+/glade-file-chooser-dialog-editor.c
 plugins/gtk+/glade-file-chooser-editor.c
 plugins/gtk+/glade-file-chooser-widget-editor.c
@@ -137,6 +138,7 @@ plugins/gtk+/gtk+.xml.in
 [type: gettext/glade]plugins/gtk+/glade-activatable-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-button-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
 [type: gettext/glade]plugins/gtk+/glade-file-chooser-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-file-chooser-widget-editor.ui


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