mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-09-24 00:04:33 -04:00
fixed bug 345604 "Pasting a widget does not paste the packing options"
* src/glade-command.c: fixed bug 345604 "Pasting a widget does not paste the packing options" * src/glade-property-class.[ch]: added transfer_on_paste property to GladePropertyClass. * src/glade-widget.[ch]: exported glade_widget_dup_properties() * src/glade.h added GLADE_TAG_TRANSFER_ON_PASTE tag. * widgets/gtk+.xml.in: set transfer-on-paste on corresponding packing properties.
This commit is contained in:
parent
c74ca729cb
commit
37b805c49a
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
||||
2006-08-16 Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
|
||||
* src/glade-command.c: fixed bug 345604
|
||||
"Pasting a widget does not paste the packing options"
|
||||
|
||||
* src/glade-property-class.[ch]: added transfer_on_paste property to
|
||||
GladePropertyClass.
|
||||
|
||||
* src/glade-widget.[ch]: exported glade_widget_dup_properties()
|
||||
|
||||
* src/glade.h added GLADE_TAG_TRANSFER_ON_PASTE tag.
|
||||
|
||||
* widgets/gtk+.xml.in: set transfer-on-paste on corresponding packing
|
||||
properties.
|
||||
|
||||
* src/glade-base-editor.c: fixed posible bug when emiting delete-child
|
||||
signal.
|
||||
|
||||
2006-08-11 Tristan Van Berkom <tvb@gnome.org>
|
||||
|
||||
* configure.in, NEWS: Wrapping the 3.0 tarball.
|
||||
|
@ -1205,6 +1205,23 @@ glade_command_create (GladeWidgetClass *class,
|
||||
return widget;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_command_transfer_props (GladeWidget *gnew, GList *saved_props)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = saved_props; l; l = l->next)
|
||||
{
|
||||
GladeProperty *prop, *sprop = l->data;
|
||||
|
||||
prop = glade_widget_get_pack_property (gnew, sprop->class->id);
|
||||
|
||||
if (prop && sprop->class->transfer_on_paste &&
|
||||
glade_property_class_match (prop->class, sprop->class))
|
||||
glade_property_set_value (prop, sprop->value);
|
||||
}
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
GLADE_CUT,
|
||||
GLADE_COPY,
|
||||
@ -1239,7 +1256,7 @@ glade_command_paste_execute (GladeCommandCutCopyPaste *me)
|
||||
{
|
||||
GladeProject *active_project = glade_app_get_project ();
|
||||
CommandData *cdata;
|
||||
GList *list, *remove = NULL, *l;
|
||||
GList *list, *remove = NULL, *l, *saved_props;
|
||||
gchar *special_child_type;
|
||||
|
||||
if (me->widgets)
|
||||
@ -1268,6 +1285,8 @@ glade_command_paste_execute (GladeCommandCutCopyPaste *me)
|
||||
g_free);
|
||||
}
|
||||
|
||||
saved_props = glade_widget_dup_properties (cdata->widget->packing_properties, FALSE);
|
||||
|
||||
/* glade_command_paste ganauntees that if
|
||||
* there we are pasting to a placeholder,
|
||||
* there is only one widget.
|
||||
@ -1286,6 +1305,14 @@ glade_command_paste_execute (GladeCommandCutCopyPaste *me)
|
||||
cdata->props_recorded == FALSE);
|
||||
}
|
||||
|
||||
glade_command_transfer_props (cdata->widget, saved_props);
|
||||
|
||||
if (saved_props)
|
||||
{
|
||||
g_list_foreach (saved_props, (GFunc)g_object_unref, NULL);
|
||||
g_list_free (saved_props);
|
||||
}
|
||||
|
||||
/* Now that we've added, apply any packing props if nescisary. */
|
||||
for (l = cdata->pack_props; l; l = l->next)
|
||||
{
|
||||
|
@ -171,6 +171,7 @@ glade_property_class_new (gpointer handle)
|
||||
property_class->translatable = FALSE;
|
||||
property_class->type = GPC_NORMAL;
|
||||
property_class->virtual = TRUE;
|
||||
property_class->transfer_on_paste = FALSE;
|
||||
|
||||
return property_class;
|
||||
}
|
||||
@ -1625,6 +1626,7 @@ glade_property_class_update_from_node (GladeXmlNode *node,
|
||||
class->visible = glade_xml_get_property_boolean (node, GLADE_TAG_VISIBLE, class->visible);
|
||||
class->ignore = glade_xml_get_property_boolean (node, GLADE_TAG_IGNORE, class->ignore);
|
||||
class->resource = glade_xml_get_property_boolean (node, GLADE_TAG_RESOURCE, class->resource);
|
||||
class->transfer_on_paste = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSFER_ON_PASTE, class->transfer_on_paste);
|
||||
|
||||
/* No atk introspection here.
|
||||
*/
|
||||
|
@ -174,6 +174,8 @@ struct _GladePropertyClass
|
||||
* directory).
|
||||
*/
|
||||
|
||||
gboolean transfer_on_paste;
|
||||
|
||||
/* Delagate to verify if this is a valid value for this property,
|
||||
* if this function exists and returns FALSE, then glade_property_set
|
||||
* will abort before making any changes
|
||||
|
@ -660,7 +660,7 @@ glade_widget_build_object (GladeWidgetClass *klass, GladeWidget *widget, GladeWi
|
||||
return object;
|
||||
}
|
||||
|
||||
static GList *
|
||||
GList *
|
||||
glade_widget_dup_properties (GList *template_props, gboolean as_load)
|
||||
{
|
||||
GList *list, *properties = NULL;
|
||||
@ -1459,6 +1459,9 @@ glade_widget_dup_internal (GladeWidget *parent, GladeWidget *template)
|
||||
if (gwidget->internal)
|
||||
glade_widget_copy_properties (gwidget, template);
|
||||
|
||||
if (gwidget->packing_properties == NULL)
|
||||
gwidget->packing_properties = glade_widget_dup_properties (template->packing_properties , FALSE);
|
||||
|
||||
/* If custom properties are still at thier
|
||||
* default value, they need to be synced.
|
||||
*/
|
||||
|
@ -185,6 +185,11 @@ gboolean glade_widget_has_decendant (GladeWidget *w
|
||||
GType type);
|
||||
LIBGLADEUI_API
|
||||
GladeWidget *glade_widget_event_widget (void);
|
||||
|
||||
LIBGLADEUI_API
|
||||
GList *glade_widget_dup_properties (GList *template_props,
|
||||
gboolean as_load);
|
||||
|
||||
/*******************************************************************************
|
||||
Project, object property references
|
||||
*******************************************************************************/
|
||||
|
@ -136,6 +136,7 @@ typedef enum _GladeItemAppearance GladeItemAppearance;
|
||||
#define GLADE_TAG_ATK_ACTION "atk-action"
|
||||
#define GLADE_TAG_ATK_PROPERTY "atk-property"
|
||||
#define GLADE_TAG_FIXED "fixed"
|
||||
#define GLADE_TAG_TRANSFER_ON_PASTE "transfer-on-paste"
|
||||
|
||||
#define GLADE_NUMERICAL_STEP_INCREMENT 1
|
||||
#define GLADE_FLOATING_STEP_INCREMENT 0.01F
|
||||
|
@ -114,12 +114,15 @@
|
||||
<remove-child-function>glade_gtk_box_remove_child</remove-child-function>
|
||||
<child-set-property-function>glade_gtk_box_set_child_property</child-set-property-function>
|
||||
<properties>
|
||||
<property id="pack-type">
|
||||
<property id="expand" transfer-on-paste="True"/>
|
||||
<property id="fill" transfer-on-paste="True"/>
|
||||
<property id="pack-type" transfer-on-paste="True">
|
||||
<displayable-values>
|
||||
<value id="GTK_PACK_START" _name="Start"/>
|
||||
<value id="GTK_PACK_END" _name="End"/>
|
||||
</displayable-values>
|
||||
</property>
|
||||
<property id="padding" transfer-on-paste="True"/>
|
||||
</properties>
|
||||
</child>
|
||||
</children>
|
||||
@ -338,6 +341,8 @@
|
||||
<spec>glade_standard_int_spec</spec>
|
||||
<_tooltip>The position of the tool item in the toolbar</_tooltip>
|
||||
</property>
|
||||
<property id="expand" transfer-on-paste="True"/>
|
||||
<property id="homogeneous" transfer-on-paste="True"/>
|
||||
</properties>
|
||||
</child>
|
||||
</children>
|
||||
@ -786,20 +791,22 @@
|
||||
<remove-child-function>glade_gtk_table_remove_child</remove-child-function>
|
||||
<replace-child-function>glade_gtk_table_replace_child</replace-child-function>
|
||||
<properties>
|
||||
<property id="x-options">
|
||||
<property id="x-options" transfer-on-paste="True">
|
||||
<displayable-values>
|
||||
<value id="GTK_EXPAND" _name="Expand"/>
|
||||
<value id="GTK_SHRINK" _name="Shrink"/>
|
||||
<value id="GTK_FILL" _name="Fill"/>
|
||||
</displayable-values>
|
||||
</property>
|
||||
<property id="y-options">
|
||||
<property id="y-options" transfer-on-paste="True">
|
||||
<displayable-values>
|
||||
<value id="GTK_EXPAND" _name="Expand"/>
|
||||
<value id="GTK_SHRINK" _name="Shrink"/>
|
||||
<value id="GTK_FILL" _name="Fill"/>
|
||||
</displayable-values>
|
||||
</property>
|
||||
<property id="x-padding" transfer-on-paste="True"/>
|
||||
<property id="y-padding" transfer-on-paste="True"/>
|
||||
<property id="right-attach">
|
||||
<verify-function>glade_gtk_table_verify_right_attach</verify-function>
|
||||
</property>
|
||||
@ -824,6 +831,10 @@
|
||||
<type>GtkWidget</type>
|
||||
<add-child-function>glade_gtk_paned_add_child</add-child-function>
|
||||
<remove-child-function>glade_gtk_paned_remove_child</remove-child-function>
|
||||
<properties>
|
||||
<property id="resize" transfer-on-paste="True"/>
|
||||
<property id="shrink" transfer-on-paste="True"/>
|
||||
</properties>
|
||||
</child>
|
||||
</children>
|
||||
</glade-widget-class>
|
||||
|
Loading…
x
Reference in New Issue
Block a user