Commit 8dadf185 authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

making menu conversions seemless


	* plugins/gtk+/glade-image-item-editor.[ch], plugins/gtk+/glade-gtk.c:
	making menu conversions seemless

	* gladeui/glade-widget.c: Remove widgets from layout on hide,
	hide widgets when adding parentless prop refs.


svn path=/trunk/; revision=2014
parent 1e70cf40
2008-10-31 Tristan Van Berkom <tvb@gnome.org>
* plugins/gtk+/glade-image-item-editor.[ch], plugins/gtk+/glade-gtk.c:
making menu conversions seemless
* gladeui/glade-widget.c: Remove widgets from layout on hide,
hide widgets when adding parentless prop refs.
2008-10-30 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-widget.[ch], gladeui/glade-command.[ch]: Added
......
......@@ -1925,6 +1925,17 @@ glade_widget_hide (GladeWidget *widget)
g_return_if_fail (GLADE_IS_WIDGET (widget));
if (GTK_IS_WIDGET (widget->object))
{
GladeDesignView *view;
GtkWidget *layout;
if ((view = glade_design_view_get_from_project (glade_widget_get_project (widget))) != NULL)
{
layout = GTK_WIDGET (glade_design_view_get_layout (view));
if (GTK_BIN (layout)->child == GTK_WIDGET (widget->object))
gtk_container_remove (GTK_CONTAINER (layout), GTK_BIN (layout)->child);
}
gtk_widget_hide (GTK_WIDGET (widget->object));
}
widget->visible = FALSE;
......@@ -1948,6 +1959,12 @@ glade_widget_add_prop_ref (GladeWidget *widget, GladeProperty *property)
if (!g_list_find (widget->prop_refs, property))
widget->prop_refs = g_list_prepend (widget->prop_refs, property);
/* parentless widget reffed widgets are added to thier reffering widgets.
* they cant be in the design view.
*/
if (property->klass->parentless_widget)
glade_widget_hide (widget);
}
/**
......
......@@ -5882,6 +5882,10 @@ glade_gtk_menu_item_add_child (GladeWidgetAdaptor *adaptor,
return;
}
g_object_set_data (child,
"special-child-type",
"submenu");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (object), GTK_WIDGET (child));
}
......@@ -5989,13 +5993,15 @@ glade_gtk_image_menu_item_get_children (GladeWidgetAdaptor *adaptor,
{
GList *list = NULL;
GtkWidget *child;
GladeWidget *gitem;
g_return_val_if_fail (GTK_IS_MENU_ITEM (object), NULL);
gitem = glade_widget_get_from_gobject (object);
if ((child = gtk_menu_item_get_submenu (GTK_MENU_ITEM (object))))
list = g_list_append (list, child);
if ((child = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (object))))
if (glade_project_get_format (gitem->project) == GLADE_PROJECT_FORMAT_LIBGLADE &&
(child = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (object))))
list = g_list_append (list, child);
return list;
......@@ -6369,7 +6375,8 @@ glade_gtk_image_menu_item_write_child (GladeWidgetAdaptor *adaptor,
{
GladeXmlNode *child_node;
if (!GTK_IS_IMAGE (widget->object))
if (glade_project_get_format (widget->project) == GLADE_PROJECT_FORMAT_GTKBUILDER ||
!GTK_IS_IMAGE (widget->object))
{
GWA_GET_CLASS (GTK_TYPE_MENU_ITEM)->write_child (adaptor, widget, context, node);
return;
......
......@@ -275,9 +275,11 @@ custom_toggled (GtkWidget *widget,
if (!get_image_widget (item_editor->loaded_widget))
{
/* item_editor->loaded_widget may be set to NULL after the create_command. */
GladeWidget *loaded = item_editor->loaded_widget;
GladeWidget *loaded = item_editor->loaded_widget;
GladeWidget *image;
property = glade_widget_get_property (loaded, "image");
if (glade_project_get_format (loaded->project) == GLADE_PROJECT_FORMAT_LIBGLADE)
image = glade_command_create (glade_widget_adaptor_get_by_type (GTK_TYPE_IMAGE),
item_editor->loaded_widget, NULL,
......@@ -287,7 +289,7 @@ custom_toggled (GtkWidget *widget,
image = glade_command_create (glade_widget_adaptor_get_by_type (GTK_TYPE_IMAGE),
NULL, NULL, glade_widget_get_project (loaded));
glade_command_set_property (loaded, "image", image);
glade_command_set_property (property, image->object);
}
/* Make sure nobody deletes this... */
......
......@@ -415,7 +415,7 @@ embedded in another object</_tooltip>
<!-- We save the label manually with the stock value if use_stock is set. -->
<property id="label" save="False" custom-layout="True"/>
<property id="use-underline" custom-layout="True"/>
<property id="image" libglade-unsupported="True" visible="False"/>
<property id="image" libglade-unsupported="True" parentless-widget="True" visible="False"/>
<!-- need to fake this property since its not available yet ! -->
<property id="accel-group" libglade-unsupported="True"/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment