[glade] Added GladeAppChooserWidgetEditor



commit d7155dc95a9494f15740262a9147fdefecbdd24d
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun May 12 20:26:15 2013 +0900

    Added GladeAppChooserWidgetEditor

 plugins/gtk+/Makefile.am                        |    4 +
 plugins/gtk+/glade-app-chooser-widget-editor.c  |   74 +++++++
 plugins/gtk+/glade-app-chooser-widget-editor.h  |   56 ++++++
 plugins/gtk+/glade-app-chooser-widget-editor.ui |  236 +++++++++++++++++++++++
 plugins/gtk+/glade-gtk-app-chooser-widget.c     |   40 ++++
 plugins/gtk+/glade-gtk-resources.gresource.xml  |    1 +
 plugins/gtk+/gtk+.xml.in                        |   17 ++-
 po/POTFILES.in                                  |    3 +
 8 files changed, 428 insertions(+), 3 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 53cdf97..970e0b8 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -27,6 +27,7 @@ libgladegtk_la_SOURCES =              \
        glade-accels.c                  \
        glade-action-editor.c           \
        glade-activatable-editor.c      \
+       glade-app-chooser-widget-editor.c \
        glade-attributes.c              \
        glade-box-editor.c              \
        glade-button-editor.c           \
@@ -48,6 +49,7 @@ libgladegtk_la_SOURCES =              \
        glade-gtk-action-group.c        \
        glade-gtk-action-widgets.c      \
        glade-gtk-adjustment.c          \
+       glade-gtk-app-chooser-widget.c  \
        glade-gtk-assistant.c           \
        glade-gtk-box.c                 \
        glade-gtk-button.c              \
@@ -132,6 +134,7 @@ noinst_HEADERS =                    \
        glade-accels.h                  \
        glade-action-editor.h           \
        glade-activatable-editor.h      \
+       glade-app-chooser-widget-editor.h \
        glade-attributes.h              \
        glade-box-editor.h              \
        glade-button-editor.h           \
@@ -208,6 +211,7 @@ UI_FILES =                          \
        glade-about-dialog-editor.ui    \
        glade-action-editor.ui          \
        glade-activatable-editor.ui     \
+       glade-app-chooser-widget-editor.ui \
        glade-box-editor.ui             \
        glade-button-editor.ui          \
        glade-entry-editor.ui           \
