GladeCommand: Glade User Interface Designer Reference Manual

## GladeCommand GladeCommand — An event filter to implement the Undo/Redo stack. |

## Functions

void | glade_command_push_group ()
void | glade_command_pop_group ()
gboolean | glade_command_execute ()
gboolean | glade_command_undo ()
gboolean | glade_command_unifies ()
void | glade_command_collapse ()
void | glade_command_set_property ()
void | glade_command_set_property_value ()
void | glade_command_set_properties ()
void | glade_command_set_properties_list ()
void | glade_command_set_name ()
void | glade_command_delete ()
GladeWidget * | glade_command_create ()
void | glade_command_cut ()
void | glade_command_paste ()
void | glade_command_dnd ()
void | glade_command_add_signal ()
void | glade_command_remove_signal ()
void | glade_command_change_signal ()
void | glade_command_set_i18n ()
void | glade_command_add ()
const gchar * | glade_command_description ()
gint | glade_command_get_group_depth ()
gint | glade_command_group_id ()
void | glade_command_lock_widget ()
void | glade_command_unlock_widget ()
void | glade_command_set_project_domain ()
void | glade_command_set_project_license ()
void | glade_command_set_project_resource_path ()
void | glade_command_set_project_target ()
void | glade_command_set_project_template ()
void | glade_command_set_property_enabled ()

## Types and Values

struct | GladeCommandSetPropData
| GladeCommand

## Description

The Glade Command api allows us to view user actions as items and execute and undo those items; each GladeProject has its own Undo/Redo stack.

## Functions

### glade_command_push_group ()

    void
    glade_command_push_group (const gchar *fmt,
                              ...);

Marks the beginning of a group.

#### Parameters

fmt | The collective description of the command group. only the description of the first group on the stack is used when embedding groups. |
... | args to the format string. |

### glade_command_pop_group ()

    void
    glade_command_pop_group (void);

Mark the end of a command group.

### glade_command_execute ()

    gboolean
    glade_command_execute (GladeCommand *command);

Executes `command`

#### Parameters

command | A GladeCommand |

#### Returns

whether the command was successfully executed

### glade_command_undo ()

    gboolean
    glade_command_undo (GladeCommand *command);

Undo the effects of `command`

#### Parameters

command | A GladeCommand |

#### Returns

whether the command was successfully reversed

### glade_command_unifies ()

    gboolean
    glade_command_unifies (GladeCommand *command,
                           GladeCommand *other);

Checks whether `command` and `other` can be unified to make one single command.

#### Parameters

command | A GladeCommand |
other | another GladeCommand |

#### Returns

whether they can be unified.

### glade_command_collapse ()

    void
    glade_command_collapse (GladeCommand *command,
                            GladeCommand *other);

Merges `other` into `command` , so that `command` now covers both commands and `other` can be dispensed with.

#### Parameters

command | A GladeCommand |
other | another GladeCommand |

### glade_command_set_property ()

    void
    glade_command_set_property (GladeProperty *property,
                                ...);

### glade_command_set_property_value ()

    void
    glade_command_set_property_value (GladeProperty *property,
                                      const GValue *value);

### glade_command_set_properties ()

    void
    glade_command_set_properties (GladeProperty *property,
                                  const GValue *old_value,
                                  const GValue *new_value,
                                  ...);

### glade_command_set_properties_list ()

    void
    glade_command_set_properties_list (GladeProject *project,
                                       GList *props);

#### Parameters

project | a GladeProject |
props | List of GladeProperty. | [element-type GladeProperty]

### glade_command_set_name ()

    void
    glade_command_set_name (GladeWidget *glade_widget,
                            const gchar *name);

### glade_command_delete ()

    void
    glade_command_delete (GList *widgets);

Performs a delete command on the list of widgets.

#### Parameters

widgets | a GList of GladeWidgets. | [element-type GladeWidget]

### glade_command_create ()

    GladeWidget *
    glade_command_create (GladeWidgetAdaptor *adaptor,
                          GladeWidget *parent,
                          GladePlaceholder *placeholder,
                          GladeProject *project);

Creates a new widget using `adaptor` and put in place of the `placeholder` in the `project`

#### Parameters

adaptor | A GladeWidgetAdaptor |
parent | the parent GladeWidget to add the new widget to. | [nullable]
placeholder | the placeholder which will be substituted by the widget. | [nullable]
project | the project his widget belongs to. |

#### Returns

the newly created widget.

[transfer full]

### glade_command_cut ()

    void
    glade_command_cut (GList *widgets);

Removes the list of widgets and adds them to the clipboard.

#### Parameters

widgets | a GList of GladeWidgets. | [element-type GladeWidget]

### glade_command_paste ()

    void
    glade_command_paste (GList *widgets,
                         GladeWidget *parent,
                         GladePlaceholder *placeholder,
                         GladeProject *project);

Performs a paste command on all widgets in `widgets` to `parent` , possibly replacing `placeholder` (note toplevels dont need a parent; the active project will be used when pasting toplevel objects).

#### Parameters

widgets | a GList of GladeWidget. | [element-type GladeWidget]
parent | a GladeWidget. | [allow-none]
placeholder | a GladePlaceholder. | [allow-none]
project | a GladeProject |

### glade_command_dnd ()

    void
    glade_command_dnd (GList *widgets,
                       GladeWidget *parent,
                       GladePlaceholder *placeholder);

