mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-11-17 00:03:25 -05:00
* Whole tree updated to remove all notion of project conversions and dual project formats,
no more libglade.
This commit is contained in:
parent
159aa6f695
commit
ecabb87545
@ -17,6 +17,9 @@
|
||||
|
||||
* gladeui/glade-design-view.c: Made loading progress bar nicer looking and ellipsizing.
|
||||
|
||||
* Whole tree updated to remove all notion of project conversions and dual project formats,
|
||||
no more libglade.
|
||||
|
||||
2010-12-28 Tristan Van Berkom <tristanvb@openismus.com>
|
||||
|
||||
* gladeui/Makefile.am, gladeui/glade.h, gladeui/glade-clipboard.c, gladeui/glade-app.[ch],
|
||||
|
||||
@ -40,9 +40,6 @@ struct _GladeCatalog
|
||||
|
||||
GList *targetable_versions; /* list of suitable version targets */
|
||||
|
||||
gboolean libglade_supported; /* whether this catalog supports libglade */
|
||||
gboolean builder_supported; /* whether this catalog supports gtkbuilder */
|
||||
|
||||
gchar *library; /* Library name for backend support */
|
||||
|
||||
gchar *name; /* Symbolic catalog name */
|
||||
@ -70,8 +67,6 @@ struct _GladeCatalog
|
||||
|
||||
gchar *init_function_name;/* Catalog's init function name */
|
||||
GladeCatalogInitFunc init_function;
|
||||
|
||||
GladeProjectConvertFunc project_convert_function; /* pointer to module's project converter */
|
||||
};
|
||||
|
||||
struct _GladeWidgetGroup
|
||||
@ -143,8 +138,6 @@ catalog_allocate (void)
|
||||
catalog->adaptors = NULL;
|
||||
catalog->widget_groups = NULL;
|
||||
|
||||
catalog->libglade_supported = FALSE;
|
||||
catalog->builder_supported = TRUE;
|
||||
return catalog;
|
||||
}
|
||||
|
||||
@ -156,7 +149,6 @@ catalog_open (const gchar *filename)
|
||||
GladeXmlContext *context;
|
||||
GladeXmlDoc *doc;
|
||||
GladeXmlNode *root;
|
||||
gchar *str;
|
||||
|
||||
/* get the context & root node of the catalog file */
|
||||
context = glade_xml_context_new_from_path (filename,
|
||||
@ -215,22 +207,6 @@ catalog_open (const gchar *filename)
|
||||
|
||||
if (!catalog->domain)
|
||||
catalog->domain = g_strdup (catalog->library);
|
||||
|
||||
if ((str = glade_xml_get_property_string (root, GLADE_TAG_SUPPORTS)) != NULL)
|
||||
{
|
||||
gchar **split = g_strsplit (str, ",", 0);
|
||||
gint i;
|
||||
|
||||
catalog->builder_supported = FALSE;
|
||||
|
||||
for (i = 0; split[i]; i++)
|
||||
{
|
||||
if (!strcmp (split[i], GLADE_TAG_LIBGLADE))
|
||||
catalog->libglade_supported = TRUE;
|
||||
else if (!strcmp (split[i], GLADE_TAG_GTKBUILDER))
|
||||
catalog->builder_supported = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* catalog->icon_prefix defaults to catalog->name */
|
||||
if (!catalog->icon_prefix)
|
||||
@ -240,11 +216,6 @@ catalog_open (const gchar *filename)
|
||||
catalog_get_function (catalog, catalog->init_function_name,
|
||||
(gpointer) &catalog->init_function);
|
||||
|
||||
if ((str = glade_xml_get_value_string (root, GLADE_TAG_PROJECT_CONVERT_FUNCTION)) != NULL)
|
||||
{
|
||||
catalog_get_function (catalog, str, (gpointer) &catalog->project_convert_function);
|
||||
}
|
||||
|
||||
return catalog;
|
||||
}
|
||||
|
||||
@ -638,23 +609,6 @@ glade_catalog_get_icon_prefix (GladeCatalog *catalog)
|
||||
return catalog->icon_prefix;
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_catalog_supports_libglade (GladeCatalog *catalog)
|
||||
{
|
||||
g_return_val_if_fail (GLADE_IS_CATALOG (catalog), FALSE);
|
||||
|
||||
return catalog->libglade_supported;
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_catalog_supports_gtkbuilder (GladeCatalog *catalog)
|
||||
{
|
||||
g_return_val_if_fail (GLADE_IS_CATALOG (catalog), FALSE);
|
||||
|
||||
return catalog->builder_supported;
|
||||
}
|
||||
|
||||
|
||||
guint16
|
||||
glade_catalog_get_major_version (GladeCatalog *catalog)
|
||||
{
|
||||
@ -814,30 +768,3 @@ widget_group_destroy (GladeWidgetGroup *group)
|
||||
|
||||
g_slice_free (GladeWidgetGroup, group);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* glade_catalog_convert_project:
|
||||
* @catalog: A #GladeCatalog
|
||||
* @project: The #GladeProject to convert
|
||||
* @new_format: The format to convert @project to
|
||||
*
|
||||
* Do any data changes needed to the project for the new
|
||||
* format in an undoable way.
|
||||
*
|
||||
* Returns: FALSE if any errors occurred during the conversion.
|
||||
*/
|
||||
gboolean
|
||||
glade_catalog_convert_project (GladeCatalog *catalog,
|
||||
GladeProject *project,
|
||||
GladeProjectFormat new_format)
|
||||
{
|
||||
g_return_val_if_fail (GLADE_IS_CATALOG (catalog), FALSE);
|
||||
g_return_val_if_fail (GLADE_IS_PROJECT (project), FALSE);
|
||||
|
||||
if (catalog->project_convert_function)
|
||||
return catalog->project_convert_function (project, new_format);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -47,22 +47,6 @@ typedef struct _GladeWidgetGroup GladeWidgetGroup;
|
||||
*/
|
||||
typedef void (*GladeCatalogInitFunc) (const gchar *name);
|
||||
|
||||
/**
|
||||
* GladeProjectConvertFunc:
|
||||
* @project: A #GladeProject
|
||||
* @new_format: The format to convert @project to
|
||||
*
|
||||
* Generally format transperency is implemented at load/save time,
|
||||
* but if some objects need to be setup differently, or some new
|
||||
* objects created (like real GtkAdjustment objects for old inline
|
||||
* property values) this is the place to do those things, be careful
|
||||
* to use the GladeCommand api because conversions are undoable.
|
||||
*
|
||||
* Returns: FALSE if any errors occurred during the conversion.
|
||||
*/
|
||||
typedef gboolean (*GladeProjectConvertFunc) (GladeProject *project,
|
||||
GladeProjectFormat new_format);
|
||||
|
||||
|
||||
typedef struct {
|
||||
gint major;
|
||||
@ -99,11 +83,6 @@ gboolean glade_widget_group_get_expanded (GladeWidgetGroup *group);
|
||||
|
||||
const GList *glade_widget_group_get_adaptors (GladeWidgetGroup *group);
|
||||
|
||||
gboolean glade_catalog_convert_project (GladeCatalog *catalog,
|
||||
GladeProject *project,
|
||||
GladeProjectFormat new_format);
|
||||
|
||||
|
||||
gboolean glade_catalog_supports_libglade (GladeCatalog *catalog);
|
||||
gboolean glade_catalog_supports_gtkbuilder (GladeCatalog *catalog);
|
||||
|
||||
|
||||
@ -484,19 +484,11 @@ glade_command_set_property_unifies (GladeCommand *this_cmd, GladeCommand *other_
|
||||
|
||||
for (list = cmd1->sdata; list; list = list->next)
|
||||
{
|
||||
GladeProject *project;
|
||||
GladeProjectFormat fmt = GLADE_PROJECT_FORMAT_GTKBUILDER;
|
||||
pdata1 = list->data;
|
||||
|
||||
if (pdata1->property->widget)
|
||||
{
|
||||
project = glade_widget_get_project (pdata1->property->widget);
|
||||
fmt = glade_project_get_format (project);
|
||||
}
|
||||
|
||||
if (glade_property_class_compare (pdata1->property->klass,
|
||||
pdata1->old_value,
|
||||
pdata1->new_value, fmt))
|
||||
pdata1->new_value))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@ -585,8 +577,7 @@ glade_command_set_property_collapse (GladeCommand *this_cmd, GladeCommand *other
|
||||
|
||||
#define MAX_UNDO_MENU_ITEM_VALUE_LEN 10
|
||||
static gchar *
|
||||
glade_command_set_property_description (GladeCommandSetProperty *me,
|
||||
GladeProjectFormat fmt)
|
||||
glade_command_set_property_description (GladeCommandSetProperty *me)
|
||||
{
|
||||
GCSetPropData *sdata;
|
||||
gchar *description = NULL;
|
||||
@ -601,7 +592,7 @@ glade_command_set_property_description (GladeCommandSetProperty *me,
|
||||
sdata = me->sdata->data;
|
||||
value_name = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (sdata->property->klass->handle),
|
||||
sdata->property->klass, sdata->new_value, fmt);
|
||||
sdata->property->klass, sdata->new_value);
|
||||
|
||||
g_assert (sdata->property->klass->name);
|
||||
g_assert (sdata->property->widget->name);
|
||||
@ -649,8 +640,7 @@ glade_command_set_properties_list (GladeProject *project, GList *props)
|
||||
|
||||
me->sdata = props;
|
||||
cmd->description =
|
||||
glade_command_set_property_description
|
||||
(me, glade_project_get_format (project));
|
||||
glade_command_set_property_description (me);
|
||||
|
||||
|
||||
multiple = g_list_length (me->sdata) > 1;
|
||||
@ -2134,11 +2124,9 @@ typedef struct {
|
||||
GladeCommand parent;
|
||||
GladeProperty *property;
|
||||
gboolean translatable;
|
||||
gboolean has_context;
|
||||
gchar *context;
|
||||
gchar *comment;
|
||||
gboolean old_translatable;
|
||||
gboolean old_has_context;
|
||||
gchar *old_context;
|
||||
gchar *old_comment;
|
||||
} GladeCommandSetI18n;
|
||||
@ -2156,7 +2144,6 @@ glade_command_set_i18n_execute(GladeCommand *cmd)
|
||||
{
|
||||
GladeCommandSetI18n *me = (GladeCommandSetI18n *)cmd;
|
||||
gboolean temp_translatable;
|
||||
gboolean temp_has_context;
|
||||
gchar *temp_context;
|
||||
gchar *temp_comment;
|
||||
|
||||
@ -2166,21 +2153,17 @@ glade_command_set_i18n_execute(GladeCommand *cmd)
|
||||
|
||||
/* set the new values in the property */
|
||||
glade_property_i18n_set_translatable(me->property, me->translatable);
|
||||
glade_property_i18n_set_has_context(me->property, me->has_context);
|
||||
glade_property_i18n_set_context(me->property, me->context);
|
||||
glade_property_i18n_set_comment(me->property, me->comment);
|
||||
|
||||
/* swap the current values with the old values to prepare for undo */
|
||||
temp_translatable = me->translatable;
|
||||
temp_has_context = me->has_context;
|
||||
temp_context = me->context;
|
||||
temp_comment = me->comment;
|
||||
me->translatable = me->old_translatable;
|
||||
me->has_context = me->old_has_context;
|
||||
me->context = me->old_context;
|
||||
me->comment = me->old_comment;
|
||||
me->old_translatable = temp_translatable;
|
||||
me->old_has_context = temp_has_context;
|
||||
me->old_context = temp_context;
|
||||
me->old_comment = temp_comment;
|
||||
|
||||
@ -2239,7 +2222,6 @@ glade_command_set_i18n_collapse (GladeCommand *this_cmd, GladeCommand *other_cmd
|
||||
|
||||
/* adjust this command to contain, as its old values, the other command's current values */
|
||||
this->old_translatable = other->old_translatable;
|
||||
this->old_has_context = other->old_has_context;
|
||||
g_free (this->old_context);
|
||||
g_free (this->old_comment);
|
||||
this->old_context = other->old_context;
|
||||
@ -2254,7 +2236,6 @@ glade_command_set_i18n_collapse (GladeCommand *this_cmd, GladeCommand *other_cmd
|
||||
* glade_command_set_i18n:
|
||||
* @property: a #GladeProperty
|
||||
* @translatable: a #gboolean
|
||||
* @has_context: a #gboolean
|
||||
* @context: a #const gchar *
|
||||
* @comment: a #const gchar *
|
||||
*
|
||||
@ -2263,7 +2244,6 @@ glade_command_set_i18n_collapse (GladeCommand *this_cmd, GladeCommand *other_cmd
|
||||
void
|
||||
glade_command_set_i18n (GladeProperty *property,
|
||||
gboolean translatable,
|
||||
gboolean has_context,
|
||||
const gchar *context,
|
||||
const gchar *comment)
|
||||
{
|
||||
@ -2273,22 +2253,17 @@ glade_command_set_i18n (GladeProperty *property,
|
||||
|
||||
/* check that something changed before continuing with the command */
|
||||
if (translatable == property->i18n_translatable &&
|
||||
has_context == property->i18n_has_context &&
|
||||
/* XXX add context string shit herex */
|
||||
|
||||
((comment == NULL && property->i18n_comment == NULL) ||
|
||||
(comment && property->i18n_comment && !strcmp(property->i18n_comment, comment))))
|
||||
!g_strcmp0 (property->i18n_context, context) &&
|
||||
!g_strcmp0 (property->i18n_comment, comment))
|
||||
return;
|
||||
|
||||
/* load up the command */
|
||||
me = g_object_new(GLADE_COMMAND_SET_I18N_TYPE, NULL);
|
||||
me->property = property;
|
||||
me->translatable = translatable;
|
||||
me->has_context = has_context;
|
||||
me->context = g_strdup(context);
|
||||
me->comment = g_strdup(comment);
|
||||
me->old_translatable = property->i18n_translatable;
|
||||
me->old_has_context = property->i18n_has_context;
|
||||
me->old_context = g_strdup(property->i18n_context);
|
||||
me->old_comment = g_strdup(property->i18n_comment);
|
||||
GLADE_COMMAND(me)->description = g_strdup_printf(_("Setting i18n metadata"));;
|
||||
@ -2307,250 +2282,6 @@ glade_command_set_i18n (GladeProperty *property,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* set project format
|
||||
*
|
||||
* This command sets the format on the project.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
GladeCommand parent;
|
||||
GladeProject *project;
|
||||
GladeProjectFormat format;
|
||||
GladeProjectFormat old_format;
|
||||
} GladeCommandSetFormat;
|
||||
|
||||
|
||||
GLADE_MAKE_COMMAND (GladeCommandSetFormat, glade_command_set_format);
|
||||
#define GLADE_COMMAND_SET_FORMAT_TYPE (glade_command_set_format_get_type ())
|
||||
#define GLADE_COMMAND_SET_FORMAT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GLADE_COMMAND_SET_FORMAT_TYPE, GladeCommandSetFormat))
|
||||
#define GLADE_COMMAND_SET_FORMAT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GLADE_COMMAND_SET_FORMAT_TYPE, GladeCommandSetFormatClass))
|
||||
#define GLADE_IS_COMMAND_SET_FORMAT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GLADE_COMMAND_SET_FORMAT_TYPE))
|
||||
#define GLADE_IS_COMMAND_SET_FORMAT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GLADE_COMMAND_SET_FORMAT_TYPE))
|
||||
|
||||
static gboolean
|
||||
glade_command_set_format_execute(GladeCommand *cmd)
|
||||
{
|
||||
GladeCommandSetFormat *me = (GladeCommandSetFormat *)cmd;
|
||||
GladeProjectFormat fmt;
|
||||
|
||||
/* sanity check */
|
||||
g_return_val_if_fail (me != NULL, TRUE);
|
||||
g_return_val_if_fail (me->project != NULL, TRUE);
|
||||
|
||||
/* set the new format */
|
||||
glade_project_set_format (me->project, me->format);
|
||||
|
||||
/* swap the current values with the old values to prepare for undo */
|
||||
fmt = me->format;
|
||||
me->format = me->old_format;
|
||||
me->old_format = fmt;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_command_set_format_undo(GladeCommand *cmd)
|
||||
{
|
||||
return glade_command_set_format_execute(cmd);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_command_set_format_finalize(GObject *obj)
|
||||
{
|
||||
/* GladeCommandSetFormat *me; */
|
||||
|
||||
g_return_if_fail(GLADE_IS_COMMAND_SET_FORMAT(obj));
|
||||
|
||||
glade_command_finalize(obj);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_command_set_format_unifies (GladeCommand *this_cmd, GladeCommand *other_cmd)
|
||||
{
|
||||
/* GladeCommandSetFormat *cmd1; */
|
||||
/* GladeCommandSetFormat *cmd2; */
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_command_set_format_collapse (GladeCommand *this_cmd, GladeCommand *other_cmd)
|
||||
{
|
||||
/* this command is the one that will be used for an undo of the sequence of like commands */
|
||||
//GladeCommandSetFormat *this = GLADE_COMMAND_SET_FORMAT (this_cmd);
|
||||
|
||||
/* the other command contains the values that will be used for a redo */
|
||||
//GladeCommandSetFormat *other = GLADE_COMMAND_SET_FORMAT (other_cmd);
|
||||
|
||||
g_return_if_fail (GLADE_IS_COMMAND_SET_FORMAT (this_cmd) && GLADE_IS_COMMAND_SET_FORMAT (other_cmd));
|
||||
|
||||
/* no unify/collapse */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
glade_command_convert_cleanup_props (GList *properties,
|
||||
GladeProjectFormat fmt)
|
||||
{
|
||||
GladeProperty *property;
|
||||
GList *list;
|
||||
|
||||
for (list = properties; list; list = list->next)
|
||||
{
|
||||
property = list->data;
|
||||
|
||||
if (glade_property_original_default (property))
|
||||
continue;
|
||||
|
||||
/* Reset any unsupported properties to thier defaults */
|
||||
if ((fmt == GLADE_PROJECT_FORMAT_GTKBUILDER &&
|
||||
property->klass->libglade_only) ||
|
||||
(fmt == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
property->klass->libglade_unsupported))
|
||||
{
|
||||
GValue value = { 0, };
|
||||
|
||||
glade_property_get_default (property, &value);
|
||||
glade_command_set_property (property, &value);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
find_format_rejected_object (GObject *object, gpointer fmtptr)
|
||||
{
|
||||
GladeWidget *widget = glade_widget_get_from_gobject (object);
|
||||
GladeProjectFormat fmt = GPOINTER_TO_INT (fmtptr);
|
||||
|
||||
if ((fmt == GLADE_PROJECT_FORMAT_GTKBUILDER &&
|
||||
GWA_LIBGLADE_ONLY (widget->adaptor)) ||
|
||||
/* If going in libglade format... */
|
||||
(fmt == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
/* ... and widget is unsupported by libglade */
|
||||
(GWA_LIBGLADE_UNSUPPORTED (widget->adaptor) ||
|
||||
/* ... and widget is a non GtkWidget object */
|
||||
!GTK_IS_WIDGET (widget->object) ||
|
||||
/* ... and its a non-window toplevel */
|
||||
(!widget->parent && g_strcmp0 (widget->adaptor->name, "GtkWindow") && !widget->internal))))
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
glade_command_convert_cleanup (GladeProject *project,
|
||||
GladeProjectFormat fmt)
|
||||
{
|
||||
GladeWidget *widget;
|
||||
const GList *objects, *list;
|
||||
GList *l;
|
||||
|
||||
/* List safely delete widgets */
|
||||
while ((l = g_list_find_custom ((GList *)glade_project_get_objects (project), GINT_TO_POINTER (fmt),
|
||||
(GCompareFunc)find_format_rejected_object)) != NULL)
|
||||
{
|
||||
GList delete = { 0, };
|
||||
widget = glade_widget_get_from_gobject (l->data);
|
||||
delete.data = widget;
|
||||
glade_command_delete (&delete);
|
||||
}
|
||||
|
||||
/* Deal with properties of remaining widgets */
|
||||
objects = glade_project_get_objects (project);
|
||||
for (list = objects; list; list = list->next)
|
||||
{
|
||||
widget = glade_widget_get_from_gobject (list->data);
|
||||
glade_command_convert_cleanup_props (widget->properties, fmt);
|
||||
glade_command_convert_cleanup_props (widget->packing_properties, fmt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glade_command_set_project_format:
|
||||
* @project: a #GladeProject
|
||||
* @fmt: the #GladeProjectFormat
|
||||
*
|
||||
* Sets the format of the project.
|
||||
*/
|
||||
void
|
||||
glade_command_set_project_format (GladeProject *project,
|
||||
GladeProjectFormat fmt)
|
||||
{
|
||||
GladeCommandSetFormat *me;
|
||||
GList *req_libs, *list;
|
||||
gchar *cat_name;
|
||||
GladeCatalog *catalog;
|
||||
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
|
||||
if (glade_project_get_format (project) != fmt)
|
||||
{
|
||||
gchar *prj_name = glade_project_get_name (project);
|
||||
glade_command_push_group (_("Converting %s to %s format"),
|
||||
prj_name,
|
||||
fmt == GLADE_PROJECT_FORMAT_LIBGLADE ? "libglade" : "Gtk+ Builder");
|
||||
g_free (prj_name);
|
||||
|
||||
/* load up the command */
|
||||
me = g_object_new(GLADE_COMMAND_SET_FORMAT_TYPE, NULL);
|
||||
me->project = project;
|
||||
me->format = fmt;
|
||||
me->old_format = glade_project_get_format (project);
|
||||
|
||||
GLADE_COMMAND(me)->description = g_strdup_printf("dummy string");
|
||||
|
||||
glade_command_check_group(GLADE_COMMAND(me));
|
||||
|
||||
if ((req_libs = glade_project_required_libs (project)) != NULL)
|
||||
{
|
||||
for (list = req_libs; list; list = list->next)
|
||||
{
|
||||
cat_name = list->data;
|
||||
catalog = glade_app_get_catalog (cat_name);
|
||||
|
||||
glade_catalog_convert_project (catalog, project, fmt);
|
||||
|
||||
g_free (cat_name);
|
||||
}
|
||||
g_list_free (req_libs);
|
||||
}
|
||||
|
||||
glade_command_convert_cleanup (project, fmt);
|
||||
|
||||
/* execute the command and push it on the stack if successful
|
||||
* this sets the actual format
|
||||
*/
|
||||
if (glade_command_set_format_execute(GLADE_COMMAND(me)))
|
||||
{
|
||||
glade_project_push_undo(glade_app_get_project(), GLADE_COMMAND(me));
|
||||
}
|
||||
else
|
||||
{
|
||||
g_object_unref(G_OBJECT(me));
|
||||
}
|
||||
|
||||
/* Emit "convert-finished" signal after setting the actual format */
|
||||
g_signal_emit_by_name (project, "convert-finished");
|
||||
|
||||
glade_command_pop_group ();
|
||||
|
||||
glade_editor_refresh (glade_app_get_editor ());
|
||||
|
||||
glade_project_verify_project_for_ui (project);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* set project naming policy
|
||||
|
||||
@ -87,9 +87,6 @@ void glade_command_collapse (GladeCommand *command,
|
||||
|
||||
/************************** project *********************************/
|
||||
|
||||
void glade_command_set_project_format (GladeProject *project,
|
||||
GladeProjectFormat fmt);
|
||||
|
||||
void glade_command_set_project_naming_policy (GladeProject *project,
|
||||
GladeNamingPolicy policy);
|
||||
|
||||
@ -160,7 +157,6 @@ void glade_command_change_signal (GladeWidget *glade_widget,
|
||||
|
||||
void glade_command_set_i18n (GladeProperty *property,
|
||||
gboolean translatable,
|
||||
gboolean has_context,
|
||||
const gchar *context,
|
||||
const gchar *comment);
|
||||
|
||||
|
||||
@ -85,22 +85,16 @@ static void
|
||||
glade_editor_property_commit_common (GladeEditorProperty *eprop,
|
||||
GValue *value)
|
||||
{
|
||||
GladeProject *project;
|
||||
GladeProjectFormat fmt;
|
||||
|
||||
if (eprop->use_command == FALSE)
|
||||
glade_property_set_value (eprop->property, value);
|
||||
else
|
||||
glade_command_set_property_value (eprop->property, value);
|
||||
|
||||
project = glade_widget_get_project (eprop->property->widget);
|
||||
fmt = glade_project_get_format (project);
|
||||
|
||||
/* If the value was denied by a verify function, we'll have to
|
||||
* reload the real value.
|
||||
*/
|
||||
if (glade_property_class_compare (eprop->property->klass,
|
||||
eprop->property->value, value, fmt) != 0)
|
||||
eprop->property->value, value) != 0)
|
||||
GLADE_EDITOR_PROPERTY_GET_CLASS (eprop)->load (eprop, eprop->property);
|
||||
else
|
||||
/* publish a value change to those interested */
|
||||
@ -1157,7 +1151,6 @@ glade_eprop_color_finalize (GObject *object)
|
||||
static void
|
||||
glade_eprop_color_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GladeEPropColor *eprop_color = GLADE_EPROP_COLOR (eprop);
|
||||
GdkColor *color;
|
||||
gchar *text;
|
||||
@ -1167,11 +1160,9 @@ glade_eprop_color_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
|
||||
if (property)
|
||||
{
|
||||
fmt = glade_project_get_format (property->widget->project);
|
||||
|
||||
if ((text = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
|
||||
eprop->klass, property->value, fmt)) != NULL)
|
||||
eprop->klass, property->value)) != NULL)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (eprop_color->entry), text);
|
||||
g_free (text);
|
||||
@ -1475,7 +1466,6 @@ glade_eprop_text_finalize (GObject *object)
|
||||
static void
|
||||
glade_eprop_text_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GladeEPropText *eprop_text = GLADE_EPROP_TEXT (eprop);
|
||||
|
||||
/* Chain up first */
|
||||
@ -1483,8 +1473,6 @@ glade_eprop_text_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
|
||||
if (property == NULL) return;
|
||||
|
||||
fmt = glade_project_get_format (property->widget->project);
|
||||
|
||||
if (GTK_IS_COMBO_BOX (eprop_text->text_entry))
|
||||
{
|
||||
if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (eprop_text->text_entry)))
|
||||
@ -1529,7 +1517,7 @@ glade_eprop_text_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
{
|
||||
gchar *text = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (property->klass->handle),
|
||||
property->klass, property->value, fmt);
|
||||
property->klass, property->value);
|
||||
gtk_text_buffer_set_text (buffer, text ? text : "", -1);
|
||||
g_free (text);
|
||||
}
|
||||
@ -1621,11 +1609,9 @@ glade_eprop_text_buffer_changed (GtkTextBuffer *buffer,
|
||||
/**
|
||||
* glade_editor_property_show_i18n_dialog:
|
||||
* @parent: The parent widget for the dialog.
|
||||
* @fmt: the #GladeProjectFormat
|
||||
* @text: A read/write pointer to the text property
|
||||
* @context: A read/write pointer to the translation context
|
||||
* @comment: A read/write pointer to the translator comment
|
||||
* @has_context: A read/write pointer to the context setting (libglade only)
|
||||
* @translatable: A read/write pointer to the translatable setting]
|
||||
*
|
||||
* Runs a dialog and updates the provided values.
|
||||
@ -1634,11 +1620,9 @@ glade_eprop_text_buffer_changed (GtkTextBuffer *buffer,
|
||||
*/
|
||||
gboolean
|
||||
glade_editor_property_show_i18n_dialog (GtkWidget *parent,
|
||||
GladeProjectFormat fmt,
|
||||
gchar **text,
|
||||
gchar **context,
|
||||
gchar **comment,
|
||||
gboolean *has_context,
|
||||
gboolean *translatable)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
@ -1648,11 +1632,11 @@ glade_editor_property_show_i18n_dialog (GtkWidget *parent,
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *text_view, *comment_view, *context_view;
|
||||
GtkTextBuffer *text_buffer, *comment_buffer, *context_buffer = NULL;
|
||||
GtkWidget *translatable_button, *context_button;
|
||||
GtkWidget *translatable_button;
|
||||
GtkWidget *content_area, *action_area;
|
||||
gint res;
|
||||
|
||||
g_return_val_if_fail (text && context && comment && translatable && has_context, FALSE);
|
||||
g_return_val_if_fail (text && context && comment && translatable, FALSE);
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons (_("Edit Text"),
|
||||
parent ? GTK_WINDOW (gtk_widget_get_toplevel (parent)) : NULL,
|
||||
@ -1727,53 +1711,42 @@ glade_editor_property_show_i18n_dialog (GtkWidget *parent,
|
||||
gtk_widget_set_tooltip_text (translatable_button,
|
||||
_("Whether this property is translatable"));
|
||||
|
||||
/* Has Context */
|
||||
context_button = gtk_check_button_new_with_mnemonic (_("_Has context prefix"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), context_button, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (context_button), *has_context);
|
||||
gtk_widget_set_tooltip_text (context_button,
|
||||
_("Whether the translatable string has a context prefix"));
|
||||
if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
gtk_widget_show (context_button);
|
||||
|
||||
/* Context. */
|
||||
if (fmt != GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 0, 0, 0);
|
||||
gtk_widget_show (alignment);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("Conte_xt for translation:"));
|
||||
gtk_widget_show (label);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), label);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
|
||||
gtk_widget_set_tooltip_text (alignment,
|
||||
"XXX Some explanation about translation context please ???");
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (sw);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
|
||||
|
||||
context_view = gtk_text_view_new ();
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (context_view), GTK_WRAP_WORD);
|
||||
gtk_widget_show (context_view);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), context_view);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), context_view);
|
||||
|
||||
context_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (context_view));
|
||||
|
||||
if (*context)
|
||||
{
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 0, 0, 0);
|
||||
gtk_widget_show (alignment);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("Conte_xt for translation:"));
|
||||
gtk_widget_show (label);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), label);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
|
||||
gtk_widget_set_tooltip_text (alignment,
|
||||
"XXX Some explanation about translation context please ???");
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (sw);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
|
||||
|
||||
context_view = gtk_text_view_new ();
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (context_view), GTK_WRAP_WORD);
|
||||
gtk_widget_show (context_view);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), context_view);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), context_view);
|
||||
|
||||
context_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (context_view));
|
||||
|
||||
if (*context)
|
||||
{
|
||||
gtk_text_buffer_set_text (context_buffer,
|
||||
*context,
|
||||
-1);
|
||||
}
|
||||
gtk_text_buffer_set_text (context_buffer,
|
||||
*context,
|
||||
-1);
|
||||
}
|
||||
|
||||
/* Comments. */
|
||||
@ -1821,7 +1794,6 @@ glade_editor_property_show_i18n_dialog (GtkWidget *parent,
|
||||
|
||||
/* get the new values for translatable, has_context, and comment */
|
||||
*translatable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (translatable_button));
|
||||
*has_context = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (context_button));
|
||||
|
||||
/* Comment */
|
||||
gtk_text_buffer_get_bounds (comment_buffer, &start, &end);
|
||||
@ -1842,15 +1814,12 @@ glade_editor_property_show_i18n_dialog (GtkWidget *parent,
|
||||
}
|
||||
|
||||
/* Context */
|
||||
if (fmt != GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
gtk_text_buffer_get_bounds (context_buffer, &start, &end);
|
||||
*context = gtk_text_buffer_get_text (context_buffer, &start, &end, TRUE);
|
||||
if (*context[0] == '\0')
|
||||
{
|
||||
gtk_text_buffer_get_bounds (context_buffer, &start, &end);
|
||||
*context = gtk_text_buffer_get_text (context_buffer, &start, &end, TRUE);
|
||||
if (*context[0] == '\0')
|
||||
{
|
||||
g_free (*context);
|
||||
*context = NULL;
|
||||
}
|
||||
g_free (*context);
|
||||
*context = NULL;
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
@ -1865,21 +1834,14 @@ static void
|
||||
glade_eprop_text_show_i18n_dialog (GtkWidget *entry,
|
||||
GladeEditorProperty *eprop)
|
||||
{
|
||||
GladeProject *project;
|
||||
GladeProjectFormat fmt;
|
||||
gchar *text = g_value_dup_string (eprop->property->value);
|
||||
gchar *context = g_strdup (glade_property_i18n_get_context (eprop->property));
|
||||
gchar *comment = g_strdup (glade_property_i18n_get_comment (eprop->property));
|
||||
gboolean translatable = glade_property_i18n_get_translatable (eprop->property);
|
||||
gboolean has_context = glade_property_i18n_get_has_context (eprop->property);
|
||||
|
||||
project = eprop->property->widget->project;
|
||||
fmt = glade_project_get_format (project);
|
||||
|
||||
if (glade_editor_property_show_i18n_dialog (entry, fmt, &text, &context, &comment,
|
||||
&has_context, &translatable))
|
||||
if (glade_editor_property_show_i18n_dialog (entry, &text, &context, &comment, &translatable))
|
||||
{
|
||||
glade_command_set_i18n (eprop->property, translatable, has_context, context, comment);
|
||||
glade_command_set_i18n (eprop->property, translatable, context, comment);
|
||||
glade_eprop_text_changed_common (eprop, text, eprop->use_command);
|
||||
|
||||
glade_editor_property_load (eprop, eprop->property);
|
||||
@ -1947,13 +1909,9 @@ static void
|
||||
glade_eprop_text_show_resource_dialog (GtkWidget *entry,
|
||||
GladeEditorProperty *eprop)
|
||||
{
|
||||
GladeProject *project;
|
||||
GladeProjectFormat fmt;
|
||||
GladeProject *project = eprop->property->widget->project;
|
||||
gchar *text = NULL;
|
||||
|
||||
project = eprop->property->widget->project;
|
||||
fmt = glade_project_get_format (project);
|
||||
|
||||
if (glade_editor_property_show_resource_dialog (project, entry, &text))
|
||||
{
|
||||
glade_eprop_text_changed_common (eprop, text, eprop->use_command);
|
||||
@ -2817,15 +2775,12 @@ glade_eprop_object_show_dialog (GtkWidget *dialog_button,
|
||||
project = glade_widget_get_project (eprop->property->widget);
|
||||
parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
|
||||
|
||||
if (glade_project_get_format (project) != GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
{
|
||||
if (eprop->property->klass->create_type)
|
||||
create_adaptor = glade_widget_adaptor_get_by_name (eprop->property->klass->create_type);
|
||||
if (!create_adaptor &&
|
||||
G_TYPE_IS_INSTANTIATABLE (eprop->klass->pspec->value_type) &&
|
||||
!G_TYPE_IS_ABSTRACT (eprop->klass->pspec->value_type))
|
||||
create_adaptor = glade_widget_adaptor_get_by_type (eprop->klass->pspec->value_type);
|
||||
}
|
||||
if (eprop->property->klass->create_type)
|
||||
create_adaptor = glade_widget_adaptor_get_by_name (eprop->property->klass->create_type);
|
||||
if (!create_adaptor &&
|
||||
G_TYPE_IS_INSTANTIATABLE (eprop->klass->pspec->value_type) &&
|
||||
!G_TYPE_IS_ABSTRACT (eprop->klass->pspec->value_type))
|
||||
create_adaptor = glade_widget_adaptor_get_by_type (eprop->klass->pspec->value_type);
|
||||
|
||||
if (create_adaptor)
|
||||
{
|
||||
@ -3024,7 +2979,6 @@ glade_eprop_object_show_dialog (GtkWidget *dialog_button,
|
||||
static void
|
||||
glade_eprop_object_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GladeEPropObject *eprop_object = GLADE_EPROP_OBJECT (eprop);
|
||||
gchar *obj_name;
|
||||
|
||||
@ -3033,11 +2987,9 @@ glade_eprop_object_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
|
||||
if (property == NULL) return;
|
||||
|
||||
fmt = glade_project_get_format (property->widget->project);
|
||||
|
||||
if ((obj_name = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
|
||||
eprop->klass, property->value, fmt)) != NULL)
|
||||
eprop->klass, property->value)) != NULL)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (eprop_object->entry), obj_name);
|
||||
g_free (obj_name);
|
||||
@ -3098,7 +3050,6 @@ glade_eprop_objects_finalize (GObject *object)
|
||||
static void
|
||||
glade_eprop_objects_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GladeEPropObjects *eprop_objects = GLADE_EPROP_OBJECTS (eprop);
|
||||
gchar *obj_name;
|
||||
|
||||
@ -3107,11 +3058,9 @@ glade_eprop_objects_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
|
||||
if (property == NULL) return;
|
||||
|
||||
fmt = glade_project_get_format (property->widget->project);
|
||||
|
||||
if ((obj_name = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
|
||||
eprop->klass, property->value, fmt)) != NULL)
|
||||
eprop->klass, property->value)) != NULL)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (eprop_objects->entry), obj_name);
|
||||
g_free (obj_name);
|
||||
@ -3272,383 +3221,6 @@ glade_eprop_objects_create_input (GladeEditorProperty *eprop)
|
||||
return hbox;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
GladeEditorPropertyAdjustmentClass
|
||||
*******************************************************************************/
|
||||
typedef struct {
|
||||
GladeEditorProperty parent_instance;
|
||||
|
||||
GtkWidget *notebook;
|
||||
|
||||
GtkWidget *libglade;
|
||||
GtkWidget *entry;
|
||||
|
||||
GtkWidget *value, *lower, *upper, *step_increment, *page_increment, *page_size;
|
||||
GtkAdjustment *value_adj;
|
||||
struct
|
||||
{
|
||||
gulong value, lower, upper, step_increment, page_increment, page_size;
|
||||
}ids;
|
||||
} GladeEPropAdjustment;
|
||||
|
||||
GLADE_MAKE_EPROP (GladeEPropAdjustment, glade_eprop_adjustment)
|
||||
#define GLADE_EPROP_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_ADJUSTMENT, GladeEPropAdjustment))
|
||||
#define GLADE_EPROP_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_ADJUSTMENT, GladeEPropAdjustmentClass))
|
||||
#define GLADE_IS_EPROP_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_ADJUSTMENT))
|
||||
#define GLADE_IS_EPROP_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_EPROP_ADJUSTMENT))
|
||||
#define GLADE_EPROP_ADJUSTMENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_EPROP_ADJUSTMENT, GladeEPropAdjustmentClass))
|
||||
|
||||
static void
|
||||
glade_eprop_adjustment_finalize (GObject *object)
|
||||
{
|
||||
/* Chain up */
|
||||
G_OBJECT_CLASS (editor_property_class)->finalize (object);
|
||||
}
|
||||
|
||||
typedef struct _EPropAdjIdle EPropAdjIdleData;
|
||||
|
||||
struct _EPropAdjIdle
|
||||
{
|
||||
GladeEditorProperty *eprop;
|
||||
gdouble value;
|
||||
};
|
||||
|
||||
static gboolean
|
||||
glade_eprop_adj_set_value_idle (gpointer p)
|
||||
{
|
||||
EPropAdjIdleData *data = (EPropAdjIdleData *) p;
|
||||
GladeEPropAdjustment *eprop_adj = GLADE_EPROP_ADJUSTMENT (data->eprop);
|
||||
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->value), data->value);
|
||||
|
||||
g_free (p);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_eprop_adj_value_changed (GtkAdjustment *adj, GladeEditorProperty *eprop)
|
||||
{
|
||||
EPropAdjIdleData *data;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (adj, glade_eprop_adj_value_changed, eprop);
|
||||
|
||||
/* Don`t do anything if the loaded property is not the same */
|
||||
if (adj != g_value_get_object (eprop->property->value)) return;
|
||||
|
||||
data = g_new (EPropAdjIdleData, 1);
|
||||
|
||||
data->eprop = eprop;
|
||||
data->value = gtk_adjustment_get_value (adj);
|
||||
|
||||
/* Update GladeEPropAdjustment value spinbutton in an idle funtion */
|
||||
g_idle_add (glade_eprop_adj_set_value_idle, data);
|
||||
|
||||
/* Set adjustment to the old value */
|
||||
gtk_adjustment_set_value (adj, gtk_spin_button_get_value (GTK_SPIN_BUTTON (
|
||||
GLADE_EPROP_ADJUSTMENT (eprop)->value)));
|
||||
}
|
||||
|
||||
static void
|
||||
glade_eprop_adjustment_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
{
|
||||
GladeEPropAdjustment *eprop_adj = GLADE_EPROP_ADJUSTMENT (eprop);
|
||||
GladeProjectFormat fmt;
|
||||
GObject *object;
|
||||
GtkAdjustment *adj = NULL;
|
||||
|
||||
/* Chain up first */
|
||||
editor_property_class->load (eprop, property);
|
||||
|
||||
if (property == NULL) return;
|
||||
|
||||
fmt = glade_project_get_format (property->widget->project);
|
||||
|
||||
gtk_widget_hide (eprop_adj->libglade);
|
||||
|
||||
if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
{
|
||||
object = g_value_get_object (property->value);
|
||||
|
||||
if (object)
|
||||
{
|
||||
adj = GTK_ADJUSTMENT (object);
|
||||
|
||||
/* Keep track of external adjustment changes */
|
||||
g_signal_connect (object, "value-changed",
|
||||
G_CALLBACK (glade_eprop_adj_value_changed),
|
||||
eprop);
|
||||
|
||||
/* Update adjustment's values */
|
||||
gtk_adjustment_set_value (eprop_adj->value_adj, gtk_adjustment_get_value (adj));
|
||||
gtk_adjustment_set_lower (eprop_adj->value_adj, gtk_adjustment_get_lower (adj));
|
||||
gtk_adjustment_set_upper (eprop_adj->value_adj, gtk_adjustment_get_upper (adj));
|
||||
gtk_adjustment_set_step_increment (eprop_adj->value_adj, gtk_adjustment_get_step_increment (adj));
|
||||
gtk_adjustment_set_page_increment (eprop_adj->value_adj, gtk_adjustment_get_page_increment (adj));
|
||||
gtk_adjustment_set_page_size (eprop_adj->value_adj, gtk_adjustment_get_page_size (adj));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_adjustment_set_value (eprop_adj->value_adj, 0.0);
|
||||
gtk_adjustment_set_lower (eprop_adj->value_adj, 0.0);
|
||||
gtk_adjustment_set_upper (eprop_adj->value_adj, 100.0);
|
||||
gtk_adjustment_set_step_increment (eprop_adj->value_adj, 1);
|
||||
gtk_adjustment_set_page_increment (eprop_adj->value_adj, 10);
|
||||
gtk_adjustment_set_page_size (eprop_adj->value_adj, 0);
|
||||
}
|
||||
|
||||
/* Block Handlers */
|
||||
g_signal_handler_block (eprop_adj->value, eprop_adj->ids.value);
|
||||
g_signal_handler_block (eprop_adj->lower, eprop_adj->ids.lower);
|
||||
g_signal_handler_block (eprop_adj->upper, eprop_adj->ids.upper);
|
||||
g_signal_handler_block (eprop_adj->step_increment, eprop_adj->ids.step_increment);
|
||||
g_signal_handler_block (eprop_adj->page_increment, eprop_adj->ids.page_increment);
|
||||
g_signal_handler_block (eprop_adj->page_size, eprop_adj->ids.page_size);
|
||||
|
||||
/* Update spinbuttons values */
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->value),
|
||||
gtk_adjustment_get_value (eprop_adj->value_adj));
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->lower),
|
||||
gtk_adjustment_get_lower (eprop_adj->value_adj));
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->upper),
|
||||
gtk_adjustment_get_upper (eprop_adj->value_adj));
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->step_increment),
|
||||
gtk_adjustment_get_step_increment (eprop_adj->value_adj));
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->page_increment),
|
||||
gtk_adjustment_get_page_increment (eprop_adj->value_adj));
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->page_size),
|
||||
gtk_adjustment_get_page_size (eprop_adj->value_adj));
|
||||
|
||||
/* Unblock Handlers */
|
||||
g_signal_handler_unblock (eprop_adj->value, eprop_adj->ids.value);
|
||||
g_signal_handler_unblock (eprop_adj->lower, eprop_adj->ids.lower);
|
||||
g_signal_handler_unblock (eprop_adj->upper, eprop_adj->ids.upper);
|
||||
g_signal_handler_unblock (eprop_adj->step_increment, eprop_adj->ids.step_increment);
|
||||
g_signal_handler_unblock (eprop_adj->page_increment, eprop_adj->ids.page_increment);
|
||||
g_signal_handler_unblock (eprop_adj->page_size, eprop_adj->ids.page_size);
|
||||
|
||||
gtk_widget_show (eprop_adj->libglade);
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (eprop_adj->notebook), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *obj_name;
|
||||
|
||||
fmt = glade_project_get_format (property->widget->project);
|
||||
|
||||
if ((obj_name = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
|
||||
eprop->klass, property->value, fmt)) != NULL)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (eprop_adj->entry), obj_name);
|
||||
g_free (obj_name);
|
||||
}
|
||||
else
|
||||
gtk_entry_set_text (GTK_ENTRY (eprop_adj->entry), "");
|
||||
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (eprop_adj->notebook), 1);
|
||||
}
|
||||
|
||||
gtk_widget_queue_resize (eprop_adj->notebook);
|
||||
}
|
||||
|
||||
static GtkAdjustment *
|
||||
glade_eprop_adjustment_dup_adj (GladeEditorProperty *eprop)
|
||||
{
|
||||
GtkAdjustment *adj;
|
||||
GObject *object;
|
||||
|
||||
object = g_value_get_object (eprop->property->value);
|
||||
if (object == NULL)
|
||||
return GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 100.0,
|
||||
1.0, 10.0, 10.0));
|
||||
|
||||
adj = GTK_ADJUSTMENT (object);
|
||||
|
||||
return GTK_ADJUSTMENT (gtk_adjustment_new (gtk_adjustment_get_value (adj),
|
||||
gtk_adjustment_get_lower (adj),
|
||||
gtk_adjustment_get_upper (adj),
|
||||
gtk_adjustment_get_step_increment (adj),
|
||||
gtk_adjustment_get_page_increment (adj),
|
||||
gtk_adjustment_get_page_size (adj)));
|
||||
}
|
||||
|
||||
static void
|
||||
glade_eprop_adjustment_prop_changed_common (GladeEditorProperty *eprop,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GValue value = {0, };
|
||||
|
||||
g_value_init (&value, GTK_TYPE_ADJUSTMENT);
|
||||
|
||||
if (gtk_adjustment_get_value (adjustment) == 0.00 &&
|
||||
gtk_adjustment_get_lower (adjustment) == 0.00 &&
|
||||
gtk_adjustment_get_upper (adjustment) == 100.00 &&
|
||||
gtk_adjustment_get_step_increment (adjustment) == 1.00 &&
|
||||
gtk_adjustment_get_page_increment (adjustment) == 10.00 &&
|
||||
gtk_adjustment_get_page_size (adjustment) == 10.00)
|
||||
{
|
||||
g_value_set_object (&value, NULL);
|
||||
}
|
||||
else
|
||||
g_value_set_object (&value, G_OBJECT (adjustment));
|
||||
|
||||
glade_editor_property_commit_no_callback (eprop, &value);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
#define GLADE_EPROP_ADJUSTMENT_DEFINE_VALUE_CHANGED_FUNC(p) \
|
||||
static void \
|
||||
glade_eprop_adjustment_ ## p ## _changed (GtkSpinButton *spin, \
|
||||
GladeEditorProperty *eprop) \
|
||||
{ \
|
||||
GtkAdjustment *adj = glade_eprop_adjustment_dup_adj (eprop); \
|
||||
if (adj == NULL) return; \
|
||||
gtk_adjustment_set_ ## p (adj, gtk_spin_button_get_value (spin)); \
|
||||
glade_eprop_adjustment_prop_changed_common (eprop, adj); \
|
||||
}
|
||||
|
||||
GLADE_EPROP_ADJUSTMENT_DEFINE_VALUE_CHANGED_FUNC (value)
|
||||
GLADE_EPROP_ADJUSTMENT_DEFINE_VALUE_CHANGED_FUNC (lower)
|
||||
GLADE_EPROP_ADJUSTMENT_DEFINE_VALUE_CHANGED_FUNC (upper)
|
||||
GLADE_EPROP_ADJUSTMENT_DEFINE_VALUE_CHANGED_FUNC (step_increment)
|
||||
GLADE_EPROP_ADJUSTMENT_DEFINE_VALUE_CHANGED_FUNC (page_increment)
|
||||
GLADE_EPROP_ADJUSTMENT_DEFINE_VALUE_CHANGED_FUNC (page_size)
|
||||
|
||||
#define GLADE_EPROP_ADJUSTMENT_CONNECT(object, prop) \
|
||||
g_signal_connect (object, "value_changed", \
|
||||
G_CALLBACK (glade_eprop_adjustment_ ## prop ## _changed), eprop);
|
||||
|
||||
static void
|
||||
glade_eprop_adjustment_table_add_label (GtkTable *table,
|
||||
gint pos,
|
||||
gchar *label,
|
||||
gchar *tip)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_label_new (label);
|
||||
gtk_misc_set_alignment (GTK_MISC (widget), 1, 0);
|
||||
|
||||
gtk_widget_set_tooltip_text (widget, tip);
|
||||
|
||||
gtk_table_attach_defaults (table, widget, 0, 1, pos, pos + 1);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
glade_eprop_adjustment_create_input_libglade (GladeEditorProperty *eprop)
|
||||
{
|
||||
GladeEPropAdjustment *eprop_adj = GLADE_EPROP_ADJUSTMENT (eprop);
|
||||
GtkWidget *widget;
|
||||
GtkTable *table;
|
||||
|
||||
eprop_adj->value = gtk_spin_button_new_with_range (-G_MAXDOUBLE, G_MAXDOUBLE, 1);
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (eprop_adj->value), 2);
|
||||
eprop_adj->ids.value = GLADE_EPROP_ADJUSTMENT_CONNECT (eprop_adj->value, value);
|
||||
eprop_adj->value_adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (eprop_adj->value));
|
||||
|
||||
eprop_adj->lower = gtk_spin_button_new_with_range (-G_MAXDOUBLE, G_MAXDOUBLE, 1);
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (eprop_adj->lower), 2);
|
||||
eprop_adj->ids.lower = GLADE_EPROP_ADJUSTMENT_CONNECT (eprop_adj->lower, lower);
|
||||
|
||||
eprop_adj->upper = gtk_spin_button_new_with_range (-G_MAXDOUBLE, G_MAXDOUBLE, 1);
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (eprop_adj->upper), 2);
|
||||
eprop_adj->ids.upper = GLADE_EPROP_ADJUSTMENT_CONNECT (eprop_adj->upper, upper);
|
||||
|
||||
eprop_adj->step_increment = gtk_spin_button_new_with_range (0, G_MAXDOUBLE, 1);
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (eprop_adj->step_increment), 2);
|
||||
eprop_adj->ids.step_increment = GLADE_EPROP_ADJUSTMENT_CONNECT (eprop_adj->step_increment, step_increment);
|
||||
|
||||
eprop_adj->page_increment = gtk_spin_button_new_with_range (0, G_MAXDOUBLE, 1);
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (eprop_adj->page_increment), 2);
|
||||
eprop_adj->ids.page_increment = GLADE_EPROP_ADJUSTMENT_CONNECT (eprop_adj->page_increment, page_increment);
|
||||
|
||||
eprop_adj->page_size = gtk_spin_button_new_with_range (0, G_MAXDOUBLE, 1);
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (eprop_adj->page_size), 2);
|
||||
eprop_adj->ids.page_size = GLADE_EPROP_ADJUSTMENT_CONNECT (eprop_adj->page_size, page_size);
|
||||
|
||||
/* Eprop */
|
||||
widget = gtk_table_new (6, 2, FALSE);
|
||||
table = GTK_TABLE (widget);
|
||||
gtk_table_set_col_spacings (table, 4);
|
||||
|
||||
glade_eprop_adjustment_table_add_label (table, 0, _("Value:"),
|
||||
_("The current value"));
|
||||
|
||||
glade_eprop_adjustment_table_add_label (table, 1, _("Lower:"),
|
||||
_("The minimum value"));
|
||||
|
||||
glade_eprop_adjustment_table_add_label (table, 2, _("Upper:"),
|
||||
_("The maximum value"));
|
||||
|
||||
glade_eprop_adjustment_table_add_label (table, 3, _("Step inc:"),
|
||||
_("The increment to use to make minor changes to the value"));
|
||||
|
||||
glade_eprop_adjustment_table_add_label (table, 4, _("Page inc:"),
|
||||
_("The increment to use to make major changes to the value"));
|
||||
|
||||
glade_eprop_adjustment_table_add_label (table, 5, _("Page size:"),
|
||||
_("The page size (in a GtkScrollbar this is the size of the area which is currently visible)"));
|
||||
|
||||
gtk_table_attach_defaults (table, eprop_adj->value, 1, 2, 0, 1);
|
||||
gtk_table_attach_defaults (table, eprop_adj->lower, 1, 2, 1, 2);
|
||||
gtk_table_attach_defaults (table, eprop_adj->upper, 1, 2, 2, 3);
|
||||
gtk_table_attach_defaults (table, eprop_adj->step_increment, 1, 2, 3, 4);
|
||||
gtk_table_attach_defaults (table, eprop_adj->page_increment, 1, 2, 4, 5);
|
||||
gtk_table_attach_defaults (table, eprop_adj->page_size, 1, 2, 5, 6);
|
||||
|
||||
gtk_widget_show_all (widget);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
glade_eprop_adjustment_create_input_builder (GladeEditorProperty *eprop)
|
||||
{
|
||||
GladeEPropAdjustment *eprop_adj = GLADE_EPROP_ADJUSTMENT (eprop);
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *button;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
eprop_adj->entry = gtk_entry_new ();
|
||||
gtk_editable_set_editable (GTK_EDITABLE (eprop_adj->entry), FALSE);
|
||||
gtk_widget_show (eprop_adj->entry);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), eprop_adj->entry, TRUE, TRUE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("...");
|
||||
gtk_widget_show (button);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (glade_eprop_object_show_dialog),
|
||||
eprop);
|
||||
return hbox;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
glade_eprop_adjustment_create_input (GladeEditorProperty *eprop)
|
||||
{
|
||||
GladeEPropAdjustment *eprop_adj = GLADE_EPROP_ADJUSTMENT (eprop);
|
||||
GtkWidget *builder;
|
||||
|
||||
eprop_adj->libglade = glade_eprop_adjustment_create_input_libglade (eprop);
|
||||
builder = glade_eprop_adjustment_create_input_builder (eprop);
|
||||
|
||||
gtk_widget_show (eprop_adj->libglade);
|
||||
gtk_widget_show (builder);
|
||||
|
||||
eprop_adj->notebook = gtk_notebook_new ();
|
||||
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (eprop_adj->notebook), FALSE);
|
||||
gtk_notebook_set_show_border (GTK_NOTEBOOK (eprop_adj->notebook), FALSE);
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (eprop_adj->notebook), eprop_adj->libglade, NULL);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (eprop_adj->notebook), builder, NULL);
|
||||
return eprop_adj->notebook;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
API
|
||||
*******************************************************************************/
|
||||
|
||||
@ -148,11 +148,9 @@ void glade_editor_property_commit_no_callback (GladeEditorProper
|
||||
GValue *value);
|
||||
|
||||
gboolean glade_editor_property_show_i18n_dialog (GtkWidget *parent,
|
||||
GladeProjectFormat fmt,
|
||||
gchar **text,
|
||||
gchar **context,
|
||||
gchar **comment,
|
||||
gboolean *has_context,
|
||||
gboolean *translatable);
|
||||
gboolean glade_editor_property_show_resource_dialog (GladeProject *project,
|
||||
GtkWidget *parent,
|
||||
@ -176,7 +174,6 @@ gboolean glade_editor_property_show_object_dialog (GladeProject
|
||||
#define GLADE_TYPE_EPROP_UNICHAR (glade_eprop_unichar_get_type())
|
||||
#define GLADE_TYPE_EPROP_OBJECT (glade_eprop_object_get_type())
|
||||
#define GLADE_TYPE_EPROP_OBJECTS (glade_eprop_objects_get_type())
|
||||
#define GLADE_TYPE_EPROP_ADJUSTMENT (glade_eprop_adjustment_get_type())
|
||||
GType glade_eprop_numeric_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_enum_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_flags_get_type (void) G_GNUC_CONST;
|
||||
@ -187,7 +184,6 @@ GType glade_eprop_bool_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_unichar_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_object_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_objects_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_adjustment_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -508,10 +508,7 @@ glade_palette_item_refresh (GtkWidget *item)
|
||||
glade_project_verify_widget_adaptor (project, adaptor, &support)) != NULL)
|
||||
{
|
||||
/* set sensitivity */
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (item),
|
||||
!(support & (GLADE_SUPPORT_LIBGLADE_UNSUPPORTED |
|
||||
GLADE_SUPPORT_LIBGLADE_ONLY |
|
||||
GLADE_SUPPORT_MISMATCH)));
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (item), !(support & GLADE_SUPPORT_MISMATCH));
|
||||
|
||||
if (support & GLADE_SUPPORT_DEPRECATED)
|
||||
/* XXX Todo, draw a cross overlaying the widget icon */
|
||||
|
||||
@ -436,24 +436,15 @@ glade_popup_create_menu (GladeWidget *widget,
|
||||
GladePlaceholder *placeholder,
|
||||
gboolean packing)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GladeWidgetAdaptor *current_item;
|
||||
GladeProject *project;
|
||||
GtkWidget *popup_menu;
|
||||
GtkWidget *separator;
|
||||
GList *list;
|
||||
gboolean sensitive, non_window;
|
||||
gboolean sensitive;
|
||||
GladePlaceholder *tmp_placeholder;
|
||||
gchar *book;
|
||||
|
||||
sensitive = (current_item = glade_palette_get_current_item (glade_app_get_palette ())) != NULL;
|
||||
|
||||
/* Resolve project format first... */
|
||||
project = widget ? glade_widget_get_project (widget) :
|
||||
placeholder ? glade_placeholder_get_project (placeholder) : glade_app_get_project ();
|
||||
fmt = glade_project_get_format (project);
|
||||
|
||||
|
||||
popup_menu = gtk_menu_new ();
|
||||
|
||||
if (current_item)
|
||||
@ -478,8 +469,7 @@ glade_popup_create_menu (GladeWidget *widget,
|
||||
}
|
||||
|
||||
glade_popup_append_item (popup_menu, NULL, _("Add widget as _toplevel"), NULL,
|
||||
fmt != GLADE_PROJECT_FORMAT_LIBGLADE,
|
||||
glade_popup_root_add_cb, NULL);
|
||||
TRUE, glade_popup_root_add_cb, NULL);
|
||||
|
||||
separator = gtk_menu_item_new ();
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), separator);
|
||||
@ -497,15 +487,6 @@ glade_popup_create_menu (GladeWidget *widget,
|
||||
|
||||
/* paste is placholder specific when the popup is on a placeholder */
|
||||
sensitive = glade_clipboard_get_has_selection (glade_app_get_clipboard ());
|
||||
non_window = FALSE;
|
||||
|
||||
for (list = glade_app_get_clipboard ()->selection; list; list = list->next)
|
||||
{
|
||||
GladeWidget *gwidget = GLADE_WIDGET (list->data);
|
||||
if (!GTK_IS_WIDGET (gwidget->object) ||
|
||||
!gtk_widget_get_has_window (GTK_WIDGET (gwidget->object)))
|
||||
non_window = TRUE;
|
||||
}
|
||||
|
||||
if (placeholder)
|
||||
glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, NULL, sensitive,
|
||||
@ -514,13 +495,10 @@ glade_popup_create_menu (GladeWidget *widget,
|
||||
glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, NULL, sensitive,
|
||||
glade_popup_paste_cb, widget);
|
||||
else
|
||||
/* No toplevel non-GtkWindow pastes in libglade */
|
||||
glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, NULL,
|
||||
sensitive && !(non_window && (fmt == GLADE_PROJECT_FORMAT_LIBGLADE)),
|
||||
glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, NULL, sensitive,
|
||||
glade_popup_paste_cb, NULL);
|
||||
|
||||
|
||||
|
||||
glade_popup_append_item (popup_menu, GTK_STOCK_DELETE, NULL, NULL, (widget != NULL),
|
||||
glade_popup_delete_cb, widget);
|
||||
|
||||
@ -692,7 +670,6 @@ void
|
||||
glade_popup_palette_pop (GladeWidgetAdaptor *adaptor,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GladeProject *project;
|
||||
GtkWidget *popup_menu;
|
||||
gchar *book = NULL;
|
||||
@ -704,11 +681,9 @@ glade_popup_palette_pop (GladeWidgetAdaptor *adaptor,
|
||||
popup_menu = gtk_menu_new ();
|
||||
|
||||
project = glade_app_get_project ();
|
||||
fmt = glade_project_get_format (project);
|
||||
|
||||
glade_popup_append_item (popup_menu, NULL, _("Add widget as _toplevel"), NULL,
|
||||
(fmt != GLADE_PROJECT_FORMAT_LIBGLADE),
|
||||
glade_popup_root_add_cb, adaptor);
|
||||
TRUE, glade_popup_root_add_cb, adaptor);
|
||||
|
||||
g_object_get (adaptor, "book", &book, NULL);
|
||||
if (book && glade_util_have_devhelp ())
|
||||
|
||||
@ -63,7 +63,6 @@ enum
|
||||
CHANGED,
|
||||
PARSE_BEGAN,
|
||||
PARSE_FINISHED,
|
||||
CONVERT_FINISHED,
|
||||
TARGETS_CHANGED,
|
||||
LOAD_PROGRESS,
|
||||
LAST_SIGNAL
|
||||
@ -76,7 +75,6 @@ enum
|
||||
PROP_HAS_SELECTION,
|
||||
PROP_PATH,
|
||||
PROP_READ_ONLY,
|
||||
PROP_FORMAT,
|
||||
PROP_PREVIEWABLE
|
||||
};
|
||||
|
||||
@ -134,8 +132,6 @@ struct _GladeProjectPrivate
|
||||
|
||||
time_t mtime; /* last UTC modification time of file, or 0 if it could not be read */
|
||||
|
||||
GladeProjectFormat format; /* file format */
|
||||
|
||||
GHashTable *target_versions_major; /* target versions by catalog */
|
||||
GHashTable *target_versions_minor; /* target versions by catalog */
|
||||
|
||||
@ -147,8 +143,6 @@ struct _GladeProjectPrivate
|
||||
|
||||
/* Control on the preferences dialog to update buttons etc when properties change */
|
||||
GtkWidget *prefs_dialog;
|
||||
GtkWidget *glade_radio;
|
||||
GtkWidget *builder_radio;
|
||||
GtkWidget *project_wide_radio;
|
||||
GtkWidget *toplevel_contextual_radio;
|
||||
GHashTable *target_radios;
|
||||
@ -214,10 +208,6 @@ static GladeWidget *search_ancestry_by_name (GladeWidget *
|
||||
|
||||
static GtkWidget *glade_project_build_prefs_dialog (GladeProject *project);
|
||||
|
||||
static void format_libglade_button_toggled (GtkWidget *widget,
|
||||
GladeProject *project);
|
||||
static void format_builder_button_toggled (GtkWidget *widget,
|
||||
GladeProject *project);
|
||||
static void policy_project_wide_button_clicked (GtkWidget *widget,
|
||||
GladeProject *project);
|
||||
static void policy_toplevel_contextual_button_clicked (GtkWidget *widget,
|
||||
@ -381,9 +371,6 @@ glade_project_get_property (GObject *object,
|
||||
case PROP_READ_ONLY:
|
||||
g_value_set_boolean (value, project->priv->readonly);
|
||||
break;
|
||||
case PROP_FORMAT:
|
||||
g_value_set_int (value, project->priv->format);
|
||||
break;
|
||||
case PROP_PREVIEWABLE:
|
||||
g_value_set_boolean (value, project->priv->previewable);
|
||||
break;
|
||||
@ -713,8 +700,6 @@ glade_project_init (GladeProject *project)
|
||||
priv->stamp = g_random_int ();
|
||||
} while (priv->stamp == 0);
|
||||
|
||||
priv->format = GLADE_PROJECT_FORMAT_GTKBUILDER;
|
||||
|
||||
priv->target_versions_major = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
g_free,
|
||||
@ -905,27 +890,6 @@ glade_project_class_init (GladeProjectClass *klass)
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
|
||||
/**
|
||||
* GladeProject::convert-finished:
|
||||
* @gladeproject: the #GladeProject which received the signal.
|
||||
*
|
||||
* Emitted when @gladeproject format conversion has finished.
|
||||
*
|
||||
* NOTE: Some properties are internally handled differently
|
||||
* when the project is in a said format, this signal is fired after
|
||||
* the new format is in effect to allow the backend access to both
|
||||
* before and after.
|
||||
*/
|
||||
glade_project_signals[CONVERT_FINISHED] =
|
||||
g_signal_new ("convert-finished",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GladeProjectClass, parse_finished),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
|
||||
/**
|
||||
* GladeProject::targets-changed:
|
||||
* @gladeproject: the #GladeProject which received the signal.
|
||||
@ -989,16 +953,6 @@ glade_project_class_init (GladeProjectClass *klass)
|
||||
FALSE,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_FORMAT,
|
||||
g_param_spec_int ("format",
|
||||
_("Format"),
|
||||
_("The project file format"),
|
||||
GLADE_PROJECT_FORMAT_LIBGLADE,
|
||||
GLADE_PROJECT_FORMAT_GTKBUILDER,
|
||||
GLADE_PROJECT_FORMAT_GTKBUILDER,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_PREVIEWABLE,
|
||||
g_param_spec_boolean ("previewable",
|
||||
@ -1050,8 +1004,7 @@ glade_project_fix_object_props (GladeProject *project)
|
||||
{
|
||||
property = GLADE_PROPERTY (ll->data);
|
||||
|
||||
if (glade_property_class_is_object (property->klass,
|
||||
project->priv->format) &&
|
||||
if (glade_property_class_is_object (property->klass) &&
|
||||
(txt = g_object_get_data (G_OBJECT (property),
|
||||
"glade-loaded-object")) != NULL)
|
||||
{
|
||||
@ -1265,7 +1218,7 @@ update_project_for_resource_path (GladeProject *project)
|
||||
gchar *string;
|
||||
|
||||
string = glade_property_class_make_string_from_gvalue
|
||||
(property->klass, property->value, project->priv->format);
|
||||
(property->klass, property->value);
|
||||
|
||||
value = glade_property_class_make_gvalue_from_string
|
||||
(property->klass, string, project, widget);
|
||||
@ -1368,17 +1321,9 @@ glade_project_introspect_signal_versions (const gchar *signal_name,
|
||||
static void
|
||||
glade_project_introspect_gtk_version (GladeProject *project)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GladeWidget *widget;
|
||||
GList *list, *l;
|
||||
gint target_major = 2, target_minor = 0;
|
||||
|
||||
fmt = glade_project_get_format (project);
|
||||
|
||||
if (fmt == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
target_minor = 12;
|
||||
else
|
||||
target_minor = 6;
|
||||
gint target_major = 2, target_minor = 12;
|
||||
|
||||
for (list = project->priv->objects; list; list = list->next)
|
||||
{
|
||||
@ -1459,8 +1404,7 @@ glade_project_count_xml_objects (GladeProject *project, GladeXmlNode *root, gint
|
||||
for (node = glade_xml_node_get_children (root);
|
||||
node; node = glade_xml_node_next (node))
|
||||
{
|
||||
if (glade_xml_node_verify_silent
|
||||
(node, GLADE_XML_TAG_WIDGET (project->priv->format)))
|
||||
if (glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET))
|
||||
count = glade_project_count_xml_objects (project, node, ++count);
|
||||
else if (glade_xml_node_verify_silent (node, GLADE_XML_TAG_CHILD))
|
||||
count = glade_project_count_xml_objects (project, node, count);
|
||||
@ -1528,14 +1472,9 @@ glade_project_load_internal (GladeProject *project)
|
||||
doc = glade_xml_context_get_doc (context);
|
||||
root = glade_xml_doc_get_root (doc);
|
||||
|
||||
if (glade_xml_node_verify_silent (root, GLADE_XML_TAG_LIBGLADE_PROJECT))
|
||||
glade_project_set_format (project, GLADE_PROJECT_FORMAT_LIBGLADE);
|
||||
else if (glade_xml_node_verify_silent (root, GLADE_XML_TAG_BUILDER_PROJECT))
|
||||
glade_project_set_format (project, GLADE_PROJECT_FORMAT_GTKBUILDER);
|
||||
else
|
||||
if (!glade_xml_node_verify_silent (root, GLADE_XML_TAG_PROJECT))
|
||||
{
|
||||
g_warning ("Couldnt determine project format, skipping %s",
|
||||
project->priv->path);
|
||||
g_warning ("Couldnt recognize GtkBuilder xml, skipping %s", project->priv->path);
|
||||
glade_xml_context_free (context);
|
||||
project->priv->loading = FALSE;
|
||||
return FALSE;
|
||||
@ -1568,8 +1507,7 @@ glade_project_load_internal (GladeProject *project)
|
||||
node; node = glade_xml_node_next (node))
|
||||
{
|
||||
/* Skip "requires" tags */
|
||||
if (!glade_xml_node_verify_silent
|
||||
(node, GLADE_XML_TAG_WIDGET (project->priv->format)))
|
||||
if (!glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET))
|
||||
continue;
|
||||
|
||||
if ((widget = glade_widget_read (project, NULL, node, NULL)) != NULL)
|
||||
@ -1748,14 +1686,11 @@ glade_project_write_required_libs (GladeProject *project,
|
||||
GladeXmlContext *context,
|
||||
GladeXmlNode *root)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GladeXmlNode *req_node;
|
||||
GList *required, *list;
|
||||
gint major, minor;
|
||||
gchar *version;
|
||||
|
||||
fmt = glade_project_get_format (project);
|
||||
|
||||
if ((required = glade_project_required_libs (project)) != NULL)
|
||||
{
|
||||
for (list = required; list; list = list->next)
|
||||
@ -1766,49 +1701,31 @@ glade_project_write_required_libs (GladeProject *project,
|
||||
version = g_strdup_printf ("%d.%d", major, minor);
|
||||
|
||||
/* Write the standard requires tag */
|
||||
if (fmt == GLADE_PROJECT_FORMAT_GTKBUILDER ||
|
||||
(fmt == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
strcmp ("gtk+", (gchar *)list->data)))
|
||||
if (GLADE_GTKBUILDER_HAS_VERSIONING (major, minor))
|
||||
{
|
||||
if (GLADE_GTKBUILDER_HAS_VERSIONING (major, minor))
|
||||
{
|
||||
req_node = glade_xml_node_new (context, GLADE_XML_TAG_REQUIRES);
|
||||
glade_xml_node_append_child (root, req_node);
|
||||
glade_xml_node_set_property_string (req_node,
|
||||
GLADE_XML_TAG_LIB,
|
||||
(gchar *)list->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *comment =
|
||||
g_strdup_printf (" interface-requires %s %s ",
|
||||
(gchar *)list->data, version);
|
||||
req_node = glade_xml_node_new_comment (context, comment);
|
||||
glade_xml_node_append_child (root, req_node);
|
||||
g_free (comment);
|
||||
}
|
||||
|
||||
if (fmt != GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
glade_xml_node_set_property_string
|
||||
(req_node, GLADE_XML_TAG_VERSION, version);
|
||||
req_node = glade_xml_node_new (context, GLADE_XML_TAG_REQUIRES);
|
||||
glade_xml_node_append_child (root, req_node);
|
||||
glade_xml_node_set_property_string (req_node,
|
||||
GLADE_XML_TAG_LIB,
|
||||
(gchar *)list->data);
|
||||
}
|
||||
|
||||
/* Add extra metadata for libglade */
|
||||
if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
else
|
||||
{
|
||||
gchar *comment = g_strdup_printf (" interface-requires %s %s ",
|
||||
(gchar *)list->data, version);
|
||||
gchar *comment =
|
||||
g_strdup_printf (" interface-requires %s %s ",
|
||||
(gchar *)list->data, version);
|
||||
req_node = glade_xml_node_new_comment (context, comment);
|
||||
glade_xml_node_append_child (root, req_node);
|
||||
g_free (comment);
|
||||
}
|
||||
|
||||
glade_xml_node_set_property_string (req_node, GLADE_XML_TAG_VERSION, version);
|
||||
g_free (version);
|
||||
|
||||
}
|
||||
g_list_foreach (required, (GFunc)g_free, NULL);
|
||||
g_list_free (required);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1868,7 +1785,7 @@ glade_project_write (GladeProject *project)
|
||||
|
||||
doc = glade_xml_doc_new ();
|
||||
context = glade_xml_context_new (doc, NULL);
|
||||
root = glade_xml_node_new (context, GLADE_XML_TAG_PROJECT (project->priv->format));
|
||||
root = glade_xml_node_new (context, GLADE_XML_TAG_PROJECT);
|
||||
glade_xml_doc_set_root (doc, root);
|
||||
|
||||
glade_project_update_comment (project);
|
||||
@ -2098,26 +2015,6 @@ glade_project_preview (GladeProject *project, GladeWidget *gwidget)
|
||||
/* translators: reffers to a widget '[%s]' introduced in toolkit version '%s %d.%d' */
|
||||
#define WIDGET_VERSION_CONFLICT_FMT _("[%s] Object class '%s' was introduced in %s %d.%d\n")
|
||||
|
||||
/* translators: reffers to a widget in toolkit version '%s %d.%d' and a project targeting toolkit version '%s %d.%d' */
|
||||
#define WIDGET_BUILDER_VERSION_CONFLICT_MSGFMT _("This widget was made available in GtkBuilder format in %s %d.%d " \
|
||||
"while project targets %s %d.%d")
|
||||
|
||||
/* translators: reffers to a widget '[%s]' introduced in toolkit version '%s %d.%d' */
|
||||
#define WIDGET_BUILDER_VERSION_CONFLICT_FMT _("[%s] Object class '%s' was made available in GtkBuilder format " \
|
||||
"in %s %d.%d\n")
|
||||
|
||||
#define WIDGET_LIBGLADE_ONLY_MSG _("This widget is only supported in libglade format")
|
||||
|
||||
/* translators: reffers to a widget '[%s]' loaded from toolkit version '%s %d.%d' */
|
||||
#define WIDGET_LIBGLADE_ONLY_FMT _("[%s] Object class '%s' from %s %d.%d " \
|
||||
"is only supported in libglade format\n")
|
||||
|
||||
#define WIDGET_LIBGLADE_UNSUPPORTED_MSG _("This widget is not supported in libglade format")
|
||||
|
||||
/* translators: reffers to a widget '[%s]' loaded from toolkit version '%s %d.%d' */
|
||||
#define WIDGET_LIBGLADE_UNSUPPORTED_FMT _("[%s] Object class '%s' from %s %d.%d " \
|
||||
"is not supported in libglade format\n")
|
||||
|
||||
#define WIDGET_DEPRECATED_MSG _("This widget is deprecated")
|
||||
|
||||
/* translators: reffers to a widget '[%s]' loaded from toolkit version '%s %d.%d' */
|
||||
@ -2128,24 +2025,6 @@ glade_project_preview (GladeProject *project, GladeWidget *gwidget)
|
||||
* you can only comment about the line directly following, forcing you to write
|
||||
* ugly messy code with comments in line breaks inside function calls).
|
||||
*/
|
||||
#define PROP_LIBGLADE_UNSUPPORTED_MSG _("This property is not supported in libglade format")
|
||||
|
||||
/* translators: reffers to a property '%s' of widget '[%s]' */
|
||||
#define PROP_LIBGLADE_UNSUPPORTED_FMT _("[%s] Property '%s' of object class '%s' is not " \
|
||||
"supported in libglade format\n")
|
||||
/* translators: reffers to a property '%s' of widget '[%s]' */
|
||||
#define PACK_PROP_LIBGLADE_UNSUPPORTED_FMT _("[%s] Packing property '%s' of object class '%s' is not " \
|
||||
"supported in libglade format\n")
|
||||
|
||||
#define PROP_LIBGLADE_ONLY_MSG _("This property is only supported in libglade format")
|
||||
|
||||
/* translators: reffers to a property '%s' of widget '[%s]' */
|
||||
#define PROP_LIBGLADE_ONLY_FMT _("[%s] Property '%s' of object class '%s' is only " \
|
||||
"supported in libglade format\n")
|
||||
|
||||
/* translators: reffers to a property '%s' of widget '[%s]' */
|
||||
#define PACK_PROP_LIBGLADE_ONLY_FMT _("[%s] Packing property '%s' of object class '%s' is only " \
|
||||
"supported in libglade format\n")
|
||||
|
||||
/* translators: reffers to a property in toolkit version '%s %d.%d'
|
||||
* and a project targeting toolkit version '%s %d.%d' */
|
||||
@ -2158,18 +2037,6 @@ glade_project_preview (GladeProject *project, GladeWidget *gwidget)
|
||||
#define PACK_PROP_VERSION_CONFLICT_FMT _("[%s] Packing property '%s' of object class '%s' " \
|
||||
"was introduced in %s %d.%d\n")
|
||||
|
||||
/* translators: reffers to a property in toolkit version '%s %d.%d' and a project targeting toolkit version '%s %d.%d' */
|
||||
#define PROP_BUILDER_VERSION_CONFLICT_MSGFMT _("This property was made available in GtkBuilder format in %s %d.%d " \
|
||||
"while project targets %s %d.%d")
|
||||
|
||||
/* translators: reffers to a property '%s' of widget '[%s]' in toolkit version '%s %d.%d' */
|
||||
#define PROP_BUILDER_VERSION_CONFLICT_FMT _("[%s] Property '%s' of object class '%s' was " \
|
||||
"made available in GtkBuilder format in %s %d.%d\n")
|
||||
|
||||
/* translators: reffers to a property '%s' of widget '[%s]' in toolkit version '%s %d.%d' */
|
||||
#define PACK_PROP_BUILDER_VERSION_CONFLICT_FMT _("[%s] Packing property '%s' of object class '%s' " \
|
||||
"was made available in GtkBuilder format in %s %d.%d\n")
|
||||
|
||||
/* translators: reffers to a signal '%s' of widget '[%s]' in toolkit version '%s %d.%d' */
|
||||
#define SIGNAL_VERSION_CONFLICT_FMT _("[%s] Signal '%s' of object class '%s' was introduced in %s %d.%d\n")
|
||||
|
||||
@ -2199,37 +2066,7 @@ glade_project_verify_property (GladeProject *project,
|
||||
&target_major,
|
||||
&target_minor);
|
||||
|
||||
if (project->priv->format == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
property->klass->libglade_unsupported)
|
||||
{
|
||||
if (forwidget)
|
||||
glade_property_set_support_warning
|
||||
(property, TRUE, PROP_LIBGLADE_UNSUPPORTED_MSG);
|
||||
else
|
||||
g_string_append_printf (string,
|
||||
property->klass->packing ?
|
||||
PACK_PROP_LIBGLADE_UNSUPPORTED_FMT :
|
||||
PROP_LIBGLADE_UNSUPPORTED_FMT,
|
||||
path_name,
|
||||
property->klass->name,
|
||||
adaptor->title);
|
||||
}
|
||||
else if (project->priv->format == GLADE_PROJECT_FORMAT_GTKBUILDER &&
|
||||
property->klass->libglade_only)
|
||||
{
|
||||
if (forwidget)
|
||||
glade_property_set_support_warning
|
||||
(property, TRUE, PROP_LIBGLADE_ONLY_MSG);
|
||||
else
|
||||
g_string_append_printf (string,
|
||||
property->klass->packing ?
|
||||
PACK_PROP_LIBGLADE_ONLY_FMT :
|
||||
PROP_LIBGLADE_ONLY_FMT,
|
||||
path_name,
|
||||
property->klass->name,
|
||||
adaptor->title);
|
||||
}
|
||||
else if (!GPC_VERSION_CHECK (property->klass, target_major, target_minor))
|
||||
if (!GPC_VERSION_CHECK (property->klass, target_major, target_minor))
|
||||
{
|
||||
if (forwidget)
|
||||
{
|
||||
@ -2254,32 +2091,6 @@ glade_project_verify_property (GladeProject *project,
|
||||
property->klass->version_since_major,
|
||||
property->klass->version_since_minor);
|
||||
}
|
||||
else if (project->priv->format == GLADE_PROJECT_FORMAT_GTKBUILDER &&
|
||||
!GPC_BUILDER_VERSION_CHECK (property->klass, target_major, target_minor))
|
||||
{
|
||||
if (forwidget)
|
||||
{
|
||||
tooltip = g_strdup_printf (PROP_BUILDER_VERSION_CONFLICT_MSGFMT,
|
||||
catalog,
|
||||
property->klass->builder_since_major,
|
||||
property->klass->builder_since_minor,
|
||||
catalog,
|
||||
target_major, target_minor);
|
||||
|
||||
glade_property_set_support_warning (property, FALSE, tooltip);
|
||||
g_free (tooltip);
|
||||
}
|
||||
else
|
||||
g_string_append_printf (string,
|
||||
property->klass->packing ?
|
||||
PACK_PROP_BUILDER_VERSION_CONFLICT_FMT :
|
||||
PROP_BUILDER_VERSION_CONFLICT_FMT,
|
||||
path_name,
|
||||
property->klass->name,
|
||||
adaptor->title, catalog,
|
||||
property->klass->builder_since_major,
|
||||
property->klass->builder_since_minor);
|
||||
}
|
||||
else if (forwidget)
|
||||
glade_property_set_support_warning (property, FALSE, NULL);
|
||||
|
||||
@ -2546,64 +2357,6 @@ glade_project_verify_adaptor (GladeProject *project,
|
||||
|
||||
support_mask |= GLADE_SUPPORT_MISMATCH;
|
||||
}
|
||||
else if (project->priv->format == GLADE_PROJECT_FORMAT_GTKBUILDER &&
|
||||
(target_major < GWA_BUILDER_SINCE_MAJOR (adaptor_iter) ||
|
||||
(target_major == GWA_BUILDER_SINCE_MAJOR (adaptor_iter) &&
|
||||
target_minor < GWA_BUILDER_SINCE_MINOR (adaptor_iter))))
|
||||
{
|
||||
if (forwidget)
|
||||
g_string_append_printf (string,
|
||||
WIDGET_BUILDER_VERSION_CONFLICT_MSGFMT,
|
||||
catalog,
|
||||
GWA_BUILDER_SINCE_MAJOR (adaptor_iter),
|
||||
GWA_BUILDER_SINCE_MINOR (adaptor_iter),
|
||||
catalog, target_major, target_minor);
|
||||
else
|
||||
g_string_append_printf (string,
|
||||
WIDGET_BUILDER_VERSION_CONFLICT_FMT,
|
||||
path_name, adaptor_iter->title, catalog,
|
||||
GWA_BUILDER_SINCE_MAJOR (adaptor_iter),
|
||||
GWA_BUILDER_SINCE_MINOR (adaptor_iter));
|
||||
|
||||
support_mask |= GLADE_SUPPORT_MISMATCH;
|
||||
}
|
||||
|
||||
/* Now accumulate some more messages...
|
||||
*/
|
||||
if (project->priv->format == GLADE_PROJECT_FORMAT_GTKBUILDER &&
|
||||
GWA_LIBGLADE_ONLY (adaptor_iter))
|
||||
{
|
||||
if (forwidget)
|
||||
{
|
||||
if (string->len)
|
||||
g_string_append (string, "\n");
|
||||
g_string_append_printf (string, WIDGET_LIBGLADE_ONLY_MSG);
|
||||
}
|
||||
else
|
||||
g_string_append_printf (string,
|
||||
WIDGET_LIBGLADE_ONLY_FMT,
|
||||
path_name, adaptor_iter->title, catalog,
|
||||
target_major, target_minor);
|
||||
|
||||
support_mask |= GLADE_SUPPORT_LIBGLADE_ONLY;
|
||||
}
|
||||
else if (project->priv->format == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
GWA_LIBGLADE_UNSUPPORTED (adaptor_iter))
|
||||
{
|
||||
if (forwidget)
|
||||
{
|
||||
if (string->len)
|
||||
g_string_append (string, "\n");
|
||||
|
||||
g_string_append_printf (string, WIDGET_LIBGLADE_UNSUPPORTED_MSG);
|
||||
}
|
||||
else
|
||||
g_string_append_printf (string, WIDGET_LIBGLADE_UNSUPPORTED_FMT,
|
||||
path_name, adaptor_iter->title, catalog,
|
||||
target_major, target_minor);
|
||||
|
||||
support_mask |= GLADE_SUPPORT_LIBGLADE_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (!saving && GWA_DEPRECATED (adaptor_iter))
|
||||
{
|
||||
@ -4017,68 +3770,6 @@ glade_project_get_naming_policy (GladeProject *project)
|
||||
return project->priv->naming_policy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glade_project_set_format:
|
||||
* @project: a #GladeProject
|
||||
* @format: the #GladeProjectFormat
|
||||
*
|
||||
* Sets @project format to @format, used internally to set the actual format
|
||||
* state; note that conversions should be done through the glade-command api.
|
||||
*/
|
||||
void
|
||||
glade_project_set_format (GladeProject *project, GladeProjectFormat format)
|
||||
{
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
|
||||
if (project->priv->format != format)
|
||||
{
|
||||
project->priv->format = format;
|
||||
g_object_notify (G_OBJECT (project), "format");
|
||||
glade_project_verify_project_for_ui (project);
|
||||
|
||||
/* Update the toggle button in the prefs dialog here: */
|
||||
g_signal_handlers_block_by_func (project->priv->glade_radio,
|
||||
G_CALLBACK (format_libglade_button_toggled), project);
|
||||
g_signal_handlers_block_by_func (project->priv->builder_radio,
|
||||
G_CALLBACK (format_builder_button_toggled), project);
|
||||
|
||||
if (format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (project->priv->builder_radio), TRUE);
|
||||
else
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (project->priv->glade_radio), TRUE);
|
||||
|
||||
g_signal_handlers_unblock_by_func (project->priv->glade_radio,
|
||||
G_CALLBACK (format_libglade_button_toggled), project);
|
||||
g_signal_handlers_unblock_by_func (project->priv->builder_radio,
|
||||
G_CALLBACK (format_builder_button_toggled), project);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
GladeProjectFormat
|
||||
glade_project_get_format (GladeProject *project)
|
||||
{
|
||||
g_return_val_if_fail (GLADE_IS_PROJECT (project), -1);
|
||||
|
||||
return project->priv->format;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
format_libglade_button_toggled (GtkWidget *widget,
|
||||
GladeProject *project)
|
||||
{
|
||||
glade_command_set_project_format (project, GLADE_PROJECT_FORMAT_LIBGLADE);
|
||||
}
|
||||
|
||||
static void
|
||||
format_builder_button_toggled (GtkWidget *widget,
|
||||
GladeProject *project)
|
||||
{
|
||||
glade_command_set_project_format (project, GLADE_PROJECT_FORMAT_GTKBUILDER);
|
||||
}
|
||||
|
||||
static gint
|
||||
count_objects_with_name (GladeProject *project,
|
||||
const gchar *name)
|
||||
@ -4297,50 +3988,6 @@ glade_project_build_prefs_box (GladeProject *project)
|
||||
gtk_container_add (GTK_CONTAINER (main_alignment), main_box);
|
||||
gtk_container_add (GTK_CONTAINER (main_frame), main_alignment);
|
||||
|
||||
|
||||
/* Project format */
|
||||
string = g_strdup_printf ("<b>%s</b>", _("Project file format:"));
|
||||
frame = gtk_frame_new (NULL);
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
alignment = gtk_alignment_new (0.5F, 0.5F, 0.8F, 0.8F);
|
||||
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 8, 0, 12, 0);
|
||||
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
|
||||
|
||||
label = gtk_label_new (string);
|
||||
g_free (string);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
|
||||
project->priv->glade_radio = gtk_radio_button_new_with_label (NULL, "Libglade");
|
||||
project->priv->builder_radio = gtk_radio_button_new_with_label_from_widget
|
||||
(GTK_RADIO_BUTTON (project->priv->glade_radio), "GtkBuilder");
|
||||
|
||||
gtk_size_group_add_widget (sizegroup1, project->priv->builder_radio);
|
||||
gtk_size_group_add_widget (sizegroup2, project->priv->glade_radio);
|
||||
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame), label);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), hbox);
|
||||
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), project->priv->builder_radio, TRUE, TRUE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), project->priv->glade_radio, TRUE, TRUE, 2);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (main_box), frame, TRUE, TRUE, 2);
|
||||
|
||||
|
||||
if (glade_project_get_format (project) == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (project->priv->builder_radio), TRUE);
|
||||
else
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (project->priv->glade_radio), TRUE);
|
||||
|
||||
g_signal_connect (G_OBJECT (project->priv->glade_radio), "toggled",
|
||||
G_CALLBACK (format_libglade_button_toggled), project);
|
||||
|
||||
g_signal_connect (G_OBJECT (project->priv->builder_radio), "toggled",
|
||||
G_CALLBACK (format_builder_button_toggled), project);
|
||||
|
||||
|
||||
/* Naming policy format */
|
||||
string = g_strdup_printf ("<b>%s</b>", _("Object names are unique:"));
|
||||
frame = gtk_frame_new (NULL);
|
||||
|
||||
@ -24,9 +24,7 @@ typedef enum
|
||||
{
|
||||
GLADE_SUPPORT_OK = 0,
|
||||
GLADE_SUPPORT_DEPRECATED = (0x01 << 0),
|
||||
GLADE_SUPPORT_MISMATCH = (0x01 << 1),
|
||||
GLADE_SUPPORT_LIBGLADE_UNSUPPORTED = (0x01 << 2),
|
||||
GLADE_SUPPORT_LIBGLADE_ONLY = (0x01 << 3)
|
||||
GLADE_SUPPORT_MISMATCH = (0x01 << 1)
|
||||
} GladeSupportMask;
|
||||
|
||||
/**
|
||||
@ -188,10 +186,6 @@ gboolean glade_project_get_modified (GladeProject *project);
|
||||
|
||||
gboolean glade_project_get_previewable (GladeProject *project);
|
||||
|
||||
void glade_project_set_format (GladeProject *project, GladeProjectFormat format);
|
||||
|
||||
GladeProjectFormat glade_project_get_format (GladeProject *project);
|
||||
|
||||
void glade_project_preferences (GladeProject *project);
|
||||
|
||||
void glade_project_verify_properties (GladeWidget *widget);
|
||||
|
||||
@ -98,17 +98,12 @@ glade_property_class_new (gpointer handle)
|
||||
property_class->virt = TRUE;
|
||||
property_class->transfer_on_paste = FALSE;
|
||||
property_class->weight = -1.0;
|
||||
property_class->libglade_only = FALSE;
|
||||
property_class->libglade_unsupported = FALSE;
|
||||
property_class->parentless_widget = FALSE;
|
||||
|
||||
/* Initialize them to the base version */
|
||||
property_class->version_since_major = GWA_VERSION_SINCE_MAJOR (handle);
|
||||
property_class->version_since_minor = GWA_VERSION_SINCE_MINOR (handle);
|
||||
|
||||
property_class->builder_since_major = GWA_BUILDER_SINCE_MAJOR (handle);
|
||||
property_class->builder_since_minor = GWA_BUILDER_SINCE_MINOR (handle);
|
||||
|
||||
return property_class;
|
||||
}
|
||||
|
||||
@ -272,8 +267,7 @@ glade_property_class_make_string_from_flags (GladePropertyClass *klass, guint fv
|
||||
|
||||
static gchar *
|
||||
glade_property_class_make_string_from_object (GladePropertyClass *property_class,
|
||||
GObject *object,
|
||||
GladeProjectFormat fmt)
|
||||
GObject *object)
|
||||
{
|
||||
GladeWidget *gwidget;
|
||||
gchar *string = NULL, *filename;
|
||||
@ -285,38 +279,6 @@ glade_property_class_make_string_from_object (GladePropertyClass *property_class
|
||||
if ((filename = g_object_get_data (object, "GladeFileName")) != NULL)
|
||||
string = g_strdup (filename);
|
||||
}
|
||||
else if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
property_class->pspec->value_type == GTK_TYPE_ADJUSTMENT)
|
||||
{
|
||||
GtkAdjustment *adj = GTK_ADJUSTMENT (object);
|
||||
GString *str = g_string_sized_new (G_ASCII_DTOSTR_BUF_SIZE * 6 + 6);
|
||||
gchar buff[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
g_ascii_dtostr (buff, sizeof (buff), gtk_adjustment_get_value (adj));
|
||||
g_string_append (str, buff);
|
||||
|
||||
g_string_append_c (str, ' ');
|
||||
g_ascii_dtostr (buff, sizeof (buff), gtk_adjustment_get_lower (adj));
|
||||
g_string_append (str, buff);
|
||||
|
||||
g_string_append_c (str, ' ');
|
||||
g_ascii_dtostr (buff, sizeof (buff), gtk_adjustment_get_upper (adj));
|
||||
g_string_append (str, buff);
|
||||
|
||||
g_string_append_c (str, ' ');
|
||||
g_ascii_dtostr (buff, sizeof (buff), gtk_adjustment_get_step_increment (adj));
|
||||
g_string_append (str, buff);
|
||||
|
||||
g_string_append_c (str, ' ');
|
||||
g_ascii_dtostr (buff, sizeof (buff), gtk_adjustment_get_page_increment (adj));
|
||||
g_string_append (str, buff);
|
||||
|
||||
g_string_append_c (str, ' ');
|
||||
g_ascii_dtostr (buff, sizeof (buff), gtk_adjustment_get_page_size (adj));
|
||||
g_string_append (str, buff);
|
||||
|
||||
string = g_string_free (str, FALSE);
|
||||
}
|
||||
else if ((gwidget = glade_widget_get_from_gobject (object)) != NULL)
|
||||
string = g_strdup (gwidget->name);
|
||||
else
|
||||
@ -328,8 +290,7 @@ glade_property_class_make_string_from_object (GladePropertyClass *property_class
|
||||
|
||||
static gchar *
|
||||
glade_property_class_make_string_from_objects (GladePropertyClass *property_class,
|
||||
GList *objects,
|
||||
GladeProjectFormat fmt)
|
||||
GList *objects)
|
||||
{
|
||||
GObject *object;
|
||||
GList *list;
|
||||
@ -339,8 +300,7 @@ glade_property_class_make_string_from_objects (GladePropertyClass *property_clas
|
||||
{
|
||||
object = list->data;
|
||||
|
||||
obj_str = glade_property_class_make_string_from_object
|
||||
(property_class, object, fmt);
|
||||
obj_str = glade_property_class_make_string_from_object (property_class, object);
|
||||
|
||||
if (string == NULL)
|
||||
string = obj_str;
|
||||
@ -358,14 +318,12 @@ glade_property_class_make_string_from_objects (GladePropertyClass *property_clas
|
||||
* glade_property_class_make_string_from_gvalue:
|
||||
* @property_class: A #GladePropertyClass
|
||||
* @value: A #GValue
|
||||
* @fmt: The #GladeProjectFormat the string should conform to
|
||||
*
|
||||
* Returns: A newly allocated string representation of @value
|
||||
*/
|
||||
gchar *
|
||||
glade_property_class_make_string_from_gvalue (GladePropertyClass *property_class,
|
||||
const GValue *value,
|
||||
GladeProjectFormat fmt)
|
||||
const GValue *value)
|
||||
{
|
||||
gchar *string = NULL, **strv, str[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
GObject *object;
|
||||
@ -463,14 +421,12 @@ glade_property_class_make_string_from_gvalue (GladePropertyClass *property_class
|
||||
else if (G_IS_PARAM_SPEC_OBJECT(property_class->pspec))
|
||||
{
|
||||
object = g_value_get_object (value);
|
||||
string = glade_property_class_make_string_from_object
|
||||
(property_class, object, fmt);
|
||||
string = glade_property_class_make_string_from_object (property_class, object);
|
||||
}
|
||||
else if (GLADE_IS_PARAM_SPEC_OBJECTS (property_class->pspec))
|
||||
{
|
||||
objects = g_value_get_boxed (value);
|
||||
string = glade_property_class_make_string_from_objects
|
||||
(property_class, objects, fmt);
|
||||
string = glade_property_class_make_string_from_objects (property_class, objects);
|
||||
}
|
||||
else
|
||||
g_critical ("Unsupported pspec type %s (value -> string)",
|
||||
@ -627,21 +583,6 @@ glade_property_class_make_object_from_string (GladePropertyClass *property_class
|
||||
|
||||
g_free (fullpath);
|
||||
}
|
||||
if (project && glade_project_get_format (project) == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
property_class->pspec->value_type == GTK_TYPE_ADJUSTMENT)
|
||||
{
|
||||
gdouble value, lower, upper, step_increment, page_increment, page_size;
|
||||
gchar *pstring = (gchar*) string;
|
||||
|
||||
value = g_ascii_strtod (pstring, &pstring);
|
||||
lower = g_ascii_strtod (pstring, &pstring);
|
||||
upper = g_ascii_strtod (pstring, &pstring);
|
||||
step_increment = g_ascii_strtod (pstring, &pstring);
|
||||
page_increment = g_ascii_strtod (pstring, &pstring);
|
||||
page_size = g_ascii_strtod (pstring, &pstring);
|
||||
|
||||
object = G_OBJECT (gtk_adjustment_new (value, lower, upper, step_increment, page_increment, page_size));
|
||||
}
|
||||
else if (project)
|
||||
{
|
||||
GladeWidget *gwidget;
|
||||
@ -1064,23 +1005,18 @@ glade_property_class_is_visible (GladePropertyClass *klass)
|
||||
/**
|
||||
* glade_property_class_is_object:
|
||||
* @property_class: A #GladePropertyClass
|
||||
* @fmt: the #GladeProjectFormat
|
||||
*
|
||||
*
|
||||
* Returns: whether or not this is an object property
|
||||
* that refers to another object in this project.
|
||||
*/
|
||||
gboolean
|
||||
glade_property_class_is_object (GladePropertyClass *klass,
|
||||
GladeProjectFormat fmt)
|
||||
glade_property_class_is_object (GladePropertyClass *klass)
|
||||
{
|
||||
g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), FALSE);
|
||||
|
||||
return (GLADE_IS_PARAM_SPEC_OBJECTS (klass->pspec) ||
|
||||
(G_IS_PARAM_SPEC_OBJECT(klass->pspec) &&
|
||||
klass->pspec->value_type != GDK_TYPE_PIXBUF &&
|
||||
!(fmt == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
klass->pspec->value_type == GTK_TYPE_ADJUSTMENT)));
|
||||
klass->pspec->value_type != GDK_TYPE_PIXBUF));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1582,16 +1518,6 @@ glade_property_class_update_from_node (GladeXmlNode *node,
|
||||
/* Visible lines */
|
||||
glade_xml_get_value_int (node, GLADE_TAG_VISIBLE_LINES, &klass->visible_lines);
|
||||
|
||||
glade_xml_get_property_version
|
||||
(node, GLADE_TAG_VERSION_SINCE,
|
||||
&klass->version_since_major,
|
||||
&klass->version_since_minor);
|
||||
|
||||
glade_xml_get_property_version
|
||||
(node, GLADE_TAG_BUILDER_SINCE,
|
||||
&klass->builder_since_major,
|
||||
&klass->builder_since_minor);
|
||||
|
||||
/* Get the Parameters */
|
||||
if ((child = glade_xml_search_child (node, GLADE_TAG_PARAMETERS)) != NULL)
|
||||
klass->parameters = glade_parameter_list_new_from_node (klass->parameters, child);
|
||||
@ -1613,10 +1539,6 @@ glade_property_class_update_from_node (GladeXmlNode *node,
|
||||
klass->transfer_on_paste = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSFER_ON_PASTE, klass->transfer_on_paste);
|
||||
klass->save_always = glade_xml_get_property_boolean (node, GLADE_TAG_SAVE_ALWAYS, klass->save_always);
|
||||
klass->parentless_widget = glade_xml_get_property_boolean (node, GLADE_TAG_PARENTLESS_WIDGET, klass->parentless_widget);
|
||||
klass->libglade_only = glade_xml_get_property_boolean (node, GLADE_TAG_LIBGLADE_ONLY, klass->libglade_only);
|
||||
klass->libglade_unsupported =
|
||||
glade_xml_get_property_boolean (node, GLADE_TAG_LIBGLADE_UNSUPPORTED,
|
||||
klass->libglade_unsupported);
|
||||
|
||||
|
||||
if ((buf = glade_xml_get_property_string
|
||||
@ -1700,7 +1622,6 @@ glade_property_class_void_value (GladePropertyClass *klass,
|
||||
* @klass: a #GladePropertyClass
|
||||
* @value1: a GValue of correct type for @klass
|
||||
* @value2: a GValue of correct type for @klass
|
||||
* @fmt: the #GladeProjectFormat to use
|
||||
*
|
||||
* Compares value1 with value2 according to @klass.
|
||||
*
|
||||
@ -1710,8 +1631,7 @@ glade_property_class_void_value (GladePropertyClass *klass,
|
||||
gint
|
||||
glade_property_class_compare (GladePropertyClass *klass,
|
||||
const GValue *value1,
|
||||
const GValue *value2,
|
||||
GladeProjectFormat fmt)
|
||||
const GValue *value2)
|
||||
{
|
||||
gint retval;
|
||||
|
||||
@ -1727,8 +1647,8 @@ glade_property_class_compare (GladePropertyClass *klass,
|
||||
*
|
||||
* NOTE: We could add a pclass option to use the string compare vs. boxed compare...
|
||||
*/
|
||||
val1 = glade_widget_adaptor_string_from_value (klass->handle, klass, value1, fmt);
|
||||
val2 = glade_widget_adaptor_string_from_value (klass->handle, klass, value2, fmt);
|
||||
val1 = glade_widget_adaptor_string_from_value (klass->handle, klass, value1);
|
||||
val2 = glade_widget_adaptor_string_from_value (klass->handle, klass, value2);
|
||||
|
||||
if (val1 && val2)
|
||||
retval = strcmp (val1, val2);
|
||||
|
||||
@ -79,9 +79,6 @@ struct _GladePropertyClass
|
||||
guint16 version_since_major; /* Version in which this property was */
|
||||
guint16 version_since_minor; /* introduced. */
|
||||
|
||||
guint16 builder_since_major; /* Version in which this property became */
|
||||
guint16 builder_since_minor; /* available in GtkBuilder format */
|
||||
|
||||
GParamSpec *pspec; /* The Parameter Specification for this property.
|
||||
*/
|
||||
|
||||
@ -118,10 +115,6 @@ struct _GladePropertyClass
|
||||
* lines should be visible in the editor.
|
||||
*/
|
||||
|
||||
/* For catalogs that support libglade: */
|
||||
guint libglade_only : 1; /* Mark special libglade virtual properties */
|
||||
guint libglade_unsupported : 1;/* Mark properties that are not available in libglade */
|
||||
|
||||
guint virt : 1; /* Whether this is a virtual property with its pspec supplied
|
||||
* via the catalog (or hard code-paths); or FALSE if its a real
|
||||
* GObject introspected property
|
||||
@ -233,8 +226,7 @@ void glade_property_class_free (GladePropertyC
|
||||
|
||||
gboolean glade_property_class_is_visible (GladePropertyClass *property_class);
|
||||
|
||||
gboolean glade_property_class_is_object (GladePropertyClass *property_class,
|
||||
GladeProjectFormat fmt);
|
||||
gboolean glade_property_class_is_object (GladePropertyClass *property_class);
|
||||
|
||||
GValue *glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class,
|
||||
const gchar *string,
|
||||
@ -242,8 +234,7 @@ GValue *glade_property_class_make_gvalue_from_string (GladePropertyC
|
||||
GladeWidget *widget);
|
||||
|
||||
gchar *glade_property_class_make_string_from_gvalue (GladePropertyClass *property_class,
|
||||
const GValue *value,
|
||||
GladeProjectFormat fmt);
|
||||
const GValue *value);
|
||||
|
||||
GValue *glade_property_class_make_gvalue_from_vl (GladePropertyClass *property_class,
|
||||
va_list vl);
|
||||
@ -275,8 +266,7 @@ gboolean glade_property_class_void_value (GladePropertyC
|
||||
|
||||
gint glade_property_class_compare (GladePropertyClass *klass,
|
||||
const GValue *value1,
|
||||
const GValue *value2,
|
||||
GladeProjectFormat fmt);
|
||||
const GValue *value2);
|
||||
|
||||
GValue *glade_property_class_get_default_from_spec (GParamSpec *spec);
|
||||
|
||||
|
||||
@ -71,7 +71,6 @@ enum
|
||||
PROP_ENABLED,
|
||||
PROP_SENSITIVE,
|
||||
PROP_I18N_TRANSLATABLE,
|
||||
PROP_I18N_HAS_CONTEXT,
|
||||
PROP_I18N_CONTEXT,
|
||||
PROP_I18N_COMMENT,
|
||||
PROP_STATE
|
||||
@ -91,7 +90,6 @@ glade_property_dup_impl (GladeProperty *template_prop, GladeWidget *widget)
|
||||
property = g_object_new (GLADE_TYPE_PROPERTY,
|
||||
"class", template_prop->klass,
|
||||
"i18n-translatable", template_prop->i18n_translatable,
|
||||
"i18n-has-context", template_prop->i18n_has_context,
|
||||
"i18n-context", template_prop->i18n_context,
|
||||
"i18n-comment", template_prop->i18n_comment,
|
||||
NULL);
|
||||
@ -123,16 +121,7 @@ static gboolean
|
||||
glade_property_equals_value_impl (GladeProperty *property,
|
||||
const GValue *value)
|
||||
{
|
||||
GladeProject *project;
|
||||
GladeProjectFormat fmt = GLADE_PROJECT_FORMAT_GTKBUILDER;
|
||||
|
||||
if (property->widget)
|
||||
{
|
||||
project = glade_widget_get_project (property->widget);
|
||||
fmt = glade_project_get_format (project);
|
||||
}
|
||||
|
||||
return !glade_property_class_compare (property->klass, property->value, value, fmt);
|
||||
return !glade_property_class_compare (property->klass, property->value, value);
|
||||
}
|
||||
|
||||
|
||||
@ -252,12 +241,10 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value)
|
||||
|
||||
gchar *str1 = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (property->klass->handle),
|
||||
property->klass, property->value,
|
||||
GLADE_PROJECT_FORMAT_GTKBUILDER);
|
||||
property->klass, property->value);
|
||||
gchar *str2 = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (property->klass->handle),
|
||||
property->klass, value,
|
||||
GLADE_PROJECT_FORMAT_GTKBUILDER);
|
||||
property->klass, value);
|
||||
g_print ("from %s to %s\n", str1, str2);
|
||||
g_free (str1);
|
||||
g_free (str2);
|
||||
@ -289,8 +276,7 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value)
|
||||
/* Add/Remove references from widget ref stacks here
|
||||
* (before assigning the value)
|
||||
*/
|
||||
if (property->widget && changed && glade_property_class_is_object
|
||||
(property->klass, glade_project_get_format (project)))
|
||||
if (property->widget && changed && glade_property_class_is_object (property->klass))
|
||||
glade_property_update_prop_refs (property, property->value, value);
|
||||
|
||||
|
||||
@ -435,9 +421,6 @@ glade_property_set_real_property (GObject *object,
|
||||
case PROP_I18N_TRANSLATABLE:
|
||||
glade_property_i18n_set_translatable (property, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_I18N_HAS_CONTEXT:
|
||||
glade_property_i18n_set_has_context (property, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_I18N_CONTEXT:
|
||||
glade_property_i18n_set_context (property, g_value_get_string (value));
|
||||
break;
|
||||
@ -472,9 +455,6 @@ glade_property_get_real_property (GObject *object,
|
||||
case PROP_I18N_TRANSLATABLE:
|
||||
g_value_set_boolean (value, glade_property_i18n_get_translatable (property));
|
||||
break;
|
||||
case PROP_I18N_HAS_CONTEXT:
|
||||
g_value_set_boolean (value, glade_property_i18n_get_has_context (property));
|
||||
break;
|
||||
case PROP_I18N_CONTEXT:
|
||||
g_value_set_string (value, glade_property_i18n_get_context (property));
|
||||
break;
|
||||
@ -518,7 +498,6 @@ glade_property_init (GladeProperty *property)
|
||||
property->enabled = TRUE;
|
||||
property->sensitive = TRUE;
|
||||
property->i18n_translatable = TRUE;
|
||||
property->i18n_has_context = FALSE;
|
||||
property->i18n_comment = NULL;
|
||||
property->sync_tolerance = 1;
|
||||
}
|
||||
@ -590,13 +569,6 @@ glade_property_klass_init (GladePropertyKlass *prop_class)
|
||||
_("Whether this property is translatable"),
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_I18N_HAS_CONTEXT,
|
||||
g_param_spec_boolean
|
||||
("i18n-has-context", _("Has Context"),
|
||||
_("Whether the translatable string has a context prefix"),
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_STATE,
|
||||
g_param_spec_int
|
||||
@ -1016,25 +988,22 @@ glade_property_read (GladeProperty *property,
|
||||
GladeProject *project,
|
||||
GladeXmlNode *prop)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GValue *gvalue = NULL;
|
||||
gchar /* *id, *name, */ *value;
|
||||
gint translatable = FALSE, has_context = FALSE;
|
||||
gint translatable = FALSE;
|
||||
gchar *comment = NULL, *context = NULL;
|
||||
|
||||
g_return_if_fail (GLADE_IS_PROPERTY (property));
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
g_return_if_fail (prop != NULL);
|
||||
|
||||
fmt = glade_project_get_format (project);
|
||||
|
||||
if (!glade_xml_node_verify (prop, GLADE_XML_TAG_PROPERTY))
|
||||
return;
|
||||
|
||||
if (!(value = glade_xml_get_content (prop)))
|
||||
return;
|
||||
|
||||
if (glade_property_class_is_object (property->klass, fmt))
|
||||
if (glade_property_class_is_object (property->klass))
|
||||
{
|
||||
/* we must synchronize this directly after loading this project
|
||||
* (i.e. lookup the actual objects after they've been parsed and
|
||||
@ -1061,28 +1030,14 @@ glade_property_read (GladeProperty *property,
|
||||
property->enabled = TRUE;
|
||||
}
|
||||
|
||||
translatable = glade_xml_get_property_boolean
|
||||
(prop, GLADE_TAG_TRANSLATABLE, FALSE);
|
||||
comment = glade_xml_get_property_string
|
||||
(prop, GLADE_TAG_COMMENT);
|
||||
|
||||
if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
has_context = glade_xml_get_property_boolean
|
||||
(prop, GLADE_TAG_HAS_CONTEXT, FALSE);
|
||||
else
|
||||
context = glade_xml_get_property_string
|
||||
(prop, GLADE_TAG_CONTEXT);
|
||||
translatable = glade_xml_get_property_boolean (prop, GLADE_TAG_TRANSLATABLE, FALSE);
|
||||
comment = glade_xml_get_property_string (prop, GLADE_TAG_COMMENT);
|
||||
context = glade_xml_get_property_string (prop, GLADE_TAG_CONTEXT);
|
||||
|
||||
glade_property_i18n_set_translatable (property, translatable);
|
||||
glade_property_i18n_set_comment (property, comment);
|
||||
|
||||
if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
glade_property_i18n_set_has_context
|
||||
(property, has_context);
|
||||
else
|
||||
glade_property_i18n_set_context
|
||||
(property, context);
|
||||
|
||||
glade_property_i18n_set_context (property, context);
|
||||
|
||||
g_free (comment);
|
||||
g_free (context);
|
||||
g_free (value);
|
||||
@ -1102,7 +1057,6 @@ glade_property_write (GladeProperty *property,
|
||||
GladeXmlContext *context,
|
||||
GladeXmlNode *node)
|
||||
{
|
||||
GladeProjectFormat fmt;
|
||||
GladeXmlNode *prop_node;
|
||||
GladeProject *project;
|
||||
gchar *name, *value, *tmp;
|
||||
@ -1112,18 +1066,9 @@ glade_property_write (GladeProperty *property,
|
||||
|
||||
project = property->widget->project;
|
||||
|
||||
fmt = glade_project_get_format(project);
|
||||
|
||||
/* This code should work the same for <packing> and <widget> */
|
||||
if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_PACKING) ||
|
||||
glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET (fmt))))
|
||||
return;
|
||||
|
||||
/* Dont write unsupported properties */
|
||||
if ((fmt == GLADE_PROJECT_FORMAT_GTKBUILDER &&
|
||||
property->klass->libglade_only) ||
|
||||
(fmt == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
property->klass->libglade_unsupported))
|
||||
glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET)))
|
||||
return;
|
||||
|
||||
g_assert (property->klass->orig_def);
|
||||
@ -1142,8 +1087,7 @@ glade_property_write (GladeProperty *property,
|
||||
|
||||
/* convert the value of this property to a string */
|
||||
if (!(value = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (property->klass->handle),
|
||||
property->klass, property->value, fmt)))
|
||||
(GLADE_WIDGET_ADAPTOR (property->klass->handle), property->klass, property->value)))
|
||||
/* make sure we keep the empty string, also... upcomming
|
||||
* funcs that may not like NULL.
|
||||
*/
|
||||
@ -1172,12 +1116,7 @@ glade_property_write (GladeProperty *property,
|
||||
GLADE_TAG_TRANSLATABLE,
|
||||
GLADE_XML_TAG_I18N_TRUE);
|
||||
|
||||
if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE && property->i18n_has_context)
|
||||
glade_xml_node_set_property_string (prop_node,
|
||||
GLADE_TAG_HAS_CONTEXT,
|
||||
GLADE_XML_TAG_I18N_TRUE);
|
||||
|
||||
if (fmt == GLADE_PROJECT_FORMAT_GTKBUILDER && property->i18n_context)
|
||||
if (property->i18n_context)
|
||||
glade_xml_node_set_property_string (prop_node,
|
||||
GLADE_TAG_CONTEXT,
|
||||
property->i18n_context);
|
||||
@ -1329,22 +1268,6 @@ glade_property_i18n_get_translatable (GladeProperty *property)
|
||||
return property->i18n_translatable;
|
||||
}
|
||||
|
||||
void
|
||||
glade_property_i18n_set_has_context (GladeProperty *property,
|
||||
gboolean has_context)
|
||||
{
|
||||
g_return_if_fail (GLADE_IS_PROPERTY (property));
|
||||
property->i18n_has_context = has_context;
|
||||
g_object_notify (G_OBJECT (property), "i18n-has-context");
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_property_i18n_get_has_context (GladeProperty *property)
|
||||
{
|
||||
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
|
||||
return property->i18n_has_context;
|
||||
}
|
||||
|
||||
void
|
||||
glade_property_set_sensitive (GladeProperty *property,
|
||||
gboolean sensitive,
|
||||
|
||||
@ -79,7 +79,6 @@ struct _GladeProperty
|
||||
|
||||
/* Used only for translatable strings. */
|
||||
guint i18n_translatable : 1;
|
||||
guint i18n_has_context : 1;
|
||||
gchar *i18n_context;
|
||||
gchar *i18n_comment;
|
||||
|
||||
@ -207,12 +206,6 @@ void glade_property_i18n_set_translatable (GladeProperty
|
||||
|
||||
gboolean glade_property_i18n_get_translatable (GladeProperty *property);
|
||||
|
||||
void glade_property_i18n_set_has_context (GladeProperty *property,
|
||||
gboolean has_context);
|
||||
|
||||
gboolean glade_property_i18n_get_has_context (GladeProperty *property);
|
||||
|
||||
|
||||
void glade_property_push_superuser (void);
|
||||
|
||||
void glade_property_pop_superuser (void);
|
||||
|
||||
@ -107,7 +107,6 @@ struct _GladeSignalEditorPrivate
|
||||
|
||||
GtkTreeViewColumn *handler_column;
|
||||
GtkTreeViewColumn *userdata_column;
|
||||
GtkTreeViewColumn *swapped_column_ptr;
|
||||
IsVoidFunc is_void_handler;
|
||||
IsVoidFunc is_void_userdata;
|
||||
|
||||
@ -1049,9 +1048,6 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
|
||||
|
||||
gtk_tree_view_append_column (view, column);
|
||||
|
||||
/* - No need for a ref here - */
|
||||
priv->swapped_column_ptr = column;
|
||||
|
||||
/************************ after column ************************/
|
||||
renderer = gtk_cell_renderer_toggle_new ();
|
||||
|
||||
@ -1216,11 +1212,6 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
|
||||
|
||||
gtk_tree_store_clear (priv->model);
|
||||
|
||||
if (glade_project_get_format (glade_widget_get_project (widget)) == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
gtk_tree_view_column_set_visible (priv->swapped_column_ptr, TRUE);
|
||||
else
|
||||
gtk_tree_view_column_set_visible (priv->swapped_column_ptr, FALSE);
|
||||
|
||||
/* Loop over every signal type
|
||||
*/
|
||||
for (list = priv->adaptor->signals; list; list = list->next)
|
||||
|
||||
@ -133,7 +133,6 @@ glade_signal_clone (const GladeSignal *signal)
|
||||
/**
|
||||
* glade_signal_write:
|
||||
* @signal: The #GladeSignal
|
||||
* @fmt: The #GladeProjectFormat to write the signal for
|
||||
* @context: A #GladeXmlContext
|
||||
* @node: A #GladeXmlNode
|
||||
*
|
||||
@ -141,7 +140,6 @@ glade_signal_clone (const GladeSignal *signal)
|
||||
*/
|
||||
void
|
||||
glade_signal_write (GladeSignal *signal,
|
||||
GladeProjectFormat fmt,
|
||||
GladeXmlContext *context,
|
||||
GladeXmlNode *node)
|
||||
{
|
||||
@ -154,9 +152,6 @@ glade_signal_write (GladeSignal *signal,
|
||||
|
||||
name = g_strdup (signal->name);
|
||||
|
||||
if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
glade_util_replace (name, '-', '_');
|
||||
|
||||
/* Now dump the node values... */
|
||||
signal_node = glade_xml_node_new (context, GLADE_XML_TAG_SIGNAL);
|
||||
glade_xml_node_append_child (node, signal_node);
|
||||
|
||||
@ -38,7 +38,6 @@ gboolean glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2);
|
||||
|
||||
GladeSignal *glade_signal_read (GladeXmlNode *node);
|
||||
void glade_signal_write (GladeSignal *signal,
|
||||
GladeProjectFormat fmt,
|
||||
GladeXmlContext *context,
|
||||
GladeXmlNode *node);
|
||||
|
||||
|
||||
@ -443,70 +443,6 @@ glade_util_hide_window (GtkWindow *window)
|
||||
gtk_window_move(window, x, y);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
format_libglade_button_clicked (GtkWidget *widget,
|
||||
GladeProject *project)
|
||||
{
|
||||
glade_project_set_format (project, GLADE_PROJECT_FORMAT_LIBGLADE);
|
||||
}
|
||||
|
||||
static void
|
||||
format_builder_button_clicked (GtkWidget *widget,
|
||||
GladeProject *project)
|
||||
{
|
||||
glade_project_set_format (project, GLADE_PROJECT_FORMAT_GTKBUILDER);
|
||||
}
|
||||
|
||||
static void
|
||||
add_format_options (GtkDialog *dialog,
|
||||
GladeProject *project)
|
||||
{
|
||||
GtkWidget *vbox, *frame;
|
||||
GtkWidget *glade_radio, *builder_radio;
|
||||
GtkWidget *label, *alignment;
|
||||
gchar *string = g_strdup_printf ("<b>%s</b>", _("File format"));
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
|
||||
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 2, 0, 12, 0);
|
||||
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
|
||||
|
||||
label = gtk_label_new (string);
|
||||
g_free (string);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
|
||||
glade_radio = gtk_radio_button_new_with_label (NULL, "Libglade");
|
||||
builder_radio = gtk_radio_button_new_with_label_from_widget
|
||||
(GTK_RADIO_BUTTON (glade_radio), "GtkBuilder");
|
||||
|
||||
if (glade_project_get_format (project) == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (builder_radio), TRUE);
|
||||
else
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_radio), TRUE);
|
||||
|
||||
g_signal_connect (G_OBJECT (glade_radio), "clicked",
|
||||
G_CALLBACK (format_libglade_button_clicked), project);
|
||||
|
||||
g_signal_connect (G_OBJECT (builder_radio), "clicked",
|
||||
G_CALLBACK (format_builder_button_clicked), project);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), builder_radio, TRUE, TRUE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), glade_radio, TRUE, TRUE, 2);
|
||||
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame), label);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), vbox);
|
||||
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
||||
|
||||
gtk_widget_show_all (frame);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (dialog)), frame, FALSE, TRUE, 2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glade_util_file_dialog_new:
|
||||
* @title: dialog title
|
||||
@ -539,10 +475,6 @@ glade_util_file_dialog_new (const gchar *title,
|
||||
GTK_STOCK_OPEN : GTK_STOCK_SAVE,
|
||||
GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
|
||||
if (action == GLADE_FILE_DIALOG_ACTION_SAVE)
|
||||
add_format_options (GTK_DIALOG (file_dialog), project);
|
||||
|
||||
file_filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_pattern (file_filter, "*");
|
||||
@ -1720,7 +1652,7 @@ glade_utils_enum_string_from_value_real (GType enum_type, gint value, gboolean d
|
||||
g_value_init (&gvalue, enum_type);
|
||||
g_value_set_enum (&gvalue, value);
|
||||
|
||||
string = glade_utils_string_from_value (&gvalue, GLADE_PROJECT_FORMAT_GTKBUILDER);
|
||||
string = glade_utils_string_from_value (&gvalue);
|
||||
g_value_unset (&gvalue);
|
||||
|
||||
if (displayable && string)
|
||||
@ -1778,7 +1710,7 @@ glade_utils_flags_string_from_value_real (GType flags_type, gint value, gboolean
|
||||
g_value_init (&gvalue, flags_type);
|
||||
g_value_set_flags (&gvalue, value);
|
||||
|
||||
string = glade_utils_string_from_value (&gvalue, GLADE_PROJECT_FORMAT_GTKBUILDER);
|
||||
string = glade_utils_string_from_value (&gvalue);
|
||||
g_value_unset (&gvalue);
|
||||
|
||||
if (displayable && string)
|
||||
@ -1949,7 +1881,6 @@ glade_utils_value_from_string (GType type,
|
||||
/**
|
||||
* glade_utils_string_from_value:
|
||||
* @value: a #GValue to convert
|
||||
* @fmt: the #GladeProjectFormat to honor
|
||||
*
|
||||
* Serializes #GValue into a string
|
||||
* (using glade conversion routines)
|
||||
@ -1957,15 +1888,14 @@ glade_utils_value_from_string (GType type,
|
||||
* Returns: A newly allocated string
|
||||
*/
|
||||
gchar *
|
||||
glade_utils_string_from_value (const GValue *value,
|
||||
GladeProjectFormat fmt)
|
||||
glade_utils_string_from_value (const GValue *value)
|
||||
{
|
||||
GladePropertyClass *pclass;
|
||||
|
||||
g_return_val_if_fail (value != NULL, NULL);
|
||||
|
||||
if ((pclass = pclass_from_gtype (G_VALUE_TYPE (value))) != NULL)
|
||||
return glade_property_class_make_string_from_gvalue (pclass, value, fmt);
|
||||
return glade_property_class_make_string_from_gvalue (pclass, value);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -145,8 +145,7 @@ GValue *glade_utils_value_from_string (GType type,
|
||||
GladeProject *project,
|
||||
GladeWidget *widget);
|
||||
|
||||
gchar *glade_utils_string_from_value (const GValue *value,
|
||||
GladeProjectFormat fmt);
|
||||
gchar *glade_utils_string_from_value (const GValue *value);
|
||||
|
||||
GtkListStore *glade_utils_liststore_from_enum_type (GType enum_type, gboolean include_empty);
|
||||
|
||||
|
||||
@ -394,7 +394,7 @@ gwa_clone_parent_properties (GladeWidgetAdaptor *adaptor, gboolean is_packing)
|
||||
parent_adaptor->priv->catalog))
|
||||
{
|
||||
pclass->version_since_major = 0;
|
||||
pclass->builder_since_major = 0;
|
||||
pclass->version_since_minor = 0;
|
||||
}
|
||||
properties = g_list_prepend (properties, pclass);
|
||||
}
|
||||
@ -611,9 +611,6 @@ glade_widget_adaptor_constructor (GType type,
|
||||
{
|
||||
GLADE_WIDGET_ADAPTOR_GET_CLASS(adaptor)->version_since_major =
|
||||
GLADE_WIDGET_ADAPTOR_GET_CLASS(adaptor)->version_since_minor = 0;
|
||||
|
||||
GLADE_WIDGET_ADAPTOR_GET_CLASS(adaptor)->builder_since_major =
|
||||
GLADE_WIDGET_ADAPTOR_GET_CLASS(adaptor)->builder_since_minor = 0;
|
||||
}
|
||||
|
||||
/* Copy parent actions */
|
||||
@ -964,8 +961,7 @@ glade_widget_adaptor_object_read_child (GladeWidgetAdaptor *adaptor,
|
||||
(node, GLADE_XML_TAG_INTERNAL_CHILD);
|
||||
|
||||
if ((widget_node =
|
||||
glade_xml_search_child
|
||||
(node, GLADE_XML_TAG_WIDGET(glade_project_get_format(widget->project)))) != NULL)
|
||||
glade_xml_search_child (node, GLADE_XML_TAG_WIDGET)) != NULL)
|
||||
{
|
||||
child_widget =
|
||||
glade_widget_read (widget->project,
|
||||
@ -1110,8 +1106,6 @@ glade_widget_adaptor_get_eprop_type (GParamSpec *pspec)
|
||||
{
|
||||
if (pspec->value_type == GDK_TYPE_PIXBUF)
|
||||
type = GLADE_TYPE_EPROP_TEXT;
|
||||
else if (pspec->value_type == GTK_TYPE_ADJUSTMENT)
|
||||
type = GLADE_TYPE_EPROP_ADJUSTMENT;
|
||||
else
|
||||
type = GLADE_TYPE_EPROP_OBJECT;
|
||||
}
|
||||
@ -1151,10 +1145,9 @@ glade_widget_adaptor_object_create_eprop (GladeWidgetAdaptor *adaptor,
|
||||
static gchar *
|
||||
glade_widget_adaptor_object_string_from_value (GladeWidgetAdaptor *adaptor,
|
||||
GladePropertyClass *klass,
|
||||
const GValue *value,
|
||||
GladeProjectFormat fmt)
|
||||
const GValue *value)
|
||||
{
|
||||
return glade_property_class_make_string_from_gvalue (klass, value, fmt);
|
||||
return glade_property_class_make_string_from_gvalue (klass, value);
|
||||
}
|
||||
|
||||
static GladeEditable *
|
||||
@ -1518,11 +1511,6 @@ gwa_derived_class_init (GladeWidgetAdaptorClass *adaptor_class,
|
||||
/* Load catalog symbols from module */
|
||||
if (module) gwa_extend_with_node_load_sym (adaptor_class, node, module);
|
||||
|
||||
glade_xml_get_property_version
|
||||
(node, GLADE_TAG_BUILDER_SINCE,
|
||||
&adaptor_class->builder_since_major,
|
||||
&adaptor_class->builder_since_minor);
|
||||
|
||||
glade_xml_get_property_version
|
||||
(node, GLADE_TAG_VERSION_SINCE,
|
||||
&adaptor_class->version_since_major,
|
||||
@ -1532,14 +1520,6 @@ gwa_derived_class_init (GladeWidgetAdaptorClass *adaptor_class,
|
||||
glade_xml_get_property_boolean
|
||||
(node, GLADE_TAG_DEPRECATED, adaptor_class->deprecated);
|
||||
|
||||
adaptor_class->libglade_unsupported =
|
||||
glade_xml_get_property_boolean
|
||||
(node, GLADE_TAG_LIBGLADE_UNSUPPORTED, adaptor_class->libglade_unsupported);
|
||||
|
||||
adaptor_class->libglade_only =
|
||||
glade_xml_get_property_boolean
|
||||
(node, GLADE_TAG_LIBGLADE_ONLY, adaptor_class->libglade_only);
|
||||
|
||||
adaptor_class->fixed =
|
||||
glade_xml_get_property_boolean
|
||||
(node, GLADE_TAG_FIXED, adaptor_class->fixed);
|
||||
@ -2484,11 +2464,6 @@ glade_widget_adaptor_from_catalog (GladeCatalog *catalog,
|
||||
|
||||
gwa_extend_with_node (adaptor, class_node, module, glade_catalog_get_domain (catalog));
|
||||
|
||||
if (!glade_catalog_supports_libglade (catalog))
|
||||
GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->libglade_unsupported = TRUE;
|
||||
if (!glade_catalog_supports_gtkbuilder (catalog))
|
||||
GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->libglade_only = TRUE;
|
||||
|
||||
/* Set default weight on properties */
|
||||
for (parent_type = adaptor->type;
|
||||
parent_type != 0;
|
||||
@ -3866,7 +3841,6 @@ glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdaptor *adaptor,
|
||||
* @adaptor: A #GladeWidgetAdaptor
|
||||
* @klass: The #GladePropertyClass
|
||||
* @value: The #GValue to convert to a string
|
||||
* @fmt: The #GladeProjectFormat the string should conform to
|
||||
*
|
||||
* For normal properties this is used to serialize
|
||||
* property values, for custom properties its still
|
||||
@ -3877,15 +3851,13 @@ glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdaptor *adaptor,
|
||||
gchar *
|
||||
glade_widget_adaptor_string_from_value (GladeWidgetAdaptor *adaptor,
|
||||
GladePropertyClass *klass,
|
||||
const GValue *value,
|
||||
GladeProjectFormat fmt)
|
||||
const GValue *value)
|
||||
{
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
|
||||
g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), NULL);
|
||||
g_return_val_if_fail (value != NULL, NULL);
|
||||
|
||||
return GLADE_WIDGET_ADAPTOR_GET_CLASS
|
||||
(adaptor)->string_from_value (adaptor, klass, value, fmt);
|
||||
return GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->string_from_value (adaptor, klass, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -560,7 +560,6 @@ typedef GladeEditorProperty *(* GladeCreateEPropFunc) (GladeWidgetAdaptor *adapt
|
||||
* @adaptor: A #GladeWidgetAdaptor
|
||||
* @klass: The #GladePropertyClass
|
||||
* @value: The #GValue to convert to a string
|
||||
* @fmt: The #GladeProjectFormat the string should conform to
|
||||
*
|
||||
* For normal properties this is used to serialize
|
||||
* property values, for custom properties (only when new pspecs are
|
||||
@ -571,8 +570,7 @@ typedef GladeEditorProperty *(* GladeCreateEPropFunc) (GladeWidgetAdaptor *adapt
|
||||
*/
|
||||
typedef gchar *(* GladeStringFromValueFunc) (GladeWidgetAdaptor *adaptor,
|
||||
GladePropertyClass *klass,
|
||||
const GValue *value,
|
||||
GladeProjectFormat fmt);
|
||||
const GValue *value);
|
||||
|
||||
|
||||
|
||||
@ -673,20 +671,9 @@ struct _GladeWidgetAdaptorClass
|
||||
guint16 version_since_major; /* Version in which this widget was */
|
||||
guint16 version_since_minor; /* introduced. */
|
||||
|
||||
guint16 builder_since_major; /* Version in which this widget became */
|
||||
guint16 builder_since_minor; /* available in GtkBuilder format */
|
||||
|
||||
|
||||
guint deprecated : 1; /* If this widget is currently
|
||||
* deprecated
|
||||
*/
|
||||
guint libglade_unsupported : 1; /* If this widget is not supported
|
||||
* by libglade
|
||||
*/
|
||||
guint libglade_only : 1; /* If this widget is only supported
|
||||
* by libglade
|
||||
*/
|
||||
|
||||
guint fixed : 1; /* If this is a Container, use free-form
|
||||
* placement with drag/resize/paste at mouse...
|
||||
*/
|
||||
@ -975,8 +962,7 @@ GladeEditorProperty *glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdapt
|
||||
|
||||
gchar *glade_widget_adaptor_string_from_value (GladeWidgetAdaptor *adaptor,
|
||||
GladePropertyClass *klass,
|
||||
const GValue *value,
|
||||
GladeProjectFormat fmt);
|
||||
const GValue *value);
|
||||
|
||||
GladeEditable *glade_widget_adaptor_create_editable (GladeWidgetAdaptor *adaptor,
|
||||
GladeEditorPageType type);
|
||||
|
||||
@ -844,8 +844,7 @@ static void
|
||||
reset_object_property (GladeProperty *property,
|
||||
GladeProject *project)
|
||||
{
|
||||
if (glade_property_class_is_object (property->klass,
|
||||
glade_project_get_format (project)))
|
||||
if (glade_property_class_is_object (property->klass))
|
||||
glade_property_reset (property);
|
||||
}
|
||||
|
||||
@ -3027,8 +3026,7 @@ glade_widget_property_string (GladeWidget *widget,
|
||||
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
|
||||
ret_string = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (property->klass->handle),
|
||||
property->klass, value ? value : property->value,
|
||||
glade_project_get_format (widget->project));
|
||||
property->klass, value ? value : property->value);
|
||||
|
||||
return ret_string;
|
||||
}
|
||||
@ -3058,8 +3056,7 @@ glade_widget_pack_property_string (GladeWidget *widget,
|
||||
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
|
||||
ret_string = glade_widget_adaptor_string_from_value
|
||||
(GLADE_WIDGET_ADAPTOR (property->klass->handle),
|
||||
property->klass, value ? value : property->value,
|
||||
glade_project_get_format (widget->project));
|
||||
property->klass, value ? value : property->value);
|
||||
|
||||
return ret_string;
|
||||
}
|
||||
@ -3633,7 +3630,7 @@ glade_widget_write_special_child_prop (GladeWidget *parent,
|
||||
GladeXmlContext *context,
|
||||
GladeXmlNode *node)
|
||||
{
|
||||
GladeXmlNode *prop_node, *packing_node;
|
||||
GladeXmlNode *packing_node;
|
||||
gchar *buff, *special_child_type;
|
||||
|
||||
buff = g_object_get_data (object, "special-child-type");
|
||||
@ -3643,27 +3640,9 @@ glade_widget_write_special_child_prop (GladeWidget *parent,
|
||||
|
||||
if (special_child_type && buff)
|
||||
{
|
||||
switch (glade_project_get_format (parent->project))
|
||||
{
|
||||
case GLADE_PROJECT_FORMAT_LIBGLADE:
|
||||
prop_node = glade_xml_node_new (context, GLADE_XML_TAG_PROPERTY);
|
||||
glade_xml_node_append_child (packing_node, prop_node);
|
||||
|
||||
/* Name and value */
|
||||
glade_xml_node_set_property_string (prop_node,
|
||||
GLADE_XML_TAG_NAME,
|
||||
special_child_type);
|
||||
glade_xml_set_content (prop_node, buff);
|
||||
break;
|
||||
case GLADE_PROJECT_FORMAT_GTKBUILDER:
|
||||
glade_xml_node_set_property_string (node,
|
||||
GLADE_XML_TAG_TYPE,
|
||||
buff);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
glade_xml_node_set_property_string (node,
|
||||
GLADE_XML_TAG_TYPE,
|
||||
buff);
|
||||
}
|
||||
g_free (special_child_type);
|
||||
}
|
||||
@ -3674,8 +3653,7 @@ glade_widget_set_child_type_from_node (GladeWidget *parent,
|
||||
GObject *child,
|
||||
GladeXmlNode *node)
|
||||
{
|
||||
GladeXmlNode *packing_node, *prop;
|
||||
gchar *special_child_type, *name, *value;
|
||||
gchar *special_child_type, *value;
|
||||
|
||||
if (!glade_xml_node_verify (node, GLADE_XML_TAG_CHILD))
|
||||
return;
|
||||
@ -3684,55 +3662,14 @@ glade_widget_set_child_type_from_node (GladeWidget *parent,
|
||||
if (!special_child_type)
|
||||
return;
|
||||
|
||||
switch (glade_project_get_format (parent->project))
|
||||
/* all child types here are depicted by the "type" property */
|
||||
if ((value =
|
||||
glade_xml_get_property_string (node, GLADE_XML_TAG_TYPE)))
|
||||
{
|
||||
case GLADE_PROJECT_FORMAT_LIBGLADE:
|
||||
if ((packing_node =
|
||||
glade_xml_search_child (node, GLADE_XML_TAG_PACKING)) != NULL)
|
||||
{
|
||||
for (prop = glade_xml_node_get_children (packing_node);
|
||||
prop; prop = glade_xml_node_next (prop))
|
||||
{
|
||||
if (!(name =
|
||||
glade_xml_get_property_string_required
|
||||
(prop, GLADE_XML_TAG_NAME, NULL)))
|
||||
continue;
|
||||
|
||||
if (!(value = glade_xml_get_content (prop)))
|
||||
{
|
||||
/* XXX should be glade_xml_get_content_required()... */
|
||||
g_free (name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp (name, special_child_type))
|
||||
{
|
||||
g_object_set_data_full (child,
|
||||
"special-child-type",
|
||||
g_strdup (value),
|
||||
g_free);
|
||||
g_free (name);
|
||||
g_free (value);
|
||||
break;
|
||||
}
|
||||
g_free (name);
|
||||
g_free (value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GLADE_PROJECT_FORMAT_GTKBUILDER:
|
||||
/* all child types here are depicted by the "type" property */
|
||||
if ((value =
|
||||
glade_xml_get_property_string (node, GLADE_XML_TAG_TYPE)))
|
||||
{
|
||||
g_object_set_data_full (child,
|
||||
"special-child-type",
|
||||
value,
|
||||
g_free);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
g_object_set_data_full (child,
|
||||
"special-child-type",
|
||||
value,
|
||||
g_free);
|
||||
}
|
||||
g_free (special_child_type);
|
||||
}
|
||||
@ -3778,8 +3715,7 @@ glade_widget_read (GladeProject *project,
|
||||
|
||||
glade_widget_push_superuser ();
|
||||
|
||||
if (!glade_xml_node_verify
|
||||
(node, GLADE_XML_TAG_WIDGET (glade_project_get_format (project))))
|
||||
if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
|
||||
return NULL;
|
||||
|
||||
if ((klass =
|
||||
@ -3913,7 +3849,6 @@ glade_widget_write_placeholder (GladeWidget *parent,
|
||||
typedef struct {
|
||||
GladeXmlContext *context;
|
||||
GladeXmlNode *node;
|
||||
GladeProjectFormat fmt;
|
||||
} WriteSignalsInfo;
|
||||
|
||||
static void
|
||||
@ -3931,7 +3866,6 @@ glade_widget_adaptor_write_signals (gpointer key,
|
||||
{
|
||||
GladeSignal *signal = g_ptr_array_index (signals, i);
|
||||
glade_signal_write (signal,
|
||||
info->fmt,
|
||||
info->context,
|
||||
info->node);
|
||||
}
|
||||
@ -3946,7 +3880,6 @@ glade_widget_write_signals (GladeWidget *widget,
|
||||
|
||||
info.context = context;
|
||||
info.node = node;
|
||||
info.fmt = glade_project_get_format (widget->project);
|
||||
|
||||
g_hash_table_foreach (widget->signals,
|
||||
glade_widget_adaptor_write_signals,
|
||||
@ -3970,9 +3903,8 @@ glade_widget_write (GladeWidget *widget,
|
||||
{
|
||||
GladeXmlNode *widget_node;
|
||||
GList *l, *list;
|
||||
GladeProjectFormat fmt = glade_project_get_format (widget->project);
|
||||
|
||||
widget_node = glade_xml_node_new (context, GLADE_XML_TAG_WIDGET (fmt));
|
||||
widget_node = glade_xml_node_new (context, GLADE_XML_TAG_WIDGET);
|
||||
glade_xml_node_append_child (node, widget_node);
|
||||
|
||||
/* Set class and id */
|
||||
@ -3987,10 +3919,8 @@ glade_widget_write (GladeWidget *widget,
|
||||
glade_widget_adaptor_write_widget (widget->adaptor, widget, context, widget_node);
|
||||
|
||||
/* Write the signals strictly after all properties and before children
|
||||
* when in builder format
|
||||
*/
|
||||
if (fmt == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
glade_widget_write_signals (widget, context, widget_node);
|
||||
glade_widget_write_signals (widget, context, widget_node);
|
||||
|
||||
/* Write the children */
|
||||
if ((list =
|
||||
|
||||
@ -25,31 +25,12 @@ typedef struct _GladeWidget GladeWidget;
|
||||
typedef struct _GladeProperty GladeProperty;
|
||||
typedef struct _GladeProject GladeProject;
|
||||
|
||||
|
||||
/* We define this here only because our headers need
|
||||
* a good sorting
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GLADE_PROJECT_FORMAT_LIBGLADE,
|
||||
GLADE_PROJECT_FORMAT_GTKBUILDER
|
||||
} GladeProjectFormat;
|
||||
|
||||
|
||||
typedef enum {
|
||||
GLADE_POLICY_PROJECT_WIDE = 0, /* widget names are unique throughout the project */
|
||||
GLADE_POLICY_TOPLEVEL_CONTEXTUAL /* toplevel names are unique, and widgets inside a toplevel */
|
||||
} GladeNamingPolicy;
|
||||
|
||||
|
||||
#define GLADE_XML_TAG_PROJECT(type) \
|
||||
((type == GLADE_PROJECT_FORMAT_LIBGLADE) ? \
|
||||
GLADE_XML_TAG_LIBGLADE_PROJECT : GLADE_XML_TAG_BUILDER_PROJECT)
|
||||
|
||||
#define GLADE_XML_TAG_WIDGET(type) \
|
||||
((type == GLADE_PROJECT_FORMAT_LIBGLADE) ? \
|
||||
GLADE_XML_TAG_LIBGLADE_WIDGET : GLADE_XML_TAG_BUILDER_WIDGET)
|
||||
|
||||
#define GLADE_GTKBUILDER_VERSIONING_BASE_MAJOR 2
|
||||
#define GLADE_GTKBUILDER_VERSIONING_BASE_MINOR 14
|
||||
#define GLADE_GTKBUILDER_HAS_VERSIONING(maj, min) \
|
||||
@ -58,10 +39,8 @@ typedef enum {
|
||||
|
||||
|
||||
/* Used for catalog tags and attributes */
|
||||
#define GLADE_XML_TAG_LIBGLADE_PROJECT "glade-interface"
|
||||
#define GLADE_XML_TAG_BUILDER_PROJECT "interface"
|
||||
#define GLADE_XML_TAG_LIBGLADE_WIDGET "widget"
|
||||
#define GLADE_XML_TAG_BUILDER_WIDGET "object"
|
||||
#define GLADE_XML_TAG_PROJECT "interface"
|
||||
#define GLADE_XML_TAG_WIDGET "object"
|
||||
|
||||
#define GLADE_XML_TAG_VERSION "version"
|
||||
#define GLADE_XML_TAG_REQUIRES "requires"
|
||||
@ -94,12 +73,6 @@ typedef enum {
|
||||
#define GLADE_TAG_BUILDER_SINCE "gtkbuilder-since"
|
||||
#define GLADE_TAG_DEPRECATED "deprecated"
|
||||
|
||||
#define GLADE_TAG_LIBGLADE_ONLY "libglade-only"
|
||||
#define GLADE_TAG_LIBGLADE_UNSUPPORTED "libglade-unsupported"
|
||||
#define GLADE_TAG_SUPPORTS "supports"
|
||||
#define GLADE_TAG_GTKBUILDER "gtkbuilder"
|
||||
#define GLADE_TAG_LIBGLADE "libglade"
|
||||
|
||||
#define GLADE_TAG_GLADE_CATALOG "glade-catalog"
|
||||
#define GLADE_TAG_GLADE_WIDGET_CLASSES "glade-widget-classes"
|
||||
#define GLADE_TAG_GLADE_WIDGET_CLASS "glade-widget-class"
|
||||
@ -118,7 +91,6 @@ typedef enum {
|
||||
#define GLADE_TAG_CONSTRUCT_ONLY "construct-only"
|
||||
#define GLADE_TAG_NEEDS_SYNC "needs-sync"
|
||||
#define GLADE_TAG_DEFAULT_PALETTE_STATE "default-palette-state"
|
||||
#define GLADE_TAG_PROJECT_CONVERT_FUNCTION "project-convert-function"
|
||||
#define GLADE_TAG_REPLACE_CHILD_FUNCTION "replace-child-function"
|
||||
#define GLADE_TAG_CONSTRUCT_OBJECT_FUNCTION "construct-object-function"
|
||||
#define GLADE_TAG_DEEP_POST_CREATE_FUNCTION "deep-post-create-function"
|
||||
|
||||
@ -20,7 +20,7 @@ libgladegtk_la_CPPFLAGS = \
|
||||
|
||||
libgladegtk_la_CFLAGS = $(AM_CFLAGS)
|
||||
|
||||
libgladegtk_la_SOURCES = glade-gtk.c glade-accels.c glade-attributes.c glade-convert.c fixed-bg.xpm \
|
||||
libgladegtk_la_SOURCES = glade-gtk.c glade-accels.c glade-attributes.c fixed-bg.xpm \
|
||||
glade-column-types.c glade-model-data.c glade-text-button.c \
|
||||
glade-icon-sources.c glade-button-editor.c glade-tool-button-editor.c glade-image-editor.c \
|
||||
glade-image-item-editor.c glade-icon-factory-editor.c glade-store-editor.c glade-label-editor.c \
|
||||
|
||||
@ -1,914 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* glade-convert.c - Project format conversion routines
|
||||
*
|
||||
* Copyright (C) 2008 Tristan Van Berkom
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Author(s):
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "glade-gtk.h"
|
||||
#include "glade-column-types.h"
|
||||
#include "glade-model-data.h"
|
||||
#include "glade-icon-sources.h"
|
||||
#include "glade-tool-button-editor.h"
|
||||
#include <gladeui/glade.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
GObject *adjustment;
|
||||
GladeProperty *property;
|
||||
} AdjustmentData;
|
||||
|
||||
typedef struct {
|
||||
GladeWidget *widget;
|
||||
gchar *text;
|
||||
} TextData;
|
||||
|
||||
typedef struct {
|
||||
GladeWidget *widget;
|
||||
gchar **items;
|
||||
} ComboData;
|
||||
|
||||
typedef struct {
|
||||
/* List of newly created objects to set */
|
||||
GList *adjustments;
|
||||
GList *textviews;
|
||||
GList *tooltips;
|
||||
GList *combos;
|
||||
GList *toolbuttons;
|
||||
GList *menus;
|
||||
} ConvertData;
|
||||
|
||||
/*****************************************
|
||||
* GtkAdjustments *
|
||||
*****************************************/
|
||||
static void
|
||||
convert_adjustments_finished (GladeProject *project,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeProjectFormat new_format = glade_project_get_format (project);
|
||||
GladeWidgetAdaptor *adaptor = glade_widget_adaptor_get_by_type (GTK_TYPE_ADJUSTMENT);
|
||||
GladeWidget *widget;
|
||||
AdjustmentData *adata;
|
||||
GList *list;
|
||||
|
||||
for (list = data->adjustments; list; list = list->next)
|
||||
{
|
||||
adata = list->data;
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
{
|
||||
gdouble value, lower, upper, step_inc, page_inc, page_size;
|
||||
|
||||
g_object_get (adata->adjustment,
|
||||
"value", &value,
|
||||
"lower", &lower,
|
||||
"upper", &upper,
|
||||
"step-increment", &step_inc,
|
||||
"page-increment", &page_inc,
|
||||
"page-size", &page_size,
|
||||
NULL);
|
||||
|
||||
/* Cant cancel an adjustment.... */
|
||||
widget = glade_command_create (adaptor, NULL, NULL, project);
|
||||
|
||||
/* Initial properties on the new adjustment dont need command history */
|
||||
glade_widget_property_set (widget, "value", value);
|
||||
glade_widget_property_set (widget, "lower", lower);
|
||||
glade_widget_property_set (widget, "upper", upper);
|
||||
glade_widget_property_set (widget, "step-increment", step_inc);
|
||||
glade_widget_property_set (widget, "page-increment", page_inc);
|
||||
glade_widget_property_set (widget, "page-size", page_size);
|
||||
|
||||
/* hook up the new adjustment */
|
||||
glade_command_set_property (adata->property, widget->object);
|
||||
|
||||
/* destroy the fabricated object */
|
||||
g_object_unref (G_OBJECT (adata->adjustment));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set the adjustment we created directly */
|
||||
glade_command_set_property (adata->property, adata->adjustment);
|
||||
}
|
||||
|
||||
g_free (adata);
|
||||
}
|
||||
|
||||
g_list_free (data->adjustments);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_adjustment_properties (GList *properties,
|
||||
GladeProjectFormat new_format,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeWidget *adj_widget;
|
||||
GladeProperty *property;
|
||||
GObject *adjustment;
|
||||
GList *list;
|
||||
GList *delete = NULL;
|
||||
|
||||
|
||||
for (list = properties; list; list = list->next)
|
||||
{
|
||||
property = list->data;
|
||||
|
||||
if (property->klass->pspec->value_type == GTK_TYPE_ADJUSTMENT)
|
||||
{
|
||||
adjustment = NULL;
|
||||
glade_property_get (property, &adjustment);
|
||||
|
||||
if (adjustment)
|
||||
{
|
||||
/* Record an adjustment here to restore after the format switch */
|
||||
gdouble value, lower, upper, step_inc, page_inc, page_size;
|
||||
AdjustmentData *adata = g_new0 (AdjustmentData, 1);
|
||||
|
||||
g_object_get (adjustment,
|
||||
"value", &value,
|
||||
"lower", &lower,
|
||||
"upper", &upper,
|
||||
"step-increment", &step_inc,
|
||||
"page-increment", &page_inc,
|
||||
"page-size", &page_size,
|
||||
NULL);
|
||||
|
||||
adata->property = property;
|
||||
adata->adjustment = (GObject *)gtk_adjustment_new (value, lower, upper,
|
||||
step_inc, page_inc, page_size);
|
||||
data->adjustments = g_list_prepend (data->adjustments, adata);
|
||||
|
||||
/* Delete trailing builder objects from project */
|
||||
if (new_format == GLADE_PROJECT_FORMAT_LIBGLADE &&
|
||||
(adj_widget = glade_widget_get_from_gobject (adjustment)))
|
||||
{
|
||||
if (!g_list_find (delete, adj_widget))
|
||||
delete = g_list_prepend (delete, adj_widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (delete)
|
||||
{
|
||||
glade_command_delete (delete);
|
||||
g_list_free (delete);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
convert_adjustments (GladeProject *project,
|
||||
GladeProjectFormat new_format,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeWidget *widget;
|
||||
const GList *objects;
|
||||
|
||||
for (objects = glade_project_get_objects (project); objects; objects = objects->next)
|
||||
{
|
||||
widget = glade_widget_get_from_gobject (objects->data);
|
||||
|
||||
convert_adjustment_properties (widget->properties, new_format, data);
|
||||
convert_adjustment_properties (widget->packing_properties, new_format, data);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* TextView:text *
|
||||
*****************************************/
|
||||
static void
|
||||
convert_textviews_finished (GladeProject *project,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeProjectFormat new_format = glade_project_get_format (project);
|
||||
GladeWidgetAdaptor *adaptor = glade_widget_adaptor_get_by_type (GTK_TYPE_TEXT_BUFFER);
|
||||
GladeProperty *property;
|
||||
GladeWidget *widget;
|
||||
TextData *tdata;
|
||||
GList *list;
|
||||
|
||||
for (list = data->textviews; list; list = list->next)
|
||||
{
|
||||
tdata = list->data;
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
{
|
||||
property = glade_widget_get_property (tdata->widget, "buffer");
|
||||
|
||||
/* Cant cancel a textbuffer.... */
|
||||
widget = glade_command_create (adaptor, NULL, NULL, project);
|
||||
|
||||
glade_command_set_property (property, widget->object);
|
||||
|
||||
property = glade_widget_get_property (widget, "text");
|
||||
glade_property_set (property, tdata->text);
|
||||
}
|
||||
else
|
||||
{
|
||||
property = glade_widget_get_property (tdata->widget, "text");
|
||||
glade_command_set_property (property, tdata->text);
|
||||
}
|
||||
g_free (tdata->text);
|
||||
g_free (tdata);
|
||||
}
|
||||
|
||||
g_list_free (data->textviews);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_textviews (GladeProject *project,
|
||||
GladeProjectFormat new_format,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeWidget *widget, *gbuffer;
|
||||
GladeProperty *property;
|
||||
TextData *tdata;
|
||||
GtkTextBuffer *buffer;
|
||||
const GList *objects;
|
||||
gchar *text;
|
||||
|
||||
for (objects = glade_project_get_objects (project); objects; objects = objects->next)
|
||||
{
|
||||
widget = glade_widget_get_from_gobject (objects->data);
|
||||
if (!GTK_IS_TEXT_VIEW (widget->object))
|
||||
continue;
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
{
|
||||
text = NULL;
|
||||
property = glade_widget_get_property (widget, "text");
|
||||
glade_property_get (property, &text);
|
||||
|
||||
if (text)
|
||||
{
|
||||
tdata = g_new0 (TextData, 1);
|
||||
tdata->widget = widget;
|
||||
tdata->text = g_strdup (text);
|
||||
data->textviews = g_list_prepend (data->textviews, tdata);
|
||||
|
||||
glade_command_set_property (property, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text = NULL;
|
||||
gbuffer = NULL;
|
||||
buffer = NULL;
|
||||
property = glade_widget_get_property (widget, "buffer");
|
||||
glade_property_get (property, &buffer);
|
||||
|
||||
if (buffer && (gbuffer = glade_widget_get_from_gobject (buffer)))
|
||||
glade_widget_property_get (gbuffer, "text", &text);
|
||||
|
||||
if (text)
|
||||
{
|
||||
GList delete = { 0, };
|
||||
delete.data = gbuffer;
|
||||
|
||||
tdata = g_new0 (TextData, 1);
|
||||
tdata->widget = widget;
|
||||
tdata->text = g_strdup (text);
|
||||
data->textviews = g_list_prepend (data->textviews, tdata);
|
||||
|
||||
/* This will take care of unsetting the buffer property as well */
|
||||
glade_command_delete (&delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* GtkWidget:tooltip *
|
||||
*****************************************/
|
||||
static void
|
||||
convert_tooltips_finished (GladeProject *project,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeProjectFormat new_format = glade_project_get_format (project);
|
||||
GladeProperty *property;
|
||||
GList *list;
|
||||
TextData *tdata;
|
||||
|
||||
for (list = data->tooltips; list; list = list->next)
|
||||
{
|
||||
tdata = list->data;
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
property = glade_widget_get_property (tdata->widget, "tooltip-text");
|
||||
else
|
||||
property = glade_widget_get_property (tdata->widget, "tooltip");
|
||||
|
||||
glade_command_set_property (property, tdata->text);
|
||||
|
||||
g_free (tdata->text);
|
||||
g_free (tdata);
|
||||
}
|
||||
|
||||
g_list_free (data->tooltips);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_tooltips (GladeProject *project,
|
||||
GladeProjectFormat new_format,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeWidget *widget;
|
||||
GladeProperty *property;
|
||||
TextData *tdata;
|
||||
const GList *objects;
|
||||
gchar *text;
|
||||
|
||||
for (objects = glade_project_get_objects (project); objects; objects = objects->next)
|
||||
{
|
||||
widget = glade_widget_get_from_gobject (objects->data);
|
||||
if (!GTK_IS_WIDGET (widget->object))
|
||||
continue;
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
property = glade_widget_get_property (widget, "tooltip");
|
||||
else
|
||||
property = glade_widget_get_property (widget, "tooltip-text");
|
||||
|
||||
|
||||
text = NULL;
|
||||
glade_property_get (property, &text);
|
||||
if (text)
|
||||
{
|
||||
tdata = g_new0 (TextData, 1);
|
||||
tdata->widget = widget;
|
||||
tdata->text = g_strdup (text);
|
||||
data->tooltips = g_list_prepend (data->tooltips, tdata);
|
||||
|
||||
glade_command_set_property (property, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* Combo:items *
|
||||
*****************************************/
|
||||
static GNode *
|
||||
combos_data_tree_from_items (gchar **items)
|
||||
{
|
||||
GNode *row, *data_tree;
|
||||
gint i;
|
||||
|
||||
if (!items)
|
||||
return NULL;
|
||||
|
||||
data_tree = g_node_new (NULL);
|
||||
|
||||
for (i = 0; items[i]; i++)
|
||||
{
|
||||
GladeModelData *data = glade_model_data_new (G_TYPE_STRING, "item text");
|
||||
|
||||
g_value_set_string (&data->value, items[i]);
|
||||
|
||||
row = g_node_new (NULL);
|
||||
g_node_append (data_tree, row);
|
||||
g_node_append_data (row, data);
|
||||
}
|
||||
return data_tree;
|
||||
}
|
||||
|
||||
static gchar **
|
||||
combos_items_from_data_tree (GNode *data_tree)
|
||||
{
|
||||
GNode *row, *item;
|
||||
GPtrArray *array = g_ptr_array_new ();
|
||||
GladeModelData *data;
|
||||
gchar *string;
|
||||
|
||||
for (row = data_tree->children; row; row = row->next)
|
||||
{
|
||||
for (item = row->children; item; item = item->next)
|
||||
{
|
||||
data = item->data;
|
||||
if (G_VALUE_TYPE (&data->value) == G_TYPE_STRING)
|
||||
{
|
||||
string = g_value_dup_string (&data->value);
|
||||
g_ptr_array_add (array, string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (array->len == 0)
|
||||
return NULL;
|
||||
|
||||
g_ptr_array_add (array, NULL);
|
||||
|
||||
return (gchar **)g_ptr_array_free (array, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
combo_box_convert_setup (GladeWidget *widget, GladeProjectFormat fmt)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkComboBox *combo = GTK_COMBO_BOX (widget->object);
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
if (fmt == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
{
|
||||
/* Get rid of any custom */
|
||||
gtk_combo_box_set_model (combo, NULL);
|
||||
|
||||
/* remove every cell (its only the libglade special case cell that is here) */
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
|
||||
}
|
||||
else if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
{
|
||||
if (!gtk_combo_box_get_model (GTK_COMBO_BOX (combo)))
|
||||
{
|
||||
/* Add store for text items */
|
||||
store = gtk_list_store_new (1, G_TYPE_STRING);
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
|
||||
g_object_unref (store);
|
||||
}
|
||||
|
||||
/* Add cell renderer for text items */
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell,
|
||||
"text", 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
convert_combos (GladeProject *project,
|
||||
GladeProjectFormat new_format,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeWidget *widget, *gmodel;
|
||||
GladeProperty *property;
|
||||
ComboData *cdata;
|
||||
GObject *model;
|
||||
const GList *objects;
|
||||
GNode *data_tree;
|
||||
gchar **items;
|
||||
|
||||
for (objects = glade_project_get_objects (project); objects; objects = objects->next)
|
||||
{
|
||||
widget = glade_widget_get_from_gobject (objects->data);
|
||||
if (!GTK_IS_COMBO_BOX (widget->object))
|
||||
continue;
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
{
|
||||
items = NULL;
|
||||
property = glade_widget_get_property (widget, "items");
|
||||
glade_property_get (property, &items);
|
||||
|
||||
combo_box_convert_setup (widget, new_format);
|
||||
|
||||
if (items)
|
||||
{
|
||||
cdata = g_new0 (ComboData, 1);
|
||||
cdata->widget = widget;
|
||||
cdata->items = g_strdupv (items);
|
||||
data->combos = g_list_prepend (data->combos, cdata);
|
||||
|
||||
glade_command_set_property (property, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
items = NULL;
|
||||
data_tree = NULL;
|
||||
gmodel = NULL;
|
||||
model = NULL;
|
||||
property = glade_widget_get_property (widget, "model");
|
||||
glade_property_get (property, &model);
|
||||
|
||||
if (model && (gmodel = glade_widget_get_from_gobject (model)))
|
||||
glade_widget_property_get (gmodel, "data", &data_tree);
|
||||
|
||||
if (data_tree)
|
||||
items = combos_items_from_data_tree (data_tree);
|
||||
|
||||
if (items)
|
||||
{
|
||||
GList delete = { 0, };
|
||||
delete.data = gmodel;
|
||||
|
||||
cdata = g_new0 (ComboData, 1);
|
||||
cdata->widget = widget;
|
||||
cdata->items = items;
|
||||
data->combos = g_list_prepend (data->combos, cdata);
|
||||
|
||||
/* This will take care of unsetting the buffer property as well */
|
||||
glade_command_delete (&delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
convert_combos_finished (GladeProject *project,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeProjectFormat new_format = glade_project_get_format (project);
|
||||
GladeWidgetAdaptor *adaptor = glade_widget_adaptor_get_by_type (GTK_TYPE_LIST_STORE);
|
||||
GladeWidgetAdaptor *cell_adaptor = glade_widget_adaptor_get_by_type (GTK_TYPE_CELL_RENDERER_TEXT);
|
||||
GladeProperty *property;
|
||||
GladeWidget *widget;
|
||||
ComboData *cdata;
|
||||
GNode *data_tree;
|
||||
GList *list;
|
||||
|
||||
for (list = data->combos; list; list = list->next)
|
||||
{
|
||||
cdata = list->data;
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
{
|
||||
GList *columns = NULL;
|
||||
GladeColumnType *column = g_new0 (GladeColumnType, 1);
|
||||
|
||||
column->type_name = g_strdup ("gchararray");
|
||||
column->column_name = g_strdup_printf ("item text");
|
||||
columns = g_list_append (columns, column);
|
||||
|
||||
property = glade_widget_get_property (cdata->widget, "model");
|
||||
|
||||
/* Cant cancel a liststore.... */
|
||||
widget = glade_command_create (adaptor, NULL, NULL, project);
|
||||
|
||||
data_tree = combos_data_tree_from_items (cdata->items);
|
||||
|
||||
glade_widget_property_set (widget, "columns", columns);
|
||||
glade_widget_property_set (widget, "data", data_tree);
|
||||
|
||||
glade_command_set_property (property, widget->object);
|
||||
|
||||
glade_column_list_free (columns);
|
||||
glade_model_data_tree_free (data_tree);
|
||||
|
||||
/* Add a cell renderer after creating and setting the mode.... */
|
||||
widget = glade_command_create (cell_adaptor, cdata->widget, NULL, project);
|
||||
glade_widget_property_set (widget, "attr-text", 0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
combo_box_convert_setup (cdata->widget, new_format);
|
||||
|
||||
property = glade_widget_get_property (cdata->widget, "items");
|
||||
glade_command_set_property (property, cdata->items);
|
||||
}
|
||||
g_strfreev (cdata->items);
|
||||
g_free (cdata);
|
||||
}
|
||||
|
||||
g_list_free (data->combos);
|
||||
}
|
||||
|
||||
/******************************
|
||||
* ToolButton:icon *
|
||||
******************************/
|
||||
static void
|
||||
convert_toolbuttons_finished (GladeProject *project,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeProjectFormat new_format = glade_project_get_format (project);
|
||||
GladeWidgetAdaptor *adaptor = glade_widget_adaptor_get_by_type (GTK_TYPE_ICON_FACTORY);
|
||||
GladeWidget *icon_factory = NULL;
|
||||
GladeIconSources *icon_sources = NULL;
|
||||
GladeProperty *property;
|
||||
TextData *tdata;
|
||||
GtkIconSource *source;
|
||||
GList *list, *source_list;
|
||||
gchar *filename;
|
||||
GValue *value;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
{
|
||||
/* Generate icon_sources first... */
|
||||
for (list = data->toolbuttons; list; list = list->next)
|
||||
{
|
||||
tdata = list->data;
|
||||
|
||||
filename = g_strdup_printf ("generated-icon-%s", tdata->text);
|
||||
glade_util_replace (filename, '.', '-');
|
||||
|
||||
/* get icon source with pixbuf from tdata->text */
|
||||
value = glade_utils_value_from_string (GDK_TYPE_PIXBUF, tdata->text,
|
||||
project, tdata->widget);
|
||||
pixbuf = g_value_get_object (value);
|
||||
source = gtk_icon_source_new ();
|
||||
gtk_icon_source_set_pixbuf (source, pixbuf);
|
||||
g_value_unset (value);
|
||||
g_free (value);
|
||||
|
||||
/* Add to the icon source (only one icon set list per icon) */
|
||||
if (!icon_sources)
|
||||
icon_sources = glade_icon_sources_new ();
|
||||
source_list = g_list_append (NULL, source);
|
||||
g_hash_table_insert (icon_sources->sources, g_strdup (filename), source_list);
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
if (icon_sources)
|
||||
{
|
||||
icon_factory = glade_command_create (adaptor, NULL, NULL, project);
|
||||
|
||||
property = glade_widget_get_property (icon_factory, "sources");
|
||||
glade_command_set_property (property, icon_sources);
|
||||
glade_icon_sources_free (icon_sources);
|
||||
}
|
||||
|
||||
for (list = data->toolbuttons; list; list = list->next)
|
||||
{
|
||||
tdata = list->data;
|
||||
|
||||
filename = g_strdup_printf ("generated-icon-%s", tdata->text);
|
||||
glade_util_replace (filename, '.', '-');
|
||||
|
||||
/* Set edit mode to stock for newly generated icon */
|
||||
property = glade_widget_get_property (tdata->widget, "image-mode");
|
||||
glade_command_set_property (property, GLADE_TB_MODE_STOCK);
|
||||
|
||||
/* Set stock-id for newly generated icon */
|
||||
property = glade_widget_get_property (tdata->widget, "stock-id");
|
||||
glade_command_set_property (property, filename);
|
||||
|
||||
g_free (filename);
|
||||
g_free (tdata->text);
|
||||
g_free (tdata);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set "icon" property */
|
||||
for (list = data->toolbuttons; list; list = list->next)
|
||||
{
|
||||
tdata = list->data;
|
||||
|
||||
/* Set edit mode to icon for converted icon */
|
||||
property = glade_widget_get_property (tdata->widget, "image-mode");
|
||||
glade_command_set_property (property, GLADE_TB_MODE_FILENAME);
|
||||
|
||||
value = glade_utils_value_from_string (GDK_TYPE_PIXBUF,
|
||||
tdata->text,
|
||||
project, tdata->widget);
|
||||
pixbuf = g_value_get_object (value);
|
||||
property = glade_widget_get_property (tdata->widget, "icon");
|
||||
glade_command_set_property (property, pixbuf);
|
||||
g_value_unset (value);
|
||||
g_free (value);
|
||||
|
||||
g_free (tdata->text);
|
||||
g_free (tdata);
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (data->toolbuttons);
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
find_icon_factory (GObject *object, gpointer blah)
|
||||
{
|
||||
if (GTK_IS_ICON_FACTORY (object))
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
convert_toolbuttons (GladeProject *project,
|
||||
GladeProjectFormat new_format,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeIconSources *icon_sources = NULL;
|
||||
GladeWidget *widget, *gfactory;
|
||||
GladeProperty *property;
|
||||
GtkIconSource *source;
|
||||
const GList *objects, *element;
|
||||
TextData *tdata;
|
||||
GdkPixbuf *pixbuf;
|
||||
gchar *filename = NULL, *stock_id = NULL;
|
||||
|
||||
for (objects = glade_project_get_objects (project); objects; objects = objects->next)
|
||||
{
|
||||
widget = glade_widget_get_from_gobject (objects->data);
|
||||
if (!GTK_IS_TOOL_BUTTON (widget->object))
|
||||
continue;
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
{
|
||||
pixbuf = NULL;
|
||||
property = glade_widget_get_property (widget, "icon");
|
||||
glade_property_get (property, &pixbuf);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
filename = g_object_get_data (G_OBJECT (pixbuf), "GladeFileName");
|
||||
|
||||
tdata = g_new0 (TextData, 1);
|
||||
tdata->widget = widget;
|
||||
tdata->text = g_strdup (filename);
|
||||
data->toolbuttons = g_list_prepend (data->toolbuttons, tdata);
|
||||
|
||||
glade_command_set_property (property, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If any stock's are provided in the icon factory, convert
|
||||
* them to the "icon" property
|
||||
*/
|
||||
property = glade_widget_get_property (widget, "stock-id");
|
||||
glade_property_get (property, &stock_id);
|
||||
|
||||
if (!stock_id)
|
||||
continue;
|
||||
|
||||
if ((element =
|
||||
g_list_find_custom ((GList *)glade_project_get_objects (project), NULL,
|
||||
(GCompareFunc)find_icon_factory)) != NULL)
|
||||
{
|
||||
gfactory = glade_widget_get_from_gobject (element->data);
|
||||
property = glade_widget_get_property (gfactory, "sources");
|
||||
glade_property_get (property, &icon_sources);
|
||||
|
||||
if (icon_sources &&
|
||||
(element = g_hash_table_lookup (icon_sources->sources, stock_id)))
|
||||
{
|
||||
source = element->data;
|
||||
pixbuf = gtk_icon_source_get_pixbuf (source);
|
||||
filename = g_object_get_data (G_OBJECT (pixbuf),
|
||||
"GladeFileName");
|
||||
if (filename)
|
||||
{
|
||||
|
||||
tdata = g_new0 (TextData, 1);
|
||||
tdata->widget = widget;
|
||||
tdata->text = g_strdup (filename);
|
||||
data->toolbuttons = g_list_prepend (data->toolbuttons, tdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************
|
||||
* GtkImageMenuItem:image,accel-group *
|
||||
******************************************/
|
||||
static void
|
||||
convert_menus_finished (GladeProject *project,
|
||||
ConvertData *data)
|
||||
{
|
||||
GList *l;
|
||||
GladeWidget *widget, *accel_group = NULL;
|
||||
GladeProperty *property;
|
||||
|
||||
for (l = data->menus; l; l = l->next)
|
||||
{
|
||||
widget = l->data;
|
||||
property = glade_widget_get_property (widget, "accel-group");
|
||||
|
||||
if (accel_group == NULL)
|
||||
{
|
||||
GladeWidget *toplevel = glade_widget_get_toplevel (widget);
|
||||
GladeProperty *groups_prop;
|
||||
|
||||
accel_group = glade_command_create (glade_widget_adaptor_get_by_type (GTK_TYPE_ACCEL_GROUP),
|
||||
NULL, NULL, project);
|
||||
|
||||
if ((groups_prop = glade_widget_get_property (toplevel, "accel-groups")))
|
||||
{
|
||||
GList *list = g_list_append (NULL, accel_group->object);
|
||||
glade_command_set_property (groups_prop, list);
|
||||
g_list_free (list);
|
||||
}
|
||||
}
|
||||
|
||||
glade_command_set_property (property, accel_group->object);
|
||||
|
||||
}
|
||||
|
||||
|
||||
g_list_free (data->menus);
|
||||
}
|
||||
|
||||
static GladeWidget *
|
||||
get_image_widget (GladeWidget *widget)
|
||||
{
|
||||
GtkWidget *image;
|
||||
image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget->object));
|
||||
return image ? glade_widget_get_from_gobject (image) : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
convert_menus (GladeProject *project,
|
||||
GladeProjectFormat new_format,
|
||||
ConvertData *data)
|
||||
{
|
||||
GladeWidget *widget;
|
||||
GladeProperty *property;
|
||||
const GList *objects;
|
||||
GladeWidget *gimage;
|
||||
gboolean use_stock;
|
||||
|
||||
for (objects = glade_project_get_objects (project); objects; objects = objects->next)
|
||||
{
|
||||
widget = glade_widget_get_from_gobject (objects->data);
|
||||
if (!GTK_IS_IMAGE_MENU_ITEM (widget->object))
|
||||
continue;
|
||||
|
||||
glade_widget_property_get (widget, "use-stock", &use_stock);
|
||||
|
||||
/* convert images */
|
||||
if ((gimage = get_image_widget (widget)) != NULL)
|
||||
{
|
||||
GList list = { 0, };
|
||||
|
||||
list.data = gimage;
|
||||
|
||||
glade_command_unlock_widget (gimage);
|
||||
glade_command_cut (&list);
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER)
|
||||
{
|
||||
property = glade_widget_get_property (widget, "image");
|
||||
glade_command_paste (&list, NULL, NULL);
|
||||
glade_command_set_property (property, gimage->object);
|
||||
}
|
||||
else
|
||||
glade_command_paste (&list, widget, NULL);
|
||||
|
||||
glade_command_lock_widget (widget, gimage);
|
||||
}
|
||||
|
||||
if (new_format == GLADE_PROJECT_FORMAT_GTKBUILDER && use_stock)
|
||||
data->menus = g_list_prepend (data->menus, widget);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* Main entry point *
|
||||
*****************************************/
|
||||
static void
|
||||
glade_gtk_project_convert_finished (GladeProject *project,
|
||||
ConvertData *data)
|
||||
{
|
||||
convert_adjustments_finished (project, data);
|
||||
convert_textviews_finished (project, data);
|
||||
convert_tooltips_finished (project, data);
|
||||
convert_combos_finished (project, data);
|
||||
convert_toolbuttons_finished (project, data);
|
||||
convert_menus_finished (project, data);
|
||||
|
||||
/* Once per conversion */
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (project),
|
||||
G_CALLBACK (glade_gtk_project_convert_finished), data);
|
||||
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_gtk_project_convert (GladeProject *project,
|
||||
GladeProjectFormat new_format)
|
||||
{
|
||||
ConvertData *data = g_new0 (ConvertData, 1);
|
||||
|
||||
convert_adjustments (project, new_format, data);
|
||||
convert_textviews (project, new_format, data);
|
||||
convert_tooltips (project, new_format, data);
|
||||
convert_combos (project, new_format, data);
|
||||
convert_toolbuttons (project, new_format, data);
|
||||
convert_menus (project, new_format, data);
|
||||
|
||||
/* Clean up after the new_format is in effect */
|
||||
g_signal_connect (G_OBJECT (project), "convert-finished",
|
||||
G_CALLBACK (glade_gtk_project_convert_finished), data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -280,17 +280,10 @@ custom_toggled (GtkWidget *widget,
|
||||
|
||||
property = glade_widget_get_property (loaded, "image");
|
||||
|
||||
if (glade_project_get_format (loaded->project) == GLADE_PROJECT_FORMAT_LIBGLADE)
|
||||
image = glade_command_create (glade_widget_adaptor_get_by_type (GTK_TYPE_IMAGE),
|
||||
item_editor->loaded_widget, NULL,
|
||||
glade_widget_get_project (loaded));
|
||||
else
|
||||
{
|
||||
image = glade_command_create (glade_widget_adaptor_get_by_type (GTK_TYPE_IMAGE),
|
||||
NULL, NULL, glade_widget_get_project (loaded));
|
||||
image = glade_command_create (glade_widget_adaptor_get_by_type (GTK_TYPE_IMAGE),
|
||||
NULL, NULL, glade_widget_get_project (loaded));
|
||||
|
||||
glade_command_set_property (property, image->object);
|
||||
}
|
||||
glade_command_set_property (property, image->object);
|
||||
|
||||
/* Make sure nobody deletes this... */
|
||||
glade_command_lock_widget (loaded, image);
|
||||
|
||||
@ -676,7 +676,6 @@ value_i18n_activate (GladeCellRendererIcon *cell,
|
||||
GNode *data_tree = NULL;
|
||||
GladeModelData *data;
|
||||
gchar *new_text;
|
||||
gboolean has_context_dummy;
|
||||
|
||||
if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (eprop_data->store), &iter, path))
|
||||
return;
|
||||
@ -699,11 +698,9 @@ value_i18n_activate (GladeCellRendererIcon *cell,
|
||||
new_text = g_value_dup_string (&data->value);
|
||||
|
||||
if (glade_editor_property_show_i18n_dialog (NULL,
|
||||
GLADE_PROJECT_FORMAT_GTKBUILDER,
|
||||
&new_text,
|
||||
&data->i18n_context,
|
||||
&data->i18n_comment,
|
||||
&has_context_dummy,
|
||||
&data->i18n_translatable))
|
||||
{
|
||||
g_value_set_string (&data->value, new_text);
|
||||
@ -793,7 +790,7 @@ enum_flags_format_cell_data (GtkCellLayout *cell_layout,
|
||||
gtk_tree_model_get_value (tree_model, iter,
|
||||
NUM_COLUMNS + colnum, &value);
|
||||
|
||||
string = glade_utils_string_from_value (&value, GLADE_PROJECT_FORMAT_GTKBUILDER);
|
||||
string = glade_utils_string_from_value (&value);
|
||||
|
||||
g_object_set (cell, "text", string && string[0] ?
|
||||
glade_get_displayable_value (G_VALUE_TYPE (&value), string) : "", NULL);
|
||||
|
||||
@ -145,9 +145,6 @@ glade_tool_button_editor_load (GladeEditable *editable,
|
||||
case GLADE_TB_MODE_ICON:
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_editor->icon_radio), TRUE);
|
||||
break;
|
||||
case GLADE_TB_MODE_FILENAME:
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_editor->file_radio), TRUE);
|
||||
break;
|
||||
case GLADE_TB_MODE_CUSTOM:
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_editor->custom_radio), TRUE);
|
||||
break;
|
||||
@ -305,40 +302,6 @@ icon_toggled (GtkWidget *widget,
|
||||
button_editor->loaded_widget);
|
||||
}
|
||||
|
||||
static void
|
||||
file_toggled (GtkWidget *widget,
|
||||
GladeToolButtonEditor *button_editor)
|
||||
{
|
||||
GladeProperty *property;
|
||||
|
||||
if (button_editor->loading || !button_editor->loaded_widget)
|
||||
return;
|
||||
|
||||
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_editor->file_radio)))
|
||||
return;
|
||||
|
||||
button_editor->modifying = TRUE;
|
||||
|
||||
glade_command_push_group (_("Setting %s to use an image from the icon theme"), button_editor->loaded_widget->name);
|
||||
|
||||
property = glade_widget_get_property (button_editor->loaded_widget, "stock-id");
|
||||
glade_command_set_property (property, NULL);
|
||||
property = glade_widget_get_property (button_editor->loaded_widget, "icon-name");
|
||||
glade_command_set_property (property, NULL);
|
||||
property = glade_widget_get_property (button_editor->loaded_widget, "icon-widget");
|
||||
glade_command_set_property (property, NULL);
|
||||
property = glade_widget_get_property (button_editor->loaded_widget, "image-mode");
|
||||
glade_command_set_property (property, GLADE_TB_MODE_FILENAME);
|
||||
|
||||
glade_command_pop_group ();
|
||||
|
||||
button_editor->modifying = FALSE;
|
||||
|
||||
/* reload buttons and sensitivity and stuff... */
|
||||
glade_editable_load (GLADE_EDITABLE (button_editor),
|
||||
button_editor->loaded_widget);
|
||||
}
|
||||
|
||||
static void
|
||||
custom_toggled (GtkWidget *widget,
|
||||
GladeToolButtonEditor *button_editor)
|
||||
@ -524,17 +487,6 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
|
||||
table_attach (table, GTK_WIDGET (eprop), 1, 1);
|
||||
button_editor->properties = g_list_prepend (button_editor->properties, eprop);
|
||||
|
||||
/* Filename... */
|
||||
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "icon", FALSE, TRUE);
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
button_editor->file_radio = gtk_radio_button_new_from_widget
|
||||
(GTK_RADIO_BUTTON (button_editor->stock_radio));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button_editor->file_radio, FALSE, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2);
|
||||
table_attach (table, hbox, 0, 2);
|
||||
table_attach (table, GTK_WIDGET (eprop), 1, 2);
|
||||
button_editor->properties = g_list_prepend (button_editor->properties, eprop);
|
||||
|
||||
/* Custom embedded image widget... */
|
||||
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "icon-widget", FALSE, TRUE);
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
@ -542,8 +494,8 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
|
||||
(GTK_RADIO_BUTTON (button_editor->stock_radio));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button_editor->custom_radio, FALSE, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), eprop->item_label, TRUE, TRUE, 2);
|
||||
table_attach (table, hbox, 0, 3);
|
||||
table_attach (table, GTK_WIDGET (eprop), 1, 3);
|
||||
table_attach (table, hbox, 0, 2);
|
||||
table_attach (table, GTK_WIDGET (eprop), 1, 2);
|
||||
button_editor->properties = g_list_prepend (button_editor->properties, eprop);
|
||||
|
||||
/* Connect radio button signals... */
|
||||
@ -555,8 +507,6 @@ glade_tool_button_editor_new (GladeWidgetAdaptor *adaptor,
|
||||
G_CALLBACK (stock_toggled), button_editor);
|
||||
g_signal_connect (G_OBJECT (button_editor->icon_radio), "toggled",
|
||||
G_CALLBACK (icon_toggled), button_editor);
|
||||
g_signal_connect (G_OBJECT (button_editor->file_radio), "toggled",
|
||||
G_CALLBACK (file_toggled), button_editor);
|
||||
g_signal_connect (G_OBJECT (button_editor->custom_radio), "toggled",
|
||||
G_CALLBACK (custom_toggled), button_editor);
|
||||
|
||||
|
||||
@ -39,7 +39,6 @@ typedef struct _GladeToolButtonEditorClass GladeToolButtonEditorClass;
|
||||
typedef enum {
|
||||
GLADE_TB_MODE_STOCK = 0, /* default */
|
||||
GLADE_TB_MODE_ICON,
|
||||
GLADE_TB_MODE_FILENAME,
|
||||
GLADE_TB_MODE_CUSTOM
|
||||
} GladeToolButtonImageMode;
|
||||
|
||||
@ -60,7 +59,6 @@ struct _GladeToolButtonEditor
|
||||
GtkWidget *image_table;
|
||||
GtkWidget *stock_radio; /* Create the image from stock-id */
|
||||
GtkWidget *icon_radio; /* Create the image with the icon theme */
|
||||
GtkWidget *file_radio; /* Create the image from filename (libglade only) */
|
||||
GtkWidget *custom_radio; /* Set a widget to be used in the image position */
|
||||
|
||||
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
<glade-catalog name="gtk+"
|
||||
version="2.20"
|
||||
targetable="2.18,2.16,2.14,2.12,2.10,2.8"
|
||||
supports="libglade,gtkbuilder"
|
||||
icon-prefix="gtk"
|
||||
library="gladegtk"
|
||||
domain="glade3"
|
||||
book="gtk">
|
||||
<project-convert-function>glade_gtk_project_convert</project-convert-function>
|
||||
<glade-widget-classes>
|
||||
|
||||
<glade-widget-class name="GtkWidget" _title="Widget" default-width="100" default-height="60">
|
||||
@ -51,26 +49,15 @@
|
||||
</actions>
|
||||
|
||||
<properties>
|
||||
<!-- Disable tooltip-text & tooltip-markup in libglade since we do
|
||||
conversions of the "tooltip" fake property -->
|
||||
<property id="tooltip-text" since="2.12" weight="4.2" translatable="True" libglade-unsupported="True">
|
||||
<property id="tooltip-text" since="2.12" weight="4.2" translatable="True" >
|
||||
<visible-lines>2</visible-lines>
|
||||
</property>
|
||||
<property id="tooltip-markup" since="2.12" weight="4.1" libglade-unsupported="True"/>
|
||||
<property id="tooltip-markup" since="2.12" weight="4.1"/>
|
||||
<property id="visible" default="True" common="True" ignore="True"/>
|
||||
<property id="width-request" common="True" optional="True" optional-default="False" default="0"/>
|
||||
<property id="height-request" common="True" optional="True" optional-default="False" default="0"/>
|
||||
<property id="no-show-all" weight="4.6" ignore="True"/>
|
||||
|
||||
<property common="True" id="tooltip" _name="Tooltip" default="" translatable="True" weight="4.5"
|
||||
libglade-only="True">
|
||||
<parameter-spec>
|
||||
<type>GParamString</type>
|
||||
</parameter-spec>
|
||||
<_tooltip>A tooltip text for this widget</_tooltip>
|
||||
<visible-lines>2</visible-lines>
|
||||
</property>
|
||||
|
||||
<property common="True" id="extension-events">
|
||||
<displayable-values>
|
||||
<value id="GDK_EXTENSION_EVENTS_NONE" _name="None"/>
|
||||
@ -428,7 +415,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkMenuShell" _title="Menu Shell" use-placeholders="False" gtkbuilder-since="2.16">
|
||||
<glade-widget-class name="GtkMenuShell" _title="Menu Shell" use-placeholders="False" since="2.16">
|
||||
<post-create-function>empty</post-create-function>
|
||||
<add-child-function>glade_gtk_menu_shell_add_child</add-child-function>
|
||||
<remove-child-function>glade_gtk_menu_shell_remove_child</remove-child-function>
|
||||
@ -452,7 +439,7 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkMenuItem" generic-name="menuitem" _title="Menu Item" use-placeholders="False"
|
||||
gtkbuilder-since="2.16">
|
||||
since="2.16">
|
||||
<constructor-function>glade_gtk_menu_item_constructor</constructor-function>
|
||||
<post-create-function>glade_gtk_menu_item_post_create</post-create-function>
|
||||
<get-children-function>glade_gtk_menu_item_get_children</get-children-function>
|
||||
@ -460,7 +447,6 @@ embedded in another object</_tooltip>
|
||||
<add-child-function>glade_gtk_menu_item_add_child</add-child-function>
|
||||
<remove-child-function>glade_gtk_menu_item_remove_child</remove-child-function>
|
||||
<action-activate-function>glade_gtk_menu_item_action_activate</action-activate-function>
|
||||
<write-child-function>glade_gtk_menu_item_write_child</write-child-function>
|
||||
<create-editable-function>glade_gtk_activatable_create_editable</create-editable-function>
|
||||
<special-child-type>submenu</special-child-type>
|
||||
|
||||
@ -471,8 +457,8 @@ embedded in another object</_tooltip>
|
||||
<property id="accel-path" since="2.14"/>
|
||||
<property id="right-justified" since="2.14"/>
|
||||
<property id="width-chars" since="2.14"/>
|
||||
<property id="label" _name="Label" translatable="True" gtkbuilder-since="2.16"/>
|
||||
<property id="use-underline" _name="Use Underline" gtkbuilder-since="2.16"/>
|
||||
<property id="label" _name="Label" translatable="True" since="2.16"/>
|
||||
<property id="use-underline" _name="Use Underline" since="2.16"/>
|
||||
|
||||
<!-- GtkActivatable -->
|
||||
<property id="related-action" _name="Related Action" custom-layout="True" since="2.16"/>
|
||||
@ -494,15 +480,13 @@ embedded in another object</_tooltip>
|
||||
<glade-widget-class name="GtkImageMenuItem" generic-name="imagemenuitem" _title="Image Menu Item">
|
||||
<read-widget-function>glade_gtk_image_menu_item_read_widget</read-widget-function>
|
||||
<write-widget-function>glade_gtk_image_menu_item_write_widget</write-widget-function>
|
||||
<read-child-function>glade_gtk_image_menu_item_read_child</read-child-function>
|
||||
<write-child-function>glade_gtk_image_menu_item_write_child</write-child-function>
|
||||
<set-property-function>glade_gtk_image_menu_item_set_property</set-property-function>
|
||||
<get-children-function>glade_gtk_image_menu_item_get_children</get-children-function>
|
||||
<add-child-function>glade_gtk_image_menu_item_add_child</add-child-function>
|
||||
<remove-child-function>glade_gtk_image_menu_item_remove_child</remove-child-function>
|
||||
<create-editable-function>glade_gtk_image_menu_item_create_editable</create-editable-function>
|
||||
<properties>
|
||||
<property id="use-stock" default="True" visible="False" save-always="True" gtkbuilder-since="2.16"/>
|
||||
<property id="use-stock" default="True" visible="False" save-always="True" since="2.16"/>
|
||||
<property id="stock" stock="True" _name="Stock Item" save="False" custom-layout="True">
|
||||
<parameter-spec>
|
||||
<type>GParamString</type>
|
||||
@ -512,16 +496,8 @@ embedded in another object</_tooltip>
|
||||
<!-- We save the label manually with the stock value if use_stock is set. -->
|
||||
<property id="label" save="False" custom-layout="True"/>
|
||||
<property id="use-underline" custom-layout="True"/>
|
||||
<property id="image" libglade-unsupported="True" parentless-widget="True" visible="False"/>
|
||||
<property id="accel-group" _name="Accel Group" custom-layout="True" since="2.16" libglade-unsupported="True"/>
|
||||
<!--
|
||||
This property is added by glade2 gnome support and makes reference to
|
||||
GNOMEUIINFO_MENU_* macros. The read-widget-funcion maps these properties to
|
||||
existing non deprecated gtk ones at load time.
|
||||
-->
|
||||
<property id="stock-item" ignore="True" visible="False" save="False">
|
||||
<spec>glade_gtk_gnome_ui_info_spec</spec>
|
||||
</property>
|
||||
<property id="image" parentless-widget="True" visible="False"/>
|
||||
<property id="accel-group" _name="Accel Group" custom-layout="True" since="2.16" />
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
@ -665,18 +641,9 @@ embedded in another object</_tooltip>
|
||||
<_tooltip>The stock icon displayed on the item (choose an item from GTK+ stock or from an icon factory)</_tooltip>
|
||||
</property>
|
||||
<property id="label" translatable="True" default="toolbutton" custom-layout="True"/>
|
||||
<property id="label-widget" parentless-widget="True" libglade-unsupported="True"
|
||||
create-type="GtkLabel" custom-layout="True"/>
|
||||
<property id="label-widget" parentless-widget="True" create-type="GtkLabel" custom-layout="True"/>
|
||||
<property id="icon-name" themed-icon="True" custom-layout="True"/>
|
||||
<property id="icon" libglade-only="True" _name="Icon" custom-layout="True">
|
||||
<parameter-spec>
|
||||
<type>GParamObject</type>
|
||||
<value-type>GdkPixbuf</value-type>
|
||||
</parameter-spec>
|
||||
<_tooltip>A file name, full or relative path to load an icon for this toolbutton</_tooltip>
|
||||
</property>
|
||||
<property id="icon-widget" parentless-widget="True" libglade-unsupported="True"
|
||||
create-type="GtkImage" custom-layout="True"/>
|
||||
<property id="icon-widget" parentless-widget="True" create-type="GtkImage" custom-layout="True"/>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
@ -748,7 +715,7 @@ embedded in another object</_tooltip>
|
||||
<visible-lines>2</visible-lines>
|
||||
</property>
|
||||
<property id="glade-attributes" _name="Attributes" save="False" custom-layout="True"
|
||||
libglade-unsupported="True" gtkbuilder-since="2.16">
|
||||
since="2.16">
|
||||
<parameter-spec>
|
||||
<type>GParamBoxed</type>
|
||||
<value-type>GladeAttrGList</value-type>
|
||||
@ -815,7 +782,7 @@ embedded in another object</_tooltip>
|
||||
<properties>
|
||||
<property id="can-focus" save-always="True"/>
|
||||
<property id="text" translatable="True" custom-layout="True"/>
|
||||
<property id="buffer" libglade-unsupported="True" create-type="GtkEntryBuffer" since="2.18" custom-layout="True"/>
|
||||
<property id="buffer" create-type="GtkEntryBuffer" since="2.18" custom-layout="True"/>
|
||||
|
||||
<property id="inner-border" since="2.10"/>
|
||||
<property id="truncate-multiline" since="2.10"/>
|
||||
@ -881,14 +848,6 @@ embedded in another object</_tooltip>
|
||||
<set-property-function>glade_gtk_text_view_set_property</set-property-function>
|
||||
|
||||
<properties>
|
||||
<!-- Text of the textview -->
|
||||
<property id="text" _name="Text" translatable="True" libglade-only="True">
|
||||
<parameter-spec>
|
||||
<type>GParamString</type>
|
||||
</parameter-spec>
|
||||
<_tooltip>Set the text in the view's text buffer</_tooltip>
|
||||
<visible-lines>2</visible-lines>
|
||||
</property>
|
||||
<property id="im-module" disabled="True"/>
|
||||
<property id="wrap-mode">
|
||||
<displayable-values>
|
||||
@ -898,7 +857,6 @@ embedded in another object</_tooltip>
|
||||
<value id="GTK_WRAP_WORD_CHAR" _name="Word Character"/>
|
||||
</displayable-values>
|
||||
</property>
|
||||
<property id="buffer" libglade-unsupported="True"/>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
@ -912,8 +870,7 @@ embedded in another object</_tooltip>
|
||||
<properties>
|
||||
<property id="can-focus" save-always="True"/>
|
||||
<property id="receives-default" save-always="True"/>
|
||||
<property id="image" parentless-widget="True" create-type="GtkImage"
|
||||
libglade-unsupported="True" custom-layout="True"/>
|
||||
<property id="image" parentless-widget="True" create-type="GtkImage" custom-layout="True"/>
|
||||
<property id="use-stock" visible="False" custom-layout="True"/>
|
||||
<property id="label" default="button" translatable="True" custom-layout="True" save="False">
|
||||
<visible-lines>2</visible-lines>
|
||||
@ -1032,7 +989,7 @@ embedded in another object</_tooltip>
|
||||
<properties>
|
||||
<property id="title" translatable="True"/>
|
||||
<property id="size" disabled="True"/>
|
||||
<property id="dialog" parentless-widget="True" create-type="GtkFileChooserDialog" libglade-unsupported="True"/>
|
||||
<property id="dialog" parentless-widget="True" create-type="GtkFileChooserDialog" />
|
||||
<property id="focus-on-click" since="2.10"/>
|
||||
<property id="action">
|
||||
<displayable-values>
|
||||
@ -1042,9 +999,6 @@ embedded in another object</_tooltip>
|
||||
<value id="GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER" _name="Create Folder"/>
|
||||
</displayable-values>
|
||||
</property>
|
||||
<property id="extra-widget" parentless-widget="True" libglade-unsupported="True"/>
|
||||
<property id="preview-widget" parentless-widget="True" libglade-unsupported="True"/>
|
||||
<property id="filter" libglade-unsupported="True"/>
|
||||
<property id="create-folders" since="2.18"/>
|
||||
<property id="select-multiple" disabled="True"/>
|
||||
</properties>
|
||||
@ -1073,9 +1027,8 @@ embedded in another object</_tooltip>
|
||||
<post-create-function>glade_gtk_file_chooser_widget_post_create</post-create-function>
|
||||
<properties>
|
||||
<property id="size" default="1" query="False" />
|
||||
<property id="extra-widget" parentless-widget="True" libglade-unsupported="True"/>
|
||||
<property id="preview-widget" parentless-widget="True" libglade-unsupported="True"/>
|
||||
<property id="filter" libglade-unsupported="True"/>
|
||||
<property id="extra-widget" parentless-widget="True" />
|
||||
<property id="preview-widget" parentless-widget="True" />
|
||||
<property id="create-folders" since="2.18"/>
|
||||
</properties>
|
||||
|
||||
@ -1135,19 +1088,12 @@ embedded in another object</_tooltip>
|
||||
<signal id="popup" since="2.12"/>
|
||||
</signals>
|
||||
<properties>
|
||||
<property id="model" libglade-unsupported="True" create-type="GtkListStore"/>
|
||||
<property id="model" create-type="GtkListStore"/>
|
||||
<property id="popup-shown" since="2.10"/>
|
||||
<property id="tearoff-title" since="2.10"/>
|
||||
<property id="active" ignore="True"/>
|
||||
<property id="column-span-column" ignore="True"/>
|
||||
<property id="row-span-column" ignore="True"/>
|
||||
<property id="items" _name="Items" translatable="True" libglade-only="True">
|
||||
<parameter-spec>
|
||||
<type>GParamBoxed</type>
|
||||
<value-type>GStrv</value-type>
|
||||
</parameter-spec>
|
||||
<_tooltip>The items in this combo box</_tooltip>
|
||||
</property>
|
||||
<property id="button-sensitivity">
|
||||
<displayable-values>
|
||||
<value id="GTK_SENSITIVITY_AUTO" _name="Automatic"/>
|
||||
@ -1427,8 +1373,6 @@ embedded in another object</_tooltip>
|
||||
|
||||
<glade-widget-class name="GtkMenu" generic-name="menu" _title="Popup Menu" toplevel="True">
|
||||
<constructor-function>glade_gtk_menu_constructor</constructor-function>
|
||||
<!-- Set special-child-type at load time for libglade projects -->
|
||||
<read-widget-function>glade_gtk_menu_read_widget</read-widget-function>
|
||||
<!-- We do not want glade_gtk_container_post_create be executed -->
|
||||
<post-create-function>empty</post-create-function>
|
||||
<actions>
|
||||
@ -1781,7 +1725,7 @@ embedded in another object</_tooltip>
|
||||
<glade-widget-class name="GtkRecentChooserDialog" generic-name="recentchooserdialog" _title="Recent Chooser Dialog"/>
|
||||
|
||||
<!-- Objects -->
|
||||
<glade-widget-class name="GtkSizeGroup" generic-name="sizegroup" _title="Size Group" libglade-unsupported="True" toplevel="True">
|
||||
<glade-widget-class name="GtkSizeGroup" generic-name="sizegroup" _title="Size Group" toplevel="True">
|
||||
<depends-function>glade_gtk_size_group_depends</depends-function>
|
||||
<read-widget-function>glade_gtk_size_group_read_widget</read-widget-function>
|
||||
<write-widget-function>glade_gtk_size_group_write_widget</write-widget-function>
|
||||
@ -1806,11 +1750,11 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkWindowGroup" generic-name="windowgroup"
|
||||
_title="Window Group" libglade-unsupported="True" toplevel="True"/>
|
||||
_title="Window Group" toplevel="True"/>
|
||||
<glade-widget-class name="GtkAccelGroup" generic-name="accelgroup"
|
||||
_title="Accel Group" libglade-unsupported="True" toplevel="True"/>
|
||||
_title="Accel Group" toplevel="True"/>
|
||||
<glade-widget-class name="GtkAdjustment" generic-name="adjustment"
|
||||
_title="Adjustment" libglade-unsupported="True" toplevel="True">
|
||||
_title="Adjustment" toplevel="True">
|
||||
<write-widget-function>glade_gtk_adjustment_write_widget</write-widget-function>
|
||||
<properties>
|
||||
<property id="value" default="0.0" save="False"/>
|
||||
@ -1822,8 +1766,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkAction" generic-name="action" _title="Action"
|
||||
libglade-unsupported="True">
|
||||
<glade-widget-class name="GtkAction" generic-name="action" _title="Action">
|
||||
<post-create-function>glade_gtk_action_post_create</post-create-function>
|
||||
<create-editor-property-function>glade_gtk_widget_create_eprop</create-editor-property-function>
|
||||
<string-from-value-function>glade_gtk_widget_string_from_value</string-from-value-function>
|
||||
@ -1850,15 +1793,12 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkToggleAction" generic-name="toggleaction" _title="Toggle Action"
|
||||
libglade-unsupported="True"/>
|
||||
<glade-widget-class name="GtkRadioAction" generic-name="radioaction" _title="Radio Action"
|
||||
libglade-unsupported="True"/>
|
||||
<glade-widget-class name="GtkRecentAction" generic-name="recentaction" _title="Recent Action"
|
||||
libglade-unsupported="True" since="2.12"/>
|
||||
<glade-widget-class name="GtkToggleAction" generic-name="toggleaction" _title="Toggle Action" />
|
||||
<glade-widget-class name="GtkRadioAction" generic-name="radioaction" _title="Radio Action" />
|
||||
<glade-widget-class name="GtkRecentAction" generic-name="recentaction" _title="Recent Action" since="2.12"/>
|
||||
|
||||
<glade-widget-class name="GtkActionGroup" generic-name="actiongroup" _title="Action Group"
|
||||
libglade-unsupported="True" toplevel="True" use-placeholders="False">
|
||||
toplevel="True" use-placeholders="False">
|
||||
<add-child-function>glade_gtk_action_group_add_child</add-child-function>
|
||||
<remove-child-function>glade_gtk_action_group_remove_child</remove-child-function>
|
||||
<get-children-function>glade_gtk_action_group_get_children</get-children-function>
|
||||
@ -1868,10 +1808,10 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkEntryCompletion" generic-name="entrycompletion" _title="Entry Completion"
|
||||
libglade-unsupported="True" toplevel="True"/>
|
||||
toplevel="True"/>
|
||||
|
||||
<glade-widget-class name="GtkIconFactory" generic-name="iconfactory" _title="Icon Factory"
|
||||
libglade-unsupported="True" toplevel="True">
|
||||
toplevel="True">
|
||||
<post-create-function>glade_gtk_icon_factory_post_create</post-create-function>
|
||||
<read-widget-function>glade_gtk_icon_factory_read_widget</read-widget-function>
|
||||
<write-widget-function>glade_gtk_icon_factory_write_widget</write-widget-function>
|
||||
@ -1891,7 +1831,7 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkListStore" generic-name="liststore" _title="List Store"
|
||||
libglade-unsupported="True" toplevel="True">
|
||||
toplevel="True">
|
||||
<post-create-function>glade_gtk_store_post_create</post-create-function>
|
||||
<set-property-function>glade_gtk_store_set_property</set-property-function>
|
||||
<create-editor-property-function>glade_gtk_store_create_eprop</create-editor-property-function>
|
||||
@ -1918,7 +1858,7 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkTreeStore" generic-name="treestore" _title="Tree Store"
|
||||
libglade-unsupported="True" toplevel="True">
|
||||
toplevel="True">
|
||||
<set-property-function>glade_gtk_store_set_property</set-property-function>
|
||||
<create-editor-property-function>glade_gtk_store_create_eprop</create-editor-property-function>
|
||||
<create-editable-function>glade_gtk_store_create_editable</create-editable-function>
|
||||
@ -1944,11 +1884,11 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkTreeModelFilter" generic-name="treemodelfilter" _title="Tree Model Filter"
|
||||
libglade-unsupported="True" toplevel="True"/>
|
||||
toplevel="True"/>
|
||||
<glade-widget-class name="GtkTreeModelSort" generic-name="treemodelsort" _title="Tree Model Sort"
|
||||
libglade-unsupported="True" toplevel="True"/>
|
||||
toplevel="True"/>
|
||||
<glade-widget-class name="GtkTreeSelection" generic-name="treeselection" _title="Tree Selection"
|
||||
libglade-unsupported="True" toplevel="True"/>
|
||||
toplevel="True"/>
|
||||
|
||||
|
||||
<glade-widget-class name="GtkTreeView" generic-name="treeview" _title="Tree View">
|
||||
@ -1977,9 +1917,7 @@ embedded in another object</_tooltip>
|
||||
<value id="GTK_TREE_VIEW_GRID_LINES_BOTH" _name="Horizontal and Vertical"/>
|
||||
</displayable-values>
|
||||
</property>
|
||||
<property id="hadjustment" libglade-unsupported="True"/>
|
||||
<property id="vadjustment" libglade-unsupported="True"/>
|
||||
<property id="model" create-type="GtkListStore" query="True" libglade-unsupported="True"/>
|
||||
<property id="model" create-type="GtkListStore" query="True" />
|
||||
</properties>
|
||||
|
||||
<packing-properties>
|
||||
@ -1991,8 +1929,7 @@ embedded in another object</_tooltip>
|
||||
</packing-properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkTreeViewColumn" generic-name="treeviewcolumn" _title="Tree View Column"
|
||||
libglade-unsupported="True">
|
||||
<glade-widget-class name="GtkTreeViewColumn" generic-name="treeviewcolumn" _title="Tree View Column">
|
||||
<add-child-function>glade_gtk_cell_layout_add_child</add-child-function>
|
||||
<remove-child-function>glade_gtk_cell_layout_remove_child</remove-child-function>
|
||||
<get-children-function>glade_gtk_cell_layout_get_children</get-children-function>
|
||||
@ -2048,7 +1985,7 @@ embedded in another object</_tooltip>
|
||||
<property id="markup-column" disabled="True"/>
|
||||
<property id="pixbuf-column" disabled="True"/>
|
||||
<property id="reorderable" ignore="True"/>
|
||||
<property id="model" create-type="GtkListStore" query="True" libglade-unsupported="True"/>
|
||||
<property id="model" create-type="GtkListStore" query="True" />
|
||||
</properties>
|
||||
|
||||
<packing-properties>
|
||||
@ -2222,8 +2159,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkCellRendererText" generic-name="cellrenderertext" _title="Text Renderer"
|
||||
libglade-unsupported="True">
|
||||
<glade-widget-class name="GtkCellRendererText" generic-name="cellrenderertext" _title="Text Renderer" >
|
||||
<properties>
|
||||
<property id="editable-set" disabled="True"/>
|
||||
<property id="ellipsize-set" disabled="True"/>
|
||||
@ -2679,8 +2615,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkCellRendererAccel" generic-name="cellrendereraccel" _title="Accelerator Renderer"
|
||||
libglade-unsupported="True">
|
||||
<glade-widget-class name="GtkCellRendererAccel" generic-name="cellrendereraccel" _title="Accelerator Renderer" >
|
||||
<properties>
|
||||
<property id="accel-key" save="False" custom-layout="True"/>
|
||||
<property id="attr-accel-key" _name="Data column" save="False" default="-1" custom-layout="True">
|
||||
@ -2766,8 +2701,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkCellRendererCombo" generic-name="cellrenderercombo" _title="Combo Renderer"
|
||||
libglade-unsupported="True">
|
||||
<glade-widget-class name="GtkCellRendererCombo" generic-name="cellrenderercombo" _title="Combo Renderer" >
|
||||
|
||||
<signals>
|
||||
<signal id="changed" since="2.14"/>
|
||||
@ -2819,8 +2753,7 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
|
||||
<glade-widget-class name="GtkCellRendererSpin" generic-name="cellrendererspin" _title="Spin Renderer"
|
||||
libglade-unsupported="True">
|
||||
<glade-widget-class name="GtkCellRendererSpin" generic-name="cellrendererspin" _title="Spin Renderer" >
|
||||
<properties>
|
||||
<property id="adjustment" save="False" custom-layout="True"/>
|
||||
<property id="attr-adjustment" _name="Adjustment column" save="False" default="-1" custom-layout="True">
|
||||
@ -2866,8 +2799,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkCellRendererPixbuf" generic-name="cellrendererpixbuf" _title="Pixbuf Renderer"
|
||||
libglade-unsupported="True">
|
||||
<glade-widget-class name="GtkCellRendererPixbuf" generic-name="cellrendererpixbuf" _title="Pixbuf Renderer">
|
||||
|
||||
<properties>
|
||||
<property id="gicon" disabled="True"/>
|
||||
@ -2988,8 +2920,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkCellRendererProgress" generic-name="cellrendererprogress" _title="Progress Renderer"
|
||||
libglade-unsupported="True">
|
||||
<glade-widget-class name="GtkCellRendererProgress" generic-name="cellrendererprogress" _title="Progress Renderer" >
|
||||
<properties>
|
||||
<property id="orientation" save="False" custom-layout="True"/>
|
||||
<property id="attr-orientation" _name="Orientation column" save="False" default="-1" custom-layout="True">
|
||||
@ -3079,8 +3010,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkCellRendererSpinner" generic-name="cellrendererspinner" _title="Spinner Renderer"
|
||||
libglade-unsupported="True" since="2.20">
|
||||
<glade-widget-class name="GtkCellRendererSpinner" generic-name="cellrendererspinner" _title="Spinner Renderer" since="2.20">
|
||||
<properties>
|
||||
<property id="active" save="False" custom-layout="True"/>
|
||||
<property id="attr-active" _name="Active column" save="False" default="-1" custom-layout="True">
|
||||
@ -3127,8 +3057,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkCellRendererToggle" generic-name="cellrenderertoggle" _title="Toggle Renderer"
|
||||
libglade-unsupported="True">
|
||||
<glade-widget-class name="GtkCellRendererToggle" generic-name="cellrenderertoggle" _title="Toggle Renderer">
|
||||
<properties>
|
||||
<property id="activatable" save="False" custom-layout="True"/>
|
||||
<property id="attr-activatable" _name="Activatable column" save="False" default="-1" custom-layout="True">
|
||||
@ -3203,8 +3132,7 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
|
||||
<glade-widget-class name="GtkStatusIcon" generic-name="statusicon" _title="Status Icon"
|
||||
libglade-unsupported="True" toplevel="True">
|
||||
<glade-widget-class name="GtkStatusIcon" generic-name="statusicon" _title="Status Icon" toplevel="True">
|
||||
<properties>
|
||||
<property id="gicon" disabled="True" since="2.14"/>
|
||||
<property id="title" since="2.18" translatable="True"/>
|
||||
@ -3213,8 +3141,7 @@ embedded in another object</_tooltip>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkTextBuffer" generic-name="textbuffer" _title="Text Buffer"
|
||||
libglade-unsupported="True" toplevel="True">
|
||||
<glade-widget-class name="GtkTextBuffer" generic-name="textbuffer" _title="Text Buffer" toplevel="True">
|
||||
<post-create-function>glade_gtk_text_buffer_post_create</post-create-function>
|
||||
<set-property-function>glade_gtk_text_buffer_set_property</set-property-function>
|
||||
<signals>
|
||||
@ -3229,7 +3156,7 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkEntryBuffer" generic-name="entrybuffer" _title="Entry Buffer"
|
||||
libglade-unsupported="True" toplevel="True" since="2.18">
|
||||
toplevel="True" since="2.18">
|
||||
<post-create-function>glade_gtk_entry_buffer_post_create</post-create-function>
|
||||
<set-property-function>glade_gtk_entry_buffer_set_property</set-property-function>
|
||||
<properties>
|
||||
@ -3240,8 +3167,7 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
|
||||
<glade-widget-class name="GtkTextTag" generic-name="texttag" _title="Text Tag"
|
||||
libglade-unsupported="True" toplevel="True">
|
||||
<glade-widget-class name="GtkTextTag" generic-name="texttag" _title="Text Tag" toplevel="True">
|
||||
<properties>
|
||||
<property id="direction">
|
||||
<displayable-values>
|
||||
@ -3254,10 +3180,10 @@ embedded in another object</_tooltip>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkTextTagTable" generic-name="texttagtable" _title="Text Tag Table"
|
||||
libglade-unsupported="True" toplevel="True"/>
|
||||
toplevel="True"/>
|
||||
|
||||
<glade-widget-class name="GtkFileFilter" generic-name="filefilter" _title="File Filter"
|
||||
libglade-unsupported="True" toplevel="True"/>
|
||||
toplevel="True"/>
|
||||
</glade-widget-classes>
|
||||
|
||||
|
||||
|
||||
@ -550,7 +550,6 @@ refresh_notebook_tab_for_project (GladeWindow *window, GladeProject *project)
|
||||
|
||||
if (project == glade_design_view_get_project (GLADE_DESIGN_VIEW (view)))
|
||||
{
|
||||
GladeProjectFormat fmt = glade_project_get_format (project);
|
||||
gchar *path, *deps;
|
||||
|
||||
tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (window->priv->notebook), view);
|
||||
@ -572,12 +571,9 @@ refresh_notebook_tab_for_project (GladeWindow *window, GladeProject *project)
|
||||
deps = glade_project_display_dependencies (project);
|
||||
str = g_markup_printf_escaped (" <b>%s</b> %s \n"
|
||||
" %s \n"
|
||||
" <b>%s</b> %s \n"
|
||||
" <b>%s</b> %s ",
|
||||
_("Name:"), path,
|
||||
glade_project_get_readonly (project) ? READONLY_INDICATOR : "",
|
||||
_("Format:"),
|
||||
fmt == GLADE_PROJECT_FORMAT_GTKBUILDER ? "GtkBuilder" : "Libglade",
|
||||
_("Requires:"), deps);
|
||||
|
||||
gtk_widget_set_tooltip_markup (eventbox, str);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user