GladeProject: Glade User Interface Designer Reference Manual

## GladeProject GladeProject — The Glade document hub and Load/Save interface. |

## Functions

GladeProject * | glade_project_new ()
gboolean | glade_project_load_from_file ()
GladeProject * | glade_project_load ()
gboolean | glade_project_save ()
const gchar * | glade_project_get_path ()
gchar * | glade_project_get_name ()
void | glade_project_undo ()
void | glade_project_redo ()
GladeCommand * | glade_project_next_undo_item ()
GladeCommand * | glade_project_next_redo_item ()
void | glade_project_push_undo ()
GtkWidget * | glade_project_undo_items ()
GtkWidget * | glade_project_redo_items ()
void | glade_project_reset_path ()
gboolean | glade_project_get_readonly ()
const GList * | glade_project_get_objects ()
void | glade_project_add_object ()
void | glade_project_remove_object ()
gboolean | glade_project_has_object ()
GladeWidget * | glade_project_get_widget_by_name ()
gchar * | glade_project_new_widget_name ()
gboolean | glade_project_is_selected ()
void | glade_project_selection_set ()
void | glade_project_selection_add ()
void | glade_project_selection_remove ()
void | glade_project_selection_clear ()
void | glade_project_selection_changed ()
GList * | glade_project_selection_get ()
gboolean | glade_project_get_has_selection ()
gchar * | glade_project_resource_fullpath ()
gboolean | glade_project_is_loading ()
time_t | glade_project_get_file_mtime ()
gboolean | glade_project_get_modified ()
gboolean | glade_project_autosave ()
gboolean | glade_project_available_widget_name ()
gboolean | glade_project_backup ()
void | glade_project_cancel_load ()
void | glade_project_check_reordered ()
void | glade_project_command_cut ()
void | glade_project_command_delete ()
void | glade_project_command_paste ()
void | glade_project_copy_selection ()
gchar * | glade_project_display_dependencies ()
GladeWidgetAdaptor * | glade_project_get_add_item ()
const gchar * | glade_project_get_css_provider_path ()
const gchar * | glade_project_get_license ()
GladePointerMode | glade_project_get_pointer_mode ()
const gchar * | glade_project_get_resource_path ()
void | glade_project_get_target_version ()
GladeWidget * | glade_project_get_template ()
const gchar * | glade_project_get_translation_domain ()
gboolean | glade_project_load_cancelled ()
void | glade_project_preview ()
void | glade_project_properties ()
void | glade_project_push_progress ()
void | glade_project_queue_selection_changed ()
GList * | glade_project_required_libs ()
gboolean | glade_project_save_verify ()
void | glade_project_set_add_item ()
void | glade_project_set_css_provider_path ()
void | glade_project_set_license ()
void | glade_project_set_pointer_mode ()
void | glade_project_set_resource_path ()
void | glade_project_set_target_version ()
void | glade_project_set_template ()
void | glade_project_set_translation_domain ()
void | glade_project_set_widget_name ()
GList * | glade_project_toplevels ()
gboolean | glade_project_verify ()
void | glade_project_verify_property ()
void | glade_project_verify_signal ()
gchar * | glade_project_verify_widget_adaptor ()
void | glade_project_widget_changed ()
void | glade_project_widget_visibility_changed ()
gboolean | glade_project_writing_preview ()
GtkWidget * | glade_project_properties_new ()

## Types and Values

| GladeProject
enum | GladeProjectModelColumns
| GladeProjectProperties
enum | GladeSupportMask
enum | GladePointerMode
enum | GladeVerifyFlags

## Description

This object owns all project objects and is responsable for loading and saving the glade document, you can monitor the project state via this object and its signals.

## Functions

### glade_project_new ()

    GladeProject *
    glade_project_new (void);

Creates a new GladeProject.

#### Returns

a new GladeProject

### glade_project_load_from_file ()

    gboolean
    glade_project_load_from_file (GladeProject *project,
                                  const gchar *path);

### glade_project_load ()

    GladeProject *
    glade_project_load (const gchar *path);

Opens a project at the given path.

#### Parameters

path | the path of the project to load |

#### Returns

a new GladeProject for the opened project on success, `NULL` on failure.

[transfer full][nullable]

### glade_project_save ()

    gboolean
    glade_project_save (GladeProject *project,
                        const gchar *path,
                        GError **error);

Saves `project` to the given path.

#### Parameters

project | a GladeProject |
path | location to save glade file |
error | an error from the `G_FILE_ERROR` domain. |

