glade3 r2047 - in trunk: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r2047 - in trunk: . gladeui plugins/gtk+
- Date: Mon, 24 Nov 2008 04:18:46 +0000 (UTC)
Author: tvb
Date: Mon Nov 24 04:18:46 2008
New Revision: 2047
URL: http://svn.gnome.org/viewvc/glade3?rev=2047&view=rev
Log:
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in:
- Fixed gtk_image_menu_item_set_stock() to not override the label value if not
in use_stock mode (fixes missing labels in pasted imagemenuitems).
Modified:
trunk/ChangeLog
trunk/gladeui/glade-command.c
trunk/gladeui/glade-widget.c
trunk/plugins/gtk+/glade-gtk.c
Modified: trunk/gladeui/glade-command.c
==============================================================================
--- trunk/gladeui/glade-command.c (original)
+++ trunk/gladeui/glade-command.c Mon Nov 24 04:18:46 2008
@@ -929,6 +929,28 @@
G_CALLBACK (glade_command_placeholder_destroyed), cdata);
}
+
+static GList *
+get_all_parentless_reffed_widgets (GList *reffed, GladeWidget *widget)
+{
+ GList *children, *l, *list;
+ GladeWidget *child;
+
+ children = glade_widget_adaptor_get_children (widget->adaptor,
+ widget->object);
+
+ for (l = children; l; l = l->next)
+ {
+ child = glade_widget_get_from_gobject (l->data);
+ if ((list = glade_widget_get_parentless_reffed_widgets (child)) != NULL)
+ reffed = g_list_concat (reffed, list);
+
+ reffed = get_all_parentless_reffed_widgets (reffed, child);
+ }
+
+ return reffed;
+}
+
/**
* glade_command_add:
* @widgets: a #Glist
@@ -989,7 +1011,7 @@
cdata->widget = g_object_ref (G_OBJECT (widget));
/* Parentless ref */
- if ((cdata->reffed = glade_widget_get_parentless_reffed_widgets (widget)) != NULL)
+ if ((cdata->reffed = get_all_parentless_reffed_widgets (cdata->reffed, widget)) != NULL)
g_list_foreach (cdata->reffed, (GFunc)g_object_ref, NULL);
/* Parent */
@@ -1080,19 +1102,26 @@
static void glade_command_remove (GList *widgets);
static void
-glade_command_remove_locked (GladeWidget *widget)
+glade_command_remove_locked (GladeWidget *widget, GList *reffed)
{
- GList list = { 0, };
+ GList list = { 0, }, *widgets, *l;
GladeWidget *locked;
- while (widget->locked_widgets)
+ widgets = g_list_copy (widget->locked_widgets);
+
+ for (l = widget->locked_widgets; l; l = l->next)
{
- locked = widget->locked_widgets->data;
+ locked = l->data;
list.data = locked;
+ if (g_list_find (reffed, locked))
+ continue;
+
glade_command_unlock_widget (locked);
glade_command_remove (&list);
}
+
+ g_list_free (widgets);
}
/**
@@ -1155,14 +1184,15 @@
cdata->widget = g_object_ref (G_OBJECT (widget));
cdata->parent = glade_widget_get_parent (widget);
cdata->project = glade_widget_get_project (widget);
- if ((cdata->reffed = glade_widget_get_parentless_reffed_widgets (widget)) != NULL)
+
+ if ((cdata->reffed = get_all_parentless_reffed_widgets (cdata->reffed, widget)) != NULL)
g_list_foreach (cdata->reffed, (GFunc)g_object_ref, NULL);
/* Undoably unset any object properties that may point to the removed object */
glade_command_delete_prop_refs (widget);
/* Undoably unlock and remove any widgets locked by this widget */
- glade_command_remove_locked (widget);
+ glade_command_remove_locked (widget, cdata->reffed);
if (widget->internal)
g_critical ("Internal widget in Remove");
@@ -1433,7 +1463,7 @@
{
GladeCommandAddRemove *cmd;
CommandData *cdata;
- GList *list, *l;
+ GList *list;
g_return_if_fail (GLADE_IS_COMMAND_ADD_REMOVE (obj));
Modified: trunk/gladeui/glade-widget.c
==============================================================================
--- trunk/gladeui/glade-widget.c (original)
+++ trunk/gladeui/glade-widget.c Mon Nov 24 04:18:46 2008
@@ -2080,7 +2080,7 @@
{
glade_property_get (property, &reffed);
if (reffed)
- widgets = g_list_prepend (widgets, reffed);
+ widgets = g_list_prepend (widgets, glade_widget_get_from_gobject (reffed));
}
}
return g_list_reverse (widgets);
Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c (original)
+++ trunk/plugins/gtk+/glade-gtk.c Mon Nov 24 04:18:46 2008
@@ -6616,7 +6616,7 @@
}
}
-static void
+static gboolean
glade_gtk_image_menu_item_set_label (GObject *object, const GValue *value)
{
GladeWidget *gitem;
@@ -6640,29 +6640,31 @@
image = gtk_image_new_from_stock (g_value_get_string (value), GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (object), image);
- /* Just for display purposes, real stock menuitems automatically have underline
- * property set. */
- gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
-
/* Get the label string... */
if (text && gtk_stock_lookup (text, &item))
gtk_label_set_label (GTK_LABEL (label), item.label);
else
gtk_label_set_label (GTK_LABEL (label), text ? text : "");
+ return TRUE;
}
- else
- gtk_label_set_label (GTK_LABEL (label), text ? text : "");
-
- /* Update underline incase... */
- gtk_label_set_use_underline (GTK_LABEL (label), use_underline);
+
+ return FALSE;
}
static void
glade_gtk_image_menu_item_set_stock (GObject *object, const GValue *value)
{
+ GladeWidget *gitem;
+ gboolean use_stock = FALSE;
+
+ gitem = glade_widget_get_from_gobject (object);
+
+ glade_widget_property_get (gitem, "use-stock", &use_stock);
+
/* Forward the work along to the label handler... */
- glade_gtk_image_menu_item_set_label (object, value);
+ if (use_stock)
+ glade_gtk_image_menu_item_set_label (object, value);
}
void
@@ -6676,7 +6678,11 @@
else if (!strcmp (id, "use-stock"))
glade_gtk_image_menu_item_set_use_stock (object, value);
else if (!strcmp (id, "label"))
- glade_gtk_image_menu_item_set_label (object, value);
+ {
+ if (!glade_gtk_image_menu_item_set_label (object, value))
+ GWA_GET_CLASS (GTK_TYPE_MENU_ITEM)->set_property (adaptor, object,
+ id, value);
+ }
else
GWA_GET_CLASS (GTK_TYPE_MENU_ITEM)->set_property (adaptor, object,
id, value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]