[glade] Added GladeFileChooserWidgetEditor



commit 1cfe0037af336724587411530bcafe69ef6e6361
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 4 21:26:22 2013 +0900

    Added GladeFileChooserWidgetEditor
    
    Simply embeds a GladeFileChooserEditor.

 plugins/gtk+/Makefile.am                         |    3 +
 plugins/gtk+/glade-file-chooser-widget-editor.c  |   48 ++++++++++++++++++
 plugins/gtk+/glade-file-chooser-widget-editor.h  |   57 ++++++++++++++++++++++
 plugins/gtk+/glade-file-chooser-widget-editor.ui |   38 ++++++++++++++
 plugins/gtk+/glade-gtk-file-chooser-widget.c     |   11 ++++
 plugins/gtk+/glade-gtk-resources.gresource.xml   |    1 +
 plugins/gtk+/gtk+.xml.in                         |   21 +++++++-
 po/POTFILES.in                                   |    2 +
 8 files changed, 178 insertions(+), 3 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 3f0ee0c..00be4ac 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -33,6 +33,7 @@ libgladegtk_la_SOURCES =              \
        glade-entry-editor.c            \
        glade-file-chooser-dialog-editor.c \
        glade-file-chooser-editor.c     \
+       glade-file-chooser-widget-editor.c \
        glade-fixed.c                   \
        glade-gtk-about-dialog.c        \
        glade-gtk-action.c              \
@@ -116,6 +117,7 @@ noinst_HEADERS =                    \
        glade-entry-editor.h            \
        glade-file-chooser-dialog-editor.h \
        glade-file-chooser-editor.h     \
+       glade-file-chooser-widget-editor.h \
        glade-fixed.h                   \
        glade-gtk.h                     \
        glade-gtk-action-widgets.h      \
@@ -170,6 +172,7 @@ UI_FILES =                          \
        glade-entry-editor.ui           \
        glade-file-chooser-dialog-editor.ui \
        glade-file-chooser-editor.ui    \
+       glade-file-chooser-widget-editor.ui \
        glade-image-editor.ui           \
        glade-label-editor.ui           \
        glade-tool-button-editor.ui     \