#### Returns

`TRUE` on success, `FALSE` on failure

### glade_project_get_path ()

    const gchar *
    glade_project_get_path (GladeProject *project);

### glade_project_get_name ()

    gchar *
    glade_project_get_name (GladeProject *project);

### glade_project_undo ()

    void
    glade_project_undo (GladeProject *project);

Undoes a GladeCommand in this project.

#### Parameters

project | a GladeProject |

### glade_project_redo ()

    void
    glade_project_redo (GladeProject *project);

Redoes a GladeCommand in this project.

#### Parameters

project | a GladeProject |

### glade_project_next_undo_item ()

    GladeCommand *
    glade_project_next_undo_item (GladeProject *project);

Gets the next undo item on `project` 's command stack.

#### Parameters

project | a GladeProject |

#### Returns

the GladeCommand.

[transfer none]

### glade_project_next_redo_item ()

    GladeCommand *
    glade_project_next_redo_item (GladeProject *project);

Gets the next redo item on `project` 's command stack.

#### Parameters

project | a GladeProject |

#### Returns

the GladeCommand.

[transfer none]

### glade_project_push_undo ()

    void
    glade_project_push_undo (GladeProject *project,
                             GladeCommand *cmd);

Pushes a newly created GladeCommand onto `projects` stack.

#### Parameters

project | a GladeProject |
cmd | the GladeCommand |

### glade_project_undo_items ()

    GtkWidget *
    glade_project_undo_items (GladeProject *project);

Creates a menu of the undo items in the project stack

#### Parameters

project | A GladeProject |

#### Returns

A newly created menu.

[transfer full]

### glade_project_redo_items ()

    GtkWidget *
    glade_project_redo_items (GladeProject *project);

Creates a menu of the undo items in the project stack

#### Parameters

project | A GladeProject |

#### Returns

A newly created menu.

[transfer full]

### glade_project_reset_path ()

    void
    glade_project_reset_path (GladeProject *project);

### glade_project_get_readonly ()

    gboolean
    glade_project_get_readonly (GladeProject *project);

Gets whether the project is read only or not

#### Parameters

project | a GladeProject |

#### Returns

TRUE if project is read only

### glade_project_get_objects ()

    const GList *
    glade_project_get_objects (GladeProject *project);

#### Parameters

project | a GladeProject |

#### Returns

List of all objects in this project.

[transfer none][element-type GObject]

### glade_project_add_object ()

    void
    glade_project_add_object (GladeProject *project,
                              GObject *object);

Adds an object to the project.

#### Parameters

project | the GladeProject the widget is added to |
object | the GObject to add |

### glade_project_remove_object ()

    void
    glade_project_remove_object (GladeProject *project,
                                 GObject *object);

Removes `object` from `project` .

Note that when removing the GObject from the project we don't change ->project in the associated GladeWidget; this way UNDO can work.

#### Parameters

project | a GladeProject |
object | the GObject to remove |

### glade_project_has_object ()

    gboolean
    glade_project_has_object (GladeProject *project,
                              GObject *object);

#### Parameters

project | the GladeProject the widget is added to |
object | the GObject to search |

#### Returns

whether this object is in this project.

### glade_project_get_widget_by_name ()

    GladeWidget *
    glade_project_get_widget_by_name (GladeProject *project,
                                      const gchar *name);

Searches under `ancestor` in `project` looking for a GladeWidget named `name` .

#### Parameters

project | a GladeProject |
name | The user visible name of the widget we are looking for |

#### Returns

a pointer to the widget, `NULL` if the widget does not exist.

[transfer none][nullable]

### glade_project_new_widget_name ()

    gchar *
    glade_project_new_widget_name (GladeProject *project,
                                   GladeWidget *widget,
                                   const gchar *base_name);

Creates a new name for a widget that doesn't collide with any of the names already in `project` . This name will start with `base_name` .

Note the `widget` parameter is ignored and preserved only for historical reasons.

#### Parameters

project | a GladeProject |
widget | the GladeWidget intended to receive a new name, or `NULL` |
base_name | base name of the widget to create |

#### Returns

a string containing the new name, `NULL` if there is not enough memory for this string

### glade_project_is_selected ()

    gboolean
    glade_project_is_selected (GladeProject *project,
                               GObject *object);

#### Parameters

project | a GladeProject |
object | a GObject |

#### Returns

whether `object` is in `project` selection

