[glade] Move GladeWidgetAdaptor code for GtkImage into it's own C file
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] Move GladeWidgetAdaptor code for GtkImage into it's own C file
- Date: Fri, 3 May 2013 17:07:27 +0000 (UTC)
commit 6338066d4b70a448a0f1f534b0a3f56834e7fdaa
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Fri May 3 23:07:23 2013 +0900
Move GladeWidgetAdaptor code for GtkImage into it's own C file
Includes a bit of a fixup for the GtkButton code
plugins/gtk+/Makefile.am | 3 +
plugins/gtk+/glade-gtk-button.c | 46 ++++----
plugins/gtk+/glade-gtk-button.h | 34 ++++++
plugins/gtk+/glade-gtk-image.c | 249 +++++++++++++++++++++++++++++++++++++++
plugins/gtk+/glade-gtk-image.h | 37 ++++++
plugins/gtk+/glade-gtk.c | 225 +----------------------------------
po/POTFILES.in | 1 +
7 files changed, 351 insertions(+), 244 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index ef059e2..0d040fb 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -45,6 +45,7 @@ libgladegtk_la_SOURCES = \
glade-gtk-fixed-layout.c \
glade-gtk-frame.c \
glade-gtk-grid.c \
+ glade-gtk-image.c \
glade-gtk-info-bar.c \
glade-gtk-message-dialog.c \
glade-gtk-notebook.c \
@@ -82,8 +83,10 @@ noinst_HEADERS = \
glade-fixed.h \
glade-gtk.h \
glade-gtk-action-widgets.h \
+ glade-gtk-button.h \
glade-gtk-dialog.h \
glade-gtk-frame.h \
+ glade-gtk-image.h \
glade-gtk-notebook.h \
glade-icon-factory-editor.h \
glade-icon-sources.h \
diff --git a/plugins/gtk+/glade-gtk-button.c b/plugins/gtk+/glade-gtk-button.c
index 4d1e165..3797be2 100644
--- a/plugins/gtk+/glade-gtk-button.c
+++ b/plugins/gtk+/glade-gtk-button.c
@@ -27,6 +27,7 @@
#include "glade-button-editor.h"
#include "glade-gtk.h"
+#include "glade-gtk-button.h"
/* ----------------------------- GtkFontButton ------------------------------ */
@@ -112,27 +113,6 @@ glade_gtk_color_button_set_property (GladeWidgetAdaptor * adaptor,
}
/* ----------------------------- GtkButton ------------------------------ */
-static void
-sync_use_appearance (GladeWidget *gwidget)
-{
- GladeProperty *prop;
- gboolean use_appearance;
-
- /* This is the kind of thing we avoid doing at project load time ;-) */
- if (glade_widget_superuser ())
- return;
-
- prop = glade_widget_get_property (gwidget, "use-action-appearance");
- use_appearance = FALSE;
-
- glade_property_get (prop, &use_appearance);
- if (use_appearance)
- {
- glade_property_set (prop, FALSE);
- glade_property_set (prop, TRUE);
- }
-}
-
GladeEditable *
glade_gtk_button_create_editable (GladeWidgetAdaptor * adaptor,
GladeEditorPageType type)
@@ -223,7 +203,7 @@ glade_gtk_button_set_property (GladeWidgetAdaptor * adaptor,
*/
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object,
id, value);
- sync_use_appearance (widget);
+ glade_gtk_sync_use_appearance (widget);
}
else if (GPC_VERSION_CHECK (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value);
@@ -282,3 +262,25 @@ glade_gtk_button_write_widget (GladeWidgetAdaptor * adaptor,
node);
}
+
+/* Shared with other classes */
+void
+glade_gtk_sync_use_appearance (GladeWidget *gwidget)
+{
+ GladeProperty *prop;
+ gboolean use_appearance;
+
+ /* This is the kind of thing we avoid doing at project load time ;-) */
+ if (glade_widget_superuser ())
+ return;
+
+ prop = glade_widget_get_property (gwidget, "use-action-appearance");
+ use_appearance = FALSE;
+
+ glade_property_get (prop, &use_appearance);
+ if (use_appearance)
+ {
+ glade_property_set (prop, FALSE);
+ glade_property_set (prop, TRUE);
+ }
+}
diff --git a/plugins/gtk+/glade-gtk-button.h b/plugins/gtk+/glade-gtk-button.h
new file mode 100644
index 0000000..365d3cd
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-button.h
@@ -0,0 +1,34 @@
+/*
+ * 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_GTK_BUTTON_H_
+#define _GLADE_GTK_BUTTON_H_
+
+#include <gtk/gtk.h>
+#include <gladeui/glade.h>
+
+G_BEGIN_DECLS
+
+void glade_gtk_sync_use_appearance (GladeWidget *gwidget);
+
+
+G_END_DECLS
+
+#endif /* _GLADE_GTK_BUTTON_H_ */
diff --git a/plugins/gtk+/glade-gtk-image.c b/plugins/gtk+/glade-gtk-image.c
new file mode 100644
index 0000000..92760f4
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-image.c
@@ -0,0 +1,249 @@
+/*
+ * glade-gtk-image.c - GladeWidgetAdaptor for GtkImage class
+ *
+ * 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-image-editor.h"
+#include "glade-gtk-image.h"
+#include "glade-gtk.h"
+
+void
+glade_gtk_image_read_widget (GladeWidgetAdaptor * adaptor,
+ GladeWidget * widget, GladeXmlNode * node)
+{
+ GladeProperty *property;
+
+ if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+ glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
+ return;
+
+ /* First chain up and read in all the normal properties.. */
+ GWA_GET_CLASS (GTK_TYPE_WIDGET)->read_widget (adaptor, widget, node);
+
+ if (glade_widget_property_original_default (widget, "icon-name") == FALSE)
+ {
+ property = glade_widget_get_property (widget, "icon-name");
+ glade_widget_property_set (widget, "image-mode", GLADE_IMAGE_MODE_ICON);
+ }
+ else if (glade_widget_property_original_default (widget, "resource") == FALSE)
+ {
+ property = glade_widget_get_property (widget, "resource");
+ glade_widget_property_set (widget, "image-mode", GLADE_IMAGE_MODE_RESOURCE);
+ }
+ else if (glade_widget_property_original_default (widget, "pixbuf") == FALSE)
+ {
+ property = glade_widget_get_property (widget, "pixbuf");
+ glade_widget_property_set (widget, "image-mode",
+ GLADE_IMAGE_MODE_FILENAME);
+ }
+ else /* if (glade_widget_property_original_default (widget, "stock") == FALSE) */
+ {
+ property = glade_widget_get_property (widget, "stock");
+ glade_widget_property_set (widget, "image-mode", GLADE_IMAGE_MODE_STOCK);
+ }
+
+ glade_property_sync (property);
+}
+
+void
+glade_gtk_image_write_widget (GladeWidgetAdaptor * adaptor,
+ GladeWidget * widget,
+ GladeXmlContext * context, GladeXmlNode * node)
+{
+
+ if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+ glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
+ return;
+
+ /* First chain up and write all the normal properties (including "use-stock")... */
+ GWA_GET_CLASS (GTK_TYPE_WIDGET)->write_widget (adaptor, widget, context, node);
+
+ glade_gtk_write_icon_size (widget, context, node, "icon-size");
+}
+
+
+static void
+glade_gtk_image_set_image_mode (GObject * object, const GValue * value)
+{
+ GladeWidget *gwidget;
+ GladeImageEditMode type;
+
+ gwidget = glade_widget_get_from_gobject (object);
+ g_return_if_fail (GTK_IS_IMAGE (object));
+ g_return_if_fail (GLADE_IS_WIDGET (gwidget));
+
+ glade_widget_property_set_sensitive (gwidget, "stock", FALSE,
+ NOT_SELECTED_MSG);
+ glade_widget_property_set_sensitive (gwidget, "icon-name", FALSE,
+ NOT_SELECTED_MSG);
+ glade_widget_property_set_sensitive (gwidget, "pixbuf", FALSE,
+ NOT_SELECTED_MSG);
+ glade_widget_property_set_sensitive (gwidget, "resource", FALSE,
+ NOT_SELECTED_MSG);
+ glade_widget_property_set_sensitive (gwidget, "icon-size", FALSE,
+ _("This property only applies to stock images or named icons"));
+ glade_widget_property_set_sensitive (gwidget, "pixel-size", FALSE,
+ _("This property only applies to named icons"));
+ glade_widget_property_set_sensitive (gwidget, "use-fallback", FALSE,
+ _("This property only applies to named icons"));
+
+ switch ((type = g_value_get_int (value)))
+ {
+ case GLADE_IMAGE_MODE_STOCK:
+ glade_widget_property_set_sensitive (gwidget, "stock", TRUE, NULL);
+ glade_widget_property_set_sensitive (gwidget, "icon-size", TRUE, NULL);
+ break;
+
+ case GLADE_IMAGE_MODE_ICON:
+ glade_widget_property_set_sensitive (gwidget, "icon-name", TRUE, NULL);
+ glade_widget_property_set_sensitive (gwidget, "icon-size", TRUE, NULL);
+ glade_widget_property_set_sensitive (gwidget, "pixel-size", TRUE, NULL);
+ glade_widget_property_set_sensitive (gwidget, "use-fallback", TRUE, NULL);
+ break;
+
+ case GLADE_IMAGE_MODE_RESOURCE:
+ glade_widget_property_set_sensitive (gwidget, "resource", TRUE, NULL);
+ break;
+
+ case GLADE_IMAGE_MODE_FILENAME:
+ glade_widget_property_set_sensitive (gwidget, "pixbuf", TRUE, NULL);
+ default:
+ break;
+ }
+}
+
+void
+glade_gtk_image_get_property (GladeWidgetAdaptor * adaptor,
+ GObject * object,
+ const gchar * id, GValue * value)
+{
+ if (!strcmp (id, "icon-size"))
+ {
+ /* Make the int an enum... */
+ GValue int_value = { 0, };
+ g_value_init (&int_value, G_TYPE_INT);
+ GWA_GET_CLASS (GTK_TYPE_WIDGET)->get_property (adaptor, object, id,
+ &int_value);
+ g_value_set_enum (value, g_value_get_int (&int_value));
+ g_value_unset (&int_value);
+ }
+ else
+ GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object, id, value);
+}
+
+void
+glade_gtk_image_set_property (GladeWidgetAdaptor * adaptor,
+ GObject * object,
+ const gchar * id, const GValue * value)
+{
+ if (!strcmp (id, "image-mode"))
+ glade_gtk_image_set_image_mode (object, value);
+ else if (!strcmp (id, "icon-size"))
+ {
+ /* Make the enum an int... */
+ GValue int_value = { 0, };
+ g_value_init (&int_value, G_TYPE_INT);
+ g_value_set_int (&int_value, g_value_get_enum (value));
+ GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object, id,
+ &int_value);
+ g_value_unset (&int_value);
+ }
+ else
+ {
+ GladeWidget *widget = glade_widget_get_from_gobject (object);
+ GladeImageEditMode mode = 0;
+
+ glade_widget_property_get (widget, "image-mode", &mode);
+
+ /* avoid setting properties in the wrong mode... */
+ switch (mode)
+ {
+ case GLADE_IMAGE_MODE_STOCK:
+ if (!strcmp (id, "icon-name") || !strcmp (id, "pixbuf"))
+ return;
+ break;
+ case GLADE_IMAGE_MODE_ICON:
+ if (!strcmp (id, "stock") || !strcmp (id, "pixbuf"))
+ return;
+ break;
+ case GLADE_IMAGE_MODE_FILENAME:
+ if (!strcmp (id, "stock") || !strcmp (id, "icon-name"))
+ return;
+ case GLADE_IMAGE_MODE_RESOURCE:
+ /* Screw the resource mode here, we can't apply them at Glade's runtime anyway */
+ default:
+ break;
+ }
+
+ GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object,
+ id, value);
+ }
+}
+
+GladeEditable *
+glade_gtk_image_create_editable (GladeWidgetAdaptor * adaptor,
+ GladeEditorPageType type)
+{
+ if (type == GLADE_PAGE_GENERAL)
+ return (GladeEditable *) glade_image_editor_new ();
+ else
+ return GWA_GET_CLASS (GTK_TYPE_WIDGET)->create_editable (adaptor, type);
+}
+
+/* Shared with other classes */
+void
+glade_gtk_write_icon_size (GladeWidget * widget,
+ GladeXmlContext * context,
+ GladeXmlNode * node,
+ const gchar *prop_name)
+{
+ GladeXmlNode *prop_node;
+ GladeProperty *size_prop;
+ GtkIconSize icon_size;
+ gchar *value;
+
+ /* We have to save icon-size as an integer, the core will take care of
+ * loading the int value though.
+ */
+ size_prop = glade_widget_get_property (widget, prop_name);
+ if (glade_property_get_enabled (size_prop) &&
+ !glade_property_original_default (size_prop))
+ {
+ gchar *write_prop_name = g_strdup (prop_name);
+
+ glade_util_replace (write_prop_name, '-', '_');
+
+ prop_node = glade_xml_node_new (context, GLADE_TAG_PROPERTY);
+ glade_xml_node_append_child (node, prop_node);
+
+ glade_xml_node_set_property_string (prop_node, GLADE_TAG_NAME, write_prop_name);
+
+ glade_property_get (size_prop, &icon_size);
+ value = g_strdup_printf ("%d", icon_size);
+ glade_xml_set_content (prop_node, value);
+ g_free (value);
+ g_free (write_prop_name);
+ }
+}
diff --git a/plugins/gtk+/glade-gtk-image.h b/plugins/gtk+/glade-gtk-image.h
new file mode 100644
index 0000000..e5cc779
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-image.h
@@ -0,0 +1,37 @@
+/*
+ * 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_GTK_IMAGE_H_
+#define _GLADE_GTK_IMAGE_H_
+
+#include <gtk/gtk.h>
+#include <gladeui/glade.h>
+
+G_BEGIN_DECLS
+
+void glade_gtk_write_icon_size (GladeWidget * widget,
+ GladeXmlContext * context,
+ GladeXmlNode * node,
+ const gchar *prop_name);
+
+
+G_END_DECLS
+
+#endif /* _GLADE_GTK_IMAGE_H_ */
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index f7cdf86..77b3542 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -49,6 +49,8 @@
#include "glade-treeview-editor.h"
#include "glade-window-editor.h"
#include "glade-gtk-dialog.h"
+#include "glade-gtk-image.h"
+#include "glade-gtk-button.h"
#include <gladeui/glade-editor-property.h>
#include <gladeui/glade-base-editor.h>
@@ -78,227 +80,6 @@ glade_gtk_init (const gchar * name)
{
}
-
-/* ----------------------------- GtkImage ------------------------------ */
-void
-glade_gtk_image_read_widget (GladeWidgetAdaptor * adaptor,
- GladeWidget * widget, GladeXmlNode * node)
-{
- GladeProperty *property;
-
- if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
- glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
- return;
-
- /* First chain up and read in all the normal properties.. */
- GWA_GET_CLASS (GTK_TYPE_WIDGET)->read_widget (adaptor, widget, node);
-
- if (glade_widget_property_original_default (widget, "icon-name") == FALSE)
- {
- property = glade_widget_get_property (widget, "icon-name");
- glade_widget_property_set (widget, "image-mode", GLADE_IMAGE_MODE_ICON);
- }
- else if (glade_widget_property_original_default (widget, "resource") == FALSE)
- {
- property = glade_widget_get_property (widget, "resource");
- glade_widget_property_set (widget, "image-mode", GLADE_IMAGE_MODE_RESOURCE);
- }
- else if (glade_widget_property_original_default (widget, "pixbuf") == FALSE)
- {
- property = glade_widget_get_property (widget, "pixbuf");
- glade_widget_property_set (widget, "image-mode",
- GLADE_IMAGE_MODE_FILENAME);
- }
- else /* if (glade_widget_property_original_default (widget, "stock") == FALSE) */
- {
- property = glade_widget_get_property (widget, "stock");
- glade_widget_property_set (widget, "image-mode", GLADE_IMAGE_MODE_STOCK);
- }
-
- glade_property_sync (property);
-}
-
-static void
-glade_gtk_write_icon_size (GladeWidget * widget,
- GladeXmlContext * context,
- GladeXmlNode * node,
- const gchar *prop_name)
-{
- GladeXmlNode *prop_node;
- GladeProperty *size_prop;
- GtkIconSize icon_size;
- gchar *value;
-
- /* We have to save icon-size as an integer, the core will take care of
- * loading the int value though.
- */
- size_prop = glade_widget_get_property (widget, prop_name);
- if (glade_property_get_enabled (size_prop) &&
- !glade_property_original_default (size_prop))
- {
- gchar *write_prop_name = g_strdup (prop_name);
-
- glade_util_replace (write_prop_name, '-', '_');
-
- prop_node = glade_xml_node_new (context, GLADE_TAG_PROPERTY);
- glade_xml_node_append_child (node, prop_node);
-
- glade_xml_node_set_property_string (prop_node, GLADE_TAG_NAME, write_prop_name);
-
- glade_property_get (size_prop, &icon_size);
- value = g_strdup_printf ("%d", icon_size);
- glade_xml_set_content (prop_node, value);
- g_free (value);
- g_free (write_prop_name);
- }
-}
-
-void
-glade_gtk_image_write_widget (GladeWidgetAdaptor * adaptor,
- GladeWidget * widget,
- GladeXmlContext * context, GladeXmlNode * node)
-{
-
- if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
- glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
- return;
-
- /* First chain up and write all the normal properties (including "use-stock")... */
- GWA_GET_CLASS (GTK_TYPE_WIDGET)->write_widget (adaptor, widget, context, node);
-
- glade_gtk_write_icon_size (widget, context, node, "icon-size");
-}
-
-
-static void
-glade_gtk_image_set_image_mode (GObject * object, const GValue * value)
-{
- GladeWidget *gwidget;
- GladeImageEditMode type;
-
- gwidget = glade_widget_get_from_gobject (object);
- g_return_if_fail (GTK_IS_IMAGE (object));
- g_return_if_fail (GLADE_IS_WIDGET (gwidget));
-
- glade_widget_property_set_sensitive (gwidget, "stock", FALSE,
- NOT_SELECTED_MSG);
- glade_widget_property_set_sensitive (gwidget, "icon-name", FALSE,
- NOT_SELECTED_MSG);
- glade_widget_property_set_sensitive (gwidget, "pixbuf", FALSE,
- NOT_SELECTED_MSG);
- glade_widget_property_set_sensitive (gwidget, "resource", FALSE,
- NOT_SELECTED_MSG);
- glade_widget_property_set_sensitive (gwidget, "icon-size", FALSE,
- _("This property only applies to stock images or named icons"));
- glade_widget_property_set_sensitive (gwidget, "pixel-size", FALSE,
- _("This property only applies to named icons"));
- glade_widget_property_set_sensitive (gwidget, "use-fallback", FALSE,
- _("This property only applies to named icons"));
-
- switch ((type = g_value_get_int (value)))
- {
- case GLADE_IMAGE_MODE_STOCK:
- glade_widget_property_set_sensitive (gwidget, "stock", TRUE, NULL);
- glade_widget_property_set_sensitive (gwidget, "icon-size", TRUE, NULL);
- break;
-
- case GLADE_IMAGE_MODE_ICON:
- glade_widget_property_set_sensitive (gwidget, "icon-name", TRUE, NULL);
- glade_widget_property_set_sensitive (gwidget, "icon-size", TRUE, NULL);
- glade_widget_property_set_sensitive (gwidget, "pixel-size", TRUE, NULL);
- glade_widget_property_set_sensitive (gwidget, "use-fallback", TRUE, NULL);
- break;
-
- case GLADE_IMAGE_MODE_RESOURCE:
- glade_widget_property_set_sensitive (gwidget, "resource", TRUE, NULL);
- break;
-
- case GLADE_IMAGE_MODE_FILENAME:
- glade_widget_property_set_sensitive (gwidget, "pixbuf", TRUE, NULL);
- default:
- break;
- }
-}
-
-void
-glade_gtk_image_get_property (GladeWidgetAdaptor * adaptor,
- GObject * object,
- const gchar * id, GValue * value)
-{
- if (!strcmp (id, "icon-size"))
- {
- /* Make the int an enum... */
- GValue int_value = { 0, };
- g_value_init (&int_value, G_TYPE_INT);
- GWA_GET_CLASS (GTK_TYPE_WIDGET)->get_property (adaptor, object, id,
- &int_value);
- g_value_set_enum (value, g_value_get_int (&int_value));
- g_value_unset (&int_value);
- }
- else
- GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object, id, value);
-}
-
-void
-glade_gtk_image_set_property (GladeWidgetAdaptor * adaptor,
- GObject * object,
- const gchar * id, const GValue * value)
-{
- if (!strcmp (id, "image-mode"))
- glade_gtk_image_set_image_mode (object, value);
- else if (!strcmp (id, "icon-size"))
- {
- /* Make the enum an int... */
- GValue int_value = { 0, };
- g_value_init (&int_value, G_TYPE_INT);
- g_value_set_int (&int_value, g_value_get_enum (value));
- GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object, id,
- &int_value);
- g_value_unset (&int_value);
- }
- else
- {
- GladeWidget *widget = glade_widget_get_from_gobject (object);
- GladeImageEditMode mode = 0;
-
- glade_widget_property_get (widget, "image-mode", &mode);
-
- /* avoid setting properties in the wrong mode... */
- switch (mode)
- {
- case GLADE_IMAGE_MODE_STOCK:
- if (!strcmp (id, "icon-name") || !strcmp (id, "pixbuf"))
- return;
- break;
- case GLADE_IMAGE_MODE_ICON:
- if (!strcmp (id, "stock") || !strcmp (id, "pixbuf"))
- return;
- break;
- case GLADE_IMAGE_MODE_FILENAME:
- if (!strcmp (id, "stock") || !strcmp (id, "icon-name"))
- return;
- case GLADE_IMAGE_MODE_RESOURCE:
- /* Screw the resource mode here, we can't apply them at Glade's runtime anyway */
- default:
- break;
- }
-
- GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object,
- id, value);
- }
-}
-
-
-GladeEditable *
-glade_gtk_image_create_editable (GladeWidgetAdaptor * adaptor,
- GladeEditorPageType type)
-{
- if (type == GLADE_PAGE_GENERAL)
- return (GladeEditable *) glade_image_editor_new ();
- else
- return GWA_GET_CLASS (GTK_TYPE_WIDGET)->create_editable (adaptor, type);
-}
-
/* ----------------------------- GtkMenu ------------------------------ */
GObject *
glade_gtk_menu_constructor (GType type,
@@ -1169,7 +950,7 @@ glade_gtk_image_menu_item_set_use_stock (GObject * object, const GValue * value)
gtk_image_menu_item_set_use_stock (GTK_IMAGE_MENU_ITEM (object), use_stock);
- sync_use_appearance (widget);
+ glade_gtk_sync_use_appearance (widget);
}
static gboolean
diff --git a/po/POTFILES.in b/po/POTFILES.in
index da6d1ce..e487425 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -73,6 +73,7 @@ plugins/gtk+/glade-gtk-file-chooser-widget.c
plugins/gtk+/glade-gtk-fixed-layout.c
plugins/gtk+/glade-gtk-frame.c
plugins/gtk+/glade-gtk-grid.c
+plugins/gtk+/glade-gtk-image.c
plugins/gtk+/glade-gtk-message-dialog.c
plugins/gtk+/glade-gtk-notebook.c
plugins/gtk+/glade-gtk-paned.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]