From f7fc7903e476cd9df5a3ef09f2868ae754f49a8c Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sun, 19 May 2013 17:03:34 +0900 Subject: [PATCH] Added GladeIconViewEditor --- plugins/gtk+/Makefile.am | 4 + plugins/gtk+/glade-gtk-icon-view.c | 40 ++ .../gtk+/glade-gtk-resources.gresource.xml | 1 + plugins/gtk+/glade-icon-view-editor.c | 76 +++ plugins/gtk+/glade-icon-view-editor.h | 57 ++ plugins/gtk+/glade-icon-view-editor.ui | 514 ++++++++++++++++++ plugins/gtk+/gtk+.xml.in | 38 +- po/POTFILES.in | 3 + 8 files changed, 727 insertions(+), 6 deletions(-) create mode 100644 plugins/gtk+/glade-gtk-icon-view.c create mode 100644 plugins/gtk+/glade-icon-view-editor.c create mode 100644 plugins/gtk+/glade-icon-view-editor.h create mode 100644 plugins/gtk+/glade-icon-view-editor.ui diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am index b8f2d647..bb1522bf 100644 --- a/plugins/gtk+/Makefile.am +++ b/plugins/gtk+/Makefile.am @@ -72,6 +72,7 @@ libgladegtk_la_SOURCES = \ glade-gtk-frame.c \ glade-gtk-grid.c \ glade-gtk-icon-factory.c \ + glade-gtk-icon-view.c \ glade-gtk-image.c \ glade-gtk-image-menu-item.c \ glade-gtk-info-bar.c \ @@ -113,6 +114,7 @@ libgladegtk_la_SOURCES = \ glade-gtk-window.c \ glade-icon-factory-editor.c \ glade-icon-sources.c \ + glade-icon-view-editor.c \ glade-image-editor.c \ glade-image-item-editor.c \ glade-label-editor.c \ @@ -186,6 +188,7 @@ noinst_HEADERS = \ glade-gtk-tree-view.h \ glade-icon-factory-editor.h \ glade-icon-sources.h \ + glade-icon-view-editor.h \ glade-image-editor.h \ glade-image-item-editor.h \ glade-label-editor.h \ @@ -259,6 +262,7 @@ UI_FILES = \ glade-font-chooser-editor.ui \ glade-font-chooser-widget-editor.ui \ glade-grid-editor.ui \ + glade-icon-view-editor.ui \ glade-image-editor.ui \ glade-label-editor.ui \ glade-layout-editor.ui \ diff --git a/plugins/gtk+/glade-gtk-icon-view.c b/plugins/gtk+/glade-gtk-icon-view.c new file mode 100644 index 00000000..595ee2ea --- /dev/null +++ b/plugins/gtk+/glade-gtk-icon-view.c @@ -0,0 +1,40 @@ +/* + * glade-gtk-icon-view.c - GladeWidgetAdaptor for GtkIconView + * + * Copyright (C) 2013 Tristan Van Berkom + * + * Authors: + * 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 Softwarel + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include +#include + +#include "glade-icon-view-editor.h" + +GladeEditable * +glade_gtk_icon_view_create_editable (GladeWidgetAdaptor * adaptor, + GladeEditorPageType type) +{ + if (type == GLADE_PAGE_GENERAL) + { + return (GladeEditable *)glade_icon_view_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 6182fd3a..66ee3d2b 100644 --- a/plugins/gtk+/glade-gtk-resources.gresource.xml +++ b/plugins/gtk+/glade-gtk-resources.gresource.xml @@ -20,6 +20,7 @@ glade-font-chooser-editor.ui glade-font-chooser-widget-editor.ui glade-grid-editor.ui + glade-icon-view-editor.ui glade-image-editor.ui glade-label-editor.ui glade-layout-editor.ui diff --git a/plugins/gtk+/glade-icon-view-editor.c b/plugins/gtk+/glade-icon-view-editor.c new file mode 100644 index 00000000..3aa2c363 --- /dev/null +++ b/plugins/gtk+/glade-icon-view-editor.c @@ -0,0 +1,76 @@ +/* + * 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 + */ + +#include +#include +#include + +#include "glade-icon-view-editor.h" + +/* GtkWidgetClass */ +static void glade_icon_view_editor_grab_focus (GtkWidget *widget); + +struct _GladeIconViewEditorPrivate +{ + GtkWidget *embed; +}; + +G_DEFINE_TYPE (GladeIconViewEditor, glade_icon_view_editor, GLADE_TYPE_EDITOR_SKELETON) + +static void +glade_icon_view_editor_class_init (GladeIconViewEditorClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + widget_class->grab_focus = glade_icon_view_editor_grab_focus; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladegtk/glade-icon-view-editor.ui"); + gtk_widget_class_bind_child (widget_class, GladeIconViewEditorPrivate, embed); + + g_type_class_add_private (object_class, sizeof (GladeIconViewEditorPrivate)); +} + +static void +glade_icon_view_editor_init (GladeIconViewEditor * self) +{ + self->priv = + G_TYPE_INSTANCE_GET_PRIVATE (self, + GLADE_TYPE_ICON_VIEW_EDITOR, + GladeIconViewEditorPrivate); + + gtk_widget_init_template (GTK_WIDGET (self)); +} + +static void +glade_icon_view_editor_grab_focus (GtkWidget * widget) +{ + GladeIconViewEditor *view_editor = GLADE_ICON_VIEW_EDITOR (widget); + GladeIconViewEditorPrivate *priv = view_editor->priv; + + gtk_widget_grab_focus (priv->embed); +} + +GtkWidget * +glade_icon_view_editor_new (void) +{ + return g_object_new (GLADE_TYPE_ICON_VIEW_EDITOR, NULL); +} diff --git a/plugins/gtk+/glade-icon-view-editor.h b/plugins/gtk+/glade-icon-view-editor.h new file mode 100644 index 00000000..99705bdb --- /dev/null +++ b/plugins/gtk+/glade-icon-view-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 + */ +#ifndef _GLADE_ICON_VIEW_EDITOR_H_ +#define _GLADE_ICON_VIEW_EDITOR_H_ + +#include +#include + +G_BEGIN_DECLS + +#define GLADE_TYPE_ICON_VIEW_EDITOR (glade_icon_view_editor_get_type ()) +#define GLADE_ICON_VIEW_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_ICON_VIEW_EDITOR, GladeIconViewEditor)) +#define GLADE_ICON_VIEW_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_ICON_VIEW_EDITOR, GladeIconViewEditorClass)) +#define GLADE_IS_ICON_VIEW_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_ICON_VIEW_EDITOR)) +#define GLADE_IS_ICON_VIEW_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_ICON_VIEW_EDITOR)) +#define GLADE_ICON_VIEW_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_ICON_VIEW_EDITOR, GladeIconViewEditorClass)) + +typedef struct _GladeIconViewEditor GladeIconViewEditor; +typedef struct _GladeIconViewEditorClass GladeIconViewEditorClass; +typedef struct _GladeIconViewEditorPrivate GladeIconViewEditorPrivate; + +struct _GladeIconViewEditor +{ + GladeEditorSkeleton parent; + + GladeIconViewEditorPrivate *priv; +}; + +struct _GladeIconViewEditorClass +{ + GladeEditorSkeletonClass parent; +}; + +GType glade_icon_view_editor_get_type (void) G_GNUC_CONST; +GtkWidget *glade_icon_view_editor_new (void); + +G_END_DECLS + +#endif /* _GLADE_ICON_VIEW_EDITOR_H_ */ diff --git a/plugins/gtk+/glade-icon-view-editor.ui b/plugins/gtk+/glade-icon-view-editor.ui new file mode 100644 index 00000000..fa35cfb4 --- /dev/null +++ b/plugins/gtk+/glade-icon-view-editor.ui @@ -0,0 +1,514 @@ + + + + + + + diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in index f4f119c5..b936ec4b 100644 --- a/plugins/gtk+/gtk+.xml.in +++ b/plugins/gtk+/gtk+.xml.in @@ -2967,6 +2967,8 @@ range of values + glade_gtk_icon_view_create_editable + empty glade_gtk_cell_layout_add_verify glade_gtk_cell_layout_add_child @@ -2983,15 +2985,39 @@ range of values - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + <_tooltip>Whether to start scrolling at less than minimum or natural width + + + <_tooltip>Whether to start scrolling at less than minimum or natural height + diff --git a/po/POTFILES.in b/po/POTFILES.in index b11835f6..e49a5bb9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -101,6 +101,7 @@ plugins/gtk+/glade-gtk-font-chooser-widget.c plugins/gtk+/glade-gtk-frame.c plugins/gtk+/glade-gtk-grid.c plugins/gtk+/glade-gtk-icon-factory.c +plugins/gtk+/glade-gtk-icon-view.c plugins/gtk+/glade-gtk-image.c plugins/gtk+/glade-gtk-image-menu-item.c plugins/gtk+/glade-gtk-info-bar.c @@ -142,6 +143,7 @@ plugins/gtk+/glade-gtk-widget.c plugins/gtk+/glade-gtk-window.c plugins/gtk+/glade-icon-factory-editor.c plugins/gtk+/glade-icon-sources.c +plugins/gtk+/glade-icon-view-editor.c plugins/gtk+/glade-image-editor.c plugins/gtk+/glade-image-item-editor.c plugins/gtk+/glade-label-editor.c @@ -192,6 +194,7 @@ plugins/gtk+/gtk+.xml.in [type: gettext/glade]plugins/gtk+/glade-font-chooser-dialog-editor.ui [type: gettext/glade]plugins/gtk+/glade-font-chooser-editor.ui [type: gettext/glade]plugins/gtk+/glade-grid-editor.ui +[type: gettext/glade]plugins/gtk+/glade-icon-view-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-layout-editor.ui