Commit 1dd08365 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Filled in all since, deprecated and builder-unsupported properties.


	* plugins/gtk+/gtk+.xml.in: Filled in all since, deprecated and
	  builder-unsupported properties.

	* gladeui/glade-widget.c, gladeui/glade-widget.h, gladeui/glade-widget-adaptor.c,
	gladeui/glade-command.c, gladeui/glade-widget-adaptor.h,
	gladeui/glade-utils.h, gladeui/glade-catalog.c, 
	gladeui/glade-catalog.h, gladeui/glade-app.c, gladeui/glade-app.h, 
	gladeui/glade-property-class.c, gladeui/glade-property-class.h, 
	gladeui/glade-project.c, gladeui/glade-project.h:
	Added versioning support, you can always chose the target version of
	your project starting with gtk+ 2.8 - a project preferences dialog has
	been added where you can switch your format, switch your target version
	and test for incompatabilities. incompatability error dialogs are also
	launched on save as. Target versions are saved to the glade file; 
	TODO: patch GtkBuilder to test the required gtk+ version from
	<requires lib="gtk+" version="2.8"> and at least warn, also let
	third party widget developers test thier own versions using builder.

	* gladeui/glade-xml-utils.h, gladeui/glade-xml-utils.c: routines
	for parsing version numbers.


	* gladeui/glade-utils.c: glade_util_ui_message() takes a widget to
	embed arg now.


