glade3 r2024 - in trunk: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r2024 - in trunk: . gladeui plugins/gtk+
- Date: Wed, 12 Nov 2008 17:12:00 +0000 (UTC)
Author: tvb
Date: Wed Nov 12 17:12:00 2008
New Revision: 2024
URL: http://svn.gnome.org/viewvc/glade3?rev=2024&view=rev
Log:
* plugins/gtk+/glade-gtk.c: Fixed loading of images and only set image
data when in the correct edit mode.
* plugins/gtk+/glade-convert.c: Fixed toolbutton conversions to search
icon factories from the beginning of the object list and not the current
list position.
* gladeui/glade-project.c: When changing resource paths, reload all pixbuf
properties automagically (this wont work for custom pixbufs like icon factory
has).
Modified:
trunk/ChangeLog
trunk/gladeui/glade-project.c
trunk/plugins/gtk+/glade-convert.c
trunk/plugins/gtk+/glade-gtk.c
trunk/plugins/gtk+/glade-gtk.h
Modified: trunk/gladeui/glade-project.c
==============================================================================
--- trunk/gladeui/glade-project.c (original)
+++ trunk/gladeui/glade-project.c Wed Nov 12 17:12:00 2008
@@ -1068,6 +1068,48 @@
return path;
}
+static void
+update_project_for_resource_path (GladeProject *project)
+{
+ GladeWidget *widget;
+ GladeProperty *property;
+ GList *l, *list;
+
+ for (l = project->priv->objects; l; l = l->next)
+ {
+
+ widget = glade_widget_get_from_gobject (l->data);
+
+ for (list = widget->properties; list; list = list->next)
+ {
+ property = list->data;
+
+ /* XXX We should have a "resource" flag on properties that need
+ * to be loaded from the resource path, but that would require
+ * that they can serialize both ways (custom properties are only
+ * required to generate unique strings for value comparisons).
+ */
+ if (property->klass->pspec->value_type == GDK_TYPE_PIXBUF)
+ {
+ GValue *value;
+ gchar *string;
+
+ string = glade_property_class_make_string_from_gvalue
+ (property->klass, property->value, project->priv->format);
+
+ value = glade_property_class_make_gvalue_from_string
+ (property->klass, string, project, widget);
+
+ glade_property_set_value (property, value);
+
+ g_value_unset (value);
+ g_free (value);
+ g_free (string);
+ }
+ }
+ }
+}
+
/* This function assumes ownership of 'path'. */
static void
@@ -1077,6 +1119,7 @@
g_free (project->priv->resource_path);
project->priv->resource_path = path;
+ update_project_for_resource_path (project);
update_prefs_for_resource_path (project);
}
Modified: trunk/plugins/gtk+/glade-convert.c
==============================================================================
--- trunk/plugins/gtk+/glade-convert.c (original)
+++ trunk/plugins/gtk+/glade-convert.c Wed Nov 12 17:12:00 2008
@@ -32,6 +32,7 @@
#include "glade-column-types.h"
#include "glade-model-data.h"
#include "glade-icon-sources.h"
+#include "glade-tool-button-editor.h"
#include <gladeui/glade.h>
@@ -602,6 +603,10 @@
filename = g_strdup_printf ("generated-icon-%s", tdata->text);
glade_util_replace (filename, '.', '-');
+ /* Set edit mode to stock for newly generated icon */
+ property = glade_widget_get_property (tdata->widget, "image-mode");
+ glade_command_set_property (property, GLADE_TB_MODE_STOCK);
+
/* Set stock-id for newly generated icon */
property = glade_widget_get_property (tdata->widget, "stock-id");
glade_command_set_property (property, filename);
@@ -618,6 +623,10 @@
{
tdata = list->data;
+ /* Set edit mode to icon for converted icon */
+ property = glade_widget_get_property (tdata->widget, "image-mode");
+ glade_command_set_property (property, GLADE_TB_MODE_FILENAME);
+
value = glade_utils_value_from_string (GDK_TYPE_PIXBUF,
tdata->text,
project, tdata->widget);
@@ -689,11 +698,12 @@
*/
property = glade_widget_get_property (widget, "stock-id");
glade_property_get (property, &stock_id);
+
if (!stock_id)
continue;
if ((element =
- g_list_find_custom ((GList *)objects, NULL,
+ g_list_find_custom ((GList *)glade_project_get_objects (project), NULL,
(GCompareFunc)find_icon_factory)) != NULL)
{
gfactory = glade_widget_get_from_gobject (element->data);
@@ -709,6 +719,7 @@
"GladeFileName");
if (filename)
{
+
tdata = g_new0 (TextData, 1);
tdata->widget = widget;
tdata->text = g_strdup (filename);
Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c (original)
+++ trunk/plugins/gtk+/glade-gtk.c Wed Nov 12 17:12:00 2008
@@ -5380,6 +5380,8 @@
GladeWidget *widget,
GladeXmlNode *node)
{
+ GladeProperty *property;
+
if (!glade_xml_node_verify
(node, GLADE_XML_TAG_WIDGET (glade_project_get_format (widget->project))))
return;
@@ -5388,13 +5390,24 @@
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, "stock") == FALSE)
- glade_widget_property_set (widget, "image-mode", GLADE_IMAGE_MODE_STOCK);
+ }
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
- glade_widget_property_reset (widget, "image-mode");
+ }
+ 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);
+
+
}
@@ -5438,8 +5451,8 @@
static void
glade_gtk_image_set_image_mode (GObject *object, const GValue *value)
{
- GladeWidget *gwidget;
- GladeGtkImageType type;
+ GladeWidget *gwidget;
+ GladeImageEditMode type;
gwidget = glade_widget_get_from_gobject (object);
g_return_if_fail (GTK_IS_IMAGE (object));
@@ -5510,8 +5523,36 @@
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;
+ default:
+ break;
+ }
+
GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object,
id, value);
+ }
}
Modified: trunk/plugins/gtk+/glade-gtk.h
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.h (original)
+++ trunk/plugins/gtk+/glade-gtk.h Wed Nov 12 17:12:00 2008
@@ -7,26 +7,7 @@
/* Types */
-typedef enum {
- GLADEGTK_IMAGE_FILENAME = 0,
- GLADEGTK_IMAGE_STOCK,
- GLADEGTK_IMAGE_ICONTHEME
-} GladeGtkImageType;
-
-typedef enum {
- GLADEGTK_BUTTON_LABEL = 0,
- GLADEGTK_BUTTON_STOCK,
- GLADEGTK_BUTTON_CONTAINER
-} GladeGtkButtonType;
-
-GType glade_gtk_image_type_get_type (void);
-GType glade_gtk_button_type_get_type (void);
-
GParamSpec *glade_gtk_gnome_ui_info_spec (void);
-GParamSpec *glade_gtk_image_type_spec (void);
-
-GParamSpec *glade_gtk_button_type_spec (void);
-
#endif /* __GLADE_GTK_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]