[glade] Added GladeAppChooserButtonEditor
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] Added GladeAppChooserButtonEditor
- Date: Sun, 12 May 2013 12:09:56 +0000 (UTC)
commit 02ffbbc4826a4553759ee2ee9b9884f479019088
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun May 12 21:02:45 2013 +0900
Added GladeAppChooserButtonEditor
plugins/gtk+/Makefile.am | 4 +
plugins/gtk+/glade-app-chooser-button-editor.c | 74 +++++++++
plugins/gtk+/glade-app-chooser-button-editor.h | 56 +++++++
plugins/gtk+/glade-app-chooser-button-editor.ui | 195 +++++++++++++++++++++++
plugins/gtk+/glade-gtk-app-chooser-button.c | 55 +++++++
plugins/gtk+/glade-gtk-resources.gresource.xml | 1 +
plugins/gtk+/gtk+.xml.in | 11 +-
po/POTFILES.in | 3 +
8 files changed, 396 insertions(+), 3 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 970e0b8..8f8cfd3 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-button-editor.c \
glade-app-chooser-widget-editor.c \
glade-attributes.c \
glade-box-editor.c \
@@ -49,6 +50,7 @@ libgladegtk_la_SOURCES = \
glade-gtk-action-group.c \
glade-gtk-action-widgets.c \
glade-gtk-adjustment.c \
+ glade-gtk-app-chooser-button.c \
glade-gtk-app-chooser-widget.c \
glade-gtk-assistant.c \
glade-gtk-box.c \
@@ -134,6 +136,7 @@ noinst_HEADERS = \
glade-accels.h \
glade-action-editor.h \
glade-activatable-editor.h \
+ glade-app-chooser-button-editor.h \
glade-app-chooser-widget-editor.h \
glade-attributes.h \
glade-box-editor.h \
@@ -211,6 +214,7 @@ UI_FILES = \
glade-about-dialog-editor.ui \
glade-action-editor.ui \
glade-activatable-editor.ui \
+ glade-app-chooser-button-editor.ui \
glade-app-chooser-widget-editor.ui \
glade-box-editor.ui \
glade-button-editor.ui \
diff --git a/plugins/gtk+/glade-app-chooser-button-editor.c b/plugins/gtk+/glade-app-chooser-button-editor.c
new file mode 100644
index 0000000..5964bf7
--- /dev/null
+++ b/plugins/gtk+/glade-app-chooser-button-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-button-editor.h"
+
+static void glade_app_chooser_button_editor_grab_focus (GtkWidget * widget);
+
+struct _GladeAppChooserButtonEditorPrivate
+{
+ GtkWidget *embed;
+};
+
+G_DEFINE_TYPE (GladeAppChooserButtonEditor, glade_app_chooser_button_editor, GLADE_TYPE_EDITOR_SKELETON)
+
+static void
+glade_app_chooser_button_editor_class_init (GladeAppChooserButtonEditorClass * klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ widget_class->grab_focus = glade_app_chooser_button_editor_grab_focus;
+
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/gladegtk/glade-app-chooser-button-editor.ui");
+ gtk_widget_class_bind_child (widget_class, GladeAppChooserButtonEditorPrivate, embed);
+
+ g_type_class_add_private (object_class, sizeof (GladeAppChooserButtonEditorPrivate));
+}
+
+static void
+glade_app_chooser_button_editor_init (GladeAppChooserButtonEditor * self)
+{
+ self->priv =
+ G_TYPE_INSTANCE_GET_PRIVATE (self,
+ GLADE_TYPE_APP_CHOOSER_BUTTON_EDITOR,
+ GladeAppChooserButtonEditorPrivate);
+
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+static void
+glade_app_chooser_button_editor_grab_focus (GtkWidget * widget)
+{
+ GladeAppChooserButtonEditor *app_editor = GLADE_APP_CHOOSER_BUTTON_EDITOR (widget);
+
+ gtk_widget_grab_focus (app_editor->priv->embed);
+}
+
+GtkWidget *
+glade_app_chooser_button_editor_new (void)
+{
+ return g_object_new (GLADE_TYPE_APP_CHOOSER_BUTTON_EDITOR, NULL);
+}
diff --git a/plugins/gtk+/glade-app-chooser-button-editor.h b/plugins/gtk+/glade-app-chooser-button-editor.h
new file mode 100644
index 0000000..bb8c6a1
--- /dev/null
+++ b/plugins/gtk+/glade-app-chooser-button-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_BUTTON_EDITOR_H_
+#define _GLADE_APP_CHOOSER_BUTTON_EDITOR_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_APP_CHOOSER_BUTTON_EDITOR (glade_app_chooser_button_editor_get_type ())
+#define GLADE_APP_CHOOSER_BUTTON_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GLADE_TYPE_APP_CHOOSER_BUTTON_EDITOR, GladeAppChooserButtonEditor))
+#define GLADE_APP_CHOOSER_BUTTON_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GLADE_TYPE_APP_CHOOSER_BUTTON_EDITOR, GladeAppChooserButtonEditorClass))
+#define GLADE_IS_APP_CHOOSER_BUTTON_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
GLADE_TYPE_APP_CHOOSER_BUTTON_EDITOR))
+#define GLADE_IS_APP_CHOOSER_BUTTON_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GLADE_TYPE_APP_CHOOSER_BUTTON_EDITOR))
+#define GLADE_APP_CHOOSER_BUTTON_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GLADE_TYPE_APP_CHOOSER_BUTTON_EDITOR, GladeAppChooserButtonEditorClass))
+
+typedef struct _GladeAppChooserButtonEditor GladeAppChooserButtonEditor;
+typedef struct _GladeAppChooserButtonEditorClass GladeAppChooserButtonEditorClass;
+typedef struct _GladeAppChooserButtonEditorPrivate GladeAppChooserButtonEditorPrivate;
+
+struct _GladeAppChooserButtonEditor
+{
+ GladeEditorSkeleton parent;
+
+ GladeAppChooserButtonEditorPrivate *priv;
+};
+
+struct _GladeAppChooserButtonEditorClass
+{
+ GladeEditorSkeletonClass parent;
+};
+
+GType glade_app_chooser_button_editor_get_type (void) G_GNUC_CONST;
+GtkWidget *glade_app_chooser_button_editor_new (void);
+
+G_END_DECLS
+
+#endif /* _GLADE_APP_CHOOSER_BUTTON_EDITOR_H_ */
diff --git a/plugins/gtk+/glade-app-chooser-button-editor.ui b/plugins/gtk+/glade-app-chooser-button-editor.ui
new file mode 100644
index 0000000..ae561f7
--- /dev/null
+++ b/plugins/gtk+/glade-app-chooser-button-editor.ui
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="glade">
+ <!-- interface-requires gladeui 0.0 -->
+ <!-- interface-requires gtk+ 3.10 -->
+ <template class="GladeAppChooserButtonEditor" 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="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 Button 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="heading_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">heading</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="heading_editor">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="property_name">heading</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="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="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-item</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="GladePropertyShell" id="show_dialog_editor">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">False</property>
+ <property name="property_name">show-dialog-item</property>
+ <property name="editor_type">GladeEpropCheck</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GladePropertyShell" id="focus_on_click_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">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GladePropertyShell" id="popup_fixed_width_editor">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">False</property>
+ <property name="property_name">popup-fixed-width</property>
+ <property name="editor_type">GladeEpropCheck</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </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="embed"/>
+ <editor id="heading_label"/>
+ <editor id="heading_editor"/>
+ <editor id="content_type_label"/>
+ <editor id="content_type_editor"/>
+ <editor id="show_default_editor"/>
+ <editor id="show_dialog_editor"/>
+ <editor id="focus_on_click_editor"/>
+ <editor id="popup_fixed_width_editor"/>
+ </child-editors>
+ </template>
+</interface>
diff --git a/plugins/gtk+/glade-gtk-app-chooser-button.c b/plugins/gtk+/glade-gtk-app-chooser-button.c
new file mode 100644
index 0000000..215fbe9
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-app-chooser-button.c
@@ -0,0 +1,55 @@
+/*
+ * glade-gtk-app-chooser-button.c - GladeWidgetAdaptor for GtkAppChooserButton
+ *
+ * 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-button-editor.h"
+
+void
+glade_gtk_app_chooser_button_post_create (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ GladeCreateReason reason)
+{
+ GladeWidget *gwidget;
+
+ /* Chain Up */
+ GWA_GET_CLASS (GTK_TYPE_COMBO_BOX)->post_create (adaptor, object, reason);
+
+ /* No customization of the cell renderers on a GtkAppChooserButton. */
+ gwidget = glade_widget_get_from_gobject (object);
+ glade_widget_set_action_visible (gwidget, "launch_editor", FALSE);
+}
+
+GladeEditable *
+glade_gtk_app_chooser_button_create_editable (GladeWidgetAdaptor * adaptor,
+ GladeEditorPageType type)
+{
+ if (type == GLADE_PAGE_GENERAL)
+ {
+ return (GladeEditable *) glade_app_chooser_button_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 a39e3c5..3ed45ef 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-button-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>
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index a085fce..ec006df 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1588,6 +1588,8 @@ range of values</_tooltip>
<glade-widget-class name="GtkAppChooserButton" generic-name="appchooserbutton"
_title="Application Chooser Button" since="3.0">
+ <post-create-function>glade_gtk_app_chooser_button_post_create</post-create-function>
+ <create-editable-function>glade_gtk_app_chooser_button_create_editable</create-editable-function>
<properties>
<property id="model" disabled="True"/>
<property id="wrap-width" disabled="True"/>
@@ -1603,10 +1605,13 @@ range of values</_tooltip>
<property id="id-column" disabled="True"/>
<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"/>
+ <property id="show-default-item" since="3.2" custom-layout="True"/>
+ <property id="show-dialog-item" custom-layout="True"/>
+ <property id="focus-on-click" custom-layout="True"/>
+ <property id="popup-fixed-width" custom-layout="True"/>
+ <property id="heading" translatable="True" custom-layout="True"/>
+ <property id="content-type" ignore="True" custom-layout="True"/>
</properties>
</glade-widget-class>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 967344f..241f957 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-button-editor.c
plugins/gtk+/glade-app-chooser-widget-editor.c
plugins/gtk+/glade-attributes.c
plugins/gtk+/glade-box-editor.c
@@ -78,6 +79,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-button.c
plugins/gtk+/glade-gtk-app-chooser-widget.c
plugins/gtk+/glade-gtk-assistant.c
plugins/gtk+/glade-gtk-box.c
@@ -159,6 +161,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-button-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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]