### glade_project_selection_set ()

    void
    glade_project_selection_set (GladeProject *project,
                                 GObject *object,
                                 gboolean emit_signal);

Set the selection in `project` to `object`

If `emit_signal` is `TRUE`, calls `glade_project_selection_changed()`.

#### Parameters

project | a GladeProject |
object | a GObject in `project` |
emit_signal | whether or not to emit a signal indicating a selection change |

### glade_project_selection_add ()

    void
    glade_project_selection_add (GladeProject *project,
                                 GObject *object,
                                 gboolean emit_signal);

Adds `object` to the selection chain of `project`

If `emit_signal` is `TRUE`, calls `glade_project_selection_changed()`.

#### Parameters

project | a GladeProject |
object | a GObject in `project` |
emit_signal | whether or not to emit a signal indicating a selection change |

### glade_project_selection_remove ()

    void
    glade_project_selection_remove (GladeProject *project,
                                    GObject *object,
                                    gboolean emit_signal);

Removes `object` from the selection chain of `project`

If `emit_signal` is `TRUE`, calls `glade_project_selection_changed()`.

#### Parameters

project | a GladeProject |
object | a GObject in `project` |
emit_signal | whether or not to emit a signal indicating a selection change |

### glade_project_selection_clear ()

    void
    glade_project_selection_clear (GladeProject *project,
                                   gboolean emit_signal);

Clears `project` 's selection chain

If `emit_signal` is `TRUE`, calls `glade_project_selection_changed()`.

#### Parameters

project | a GladeProject |
emit_signal | whether or not to emit a signal indication a selection change |

### glade_project_selection_changed ()

    void
    glade_project_selection_changed (GladeProject *project);

Causes `project` to emit a "selection_changed" signal.

#### Parameters

project | a GladeProject |

### glade_project_selection_get ()

    GList *
    glade_project_selection_get (GladeProject *project);

#### Parameters

project | a GladeProject |

#### Returns

a GList containing the GtkWidget items currently selected in `project` .

[transfer none][element-type GtkWidget]

### glade_project_get_has_selection ()

    gboolean
    glade_project_get_has_selection (GladeProject *project);

#### Parameters

project | a GladeProject |

#### Returns

whether `project` currently has a selection

### glade_project_resource_fullpath ()

    gchar *
    glade_project_resource_fullpath (GladeProject *project,
                                     const gchar *resource);

Project resource strings are always relative, this function transforms a path relative to project to a full path.

#### Parameters

project | The GladeProject. |
resource | The resource basename |

#### Returns

A newly allocated string holding the full path to the resource.

### glade_project_is_loading ()

    gboolean
    glade_project_is_loading (GladeProject *project);

#### Parameters

project | A GladeProject |

#### Returns

Whether the project is being loaded or not

### glade_project_get_file_mtime ()

    time_t
    glade_project_get_file_mtime (GladeProject *project);

### glade_project_get_modified ()

    gboolean
    glade_project_get_modified (GladeProject *project);

Get's whether the project has been modified since it was last saved.

#### Parameters

project | a GladeProject |

#### Returns

`TRUE` if the project has been modified since it was last saved

### glade_project_autosave ()

    gboolean
    glade_project_autosave (GladeProject *project,
                            GError **error);

Saves an autosave snapshot of `project` to it's currently set path

If the project was never saved, nothing is done and `TRUE` is returned.

#### Parameters

project | a GladeProject |
error | an error from the G_FILE_ERROR domain. |

#### Returns

`TRUE` on success, `FALSE` on failure

### glade_project_available_widget_name ()

    gboolean
    glade_project_available_widget_name (GladeProject *project,
                                         GladeWidget *widget,
                                         const gchar *name);

Checks whether `name` is an appropriate name for `widget` .

#### Parameters

project | a GladeProject |
widget | the GladeWidget intended to receive a new name |
name | base name of the widget to create |

#### Returns

whether the name is available or not.

### glade_project_backup ()

    gboolean
    glade_project_backup (GladeProject *project,
                          const gchar *path,
                          GError **error);

Backup the last file which `project` has saved to or was loaded from.

If `path` is not the same as the current project path, then the current project path will be backed up under the new location.

If this the first save, and no persisted file exists, then `TRUE` is returned and no backup is made.

#### Parameters

project | a GladeProject |
path | location to save glade file |
error | an error from the G_FILE_ERROR domain. |

#### Returns

`TRUE` on success, `FALSE` on failure

### glade_project_cancel_load ()

    void
    glade_project_cancel_load (GladeProject *project);

