Glade Commands

Glade Commands — An event filter to implement the Undo/Redo stack

Synopsis


#include <glade.h>


void        glade_command_undo              (GladeProject *project);
void        glade_command_redo              (GladeProject *project);
GladeCommand* glade_command_next_undo_item  (GladeProject *project);
GladeCommand* glade_command_next_redo_item  (GladeProject *project);
void        glade_command_push_group        (const gchar *description);
void        glade_command_pop_group         (void);
void        glade_command_set_name          (GladeWidget *glade_widget,
                                             const gchar *name);
GladeWidget* glade_command_create           (GladeWidgetClass *class,
                                             GladeWidget *parent,
                                             GladePlaceholder *placeholder,
                                             GladeProject *project);
void        glade_command_delete            (GList *widgets);
            GCSetPropData;
void        glade_command_set_property      (GladeProperty *property,
                                             const GValue *value);
void        glade_command_set_properties    (GladeProperty *property,
                                             const GValue *old_value,
                                             const GValue *new_value,
                                             ...);
void        glade_command_set_properties_list
                                            (GladeProject *project,
                                             GList *props);
void        glade_command_cut               (GList *widgets);
void        glade_command_copy              (GList *widgets);
void        glade_command_paste             (GList *widgets,
                                             GladeWidget *parent,
                                             GladePlaceholder *placeholder);
void        glade_command_add_signal        (GladeWidget *glade_widget,
                                             const GladeSignal *signal);
void        glade_command_remove_signal     (GladeWidget *glade_widget,
                                             const GladeSignal *signal);
void        glade_command_change_signal     (GladeWidget *glade_widget,
                                             const GladeSignal *old,
                                             const GladeSignal *new);

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.

Details

glade_command_undo ()

void        glade_command_undo              (GladeProject *project);

Undoes the last command performed in project.

project : a GladeProject

glade_command_redo ()

void        glade_command_redo              (GladeProject *project);

Redoes the last undone command in project.

project : a GladeProject

glade_command_next_undo_item ()

GladeCommand* glade_command_next_undo_item  (GladeProject *project);

project :
Returns :

glade_command_next_redo_item ()

GladeCommand* glade_command_next_redo_item  (GladeProject *project);

project :
Returns :

glade_command_push_group ()

void        glade_command_push_group        (const gchar *description);

Marks the begining of a group.

description : The collective desctiption of the command group. only the description of the first group on the stack is used when embedding groups.

glade_command_pop_group ()

void        glade_command_pop_group         (void);

Mark the end of a command group.


glade_command_set_name ()

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

glade_widget :
name :

glade_command_create ()

GladeWidget* glade_command_create           (GladeWidgetClass *class,
                                             GladeWidget *parent,
                                             GladePlaceholder *placeholder,
                                             GladeProject *project);

Creates a new widget of class and put in place of the placeholder in the project

class : the class of the widget (GtkWindow or GtkButton)
parent :
placeholder : the placeholder which will be substituted by the widget
project : the project his widget belongs to.
Returns : the newly created widget.

glade_command_delete ()

void        glade_command_delete            (GList *widgets);

Performs a delete command on the list of widgets

widgets : a GList of GladeWidgets

GCSetPropData

typedef struct {
	GladeProperty *property;
	GValue        *new_value;
	GValue        *old_value;
} GCSetPropData;

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

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

glade_command_set_property ()

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

property :
value :

glade_command_set_properties ()

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

property :
old_value :
new_value :
... :

glade_command_set_properties_list ()

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

project :
props :

glade_command_cut ()

void        glade_command_cut               (GList *widgets);

TODO: write me

widgets : a GList

glade_command_copy ()

void        glade_command_copy              (GList *widgets);

TODO: write me

widgets : a GList

glade_command_paste ()

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

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).

widgets : a GList of GladeWidget
parent : a GladeWidget
placeholder : a GladePlaceholder

glade_command_add_signal ()

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

TODO: write me

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

glade_widget : a GladeWidget
signal : a GladeSignal

glade_command_change_signal ()

void        glade_command_change_signal     (GladeWidget *glade_widget,
                                             const GladeSignal *old,
                                             const GladeSignal *new);

TODO: write me

glade_widget : a GladeWidget
old : a GladeSignal
new : a GladeSignal