From 22154af400771676e4a1e60598d41c80f7186eba Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Wed, 15 May 2013 23:17:47 +0900 Subject: Added GladeScrollbarEditor --- plugins/gtk+/Makefile.am | 4 + plugins/gtk+/glade-gtk-resources.gresource.xml | 1 + plugins/gtk+/glade-gtk-scrollbar.c | 40 +++ plugins/gtk+/glade-scrollbar-editor.c | 75 +++++ plugins/gtk+/glade-scrollbar-editor.h | 56 ++++ plugins/gtk+/glade-scrollbar-editor.ui | 396 +++++++++++++++++++++++++ plugins/gtk+/gtk+.xml.in | 13 +- po/POTFILES.in | 3 + 8 files changed, 587 insertions(+), 1 deletion(-) create mode 100644 plugins/gtk+/glade-gtk-scrollbar.c create mode 100644 plugins/gtk+/glade-scrollbar-editor.c create mode 100644 plugins/gtk+/glade-scrollbar-editor.h create mode 100644 plugins/gtk+/glade-scrollbar-editor.ui diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am index dca6207d..04bf3b46 100644 --- a/plugins/gtk+/Makefile.am +++ b/plugins/gtk+/Makefile.am @@ -91,6 +91,7 @@ libgladegtk_la_SOURCES = \ glade-gtk-recent-chooser-widget.c \ glade-gtk-recent-file-filter.c \ glade-gtk-scale.c \ + glade-gtk-scrollbar.c \ glade-gtk-scrolled-window.c \ glade-gtk-size-group.c \ glade-gtk-spin-button.c \ @@ -122,6 +123,7 @@ libgladegtk_la_SOURCES = \ glade-recent-chooser-widget-editor.c \ glade-scale-button-editor.c \ glade-scale-editor.c \ + glade-scrollbar-editor.c \ glade-scrolled-window-editor.c \ glade-spin-button-editor.c \ glade-store-editor.c \ @@ -186,6 +188,7 @@ noinst_HEADERS = \ glade-recent-chooser-widget-editor.h \ glade-scale-editor.h \ glade-scale-button-editor.h \ + glade-scrollbar-editor.h \ glade-scrolled-window-editor.h \ glade-spin-button-editor.h \ glade-store-editor.h \ @@ -248,6 +251,7 @@ UI_FILES = \ glade-recent-chooser-widget-editor.ui \ glade-scale-editor.ui \ glade-scale-button-editor.ui \ + glade-scrollbar-editor.ui \ glade-scrolled-window-editor.ui \ glade-spin-button-editor.ui \ glade-tool-button-editor.ui \ diff --git a/plugins/gtk+/glade-gtk-resources.gresource.xml b/plugins/gtk+/glade-gtk-resources.gresource.xml index 65bbfefb..149077a8 100644 --- a/plugins/gtk+/glade-gtk-resources.gresource.xml +++ b/plugins/gtk+/glade-gtk-resources.gresource.xml @@ -31,6 +31,7 @@ glade-recent-chooser-menu-editor.ui glade-scale-editor.ui glade-scale-button-editor.ui + glade-scrollbar-editor.ui glade-scrolled-window-editor.ui glade-spin-button-editor.ui glade-tool-button-editor.ui diff --git a/plugins/gtk+/glade-gtk-scrollbar.c b/plugins/gtk+/glade-gtk-scrollbar.c new file mode 100644 index 00000000..7ebde834 --- /dev/null +++ b/plugins/gtk+/glade-gtk-scrollbar.c @@ -0,0 +1,40 @@ +/* + * glade-gtk-scrollbar.c - GladeWidgetAdaptor for GtkScrollbar + * + * 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 Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include +#include + +#include "glade-scrollbar-editor.h" + +GladeEditable * +glade_gtk_scrollbar_create_editable (GladeWidgetAdaptor * adaptor, + GladeEditorPageType type) +{ + if (type == GLADE_PAGE_GENERAL) + { + return (GladeEditable *)glade_scrollbar_editor_new (); + } + + return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type); +} diff --git a/plugins/gtk+/glade-scrollbar-editor.c b/plugins/gtk+/glade-scrollbar-editor.c new file mode 100644 index 00000000..17f74085 --- /dev/null +++ b/plugins/gtk+/glade-scrollbar-editor.c @@ -0,0 +1,75 @@ +/* + * 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 + +#include "glade-scrollbar-editor.h" + +static void glade_scrollbar_editor_grab_focus (GtkWidget * widget); + +struct _GladeScrollbarEditorPrivate +{ + GtkWidget *embed; +}; + +G_DEFINE_TYPE (GladeScrollbarEditor, glade_scrollbar_editor, GLADE_TYPE_EDITOR_SKELETON) + +static void +glade_scrollbar_editor_class_init (GladeScrollbarEditorClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + widget_class->grab_focus = glade_scrollbar_editor_grab_focus; + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladegtk/glade-scrollbar-editor.ui"); + gtk_widget_class_bind_child (widget_class, GladeScrollbarEditorPrivate, embed); + + g_type_class_add_private (object_class, sizeof (GladeScrollbarEditorPrivate)); +} + +static void +glade_scrollbar_editor_init (GladeScrollbarEditor * self) +{ + self->priv = + G_TYPE_INSTANCE_GET_PRIVATE (self, + GLADE_TYPE_SCROLLBAR_EDITOR, + GladeScrollbarEditorPrivate); + + gtk_widget_init_template (GTK_WIDGET (self)); +} + +static void +glade_scrollbar_editor_grab_focus (GtkWidget * widget) +{ + GladeScrollbarEditor *scrollbar_editor = GLADE_SCROLLBAR_EDITOR (widget); + + gtk_widget_grab_focus (scrollbar_editor->priv->embed); +} + +GtkWidget * +glade_scrollbar_editor_new (void) +{ + return g_object_new (GLADE_TYPE_SCROLLBAR_EDITOR, NULL); +} diff --git a/plugins/gtk+/glade-scrollbar-editor.h b/plugins/gtk+/glade-scrollbar-editor.h new file mode 100644 index 00000000..695bf9e3 --- /dev/null +++ b/plugins/gtk+/glade-scrollbar-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 + */ +#ifndef _GLADE_SCROLLBAR_EDITOR_H_ +#define _GLADE_SCROLLBAR_EDITOR_H_ + +#include + +G_BEGIN_DECLS + +#define GLADE_TYPE_SCROLLBAR_EDITOR (glade_scrollbar_editor_get_type ()) +#define GLADE_SCROLLBAR_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_SCROLLBAR_EDITOR, GladeScrollbarEditor)) +#define GLADE_SCROLLBAR_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_SCROLLBAR_EDITOR, GladeScrollbarEditorClass)) +#define GLADE_IS_SCROLLBAR_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_SCROLLBAR_EDITOR)) +#define GLADE_IS_SCROLLBAR_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_SCROLLBAR_EDITOR)) +#define GLADE_SCROLLBAR_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_SCROLLBAR_EDITOR, GladeScrollbarEditorClass)) + +typedef struct _GladeScrollbarEditor GladeScrollbarEditor; +typedef struct _GladeScrollbarEditorClass GladeScrollbarEditorClass; +typedef struct _GladeScrollbarEditorPrivate GladeScrollbarEditorPrivate; + +struct _GladeScrollbarEditor +{ + GladeEditorSkeleton parent; + + GladeScrollbarEditorPrivate *priv; +}; + +struct _GladeScrollbarEditorClass +{ + GladeEditorSkeletonClass parent; +}; + +GType glade_scrollbar_editor_get_type (void) G_GNUC_CONST; +GtkWidget *glade_scrollbar_editor_new (void); + +G_END_DECLS + +#endif /* _GLADE_SCROLLBAR_EDITOR_H_ */ diff --git a/plugins/gtk+/glade-scrollbar-editor.ui b/plugins/gtk+/glade-scrollbar-editor.ui new file mode 100644 index 00000000..62f03e3d --- /dev/null +++ b/plugins/gtk+/glade-scrollbar-editor.ui @@ -0,0 +1,396 @@ + + + + + + diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in index 16e48e84..9e21b4c7 100644 --- a/plugins/gtk+/gtk+.xml.in +++ b/plugins/gtk+/gtk+.xml.in @@ -2043,8 +2043,19 @@ range of values + glade_gtk_scrollbar_create_editable - + + + + <_tooltip>The number of digits to round the value to when the value changes + + + + + + + diff --git a/po/POTFILES.in b/po/POTFILES.in index 3fd1cf90..1c305c69 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -120,6 +120,7 @@ plugins/gtk+/glade-gtk-recent-chooser-menu.c plugins/gtk+/glade-gtk-recent-chooser-widget.c plugins/gtk+/glade-gtk-recent-file-filter.c plugins/gtk+/glade-gtk-scale.c +plugins/gtk+/glade-gtk-scrollbar.c plugins/gtk+/glade-gtk-scrolled-window.c plugins/gtk+/glade-gtk-size-group.c plugins/gtk+/glade-gtk-spin-button.c @@ -151,6 +152,7 @@ plugins/gtk+/glade-recent-chooser-menu-editor.c plugins/gtk+/glade-recent-chooser-widget-editor.c plugins/gtk+/glade-scale-editor.c plugins/gtk+/glade-scale-button-editor.c +plugins/gtk+/glade-scrollbar-editor.c plugins/gtk+/glade-scrolled-window-editor.c plugins/gtk+/glade-spin-button-editor.c plugins/gtk+/glade-store-editor.c @@ -191,6 +193,7 @@ plugins/gtk+/gtk+.xml.in [type: gettext/glade]plugins/gtk+/glade-recent-chooser-widget-editor.ui [type: gettext/glade]plugins/gtk+/glade-scale-editor.ui [type: gettext/glade]plugins/gtk+/glade-scale-button-editor.ui +[type: gettext/glade]plugins/gtk+/glade-scrollbar-editor.ui [type: gettext/glade]plugins/gtk+/glade-scrolled-window-editor.ui [type: gettext/glade]plugins/gtk+/glade-spin-button-editor.ui [type: gettext/glade]plugins/gtk+/glade-tool-button-editor.ui -- cgit v1.2.1