svn path=/trunk/; revision=1780
parent d62e5925
2008-04-09 Tristan Van Berkom <tvb@gnome.org>
* plugins/gtk+/gtk+.xml.in: Filled in all since, deprecated and
builder-unsupported properties.
* gladeui/glade-widget.c, gladeui/glade-widget.h, gladeui/glade-widget-adaptor.c,
gladeui/glade-command.c, gladeui/glade-widget-adaptor.h,
gladeui/glade-utils.h, gladeui/glade-catalog.c,
gladeui/glade-catalog.h, gladeui/glade-app.c, gladeui/glade-app.h,
gladeui/glade-property-class.c, gladeui/glade-property-class.h,
gladeui/glade-project.c, gladeui/glade-project.h:
Added versioning support, you can always chose the target version of
your project starting with gtk+ 2.8 - a project preferences dialog has
been added where you can switch your format, switch your target version
and test for incompatabilities. incompatability error dialogs are also
launched on save as. Target versions are saved to the glade file;
TODO: patch GtkBuilder to test the required gtk+ version from
<requires lib="gtk+" version="2.8"> and at least warn, also let
third party widget developers test thier own versions using builder.
* gladeui/glade-xml-utils.h, gladeui/glade-xml-utils.c: routines
for parsing version numbers.
* gladeui/glade-utils.c: glade_util_ui_message() takes a widget to
embed arg now.
2008-04-08 Tristan Van Berkom <tvb@gnome.org>
* NEWS: Rolling 3.5.0
......
......@@ -589,7 +589,7 @@ glade_app_config_save ()
/* Config dir exists but is not a directory */
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Trying to save private data to %s directory "
"but it is a regular file.\n"
"No private data will be saved in this session"),
......@@ -602,7 +602,7 @@ glade_app_config_save ()
/* Doesnt exist; failed to create */
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Failed to create directory %s to save private data.\n"
"No private data will be saved in this session"), config_dir);
error_shown = TRUE;
......@@ -630,7 +630,7 @@ glade_app_config_save ()
{
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Error writing private data to %s (%s).\n"
"No private data will be saved in this session"),
filename, error->message);
......@@ -642,7 +642,7 @@ glade_app_config_save ()
{
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Error serializing configuration data to save (%s).\n"
"No private data will be saved in this session"),
error->message);
......@@ -655,7 +655,7 @@ glade_app_config_save ()
{
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Error opening %s to write private data (%s).\n"
"No private data will be saved in this session"),
filename, error->message);
......@@ -729,6 +729,35 @@ glade_app_set_window (GtkWidget *window)
app->priv->window = window;
}
void
glade_app_get_catalog_version (const gchar *name, gint *major, gint *minor)
{
GladeApp *app = glade_app_get ();
GList *list;
for (list = app->priv->catalogs; list; list = list->next)
{
GladeCatalog *catalog = list->data;
if (strcmp (glade_catalog_get_name (catalog), name))
{
if (major)
*major = glade_catalog_get_major_version (catalog);
if (minor)
*minor = glade_catalog_get_minor_version (catalog);
return;
}
}
}
GList *
glade_app_get_catalogs (void)
{
GladeApp *app = glade_app_get ();
return app->priv->catalogs;
}
GtkWidget *
glade_app_get_window (void)
{
......@@ -1114,7 +1143,7 @@ glade_app_command_copy (void)
{
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_WARN,
GLADE_UI_WARN, NULL,
_("You cannot copy a widget "
"internal to a composite widget."));
failed = TRUE;
......@@ -1129,7 +1158,7 @@ glade_app_command_copy (void)
}
else if (widgets == NULL)
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_INFO,
GLADE_UI_INFO, NULL,
_("No widget selected."));
if (widgets) g_list_free (widgets);
......@@ -1167,7 +1196,7 @@ glade_app_command_cut (void)
{
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_WARN,
GLADE_UI_WARN, NULL,
_("You cannot cut a widget "
"internal to a composite widget."));
failed = TRUE;
......@@ -1182,7 +1211,7 @@ glade_app_command_cut (void)
}
else if (widgets == NULL)
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_INFO,
GLADE_UI_INFO, NULL,
_("No widget selected."));
if (widgets) g_list_free (widgets);
......@@ -1226,7 +1255,7 @@ glade_app_command_paste (GladePlaceholder *placeholder)
!glade_widget_adaptor_is_container (parent->adaptor))
{
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_INFO,
GLADE_UI_INFO, NULL,
_("Unable to paste to the selected parent"));
return;
}
......@@ -1237,7 +1266,7 @@ glade_app_command_paste (GladePlaceholder *placeholder)
if (g_list_length (list) != 1)
{
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_INFO,
GLADE_UI_INFO, NULL,
_("Unable to paste to multiple widgets"));
return;
......@@ -1247,7 +1276,7 @@ glade_app_command_paste (GladePlaceholder *placeholder)
/* Check if we have anything to paste */
if (g_list_length (clipboard->selection) == 0)
{
glade_util_ui_message (glade_app_get_window (), GLADE_UI_INFO,
glade_util_ui_message (glade_app_get_window (), GLADE_UI_INFO, NULL,
_("No widget selected on the clipboard"));
return;
......@@ -1273,7 +1302,7 @@ glade_app_command_paste (GladePlaceholder *placeholder)
else if (!GWA_IS_TOPLEVEL (widget->adaptor) && !parent)
{
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO,
GLADE_UI_INFO, NULL,
_("Unable to paste widget %s without a parent"),
widget->name);
return;
......@@ -1290,7 +1319,7 @@ glade_app_command_paste (GladePlaceholder *placeholder)
g_list_length (clipboard->selection) != 1)
{
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO,
GLADE_UI_INFO, NULL,
_("Only one widget can be pasted at a "
"time to this container"));
return;
......@@ -1302,7 +1331,7 @@ glade_app_command_paste (GladePlaceholder *placeholder)
glade_util_count_placeholders (parent) < placeholder_relations)
{
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO,
GLADE_UI_INFO, NULL,
_("Insufficient amount of placeholders in "
"target container"));
return;
......@@ -1341,7 +1370,7 @@ glade_app_command_delete (void)
{
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_WARN,
GLADE_UI_WARN, NULL,
_("You cannot delete a widget "
"internal to a composite widget."));
failed = TRUE;
......@@ -1356,7 +1385,7 @@ glade_app_command_delete (void)
}
else if (widgets == NULL)
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_INFO,
GLADE_UI_INFO, NULL,
_("No widget selected."));
if (widgets) g_list_free (widgets);
......@@ -1377,7 +1406,7 @@ glade_app_command_delete_clipboard (void)
clipboard = glade_app_get_clipboard ();
if (clipboard->selection == NULL)
glade_util_ui_message (glade_app_get_window (), GLADE_UI_INFO,
glade_util_ui_message (glade_app_get_window (), GLADE_UI_INFO, NULL,
_("No widget selected on the clipboard"));
for (list = clipboard->selection; list; list = list->next)
......@@ -1387,7 +1416,7 @@ glade_app_command_delete_clipboard (void)
{
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_WARN,
GLADE_UI_WARN, NULL,
_("You cannot delete a widget "
"internal to a composite widget."));
return;
......
......@@ -98,6 +98,9 @@ void glade_app_set_window (GtkWidget *window);
GtkWidget* glade_app_get_window (void);
void glade_app_get_catalog_version (const gchar *name, gint *major, gint *minor);
GList *glade_app_get_catalogs (void);
GladeEditor* glade_app_get_editor (void);
......
......@@ -37,6 +37,11 @@ typedef void (*GladeCatalogInitFunc) (void);
struct _GladeCatalog
{
gint major_version; /* The catalog version */
gint minor_version;
GList *targetable_versions; /* list of suitable version targets */
gchar *library; /* Library name for backend support */
gchar *name; /* Symbolic catalog name */
......@@ -141,6 +146,7 @@ catalog_allocate (void)
static GladeCatalog *
catalog_open (const gchar *filename)
{
GladeTargetableVersion *version;
GladeCatalog *catalog;
GladeXmlContext *context;
GladeXmlDoc *doc;
......@@ -177,7 +183,23 @@ catalog_open (const gchar *filename)
catalog_destroy (catalog);
return NULL;
}
glade_xml_get_property_version (root, GLADE_TAG_VERSION,
&catalog->major_version,
&catalog->minor_version);
/* Make one default suitable target */
version = g_new (GladeTargetableVersion, 1);
version->major = catalog->major_version;
version->minor = catalog->minor_version;
catalog->targetable_versions =
glade_xml_get_property_targetable_versions
(root, GLADE_TAG_TARGETABLE);
catalog->targetable_versions = g_list_prepend (catalog->targetable_versions, version);
catalog->library = glade_xml_get_property_string (root, GLADE_TAG_LIBRARY);
catalog->dep_catalog = glade_xml_get_property_string (root, GLADE_TAG_DEPENDS);
catalog->domain = glade_xml_get_property_string (root, GLADE_TAG_DOMAIN);
......@@ -535,6 +557,31 @@ glade_catalog_get_name (GladeCatalog *catalog)
return catalog->name;
}
gint
glade_catalog_get_major_version (GladeCatalog *catalog)
{
g_return_val_if_fail (catalog != NULL, 0);
return catalog->major_version;
}
gint
glade_catalog_get_minor_version (GladeCatalog *catalog)
{
g_return_val_if_fail (catalog != NULL, 0);
return catalog->minor_version;
}
GList *
glade_catalog_get_targets (GladeCatalog *catalog)
{
g_return_val_if_fail (catalog != NULL, NULL);
return catalog->targetable_versions;
}
GList *
glade_catalog_get_widget_groups (GladeCatalog *catalog)
{
......
......@@ -29,18 +29,28 @@ G_BEGIN_DECLS
#define GLADE_CATALOG(c) ((GladeCatalog *) c)
#define GLADE_IS_CATALOG(c) (c != NULL)
typedef struct _GladeCatalog GladeCatalog;
#define GLADE_WIDGET_GROUP(g) ((GladeWidgetGroup *) g)
#define GLADE_IS_WIDGET_GROUP(g) (g != NULL)
typedef struct _GladeCatalog GladeCatalog;
typedef struct _GladeWidgetGroup GladeWidgetGroup;
typedef struct {
gint major;
gint minor;
} GladeTargetableVersion;
const GList *glade_catalog_load_all (void);
const gchar *glade_catalog_get_name (GladeCatalog *catalog);
GList *glade_catalog_get_targets (GladeCatalog *catalog);
gint glade_catalog_get_major_version (GladeCatalog *catalog);
gint glade_catalog_get_minor_version (GladeCatalog *catalog);
GList *glade_catalog_get_widget_groups (GladeCatalog *catalog);
GList *glade_catalog_get_adaptors (GladeCatalog *catalog);
......
......@@ -1026,7 +1026,7 @@ glade_command_remove (GList *widgets)
if (widget->internal)
{
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_WARN,
GLADE_UI_WARN, NULL,
_("You cannot remove a widget internal to a composite widget."));
return;
}
......
This diff is collapsed.
......@@ -170,6 +170,8 @@ void glade_project_set_format (GladeProject *project, GladePro
GladeProjectFormat glade_project_get_format (GladeProject *project);
void glade_project_preferences (GladeProject *project);
G_END_DECLS
#endif /* __GLADE_PROJECT_H__ */
......@@ -65,6 +65,7 @@ glade_property_class_new (gpointer handle)
GladePropertyClass *property_class;
property_class = g_new0 (GladePropertyClass, 1);
property_class->origin_handle = handle;
property_class->handle = handle;
property_class->pspec = NULL;
property_class->id = NULL;
......@@ -110,8 +111,10 @@ glade_property_class_clone (GladePropertyClass *property_class)
clone = g_new0 (GladePropertyClass, 1);
/* copy ints over */
memcpy (clone, property_class, sizeof(GladePropertyClass));
/* Make sure we own our strings */
clone->pspec = property_class->pspec;
clone->id = g_strdup (clone->id);
clone->name = g_strdup (clone->name);
......@@ -1461,17 +1464,16 @@ 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);
/* 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);
/* Whether or not the property is translatable. This is only used for
* string properties.
*/
klass->translatable = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSLATABLE,
klass->translatable);
/* common, optional, etc */
klass->translatable = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSLATABLE, klass->translatable);
klass->common = glade_xml_get_property_boolean (node, GLADE_TAG_COMMON, klass->common);
klass->optional = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL, klass->optional);
klass->query = glade_xml_get_property_boolean (node, GLADE_TAG_QUERY, klass->query);
......
......@@ -26,6 +26,14 @@ struct _GladePropertyClass
gpointer handle; /* The GladeWidgetAdaptor that this property class
* was created for.
*/
gpointer origin_handle; /* The GladeWidgetAdaptor that this property class
* was introduced in.
*/
gint version_since_major; /* Version in which this property was
* introduced
*/
gint version_since_minor;
GParamSpec *pspec; /* The Parameter Specification for this property.
*/
......
......@@ -186,8 +186,9 @@ glade_utils_get_pspec_from_funcname (const gchar *funcname)
/**
* glade_util_ui_message:
* @parent: a #GtkWindow cast as a #GtkWidget
* @format: a printf style format string
* @type: a #GladeUIMessageType
* @widget: a #GtkWidget to append to the dialog vbox
* @format: a printf style format string
* @...: args for the format.
*
* Creates a new warning dialog window as a child of @parent containing
......@@ -198,9 +199,10 @@ glade_utils_get_pspec_from_funcname (const gchar *funcname)
* selected "OK", True if the @type was GLADE_UI_YES_OR_NO and
* the user selected "YES"; False otherwise.
*/
gboolean
gint
glade_util_ui_message (GtkWidget *parent,
GladeUIMessageType type,
GtkWidget *widget,
const gchar *format,
...)
{
......@@ -254,6 +256,12 @@ glade_util_ui_message (GtkWidget *parent,
buttons_type,
string);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
if (widget)
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox),
widget, TRUE, TRUE, 2);
response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
......@@ -506,7 +514,7 @@ add_format_options (GtkDialog *dialog,
GtkWidget *vbox, *frame;
GtkWidget *glade_radio, *builder_radio;
GtkWidget *label, *alignment;
gchar *string = g_strdup_printf ("<b>%s</b>", _("Select file format"));
gchar *string = g_strdup_printf ("<b>%s</b>", _("File format"));
frame = gtk_frame_new (NULL);
vbox = gtk_vbox_new (FALSE, 0);
......@@ -1308,7 +1316,7 @@ glade_util_copy_file (const gchar *src_path,
if (g_file_test (dest_path, G_FILE_TEST_IS_REGULAR) != FALSE)
if (glade_util_ui_message
(glade_app_get_window(), GLADE_UI_YES_OR_NO,
(glade_app_get_window(), GLADE_UI_YES_OR_NO, NULL,
_("%s exists.\nDo you want to replace it?"), dest_path) == FALSE)
return FALSE;
......@@ -1336,7 +1344,7 @@ glade_util_copy_file (const gchar *src_path,
if (write_status == G_IO_STATUS_ERROR)
{
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Error writing to %s: %s"),
dest_path, error->message);
error = (g_error_free (error), NULL);
......@@ -1350,7 +1358,7 @@ glade_util_copy_file (const gchar *src_path,
if (read_status == G_IO_STATUS_ERROR)
{
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Error reading %s: %s"),
src_path, error->message);
error = (g_error_free (error), NULL);
......@@ -1365,7 +1373,7 @@ glade_util_copy_file (const gchar *src_path,
{
glade_util_ui_message
(glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Error shutting down I/O channel %s: %s"),
dest_path, error->message);
error = (g_error_free (error), NULL);
......@@ -1375,7 +1383,7 @@ glade_util_copy_file (const gchar *src_path,
else
{
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Failed to open %s for writing: %s"),
dest_path, error->message);
error = (g_error_free (error), NULL);
......@@ -1386,7 +1394,7 @@ glade_util_copy_file (const gchar *src_path,
if (g_io_channel_shutdown (src, TRUE, &error) != G_IO_STATUS_NORMAL)
{
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Error shutting down io channel %s: %s"),
src_path, error->message);
success = FALSE;
......@@ -1395,7 +1403,7 @@ glade_util_copy_file (const gchar *src_path,
else
{
glade_util_ui_message (glade_app_get_window(),
GLADE_UI_ERROR,
GLADE_UI_ERROR, NULL,
_("Failed to open %s for reading: %s"),
src_path, error->message);
error = (g_error_free (error), NULL);
......@@ -1897,3 +1905,4 @@ glade_util_get_file_mtime (const gchar *filename, GError **error)
return info.st_mtime;
}
}
......@@ -6,7 +6,6 @@
G_BEGIN_DECLS
typedef enum _GladeUtilFileDialogType
{
GLADE_FILE_DIALOG_ACTION_OPEN,
......@@ -22,7 +21,6 @@ typedef enum
GLADE_UI_YES_OR_NO
} GladeUIMessageType;
void glade_util_widget_set_tooltip (GtkWidget *widget, const gchar *str);
GType glade_util_get_type_from_name (const gchar *name, gboolean have_func);
......@@ -31,6 +29,7 @@ GParamSpec *glade_utils_get_pspec_from_funcname (const gchar *funcname);
gboolean glade_util_ui_message (GtkWidget *parent,
GladeUIMessageType type,
GtkWidget *widget,
const gchar *format, ...);
void glade_util_flash_message (GtkWidget *statusbar,
......@@ -128,6 +127,9 @@ gboolean glade_util_url_show (const gchar *url);
time_t glade_util_get_file_mtime (const gchar *filename, GError **error);
gboolean glade_util_version_lesser_than (gdouble a, gdouble b);
G_END_DECLS
#endif /* __GLADE_UTILS_H__ */
......@@ -106,23 +106,6 @@ static GHashTable *adaptor_hash = NULL;
/*******************************************************************************
Helper functions
*******************************************************************************/
static GladeWidgetAdaptor *
gwa_get_parent_adaptor (GladeWidgetAdaptor *adaptor)
{
GladeWidgetAdaptor *parent_adaptor = NULL;
GType iter_type;
for (iter_type = g_type_parent (adaptor->type);
iter_type > 0;
iter_type = g_type_parent (iter_type))
{
if ((parent_adaptor =
glade_widget_adaptor_get_by_type (iter_type)) != NULL)
return parent_adaptor;
}
return NULL;
}
/*
This function assignes "weight" to each property in its natural order staring from 1.
......@@ -270,6 +253,31 @@ glade_abort_if_derived_adaptors_exist (GType type)
/*******************************************************************************
Base Object Implementation detail
*******************************************************************************/
#define gwa_get_parent_adaptor(a) glade_widget_adaptor_get_parent_adaptor (a)
/* XXX DOCME
*/
GladeWidgetAdaptor *
glade_widget_adaptor_get_parent_adaptor (GladeWidgetAdaptor *adaptor)
{
GladeWidgetAdaptor *parent_adaptor = NULL;
GType iter_type;
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
for (iter_type = g_type_parent (adaptor->type);
iter_type > 0;
iter_type = g_type_parent (iter_type))
{
if ((parent_adaptor =
glade_widget_adaptor_get_by_type (iter_type)) != NULL)
return parent_adaptor;
}
return NULL;
}
static gint
gwa_signal_comp (gconstpointer a, gconstpointer b)
{
......@@ -277,8 +285,16 @@ gwa_signal_comp (gconstpointer a, gconstpointer b)
return strcmp (signal_b->query.signal_name, signal_a->query.signal_name);
}
static gint
gwa_signal_find_comp (gconstpointer a, gconstpointer b)
{
const GladeSignalClass *signal = a;
const gchar *name = b;
return strcmp (name, signal->query.signal_name);
}
static void
gwa_add_signals (GList **signals, GType type)
gwa_add_signals (GladeWidgetAdaptor *adaptor, GList **signals, GType type)
{
guint count, *sig_ids, num_signals;
GladeSignalClass *cur;
......@@ -299,6 +315,7 @@ gwa_add_signals (GList **signals, GType type)
*/
g_assert (cur->query.signal_id != 0);
cur->adaptor = adaptor;
cur->name = (cur->query.signal_name);
cur->type = (gchar *) g_type_name (type);
......@@ -324,12 +341,12 @@ gwa_list_signals (GladeWidgetAdaptor *adaptor)
parent = g_type_parent (type);
/* Add class signals */
gwa_add_signals (&signals, type);
gwa_add_signals (adaptor, &signals, type);
/* Add class interfaces signals */
for (i = p = g_type_interfaces (type, NULL); *i; i++)
if (!glade_util_class_implements_interface (parent, *i))
gwa_add_signals (&signals, *i);
gwa_add_signals (adaptor, &signals, *i);
g_free (p);
}
......@@ -354,6 +371,13 @@ gwa_clone_parent_properties (GladeWidgetAdaptor *adaptor, gboolean is_packing)
GladePropertyClass *pclass =
glade_property_class_clone (list->data);
pclass->handle = adaptor;
/* Reset versioning in derived catalogs just once */
if (strcmp (adaptor->priv->catalog,
parent_adaptor->priv->catalog))
pclass->version_since_major =
pclass->version_since_major = 0;
properties = g_list_prepend (properties, pclass);
}
}
......@@ -488,6 +512,42 @@ gwa_inherit_child_packing (GladeWidgetAdaptor *adaptor)
return child_packings;
}
static void
gwa_inherit_signals (GladeWidgetAdaptor *adaptor)
{
GladeWidgetAdaptor *parent_adaptor;
GList *list, *node;
GladeSignalClass *signal, *parent_signal;
if ((parent_adaptor = gwa_get_parent_adaptor (adaptor)) != NULL)
{
for (list = adaptor->signals; list; list = list->next)
{
signal = list->data;
if ((node = g_list_find_custom
(parent_adaptor->signals, signal->name,
(GCompareFunc)gwa_signal_find_comp)) != NULL)
{
parent_signal = node->data;
/* Reset versioning in derived catalogs just once */
if (strcmp (adaptor->priv->catalog,
parent_adaptor->priv->catalog))
signal->version_since_major =
signal->version_since_major = 0;
else
{
signal->version_since_major =
parent_signal->version_since_major;
signal->version_since_minor =
parent_signal->version_since_minor;
}
}
}
}
}
static GObject *
glade_widget_adaptor_constructor (GType type,
guint n_construct_properties,
......@@ -521,12 +581,11 @@ glade_widget_adaptor_constructor (GType type,
{
/* Build signals & properties */
adaptor->signals = gwa_list_signals (adaptor);
gwa_inherit_signals (adaptor);
gwa_setup_properties (adaptor, object_class, FALSE);
gwa_setup_properties (adaptor, object_class, TRUE);
}
else
g_critical ("Failed to get class for type %s\n",
g_type_name (adaptor->type));
/* Inherit packing defaults here */
adaptor->child_packings = gwa_inherit_child_packing (adaptor);
......@@ -536,7 +595,14 @@ glade_widget_adaptor_constructor (GType type,
adaptor->priv->special_child_type =
parent_adaptor->priv->special_child_type ?
g_strdup (parent_adaptor->priv->special_child_type) : NULL;
/* Reset version numbering if we're in a new catalog just once */
if (parent_adaptor &&
strcmp (adaptor->priv->catalog, parent_adaptor->priv->catalog))
GLADE_WIDGET_ADAPTOR_GET_CLASS(adaptor)->version_since_major =
GLADE_WIDGET_ADAPTOR_GET_CLASS(adaptor)->version_since_minor = 0;
/* Copy parent actions */
if (parent_adaptor)
{
......@@ -1389,25 +1455,36 @@ gwa_derived_class_init (GladeWidgetAdaptorClass *adaptor_class,
/* Load catalog symbols from module */
if (module) gwa_extend_with_node_load_sym (adaptor_class, node, module);