diff --git a/plugins/gtk+/glade-app-chooser-widget-editor.c b/plugins/gtk+/glade-app-chooser-widget-editor.c
new file mode 100644
index 0000000..b1daeb7
--- /dev/null
+++ b/plugins/gtk+/glade-app-chooser-widget-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-app-chooser-widget-editor.h"
+
+static void glade_app_chooser_widget_editor_grab_focus (GtkWidget * widget);
+
+struct _GladeAppChooserWidgetEditorPrivate
+{
+  GtkWidget *embed;
+};
+
+G_DEFINE_TYPE (GladeAppChooserWidgetEditor, glade_app_chooser_widget_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_app_chooser_widget_editor_class_init (GladeAppChooserWidgetEditorClass * klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  widget_class->grab_focus = glade_app_chooser_widget_editor_grab_focus;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/gladegtk/glade-app-chooser-widget-editor.ui");
+  gtk_widget_class_bind_child (widget_class, GladeAppChooserWidgetEditorPrivate, embed);
+
+  g_type_class_add_private (object_class, sizeof (GladeAppChooserWidgetEditorPrivate));  
+}
+
+static void
+glade_app_chooser_widget_editor_init (GladeAppChooserWidgetEditor * self)
+{
+  self->priv = 
+    G_TYPE_INSTANCE_GET_PRIVATE (self,
+                                GLADE_TYPE_APP_CHOOSER_WIDGET_EDITOR,
+                                GladeAppChooserWidgetEditorPrivate);
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+static void
+glade_app_chooser_widget_editor_grab_focus (GtkWidget * widget)
+{
+  GladeAppChooserWidgetEditor *app_editor = GLADE_APP_CHOOSER_WIDGET_EDITOR (widget);
+
+  gtk_widget_grab_focus (app_editor->priv->embed);
+}
+
+GtkWidget *
+glade_app_chooser_widget_editor_new (void)
+{
+  return g_object_new (GLADE_TYPE_APP_CHOOSER_WIDGET_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-app-chooser-widget-editor.h b/plugins/gtk+/glade-app-chooser-widget-editor.h
new file mode 100644
index 0000000..bf19ec9
--- /dev/null
+++ b/plugins/gtk+/glade-app-chooser-widget-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_APP_CHOOSER_WIDGET_EDITOR_H_
+#define _GLADE_APP_CHOOSER_WIDGET_EDITOR_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_APP_CHOOSER_WIDGET_EDITOR             (glade_app_chooser_widget_editor_get_type ())
+#define GLADE_APP_CHOOSER_WIDGET_EDITOR(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GLADE_TYPE_APP_CHOOSER_WIDGET_EDITOR, GladeAppChooserWidgetEditor))
+#define GLADE_APP_CHOOSER_WIDGET_EDITOR_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), 
GLADE_TYPE_APP_CHOOSER_WIDGET_EDITOR, GladeAppChooserWidgetEditorClass))
+#define GLADE_IS_APP_CHOOSER_WIDGET_EDITOR(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GLADE_TYPE_APP_CHOOSER_WIDGET_EDITOR))
+#define GLADE_IS_APP_CHOOSER_WIDGET_EDITOR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GLADE_TYPE_APP_CHOOSER_WIDGET_EDITOR))
+#define GLADE_APP_CHOOSER_WIDGET_EDITOR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GLADE_TYPE_APP_CHOOSER_WIDGET_EDITOR, GladeAppChooserWidgetEditorClass))
+
+typedef struct _GladeAppChooserWidgetEditor        GladeAppChooserWidgetEditor;
+typedef struct _GladeAppChooserWidgetEditorClass   GladeAppChooserWidgetEditorClass;
+typedef struct _GladeAppChooserWidgetEditorPrivate GladeAppChooserWidgetEditorPrivate;
+
+struct _GladeAppChooserWidgetEditor
+{
+  GladeEditorSkeleton  parent;
+
+  GladeAppChooserWidgetEditorPrivate *priv;
+};
+
+struct _GladeAppChooserWidgetEditorClass
+{
+  GladeEditorSkeletonClass parent;
+};
+
+GType            glade_app_chooser_widget_editor_get_type (void) G_GNUC_CONST;
+GtkWidget       *glade_app_chooser_widget_editor_new      (void);
+
+G_END_DECLS
+
+#endif  /* _GLADE_APP_CHOOSER_WIDGET_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-app-chooser-widget-editor.ui b/plugins/gtk+/glade-app-chooser-widget-editor.ui
new file mode 100644
index 0000000..db418dd
--- /dev/null
+++ b/plugins/gtk+/glade-app-chooser-widget-editor.ui
@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+  <!-- interface-requires gladeui 0.0 -->
+  <!-- interface-requires gtk+ 3.10 -->
+  <template class="GladeAppChooserWidgetEditor" 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="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="hexpand">False</property>
+            <property name="label" translatable="yes">App Chooser Widget 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="default_text_label">
+            <property name="name">1</property>
+            <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">default-text</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="default_text_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">default-text</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="content_type_label">
+            <property name="name">1</property>
+            <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">content-type</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="content_type_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">content-type</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="GladePropertyShell" id="show_default_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">show-default</property>
+            <property name="editor_type">GladeEpropCheck</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="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="GladePropertyShell" id="show_recommended_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">show-recommended</property>
+            <property name="editor_type">GladeEpropCheck</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">4</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="show_fallback_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">show-fallback</property>
+            <property name="editor_type">GladeEpropCheck</property>
+          </object>
+          <packing>
+            <property name="left_attach">3</property>
+            <property name="top_attach">4</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GladePropertyShell" id="show_other_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">show-other</property>
+            <property name="editor_type">GladeEpropCheck</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="show_all_editor">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">False</property>
+            <property name="property_name">show-all</property>
+            <property name="editor_type">GladeEpropCheck</property>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">5</property>
+            <property name="width">1</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>
+        <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="default_text_label"/>
+      <editor id="default_text_editor"/>
+      <editor id="content_type_label"/>
+      <editor id="content_type_editor"/>
+      <editor id="show_default_editor"/>
+      <editor id="embed"/>
+      <editor id="show_recommended_editor"/>
+      <editor id="show_fallback_editor"/>
+      <editor id="show_other_editor"/>
+      <editor id="show_all_editor"/>
+    </child-editors>
+  </template>
+</interface>
diff --git a/plugins/gtk+/glade-gtk-app-chooser-widget.c b/plugins/gtk+/glade-gtk-app-chooser-widget.c
new file mode 100644
index 0000000..8cf2dd9
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-app-chooser-widget.c
@@ -0,0 +1,40 @@
+/*
+ * glade-gtk-app-chooser-widget.c - GladeWidgetAdaptor for GtkAppChooserWidget
+ *
+ * Copyright (C) 2013 Tristan Van Berkom
+ *
+ * Authors:
+ *      Tristan Van Berkom <tristan van berkom 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 <glib/gi18n-lib.h>
+#include <gladeui/glade.h>
+
+#include "glade-app-chooser-widget-editor.h"
+
+GladeEditable *
+glade_gtk_app_chooser_widget_create_editable (GladeWidgetAdaptor * adaptor,
+                                             GladeEditorPageType type)
+{
+  if (type == GLADE_PAGE_GENERAL)
+    {
+      return (GladeEditable *) glade_app_chooser_widget_editor_new ();
+    }
+
+  return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
+}
diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml
index 8ca3d68..a39e3c5 100644
--- a/plugins/gtk+/glade-gtk-resources.gresource.xml
+++ b/plugins/gtk+/glade-gtk-resources.gresource.xml
@@ -4,6 +4,7 @@
     <file compressed="true" preprocess="xml-stripblanks">glade-about-dialog-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-action-editor.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">glade-activatable-editor.ui</file>
+    <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-entry-editor.ui</file>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index f58f906..a085fce 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1422,8 +1422,6 @@ range of values</_tooltip>
        <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>
@@ -1433,11 +1431,21 @@ range of values</_tooltip>
 
     <glade-widget-class name="GtkAppChooserWidget" generic-name="appchooserwidget" 
                        _title="Application Chooser Widget" since="3.0">
+      <create-editable-function>glade_gtk_app_chooser_widget_create_editable</create-editable-function>
       <properties>
        <property id="size" disabled="True"/>
        <property id="spacing" disabled="True"/>
        <property id="homogeneous" disabled="True"/>
        <property id="orientation" disabled="True"/>
+       <property id="baseline-position" disabled="True"/>
+
+       <property id="default-text" translatable="True" custom-layout="True"/>
+       <property id="content-type" ignore="True" custom-layout="True"/>
+       <property id="show-default" custom-layout="True"/>
+       <property id="show-recommended" custom-layout="True"/>
+       <property id="show-fallback" custom-layout="True"/>
+       <property id="show-other" custom-layout="True"/>
+       <property id="show-all" custom-layout="True"/>
       </properties>
     </glade-widget-class>
 
@@ -1596,6 +1604,9 @@ range of values</_tooltip>
        <property id="active-id" disabled="True"/>
        <property id="cell-area" disabled="True"/>
        <property id="show-default-item" since="3.2"/>
+
+       <property id="heading" translatable="True"/>
+       <property id="content-type" ignore="True"/>
       </properties>
     </glade-widget-class>
 
@@ -2300,8 +2311,8 @@ range of values</_tooltip>
       <properties>
        <property id="heading" translatable="True"/>
        <property id="gfile" disabled="True"/>
+       <property id="content-type" ignore="True"/>
       </properties>
-
     </glade-widget-class>
 
     <glade-widget-class name="GtkMessageDialog" generic-name="messagedialog" _title="Message Dialog" 
default-width="400" default-height="115">
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b7316f6..967344f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -56,6 +56,7 @@ plugins/gtk+/glade-about-dialog-editor.c
 plugins/gtk+/glade-accels.c
 plugins/gtk+/glade-action-editor.c
 plugins/gtk+/glade-activatable-editor.c
+plugins/gtk+/glade-app-chooser-widget-editor.c
 plugins/gtk+/glade-attributes.c
 plugins/gtk+/glade-box-editor.c
 plugins/gtk+/glade-button-editor.c
@@ -77,6 +78,7 @@ plugins/gtk+/glade-gtk-action.c
 plugins/gtk+/glade-gtk-action-group.c
 plugins/gtk+/glade-gtk-action-widgets.c
 plugins/gtk+/glade-gtk-adjustment.c
+plugins/gtk+/glade-gtk-app-chooser-widget.c
 plugins/gtk+/glade-gtk-assistant.c
 plugins/gtk+/glade-gtk-box.c
 plugins/gtk+/glade-gtk-button.c
@@ -157,6 +159,7 @@ plugins/gtk+/gtk+.xml.in
 [type: gettext/glade]plugins/gtk+/glade-about-dialog-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-action-editor.ui
 [type: gettext/glade]plugins/gtk+/glade-activatable-editor.ui
+[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-entry-editor.ui


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