### glade_project_check_reordered ()

    void
    glade_project_check_reordered (GladeProject *project,
                                   GladeWidget *parent,
                                   GList *old_order);

#### Parameters

project | a GladeProject |
parent | the parent GladeWidget |
old_order | the old order to compare with. | [element-type GObject]

### glade_project_command_cut ()

    void
    glade_project_command_cut (GladeProject *project);

### glade_project_command_delete ()

    void
    glade_project_command_delete (GladeProject *project);

### glade_project_command_paste ()

    void
    glade_project_command_paste (GladeProject *project,
                                 GladePlaceholder *placeholder);

### glade_project_copy_selection ()

    void
    glade_project_copy_selection (GladeProject *project);

### glade_project_display_dependencies ()

    gchar *
    glade_project_display_dependencies (GladeProject *project);

### glade_project_get_add_item ()

    GladeWidgetAdaptor *
    glade_project_get_add_item (GladeProject *project);

#### Parameters

project | a GladeProject |

#### Returns

a GladeWidgetAdaptor.

[transfer none]

### glade_project_get_css_provider_path ()

    const gchar *
    glade_project_get_css_provider_path (GladeProject *project);

#### Parameters

project | a GladeProject |

#### Returns

the CSS path of the custom provider used for `project`

### glade_project_get_license ()

    const gchar *
    glade_project_get_license (GladeProject *project);

### glade_project_get_pointer_mode ()

    GladePointerMode
    glade_project_get_pointer_mode (GladeProject *project);

### glade_project_get_resource_path ()

    const gchar *
    glade_project_get_resource_path (GladeProject *project);

### glade_project_get_target_version ()

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

Fetches the target version of the `project` for `catalog` .

#### Parameters

project | a GladeProject |
catalog | the name of the catalog `project` includes |
major | the return location for the target major version |
minor | the return location for the target minor version |

### glade_project_get_template ()

    GladeWidget *
    glade_project_get_template (GladeProject *project);

#### Parameters

project | a GladeProject |

#### Returns

a GladeWidget.

[transfer none]

### glade_project_get_translation_domain ()

    const gchar *
    glade_project_get_translation_domain (GladeProject *project);

#### Parameters

project | a GladeProject |

#### Returns

the translation domain

### glade_project_load_cancelled ()

    gboolean
    glade_project_load_cancelled (GladeProject *project);

### glade_project_preview ()

    void
    glade_project_preview (GladeProject *project,
                           GladeWidget *gwidget);

Creates and displays a preview window holding a snapshot of `gwidget` 's toplevel window in `project` . Note that the preview window is only a snapshot of the current state of the project, there is no limit on how many preview snapshots can be taken.

#### Parameters

project | a GladeProject |
gwidget | a GladeWidget |

### glade_project_properties ()

    void
    glade_project_properties (GladeProject *project);

Runs a document properties dialog for `project` .

#### Parameters

project | A GladeProject |

### glade_project_push_progress ()

    void
    glade_project_push_progress (GladeProject *project);

### glade_project_queue_selection_changed ()

    void
    glade_project_queue_selection_changed (GladeProject *project);

### glade_project_required_libs ()

    GList *
    glade_project_required_libs (GladeProject *project);

#### Parameters

project | a GladeProject |

#### Returns

a GList of allocated strings which are the names of the required catalogs for this project.

[transfer full][element-type utf8]

### glade_project_save_verify ()

    gboolean
    glade_project_save_verify (GladeProject *project,
                               const gchar *path,
                               GladeVerifyFlags flags,
                               GError **error);

Saves `project` to the given path.

#### Parameters

project | a GladeProject |
path | location to save glade file |
flags | the GladeVerifyFlags to warn about |
error | an error from the `G_FILE_ERROR` domain. |

#### Returns

`TRUE` on success, `FALSE` on failure

### glade_project_set_add_item ()

    void
    glade_project_set_add_item (GladeProject *project,
                                GladeWidgetAdaptor *adaptor);

#### Parameters

project | a GladeProject |
adaptor | a GladeWidgetAdaptor. | [transfer full]

### glade_project_set_css_provider_path ()

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

Set the custom CSS provider path to use in `project`

#### Parameters

project | a GladeProject |
path | a CSS file path |

### glade_project_set_license ()

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

### glade_project_set_pointer_mode ()

    void
    glade_project_set_pointer_mode (GladeProject *project,
                                    GladePointerMode mode);

### glade_project_set_resource_path ()

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

### glade_project_set_target_version ()

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