Performs a drag-n-drop command, i.e. removes the list of widgets and adds them to the new parent, possibly replacing `placeholder` (note toplevels dont need a parent; the active project will be used when pasting toplevel objects).

#### Parameters

widgets | a GList of GladeWidget. | [element-type GladeWidget]
parent | a GladeWidget. | [allow-none]
placeholder | a GladePlaceholder. | [allow-none]

### glade_command_add_signal ()

    void
    glade_command_add_signal (GladeWidget *glade_widget,
                              const GladeSignal *signal);

TODO: write me

#### Parameters

glade_widget | a GladeWidget |
signal | a GladeSignal |

### glade_command_remove_signal ()

    void
    glade_command_remove_signal (GladeWidget *glade_widget,
                                 const GladeSignal *signal);

TODO: write me

#### Parameters

glade_widget | a GladeWidget |
signal | a GladeSignal |

### glade_command_change_signal ()

    void
    glade_command_change_signal (GladeWidget *glade_widget,
                                 const GladeSignal *old_signal,
                                 const GladeSignal *new_signal);

TODO: write me

#### Parameters

glade_widget | a GladeWidget |
old_signal | a GladeSignal |
new_signal | a GladeSignal |

### glade_command_set_i18n ()

    void
    glade_command_set_i18n (GladeProperty *property,
                            gboolean translatable,
                            const gchar *context,
                            const gchar *comment);

Sets the i18n data on the property.

#### Parameters

property | a GladeProperty |
translatable | a gboolean |
context | a const gchar * |
comment | a const gchar * |

### glade_command_add ()

    void
    glade_command_add (GList *widgets,
                       GladeWidget *parent,
                       GladePlaceholder *placeholder,
                       GladeProject *project,
                       gboolean pasting);

Performs an add command on all widgets in `widgets` to `parent` , possibly replacing `placeholder` (note toplevels don't need a parent; the active project will be used when pasting toplevel objects). Pasted widgets will persist packing properties from their cut/copy source while newly added widgets will prefer packing defaults.

#### Parameters

widgets | a GList. | [element-type GladeWidget]
parent | a GladeWidget |
placeholder | a GladePlaceholder |
project | a GladeProject |
pasting | whether we are pasting an existing widget or creating a new one. |

### glade_command_description ()

    const gchar *
    glade_command_description (GladeCommand *command);

### glade_command_get_group_depth ()

    gint
    glade_command_get_group_depth (void);

### glade_command_group_id ()

    gint
    glade_command_group_id (GladeCommand *command);

### glade_command_lock_widget ()

    void
    glade_command_lock_widget (GladeWidget *widget,
                               GladeWidget *locked);

Sets `locked` to be in a locked up state spoken for by `widget` , locked widgets cannot be removed from the project until unlocked.

#### Parameters

widget | A GladeWidget |
locked | The GladeWidget to lock |

### glade_command_unlock_widget ()

    void
    glade_command_unlock_widget (GladeWidget *widget);

Unlocks `widget` so that it can be removed from the project again

#### Parameters

widget | A GladeWidget |

### glade_command_set_project_domain ()

    void
    glade_command_set_project_domain (GladeProject *project,
                                      const gchar *domain);

Sets `domain` as the translation domain for `project` .

#### Parameters

project | A GladeProject |
domain | The translation domain for `project` |

### glade_command_set_project_license ()

    void
    glade_command_set_project_license (GladeProject *project,
                                       const gchar *license);

Sets the license agreement for `project` . It will be saved in the xml as comment.

#### Parameters

project | A GladeProject |
license | License of `project` |

### glade_command_set_project_resource_path ()

    void
    glade_command_set_project_resource_path
                                   (GladeProject *project,
                                    const gchar *path);

Sets a resource path `project` .

#### Parameters

project | A GladeProject |
path | path to load resources from. |

### glade_command_set_project_target ()

    void
    glade_command_set_project_target (GladeProject *project,
                                      const gchar *catalog,
                                      gint major,
                                      gint minor);

Sets the target of `catalog` to `major` .`minor` in `project` .

#### Parameters

project | A GladeProject |
catalog | The name of the catalog to set the project's target for |
major | The new major version of `catalog` to target |
minor | The new minor version of `catalog` to target |

### glade_command_set_project_template ()

    void
    glade_command_set_project_template (GladeProject *project,
                                        GladeWidget *widget);

Sets `widget` to be the template widget in `project` .

#### Parameters

project | A GladeProject |
widget | The GladeWidget to make template |

### glade_command_set_property_enabled ()

    void
    glade_command_set_property_enabled (GladeProperty *property,
                                        gboolean enabled);

Enables or disables `property` .

`property` must be an optional property.

#### Parameters

property | An optional GladeProperty |
enabled | Whether the property should be enabled |

## Types and Values

### struct GladeCommandSetPropData

    struct GladeCommandSetPropData {
      GladeProperty *property;
      GValue        *new_value;
      GValue        *old_value;
    };

GladeProperty can be set in a list as one command, for Undo purposes; we store the list of GladeCommandSetPropData with their old and new GValue.

#### Members

GladeProperty *`property`; | A GladeProperty to set |
GValue *`new_value`; | The new GValue to assign to `property` |
GValue *`old_value`; | The old GValue of `property` |

### GladeCommand

    typedef struct _GladeCommand GladeCommand;