- Ya usa el SqlBatch puesto en Glade.
This commit is contained in:
Alejandro T. Colombini Gómez 2014-07-09 16:16:30 +02:00
parent e755daf539
commit f804ff4443
7 changed files with 16 additions and 42 deletions

View File

@ -19,7 +19,7 @@
//+++++++++++++++++++++++++++++++++++++++++++++++++++ GladeModelEditor //+++++++++++++++++++++++++++++++++++++++++++++++++++ GladeModelEditor
static void glade_model_editor_add_eprop (GladeModelEditor * obj, static void glade_model_editor_add_list_eprop (GladeModelEditor * obj,
GladeWidgetAdaptor * adaptor, const gchar * name, const gchar * tooltip) GladeWidgetAdaptor * adaptor, const gchar * name, const gchar * tooltip)
{ {
GtkWidget * frame, * alignment, * vbox; GtkWidget * frame, * alignment, * vbox;
@ -56,12 +56,12 @@ GtkWidget * glade_model_editor_new (GladeWidgetAdaptor * adaptor,
obj = g_object_new (GLADE_TYPE_MODEL_EDITOR, obj = g_object_new (GLADE_TYPE_MODEL_EDITOR,
"orientation", GTK_ORIENTATION_VERTICAL, NULL); "orientation", GTK_ORIENTATION_VERTICAL, NULL);
obj->base = GTK_WIDGET (editable); obj->base = GTK_WIDGET (editable);
gtk_box_pack_start (GTK_BOX (obj), GTK_WIDGET (editable), FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (obj), GTK_WIDGET (editable), TRUE, TRUE, 0);
glade_model_editor_add_eprop (obj, adaptor, "links", glade_model_editor_add_list_eprop (obj, adaptor, "links",
_("List of parameters linked to the model")); _("List of parameters linked to the model"));
glade_model_editor_add_eprop (obj, adaptor, "batch", glade_model_editor_add_list_eprop (obj, adaptor, "batch",
_("List of SqlHolders and identifiers")); _("List of SqlHolders and identifiers"));
gtk_widget_show_all (GTK_WIDGET (obj)); gtk_widget_show_all (GTK_WIDGET (obj));
@ -84,8 +84,8 @@ static void glade_model_editor_load (GladeEditable * editable, GladeWidget * wid
static void glade_model_editor_set_show_name (GladeEditable * editable, gboolean show_name) static void glade_model_editor_set_show_name (GladeEditable * editable, gboolean show_name)
{ {
GladeModelEditor * obj = GLADE_MODEL_EDITOR (editable); GladeModelEditor * obj = GLADE_MODEL_EDITOR (editable);
glade_editable_set_show_name (GLADE_EDITABLE (obj->base), show_name); glade_editable_set_show_name (GLADE_EDITABLE (obj->base), show_name);
} }
static void glade_model_editor_finalize (GObject * object) static void glade_model_editor_finalize (GObject * object)

View File

@ -382,8 +382,8 @@ static GtkWidget * glade_eprop_batch_create_input (GladeEditorProperty * eprop)
void glade_eprop_batch_finalize (GObject * object) void glade_eprop_batch_finalize (GObject * object)
{ {
GladeEPropLinks * obj = GLADE_EPROP_LINKS (object); GladeEPropBatch * obj = GLADE_EPROP_BATCH (object);
GObjectClass * parent = g_type_class_peek_parent (GLADE_EPROP_LINKS_GET_CLASS (obj)); GObjectClass * parent = g_type_class_peek_parent (GLADE_EPROP_BATCH_GET_CLASS (obj));
parent->finalize (G_OBJECT (obj)); parent->finalize (G_OBJECT (obj));
} }

View File

@ -340,12 +340,3 @@ GladeEditorProperty * glade_db_model_holder_create_eprop (GladeWidgetAdaptor * a
return eprop; return eprop;
} }
//+++++++++++++++++++++++++++++++++++++++++++++++++++ DbModel Action Callback
void glade_db_model_action_activate (GladeWidgetAdaptor * adaptor,
DbModel * model, const gchar * path)
{
glade_eprop_model_show_dialog (NULL,
(GObject *) glade_widget_get_from_gobject (model));
}

View File

@ -43,10 +43,6 @@
<create-editable-function>glade_db_model_create_editable</create-editable-function> <create-editable-function>glade_db_model_create_editable</create-editable-function>
<write-widget-function>glade_db_model_write_widget</write-widget-function> <write-widget-function>glade_db_model_write_widget</write-widget-function>
<read-widget-function>glade_db_model_read_widget</read-widget-function> <read-widget-function>glade_db_model_read_widget</read-widget-function>
<action-activate-function>glade_db_model_action_activate</action-activate-function>
<actions>
<action important="True" id="launch_editor" name="Edit&#8230;" stock="gtk-edit"/>
</actions>
</glade-widget-class> </glade-widget-class>
<glade-widget-class name="VnIterator" generic-name="iterator" title="Iterator" icon-name="widget-gtk-texttagtable"> <glade-widget-class name="VnIterator" generic-name="iterator" title="Iterator" icon-name="widget-gtk-texttagtable">

View File

@ -4,12 +4,12 @@
<item> <item>
<attribute name='label' translatable='yes'>Send</attribute> <attribute name='label' translatable='yes'>Send</attribute>
<attribute name='action'>win.send</attribute> <attribute name='action'>win.send</attribute>
<attribute name='accel'>&lt;Primary&gt;s</attribute> <attribute name='accel'>&lt;Shift&gt;s</attribute>
</item> </item>
<item> <item>
<attribute name='label' translatable='yes'>Clean</attribute> <attribute name='label' translatable='yes'>Clean</attribute>
<attribute name='action'>win.clean</attribute> <attribute name='action'>win.clean</attribute>
<attribute name='accel'>&lt;Primary&gt;c</attribute> <attribute name='accel'>&lt;Shift&gt;c</attribute>
</item> </item>
</menu> </menu>
</interface> </interface>

View File

@ -1,5 +1,3 @@
Vn cheader_filename="vn/vn.h" Vn cheader_filename="vn/vn.h"
Grid.append_columns skip=false
Form.@get type="unowned GLib.Object" Form.@get type="unowned GLib.Object"

View File

@ -53,6 +53,7 @@ static void vn_model_start_element (GMarkupParseContext * context,
VnModelData * d = data; VnModelData * d = data;
if (!g_strcmp0 (element, "link")) if (!g_strcmp0 (element, "link"))
{
for (i = 0; names[i]; i++) for (i = 0; names[i]; i++)
if (!g_strcmp0 (names[i], "field")) if (!g_strcmp0 (names[i], "field"))
d->fields = g_slist_prepend (d->fields, g_strdup (values[i])); d->fields = g_slist_prepend (d->fields, g_strdup (values[i]));
@ -63,6 +64,7 @@ static void vn_model_start_element (GMarkupParseContext * context,
gboolean b = values[i] && !g_strcmp0 (values[i], "True") ? TRUE : FALSE; gboolean b = values[i] && !g_strcmp0 (values[i], "True") ? TRUE : FALSE;
d->linked = g_slist_prepend (d->linked, GINT_TO_POINTER (b)); d->linked = g_slist_prepend (d->linked, GINT_TO_POINTER (b));
} }
}
else if (!g_strcmp0 (element, "holder")) else if (!g_strcmp0 (element, "holder"))
for (i = 0; names[i]; i++) for (i = 0; names[i]; i++)
if (!g_strcmp0 (names[i], "id")) if (!g_strcmp0 (names[i], "id"))
@ -112,10 +114,6 @@ static void vn_model_buildable_custom_finished (GtkBuildable * buildable,
if (!g_strcmp0 (tagname, "links")) if (!g_strcmp0 (tagname, "links"))
{ {
d->fields = g_slist_reverse (d->fields);
d->params = g_slist_reverse (d->params);
d->linked = g_slist_reverse (d->linked);
for (f = d->fields, p = d->params, l = d->linked; for (f = d->fields, p = d->params, l = d->linked;
f && p && l; f && p && l;
f = f->next, p = p->next, l = l->next) f = f->next, p = p->next, l = l->next)
@ -125,21 +123,15 @@ static void vn_model_buildable_custom_finished (GtkBuildable * buildable,
GvnParam * param = GVN_PARAM (gtk_builder_get_object (d->builder, p->data)); GvnParam * param = GVN_PARAM (gtk_builder_get_object (d->builder, p->data));
db_model_set_default_value_from_param (d->model, field, param, linked); db_model_set_default_value_from_param (d->model, field, param, linked);
g_free (f->data);
g_free (p->data);
} }
g_slist_free (d->fields); g_slist_free_full (d->fields, g_free);
g_slist_free (d->params); g_slist_free_full (d->params, g_free);
g_slist_free (d->linked); g_slist_free (d->linked);
g_slice_free (VnModelData, d); g_slice_free (VnModelData, d);
} }
else if (!g_strcmp0 (tagname, "batch")) else if (!g_strcmp0 (tagname, "batch"))
{ {
d->fields = g_slist_reverse (d->fields);
d->params = g_slist_reverse (d->params);
for (f = d->fields, p = d->params; for (f = d->fields, p = d->params;
f && p; f && p;
f = f->next, p = p->next) f = f->next, p = p->next)
@ -156,13 +148,10 @@ static void vn_model_buildable_custom_finished (GtkBuildable * buildable,
} }
else else
sql_batch_add_from_param (batch, id, param); sql_batch_add_from_param (batch, id, param);
g_free (f->data);
g_free (p->data);
} }
g_slist_free (d->fields); g_slist_free_full (d->fields, g_free);
g_slist_free (d->params); g_slist_free_full (d->params, g_free);
g_slice_free (VnModelData, d); g_slice_free (VnModelData, d);
} }
} }