diff --git a/plugins/gtk+/glade-file-chooser-widget-editor.c b/plugins/gtk+/glade-file-chooser-widget-editor.c
new file mode 100644
index 0000000..7f78d93
--- /dev/null
+++ b/plugins/gtk+/glade-file-chooser-widget-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-widget-editor.h"
+
+G_DEFINE_TYPE (GladeFileChooserWidgetEditor, glade_file_chooser_widget_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_file_chooser_widget_editor_class_init (GladeFileChooserWidgetEditorClass * klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/gladegtk/glade-file-chooser-widget-editor.ui");
+}
+
+static void
+glade_file_chooser_widget_editor_init (GladeFileChooserWidgetEditor * self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+glade_file_chooser_widget_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_FILE_CHOOSER_WIDGET_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-file-chooser-widget-editor.h b/plugins/gtk+/glade-file-chooser-widget-editor.h
new file mode 100644
index 0000000..bbfb5c9
--- /dev/null
+++ b/plugins/gtk+/glade-file-chooser-widget-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_WIDGET_EDITOR_H_
+#define _GLADE_FILE_CHOOSER_WIDGET_EDITOR_H_
+
+#include <gtk/gtk.h>
+#include "glade-window-editor.h"
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_FILE_CHOOSER_WIDGET_EDITOR              (glade_file_chooser_widget_editor_get_type ())
+#define GLADE_FILE_CHOOSER_WIDGET_EDITOR(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_FILE_CHOOSER_WIDGET_EDITOR, GladeFileChooserWidgetEditor))
+#define GLADE_FILE_CHOOSER_WIDGET_EDITOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_FILE_CHOOSER_WIDGET_EDITOR, GladeFileChooserWidgetEditorClass))
+#define GLADE_IS_FILE_CHOOSER_WIDGET_EDITOR(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GLADE_TYPE_FILE_CHOOSER_WIDGET_EDITOR))
+#define GLADE_IS_FILE_CHOOSER_WIDGET_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GLADE_TYPE_FILE_CHOOSER_WIDGET_EDITOR))
+#define GLADE_FILE_CHOOSER_WIDGET_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GLADE_TYPE_FILE_CHOOSER_WIDGET_EDITOR, GladeFileChooserWidgetEditorClass))
+
+typedef struct _GladeFileChooserWidgetEditor        GladeFileChooserWidgetEditor;
+typedef struct _GladeFileChooserWidgetEditorClass   GladeFileChooserWidgetEditorClass;
+typedef struct _GladeFileChooserWidgetEditorPrivate GladeFileChooserWidgetEditorPrivate;
+
+struct _GladeFileChooserWidgetEditor
+{
+  GladeEditorSkeleton  parent;
+
+  GladeFileChooserWidgetEditorPrivate *priv;
+};
+
+struct _GladeFileChooserWidgetEditorClass
+{
+  GladeEditorSkeletonClass parent;
+};
+
+GType            glade_file_chooser_widget_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_file_chooser_widget_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_FILE_CHOOSER_WIDGET_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-file-chooser-widget-editor.ui 
b/plugins/gtk+/glade-file-chooser-widget-editor.ui
new file mode 100644
index 0000000..7dc1cae
--- /dev/null
+++ b/plugins/gtk+/glade-file-chooser-widget-editor.ui
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+  <!-- interface-requires glade-gtk-plugin 0.0 -->
+  <!-- interface-requires gladeui 0.0 -->
+  <template class="GladeFileChooserWidgetEditor" parent="GladeEditorSkeleton">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GladeEditorTable" id="embed">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</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="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child-editors>
+      <editor id="embed"/>
+      <editor id="filechoosereditor"/>
+    </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 6d58c80..500bdab 100644
--- a/plugins/gtk+/glade-gtk-file-chooser-widget.c
+++ b/plugins/gtk+/glade-gtk-file-chooser-widget.c
@@ -26,6 +26,7 @@
 #include <gladeui/glade.h>
 
 #include "glade-gtk-dialog.h"
+#include "glade-file-chooser-widget-editor.h"
 
 void
 glade_gtk_file_chooser_widget_post_create (GladeWidgetAdaptor * adaptor,
@@ -52,3 +53,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,
+                                              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);
+}
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index aace2fc..6240536 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -7,6 +7,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-entry-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>
     <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-tool-button-editor.ui</file>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 6d48efa..9c93158 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1365,11 +1365,24 @@ embedded in another object</_tooltip>
     <glade-widget-class name="GtkFileChooserWidget" generic-name="filechooserwidget" 
                        _title="File Chooser Widget">
       <post-create-function>glade_gtk_file_chooser_widget_post_create</post-create-function>
+      <create-editable-function>glade_gtk_file_chooser_widget_create_editable</create-editable-function>
       <properties>
         <property id="size" default="1" query="False" />
-       <property id="extra-widget" parentless-widget="True" />
-       <property id="preview-widget" parentless-widget="True" />
-       <property id="create-folders" since="2.18"/>
+
+       <!-- 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"/>
+       <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>
 
       <signals>
@@ -2163,6 +2176,8 @@ embedded in another object</_tooltip>
 
     <glade-widget-class name="GtkFileChooserDialog" generic-name="filechooserdialog" _title="File Chooser 
Dialog">
       <properties>
+
+       <!-- 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"/>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7f406a9..c8e5982 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -62,6 +62,7 @@ plugins/gtk+/glade-column-types.c
 plugins/gtk+/glade-entry-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
 plugins/gtk+/glade-fixed.c
 plugins/gtk+/glade-gtk-about-dialog.c
 plugins/gtk+/glade-gtk-action.c
@@ -138,6 +139,7 @@ plugins/gtk+/gtk+.xml.in
 [type: gettext/glade]plugins/gtk+/glade-entry-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
 [type: gettext/glade]plugins/gtk+/glade-image-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-label-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-tool-button-editor.ui


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