GladeProject

GladeProject — The Glade document hub and Load/Save interface

Synopsis


#include <glade.h>


struct      GladeProject;
GladeProject* glade_project_new             (gboolean untitled);
GladeProject* glade_project_open            (const gchar *path);
gboolean    glade_project_save              (GladeProject *project,
                                             const gchar *path,
                                             GError **error);
void        glade_project_push_undo         (GladeProject *project,
                                             GladeCommand *cmd);
void        glade_project_redo              (GladeProject *project);
void        glade_project_undo              (GladeProject *project);
GladeCommand* glade_project_next_redo_item  (GladeProject *project);
GladeCommand* glade_project_next_undo_item  (GladeProject *project);
void        glade_project_reset_path        (GladeProject *project);
void        glade_project_add_object        (GladeProject *project,
                                             GladeProject *old_project,
                                             GObject *object);
void        glade_project_remove_object     (GladeProject *project,
                                             GObject *object);
gboolean    glade_project_has_object        (GladeProject *project,
                                             GObject *object);
GladeWidget* glade_project_get_widget_by_name
                                            (GladeProject *project,
                                             const char *name);
char*       glade_project_new_widget_name   (GladeProject *project,
                                             const char *base_name);
void        glade_project_widget_name_changed
                                            (GladeProject *project,
                                             GladeWidget *widget,
                                             const char *old_name);
GtkTooltips* glade_project_get_tooltips     (GladeProject *project);
gboolean    glade_project_is_selected       (GladeProject *project,
                                             GObject *object);
void        glade_project_selection_set     (GladeProject *project,
                                             GObject *object,
                                             gboolean emit_signal);
void        glade_project_selection_add     (GladeProject *project,
                                             GObject *object,
                                             gboolean emit_signal);
void        glade_project_selection_remove  (GladeProject *project,
                                             GObject *object,
                                             gboolean emit_signal);
void        glade_project_selection_clear   (GladeProject *project,
                                             gboolean emit_signal);
void        glade_project_selection_changed (GladeProject *project);
GList*      glade_project_selection_get     (GladeProject *project);
void        glade_project_set_accel_group   (GladeProject *project,
                                             GtkAccelGroup *accel_group);
void        glade_project_set_resource      (GladeProject *project,
                                             GladeProperty *property,
                                             const gchar *resource);
GList*      glade_project_list_resources    (GladeProject *project);
gchar*      glade_project_resource_fullpath (GladeProject *project,
                                             const gchar *resource);
gchar*      glade_project_display_name      (GladeProject *project,
                                             gboolean unsaved_changes,
                                             gboolean tab_aligned,
                                             gboolean mnemonic);
gboolean    glade_project_is_loading        (GladeProject *project);
gboolean    glade_project_get_has_selection (GladeProject *project);
gboolean    glade_project_get_readonly      (GladeProject *project);

Object Hierarchy


  GObject
   +----GladeProject

Properties


  "has-selection"        gboolean              : Read
  "has-unsaved-changes"  gboolean              : Read
  "read-only"            gboolean              : Read

Signal Prototypes


"add-widget"
            void        user_function      (GladeProject *gladeproject,
                                            GladeWidget *arg1,
                                            gpointer user_data);
"changed"   void        user_function      (GladeProject *gladeproject,
                                            GladeCommand *arg1,
                                            gboolean arg2,
                                            gpointer user_data);
"close"     void        user_function      (GladeProject *gladeproject,
                                            gpointer user_data);
"parse-finished"
            void        user_function      (GladeProject *gladeproject,
                                            gpointer user_data);
"remove-widget"
            void        user_function      (GladeProject *gladeproject,
                                            GladeWidget *arg1,
                                            gpointer user_data);
"resource-added"
            void        user_function      (GladeProject *gladeproject,
                                            gchar *arg1,
                                            gpointer user_data);
"resource-removed"
            void        user_function      (GladeProject *gladeproject,
                                            gchar *arg1,
                                            gpointer user_data);
"selection-changed"
            void        user_function      (GladeProject *gladeproject,
                                            gpointer user_data);
