Commit 351a89ed authored by Tristan Van Berkom's avatar Tristan Van Berkom

Now we have a conversion routine that is run in the plugin to convert some


	Now we have a conversion routine that is run in the plugin to
	convert some data for one format to another (builder on the way...)
	In this patch we use it to handle GtkAdjustment property conversions.
	(NOTE: Completely undoable)
	
	* gladeui/glade-editor-property.c: Made adjustment eprop fallback on
	  object dialog in builder cases.

	* gladeui/glade-command.[ch]: Added glade_command_set_project_format()

	* gladeui/gldae-catalog.c, gladeui/glade-xml-utils.h: Added GladeProjectConvertFunc

	* plugins/gtk+/Makefile.am, plugins/gtk+/glade-convert.c,
	plugins/gtk+/gtk+.xml.in: New file to handle conversion routines, 
	added some objects.


svn path=/trunk/; revision=1935
parent 0ff63d41
2008-09-19 Tristan Van Berkom <tvb@gnome.org>
Now we have a conversion routine that is run in the plugin to
convert some data for one format to another (builder on the way...)
In this patch we use it to handle GtkAdjustment property conversions.
(NOTE: Completely undoable)
* gladeui/glade-editor-property.c: Made adjustment eprop fallback on
object dialog in builder cases.
* gladeui/glade-command.[ch]: Added glade_command_set_project_format()
* gladeui/gldae-catalog.c, gladeui/glade-xml-utils.h: Added GladeProjectConvertFunc
* plugins/gtk+/Makefile.am, plugins/gtk+/glade-convert.c,
plugins/gtk+/gtk+.xml.in: New file to handle conversion routines,
added some objects.
2008-09-18 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* plugins/gtk+/gtk+.xml.in:
......
......@@ -10,3 +10,12 @@ Nice editor resizing by Pavel, needs fix for warning icons: http://bugzilla.gnom
Create Gtk+ Specialized widget group: http://bugzilla.gnome.org/show_bug.cgi?id=544845
No way to add menus to toolbar: http://bugzilla.gnome.org/show_bug.cgi?id=429438
GdkColor null values critical errors: http://bugzilla.gnome.org/show_bug.cgi?id=426345
Need proper conversion routine:
currently adjustments are saved as data in libglade and as objects in builder,
we need a conversion "routine" to be run, to create/remove the nescisary objects
and modify the project as needed when converts take place - this should also help
clean things up wrt the internal icon factory cache for pixbufs.
Its possible that as a result of project conversions, we will dump/lose our
command history.
......@@ -719,24 +719,37 @@ glade_app_set_window (GtkWidget *window)
app->priv->window = window;
}
void
glade_app_get_catalog_version (const gchar *name, gint *major, gint *minor)
GladeCatalog *
glade_app_get_catalog (const gchar *name)
{
GladeApp *app = glade_app_get ();
GList *list;
GladeApp *app = glade_app_get ();
GList *list;
GladeCatalog *catalog;
g_return_val_if_fail (name && name[0], NULL);
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;
}
catalog = list->data;
if (!strcmp (glade_catalog_get_name (catalog), name))
return catalog;
}
return NULL;
}
gboolean
glade_app_get_catalog_version (const gchar *name, gint *major, gint *minor)
{
GladeCatalog *catalog = glade_app_get_catalog (name);
g_return_val_if_fail (catalog != NULL, FALSE);
if (major)
*major = glade_catalog_get_major_version (catalog);
if (minor)
*minor = glade_catalog_get_minor_version (catalog);
return TRUE;
}
GList *
......
......@@ -26,6 +26,7 @@
#include <gladeui/glade-editor.h>
#include <gladeui/glade-palette.h>
#include <gladeui/glade-clipboard.h>
#include <gladeui/glade-catalog.h>
G_BEGIN_DECLS
......@@ -98,9 +99,11 @@ 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);
gboolean glade_app_get_catalog_version (const gchar *name, gint *major, gint *minor);
GList *glade_app_get_catalogs (void);
GladeCatalog *glade_app_get_catalog (const gchar *name);
GladeEditor* glade_app_get_editor (void);
......
......@@ -33,8 +33,6 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
typedef void (*GladeCatalogInitFunc) (const gchar *name);
struct _GladeCatalog
{
gint major_version; /* The catalog version */
......@@ -69,6 +67,8 @@ 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
......@@ -151,6 +151,7 @@ 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,
......@@ -214,6 +215,11 @@ catalog_open (const gchar *filename)
if (catalog->init_function_name)
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;
}
......@@ -719,3 +725,28 @@ widget_group_destroy (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;
}
......@@ -23,6 +23,7 @@
#define __GLADE_CATALOG_H__
#include <glib.h>
#include <gladeui/glade-xml-utils.h>
G_BEGIN_DECLS
......@@ -36,6 +37,33 @@ G_BEGIN_DECLS
typedef struct _GladeCatalog GladeCatalog;
typedef struct _GladeWidgetGroup GladeWidgetGroup;
/**
* GladeCatalogInitFunc:
* @name: The name of the catalog
*
* Called once at glade startup time for every catalog, catalogs
* are initialized in order of dependancies.
*/
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;
gint minor;
......@@ -68,6 +96,10 @@ 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);
G_END_DECLS
#endif /* __GLADE_CATALOG_H__ */
......@@ -475,11 +475,19 @@ 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))
pdata1->new_value, fmt))
return FALSE;
}
return TRUE;
......@@ -568,7 +576,8 @@ 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)
glade_command_set_property_description (GladeCommandSetProperty *me,
GladeProjectFormat fmt)
{
GCSetPropData *sdata;
gchar *description = NULL;
......@@ -583,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);
sdata->property->klass, sdata->new_value, fmt);
if (!value_name || strlen (value_name) > MAX_UNDO_MENU_ITEM_VALUE_LEN
|| strchr (value_name, '_')) {
......@@ -627,7 +636,8 @@ glade_command_set_properties_list (GladeProject *project, GList *props)
me->sdata = props;
cmd->description = NULL;
glade_command_push_group (glade_command_set_property_description (me));
glade_command_push_group (glade_command_set_property_description
(me, glade_project_get_format (project)));
glade_command_check_group (GLADE_COMMAND (me));
/* Push onto undo stack only if it executes successfully. */
......@@ -2078,3 +2088,165 @@ glade_command_set_i18n (GladeProperty *property, gboolean translatable, gboolean
}
/******************************************************************************
*
* 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 */
}
/**
* 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);
gchar *desc = g_strdup_printf (_("Converting %s to %s format"),
prj_name,
fmt == GLADE_PROJECT_FORMAT_LIBGLADE ? "libglade" : "Gtk+ Builder");
glade_command_push_group (desc);
g_free (desc);
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);
}
/* 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);
}
}
......@@ -85,6 +85,11 @@ gboolean glade_command_unifies (GladeCommand *command,
void glade_command_collapse (GladeCommand *command,
GladeCommand *other);
/************************** project *********************************/
void glade_command_set_project_format (GladeProject *project,
GladeProjectFormat fmt);
/************************** properties *********************************/
void glade_command_set_property (GladeProperty *property,
......
......@@ -91,6 +91,9 @@ void
glade_editor_property_commit (GladeEditorProperty *eprop,
GValue *value)
{
GladeProject *project;
GladeProjectFormat fmt;
g_return_if_fail (GLADE_IS_EDITOR_PROPERTY (eprop));
if (eprop->use_command == FALSE)
......@@ -98,11 +101,14 @@ glade_editor_property_commit (GladeEditorProperty *eprop,
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) != 0)
eprop->property->value, value, fmt) != 0)
GLADE_EDITOR_PROPERTY_GET_CLASS (eprop)->load (eprop, eprop->property);
}
......@@ -1233,6 +1239,7 @@ 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;
......@@ -1242,9 +1249,11 @@ 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)) != NULL)
eprop->klass, property->value, fmt)) != NULL)
{
gtk_entry_set_text (GTK_ENTRY (eprop_color->entry), text);
g_free (text);
......@@ -1549,6 +1558,7 @@ 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 */
......@@ -1556,6 +1566,8 @@ glade_eprop_text_load (GladeEditorProperty *eprop, GladeProperty *property)
if (property == NULL) return;
fmt = glade_project_get_format (property->widget->project);
if (GTK_IS_ENTRY (eprop_text->text_entry))
{
GtkEntry *entry = GTK_ENTRY (eprop_text->text_entry);
......@@ -1575,7 +1587,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);
property->klass, property->value, fmt);
gtk_text_buffer_set_text (buffer, text ? text : "", -1);
g_free (text);
}
......@@ -2213,6 +2225,7 @@ glade_eprop_resource_select_file (GtkButton *button, GladeEditorProperty *eprop)
static void
glade_eprop_resource_load (GladeEditorProperty *eprop, GladeProperty *property)
{
GladeProjectFormat fmt;
GladeEPropResource *eprop_resource = GLADE_EPROP_RESOURCE (eprop);
gchar *file;
......@@ -2221,9 +2234,11 @@ glade_eprop_resource_load (GladeEditorProperty *eprop, GladeProperty *property)
if (property == NULL) return;
fmt = glade_project_get_format (property->widget->project);
file = glade_widget_adaptor_string_from_value
(GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
eprop->klass, property->value);
eprop->klass, property->value, fmt);
if (file)
{
gtk_entry_set_text (GTK_ENTRY (eprop_resource->entry), file);
......@@ -2761,6 +2776,7 @@ 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;
......@@ -2769,9 +2785,11 @@ 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)) != NULL)
eprop->klass, property->value, fmt)) != NULL)
{
gtk_entry_set_text (GTK_ENTRY (eprop_object->entry), obj_name);
g_free (obj_name);
......@@ -2832,6 +2850,7 @@ 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;
......@@ -2840,9 +2859,11 @@ 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)) != NULL)
eprop->klass, property->value, fmt)) != NULL)
{
gtk_entry_set_text (GTK_ENTRY (eprop_objects->entry), obj_name);
g_free (obj_name);
......@@ -2992,6 +3013,11 @@ glade_eprop_objects_create_input (GladeEditorProperty *eprop)
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
......@@ -3062,6 +3088,7 @@ static void
glade_eprop_adjustment_load (GladeEditorProperty *eprop, GladeProperty *property)
{
GladeEPropAdjustment *eprop_adj = GLADE_EPROP_ADJUSTMENT (eprop);
GladeProjectFormat fmt;
GObject *object;
GtkAdjustment *adj;
......@@ -3070,46 +3097,76 @@ glade_eprop_adjustment_load (GladeEditorProperty *eprop, GladeProperty *property
if (property == NULL) return;
object = g_value_get_object (property->value);
if (object == NULL) return;
fmt = glade_project_get_format (property->widget->project);
adj = GTK_ADJUSTMENT (object);
/* Keep track of external adjustment changes */
g_signal_connect (object, "value-changed",
G_CALLBACK (glade_eprop_adj_value_changed),
eprop);
if (fmt == GLADE_PROJECT_FORMAT_LIBGLADE)
{
object = g_value_get_object (property->value);
if (object == NULL) return;
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 */
eprop_adj->value_adj->lower = adj->lower;
eprop_adj->value_adj->upper = adj->upper;
eprop_adj->value_adj->step_increment = adj->step_increment;
eprop_adj->value_adj->page_increment = adj->page_increment;
eprop_adj->value_adj->page_size = adj->page_size;
/* 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), adj->value);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->lower), adj->lower);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->upper), adj->upper);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->step_increment), adj->step_increment);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->page_increment), adj->page_increment);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->page_size), adj->page_size);
/* 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);
/* Update adjustment's values */
eprop_adj->value_adj->lower = adj->lower;
eprop_adj->value_adj->upper = adj->upper;
eprop_adj->value_adj->step_increment = adj->step_increment;
eprop_adj->value_adj->page_increment = adj->page_increment;
eprop_adj->value_adj->page_size = adj->page_size;
/* 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), adj->value);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->lower), adj->lower);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->upper), adj->upper);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->step_increment), adj->step_increment);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->page_increment), adj->page_increment);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_adj->page_size), adj->page_size);
/* 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_notebook_set_page (GTK_NOTEBOOK (eprop_adj->notebook), 0);
gtk_widget_show (eprop_adj->libglade);
}
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_page (GTK_NOTEBOOK (eprop_adj->notebook), 1);
gtk_widget_hide (eprop_adj->libglade);
}
gtk_widget_queue_resize (eprop_adj->notebook);
}
static GtkAdjustment *
......@@ -3184,7 +3241,7 @@ glade_eprop_adjustment_table_add_label (GtkTable *table,
}
static GtkWidget *
glade_eprop_adjustment_create_input (GladeEditorProperty *eprop)
glade_eprop_adjustment_create_input_libglade (GladeEditorProperty *eprop)
{
GladeEPropAdjustment *eprop_adj = GLADE_EPROP_ADJUSTMENT (eprop);
GtkWidget *widget;
......@@ -3250,6 +3307,50 @@ glade_eprop_adjustment_create_input (GladeEditorProperty *eprop)
return widget;
}
static GtkWidget *
glade_eprop_adjustment_create_input_builder (GladeEditorProperty *eprop)
{