### glade_project_set_template ()

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

### glade_project_set_translation_domain ()

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

Set the project translation domain.

#### Parameters

project | a GladeProject |
domain | the translation domain |

### glade_project_set_widget_name ()

    void
    glade_project_set_widget_name (GladeProject *project,
                                   GladeWidget *widget,
                                   const gchar *name);

Sets `name` on `widget` in `project` , if `name` is not available then a new name will be used.

#### Parameters

project | a GladeProject |
widget | the GladeWidget to set a name on |
name | the name to set. |

### glade_project_toplevels ()

    GList *
    glade_project_toplevels (GladeProject *project);

#### Parameters

project | a GladeProject |

#### Returns

a GList containing the GtkWidget toplevel items in `project` .

[transfer none][element-type GtkWidget]

### glade_project_verify ()

    gboolean
    glade_project_verify (GladeProject *project,
                          gboolean saving,
                          GladeVerifyFlags flags);

### glade_project_verify_property ()

    void
    glade_project_verify_property (GladeProperty *property);

### glade_project_verify_signal ()

    void
    glade_project_verify_signal (GladeWidget *widget,
                                 GladeSignal *signal);

### glade_project_verify_widget_adaptor ()

    gchar *
    glade_project_verify_widget_adaptor (GladeProject *project,
                                         GladeWidgetAdaptor *adaptor,
                                         GladeSupportMask *mask);

Checks the supported state of this widget adaptor and generates a string to show in the UI describing why.

#### Parameters

project | A GladeProject |
adaptor | the GladeWidgetAdaptor to verify |
mask | a return location for a GladeSupportMask |

#### Returns

A newly allocated string

### glade_project_widget_changed ()

    void
    glade_project_widget_changed (GladeProject *project,
                                  GladeWidget *gwidget);

### glade_project_widget_visibility_changed ()

    void
    glade_project_widget_visibility_changed
                                   (GladeProject *project,
                                    GladeWidget *widget,
                                    gboolean visible);

Emits GladeProject::widget-visibility-changed signal

#### Parameters

project | The GladeProject. |
widget | The widget which visibility changed |
visible | widget visibility value |

### glade_project_writing_preview ()

    gboolean
    glade_project_writing_preview (GladeProject *project);

### glade_project_properties_new ()

    GtkWidget *
    glade_project_properties_new (GladeProject *project);

## Types and Values

### GladeProject

    typedef struct {
      GObject parent_instance;

      GladeProjectPrivate *priv;
    } GladeProject;

### enum GladeProjectModelColumns

The tree view columns provided by the GtkTreeModel implemented by GladeProject

#### Members

GLADE_PROJECT_MODEL_COLUMN_ICON_NAME | name of the icon for the widget |
GLADE_PROJECT_MODEL_COLUMN_NAME | Name of the widget |
GLADE_PROJECT_MODEL_COLUMN_TYPE_NAME | The type name of the widget |
GLADE_PROJECT_MODEL_COLUMN_OBJECT | the GObject of the widget |
GLADE_PROJECT_MODEL_COLUMN_MISC | the auxilary text describing a widget's role |
GLADE_PROJECT_MODEL_COLUMN_WARNING | the support warning text for this widget |
GLADE_PROJECT_MODEL_N_COLUMNS | Number of columns |

### GladeProjectProperties

    typedef struct _GladeProjectProperties GladeProjectProperties;

### enum GladeSupportMask

#### Members

GLADE_SUPPORT_OK |  |
GLADE_SUPPORT_DEPRECATED |  |
GLADE_SUPPORT_MISMATCH |  |

### enum GladePointerMode

Indicates what the pointer is used for in the workspace.

#### Members

GLADE_POINTER_SELECT | Mouse pointer used for selecting widgets |
GLADE_POINTER_ADD_WIDGET | Mouse pointer used for adding widgets |
GLADE_POINTER_DRAG_RESIZE | Mouse pointer used for dragging and resizing widgets in containers |
GLADE_POINTER_MARGIN_EDIT | Mouse pointer used to edit widget margins |
GLADE_POINTER_ALIGN_EDIT | Mouse pointer used to edit widget alignment |

### enum GladeVerifyFlags

#### Members

GLADE_VERIFY_NONE | No verification |
GLADE_VERIFY_VERSIONS | Verify version mismatches |
GLADE_VERIFY_DEPRECATIONS | Verify deprecations |
GLADE_VERIFY_UNRECOGNIZED | Verify unrecognized types |