"widget-name-changed"
            void        user_function      (GladeProject *gladeproject,
                                            GladeWidget *arg1,
                                            gpointer user_data);

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.

Details

struct GladeProject

struct GladeProject;


glade_project_new ()

GladeProject* glade_project_new             (gboolean untitled);

Creates a new GladeProject. If untitled is TRUE, sets the project's name to "Untitled 1" or some such, giving a unique number each time called.

untitled : Whether or not this project is untitled
Returns : a new GladeProject

glade_project_open ()

GladeProject* glade_project_open            (const gchar *path);

Opens a project at the given path.

path :
Returns : a new GladeProject for the opened project on success, NULL on failure

glade_project_save ()

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

Saves project to the given path.

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_push_undo ()

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

Pushes a newly created GladeCommand onto projects stack.

project : a GladeProject
cmd : the GladeCommand

glade_project_redo ()

void        glade_project_redo              (GladeProject *project);

project :

glade_project_undo ()

void        glade_project_undo              (GladeProject *project);

Redoes a GladeCommand in this project.

project : a GladeProject

glade_project_next_redo_item ()

GladeCommand* glade_project_next_redo_item  (GladeProject *project);

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

project : a GladeProject
Returns : the GladeCommand

glade_project_next_undo_item ()

GladeCommand* glade_project_next_undo_item  (GladeProject *project);

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

project : a GladeProject
Returns : the GladeCommand

glade_project_reset_path ()

void        glade_project_reset_path        (GladeProject *project);

project :

glade_project_add_object ()

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

Adds an object to the project.

project : the GladeProject the widget is added to
old_project : the GladeProject the widget was previously in (or NULL for the clipboard)
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.

project : a GladeProject
object : the GObject to remove

glade_project_has_object ()

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

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 char *name);

Searches through project looking for a GladeWidget named name.

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

glade_project_new_widget_name ()

char*       glade_project_new_widget_name   (GladeProject *project,
                                             const char *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.

project : a GladeProject
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_widget_name_changed ()

void        glade_project_widget_name_changed
                                            (GladeProject *project,
                                             GladeWidget *widget,
                                             const char *old_name);

TODO: write me

project : a GladeProject
widget : a GladeWidget
old_name :

glade_project_get_tooltips ()

GtkTooltips* glade_project_get_tooltips     (GladeProject *project);

project : a GladeProject
Returns : a GtkTooltips object containing all tooltips for project

glade_project_is_selected ()

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

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

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

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

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

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.

project : a GladeProject

glade_project_selection_get ()

GList*      glade_project_selection_get     (GladeProject *project);

project : a GladeProject
Returns : a GList containing the GtkWidget items currently selected in project

glade_project_set_accel_group ()

void        glade_project_set_accel_group   (GladeProject *project,
                                             GtkAccelGroup *accel_group);

Set accel_group to every top level widget in project.

project : A GladeProject
accel_group : The GtkAccelGroup

glade_project_set_resource ()

void        glade_project_set_resource      (GladeProject *project,
                                             GladeProperty *property,
                                             const gchar *resource);

Adds/Modifies/Removes a resource from a project; any project resources will be copied when using "Save As...", when moving widgets across projects and will be copied into the project's directory when selected.

project : A GladeProject
property : The GladeProperty this resource is required by
resource : The resource file basename to be found in the same directory as the glade file.

glade_project_list_resources ()

GList*      glade_project_list_resources    (GladeProject *project);

project : A GladeProject
Returns : A newly allocated GList of file basenames of resources in this project, note that the strings are not allocated and are unsafe to use once the projects state changes. The returned list should be freed with g_list_free.

glade_project_resource_fullpath ()

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

project : The GladeProject.
resource : The resource basename
Returns : A newly allocated string holding the full path the the project resource.

glade_project_display_name ()

gchar*      glade_project_display_name      (GladeProject *project,
                                             gboolean unsaved_changes,
                                             gboolean tab_aligned,
                                             gboolean mnemonic);

project : A GladeProject
unsaved_changes : whether to prepend a '*' to names of projects with unsaved changes
tab_aligned : whether to prepend a tab and align unsaved names using the tab (for the project menu)
mnemonic : Pass TRUE here if you are going to use this in a mnemonic label... this will escape the underscores nicely.
Returns : A newly allocated string to uniquely describe this open project.

glade_project_is_loading ()

gboolean    glade_project_is_loading        (GladeProject *project);

project : A GladeProject
Returns : Whether the project is being loaded or not.

glade_project_get_has_selection ()

gboolean    glade_project_get_has_selection (GladeProject *project);

project : a GladeProject
Returns : whether project currently has a selection

glade_project_get_readonly ()

gboolean    glade_project_get_readonly      (GladeProject *project);

Gets whether the project is read only or not

project : a GladeProject
Returns : TRUE if project is read only

Properties

The "has-selection" property

  "has-selection"        gboolean              : Read

Whether project has a selection.

Default value: FALSE


The "has-unsaved-changes" property

  "has-unsaved-changes"  gboolean              : Read

Whether project has unsaved changes.

Default value: FALSE


The "read-only" property

  "read-only"            gboolean              : Read

Whether project is read only or not.

Default value: FALSE

Signals

The "add-widget" signal

void        user_function                  (GladeProject *gladeproject,
                                            GladeWidget *arg1,
                                            gpointer user_data);

Emitted when a widget is added to a project.

gladeproject : the GladeProject which received the signal.
arg1 : the GladeWidget that was added to gladeproject.
user_data : user data set when the signal handler was connected.

The "changed" signal

void        user_function                  (GladeProject *gladeproject,
                                            GladeCommand *arg1,
                                            gboolean arg2,
                                            gpointer user_data);

Emitted when a gladeproject's state changes via a GladeCommand.

gladeproject : the GladeProject which received the signal.
arg1 : the GladeCommand that was executed
arg2 : whether the command was executed or undone.
user_data : user data set when the signal handler was connected.

The "close" signal

void        user_function                  (GladeProject *gladeproject,
                                            gpointer user_data);

Emitted when a project is closing (a good time to clean up any associated resources).

gladeproject : the GladeProject which received the signal.
user_data : user data set when the signal handler was connected.

The "parse-finished" signal

void        user_function                  (GladeProject *gladeproject,
                                            gpointer user_data);

Emitted when gladeproject parsing has finished.

gladeproject : the GladeProject which received the signal.
user_data : user data set when the signal handler was connected.

The "remove-widget" signal

void        user_function                  (GladeProject *gladeproject,
                                            GladeWidget *arg1,
                                            gpointer user_data);

Emitted when a widget is removed from a project.

gladeproject : the GladeProject which received the signal.
arg1 : the GladeWidget that was removed from gladeproject.
user_data : user data set when the signal handler was connected.

The "resource-added" signal

void        user_function                  (GladeProject *gladeproject,
                                            gchar *arg1,
                                            gpointer user_data);

Emitted when a resource file required by a GladeProperty is added to gladeproject

gladeproject : the GladeProject which received the signal.
arg1 : the file's basename (in the project path).
user_data : user data set when the signal handler was connected.

The "resource-removed" signal

void        user_function                  (GladeProject *gladeproject,
                                            gchar *arg1,
                                            gpointer user_data);

Emitted when a resource file is removed from gladeproject

gladeproject : the GladeProject which received the signal.
arg1 : the file's basename
user_data : user data set when the signal handler was connected.

The "selection-changed" signal

void        user_function                  (GladeProject *gladeproject,
                                            gpointer user_data);

Emitted when gladeproject selection list changes.

gladeproject : the GladeProject which received the signal.
user_data : user data set when the signal handler was connected.

The "widget-name-changed" signal

void        user_function                  (GladeProject *gladeproject,
                                            GladeWidget *arg1,
                                            gpointer user_data);

Emitted when gwidget's name changes.

gladeproject : the GladeProject which received the signal.
arg1 : the GladeWidget who's name changed.
user_data : user data set when the signal handler was connected.