VnColumnSpin:

- Eliminadas propiedades ya definidas en su cellrenderer interno.
VnConsulter:
	- Limpieza de codigo obsoleto.
This commit is contained in:
Juan Ferrer Toribio 2014-07-14 10:25:57 +02:00
parent cc827ae619
commit 9bea4cae33
5 changed files with 237 additions and 282 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.18.3 -->
<interface> <interface>
<requires lib="gtk+" version="3.0"/> <requires lib="gtk+" version="3.8"/>
<requires lib="vn" version="0.0"/> <requires lib="vn" version="0.0"/>
<!-- interface-local-resource-path ../image --> <!-- interface-local-resource-path ../image -->
<object class="GtkActionGroup" id="actions"> <object class="GtkActionGroup" id="actions">
@ -31,24 +31,17 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkListStore" id="model">
<columns>
<!-- column-name col -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkBox" id="main"> <object class="GtkBox" id="main">
<property name="height_request">300</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">8</property> <property name="border_width">6</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">8</property> <property name="spacing">5</property>
<child> <child>
<object class="GtkHBox" id="hbox"> <object class="GtkBox" id="box2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">8</property> <property name="spacing">4</property>
<child> <child>
<object class="GtkLabel" id="label"> <object class="GtkLabel" id="label">
<property name="visible">True</property> <property name="visible">True</property>
@ -71,7 +64,7 @@
<object class="GtkEntry" id="combo-entry"> <object class="GtkEntry" id="combo-entry">
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="activates_default">True</property> <property name="activates_default">True</property>
<property name="placeholder_text">Set on the code</property> <property name="placeholder_text" translatable="yes">Type or select a query</property>
<signal name="activate" handler="gtk_action_activate" object="send" swapped="yes"/> <signal name="activate" handler="gtk_action_activate" object="send" swapped="yes"/>
</object> </object>
</child> </child>
@ -82,32 +75,42 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
<property name="layout_style">start</property>
<child> <child>
<object class="GtkButton" id="button-send"> <object class="GtkButton" id="button-send">
<property name="label" translatable="yes">Send</property>
<property name="use_action_appearance">True</property> <property name="use_action_appearance">True</property>
<property name="related_action">send</property> <property name="related_action">send</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_underline">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">False</property>
<property name="position">2</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="button-clean"> <object class="GtkButton" id="button-clean">
<property name="label" translatable="yes">Clean</property>
<property name="use_action_appearance">True</property> <property name="use_action_appearance">True</property>
<property name="related_action">clean</property> <property name="related_action">clean</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_underline">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">3</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -122,7 +125,14 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">4</property> <property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -133,16 +143,37 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkVPaned" id="paned"> <object class="GtkPaned" id="paned1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="position">120</property> <property name="orientation">vertical</property>
<property name="position_set">True</property>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow"> <object class="GtkScrolledWindow" id="scrolledwindow-data">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="VnGrid" id="consulter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="grid-selection">
<property name="mode">multiple</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow-log">
<property name="height_request">100</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property> <property name="shadow_type">in</property>
<child> <child>
<object class="GtkTreeView" id="treeview"> <object class="GtkTreeView" id="treeview">
@ -154,7 +185,13 @@
<property name="fixed_height_mode">True</property> <property name="fixed_height_mode">True</property>
<property name="rubber_banding">True</property> <property name="rubber_banding">True</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/> <object class="GtkTreeSelection" id="treeview-selection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="column-log">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Log</property>
</object>
</child> </child>
</object> </object>
</child> </child>
@ -164,28 +201,6 @@
<property name="shrink">True</property> <property name="shrink">True</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="VnGrid" id="consulter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="grid-selection1">
<property name="mode">multiple</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@ -236,4 +251,10 @@
</packing> </packing>
</child> </child>
</object> </object>
<object class="GtkListStore" id="model">
<columns>
<!-- column-name col -->
<column type="gchararray"/>
</columns>
</object>
</interface> </interface>

View File

@ -20,6 +20,31 @@
#define FILE_KW "sql://" #define FILE_KW "sql://"
static const gchar * queries[] =
{
//MySQL (kk schema)
"/*my*/SELECT id, name, item_id, item_id2, amount, item.price "
"FROM movement JOIN item USING (item_id, item_id2)"
,"/*my*/SELECT item_id,item_id2, i.name, m.id, m.amount, m.price "
"FROM item i LEFT JOIN movement m USING (item_id, item_id2)"
,"/*my*/SELECT item_id, item_id2, name, price FROM item"
//PgSQL (test schema)
,"/*pg*/SELECT pg_sleep(120)"
,"/*pg*/SELECT i.id, i.name, i.color, m.id, m.amount "
"FROM item i LEFT JOIN movement m ON i.id = m.item_id"
,"/*pg*/SELECT m.id, amount, item_id, name, color "
"FROM movement m JOIN item ON m.item_id = item.id"
,"sql://example/consulter"
,"/*pg*/ SELECT id1, id2, name, ok, date, number, floating, image "
"FROM prueben"
,"/*pg*/ SELECT id1, number, floating FROM prueben LIMIT 1"
,"SELECT 1 f_integer, 'A' f_varchar, 1.1 f_double, TRUE f_boolean, NULL f_null"
};
G_DEFINE_TYPE (VnConsulter, vn_consulter, VN_TYPE_FORM); G_DEFINE_TYPE (VnConsulter, vn_consulter, VN_TYPE_FORM);
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private //+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
@ -49,6 +74,7 @@ static void vn_consulter_set_message (VnConsulter * obj, const gchar * msg)
static void vn_consulter_model_status_changed (DbModel * model, static void vn_consulter_model_status_changed (DbModel * model,
DbModelStatus status, VnConsulter * obj) DbModelStatus status, VnConsulter * obj)
{ {
gint i;
GList * n; GList * n;
GtkTreeView * tv = GTK_TREE_VIEW (obj->grid); GtkTreeView * tv = GTK_TREE_VIEW (obj->grid);
GList * cols = gtk_tree_view_get_columns (tv); GList * cols = gtk_tree_view_get_columns (tv);
@ -61,96 +87,111 @@ static void vn_consulter_model_status_changed (DbModel * model,
g_list_free (cols); g_list_free (cols);
switch (status) if (status == DB_MODEL_STATUS_READY)
{
case DB_MODEL_STATUS_READY:
{
gint i;
for (i = 0; i < db_model_get_ncols (model); i++) for (i = 0; i < db_model_get_ncols (model); i++)
{ {
VnColumn * column; VnColumn * column;
GType col_type, type = db_model_get_column_type (model, i); GType col_type, type = db_model_get_column_type (model, i);
gboolean image = FALSE; const gchar * colname = db_model_get_column_name (model, i);
gchar * format = NULL;
/*col_type = VN_TYPE_COLUMN_ENTRY; switch (type)
if (type == G_TYPE_INT) {
format = "%d"; case G_TYPE_BOOLEAN:
else if (type == G_TYPE_UINT)
format = "%u";
else*/
if (type == G_TYPE_FLOAT || type == G_TYPE_DOUBLE
|| type == G_TYPE_INT || type == G_TYPE_UINT)
col_type = VN_TYPE_COLUMN_SPIN;
//format = "%.2f";
else if (type == G_TYPE_BYTES)
col_type = VN_TYPE_COLUMN_IMAGE;
else if (type == G_TYPE_BOOLEAN)
col_type = VN_TYPE_COLUMN_CHECK; col_type = VN_TYPE_COLUMN_CHECK;
//format = "%b"; break;
else if (type == G_TYPE_STRING && !g_utf8_collate case G_TYPE_INT:
(g_utf8_casefold (db_model_get_column_name (model, i), -1) case G_TYPE_UINT:
,g_utf8_casefold ("image", -1))) case G_TYPE_FLOAT:
{ case G_TYPE_DOUBLE:
image = TRUE; col_type = VN_TYPE_COLUMN_SPIN;
col_type = VN_TYPE_COLUMN_IMAGE; break;
} default:
/*else if (type == G_TYPE_DATE) if (g_strcmp0 (colname, "image"))
format = "%Y-%m-%d";
else if (type == G_TYPE_DATE_TIME)
format = "%Y-%m-%d %T";
*/ else
{
col_type = VN_TYPE_COLUMN_ENTRY; col_type = VN_TYPE_COLUMN_ENTRY;
//format = "%s"; else
col_type = VN_TYPE_COLUMN_IMAGE;
} }
column = g_object_new (col_type column = g_object_new (col_type
,"title", db_model_get_column_name (model, i) ,"title", colname
,"column-index", i ,"column-index", i
,"editable", TRUE ,"editable", TRUE
,"expand", FALSE ,"expand", FALSE
,"resizable", TRUE
,NULL ,NULL
); );
// Cofigures the numeric columns
if (col_type == VN_TYPE_COLUMN_SPIN)
{
guint min_width = 100;
guint digits = 0;
gdouble climb_rate = 0.5;
GtkCellRenderer * cell;
GtkAdjustment * adjustment = NULL;
switch (type)
{
case G_TYPE_INT:
adjustment = gtk_adjustment_new (
0, G_MININT, G_MAXINT, 1, 1, 0);
break;
case G_TYPE_UINT:
adjustment = gtk_adjustment_new (
0, 0, G_MAXUINT, 1, 1, 0);
break;
case G_TYPE_FLOAT:
adjustment = gtk_adjustment_new (
0, G_MINFLOAT, G_MAXFLOAT, 0.1, 1, 0);
break;
case G_TYPE_DOUBLE:
adjustment = gtk_adjustment_new (
0, G_MINDOUBLE, G_MAXDOUBLE, 0.1, 1, 0);
break;
}
switch (type)
{
case G_TYPE_FLOAT:
case G_TYPE_DOUBLE:
digits = 2;
climb_rate = 0.1;
min_width = 120;
}
g_object_set (column
,"digits", digits
,"min-width", min_width
,NULL
);
cell = vn_column_get_cell_renderer (column);
g_object_set (cell
,"adjustment", adjustment
,"climb_rate", climb_rate
,"digits", digits
,NULL
);
}
// Cofigures the image columns
if (col_type == VN_TYPE_COLUMN_IMAGE)
g_object_set (column
,"host", "www.verdnatura.es"
,"path", "image/cache/catalog/icon"
,"tooltip-path", "../full"
,NULL
);
// Appends the column to the grid
gtk_tree_view_append_column (GTK_TREE_VIEW (obj->grid), gtk_tree_view_append_column (GTK_TREE_VIEW (obj->grid),
GTK_TREE_VIEW_COLUMN (column)); GTK_TREE_VIEW_COLUMN (column));
if (format)
g_object_set (column, "format", format, NULL);
if (type == G_TYPE_INT)
g_object_set (column,
"lower", (gdouble)G_MININT,
"upper", (gdouble)G_MAXINT,
NULL);
else if (type == G_TYPE_UINT)
g_object_set (column,
"upper", (gdouble)G_MAXUINT,
NULL);
else if (type == G_TYPE_FLOAT || type == G_TYPE_DOUBLE)
g_object_set (column,
"digits", 2,
"lower", -1000.0,
"upper", 1000.0,
"step-increment", 0.1,
NULL);
else
if (image)
g_object_set (column,
"host", "www.verdnatura.es",
"path", "image/cache/catalog/icon",
"tooltip-path", "../full",
NULL);
} }
else if (status == DB_MODEL_STATUS_ERROR)
break;
}
case DB_MODEL_STATUS_ERROR:
vn_consulter_set_message (obj, "Error"); vn_consulter_set_message (obj, "Error");
break;
default:
break;
}
gtk_widget_set_sensitive (GTK_WIDGET (obj->mode), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (obj->mode), TRUE);
} }
@ -202,46 +243,23 @@ void vn_consulter_send (GtkButton * button, VnConsulter * obj)
static void vn_consulter_open (VnConsulter * obj) static void vn_consulter_open (VnConsulter * obj)
{ {
gint i; gint i;
GtkCellRenderer * cell;
GtkTreeViewColumn * column;
VnForm * form = VN_FORM (obj); VnForm * form = VN_FORM (obj);
obj->file = g_strconcat
(FILE_KW, vn_mod_get_name (form->mod), "/consulter", NULL);
gchar * queries[] =
{
//MySQL (kk schema)
"/*my*/SELECT id, name, item_id, item_id2, amount, item.price "
"FROM movement JOIN item USING (item_id, item_id2)"
,"/*my*/SELECT item_id,item_id2, i.name, m.id, m.amount, m.price "
"FROM item i LEFT JOIN movement m USING (item_id, item_id2)"
,"/*my*/SELECT item_id, item_id2, name, price FROM item"
//PgSQL (test schema)
,"/*pg*/SELECT pg_sleep(120)"
,"/*pg*/SELECT i.id, i.name, i.color, m.id, m.amount "
"FROM item i LEFT JOIN movement m ON i.id = m.item_id"
,"/*pg*/SELECT m.id, amount, item_id, name, color "
"FROM movement m JOIN item ON m.item_id = item.id"
,obj->file
,"/*pg*/ SELECT id1, id2, name, ok, date, number, floating, image "
"FROM prueben"
,"/*pg*/ SELECT id1, number, floating FROM prueben LIMIT 1"
,"SELECT 1, 'A', 1.1, TRUE, NULL"
,NULL
};
obj->model = vn_form_get (form, "model"); obj->model = vn_form_get (form, "model");
obj->combo = vn_form_get (form, "query"); obj->combo = vn_form_get (form, "query");
obj->tv = vn_form_get (form, "treeview"); obj->tv = vn_form_get (form, "treeview");
obj->mode = vn_form_get (form, "mode"); obj->mode = vn_form_get (form, "mode");
obj->grid = vn_form_get (form, "consulter"); obj->grid = vn_form_get (form, "consulter");
obj->handler = vn_form_get (form, "handler"); obj->handler = vn_form_get (form, "handler");
gtk_entry_set_placeholder_text (vn_form_get (form, "combo-entry"),
_("Type or select a query"));
gtk_tree_view_insert_column_with_attributes (obj->tv, -1, _("Message"), column = vn_form_get (form, "column-log");
gtk_cell_renderer_text_new (), "text", 0, NULL); cell = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, cell, TRUE);
gtk_tree_view_column_add_attribute (column, cell, "text", 0);
for (i = 0; i < g_strv_length (queries); i++) for (i = 0; i < G_N_ELEMENTS (queries); i++)
gtk_combo_box_text_prepend_text (obj->combo, queries[i]); gtk_combo_box_text_prepend_text (obj->combo, queries[i]);
} }

View File

@ -31,27 +31,11 @@ static void vn_column_spin_on_edited (GtkCellRendererSpin * cell,
const gchar * path, gchar * text, VnColumnSpin * obj) const gchar * path, gchar * text, VnColumnSpin * obj)
{ {
GValue value = G_VALUE_INIT; GValue value = G_VALUE_INIT;
DbModelStatus status = db_model_get_status (vn_column_get_model (VN_COLUMN (obj)));
if (status != DB_MODEL_STATUS_READY)
return;
if (g_strcmp0 (text, "")) if (g_strcmp0 (text, ""))
{ {
gchar * err;
if (!err || *err == '\0')
{
gdouble val, min, max;
g_object_get (obj->adjustment, "lower", &min, "upper", &max, NULL);
val = CLAMP (g_strtod (text, &err), min, max);
g_value_init (&value, G_TYPE_DOUBLE); g_value_init (&value, G_TYPE_DOUBLE);
g_value_set_double (&value, val); g_value_set_double (&value, g_strtod (text, NULL));
g_object_set (obj->adjustment, "value", val, NULL);
}
else
return;
} }
else else
g_value_init (&value, GVN_TYPE_NULL); g_value_init (&value, GVN_TYPE_NULL);
@ -148,11 +132,7 @@ static void vn_column_spin_set_value (VnColumnSpin * obj, GtkTreeModel * model,
enum enum
{ {
PROP_CLIMB_RATE = 1 PROP_DIGITS = 1
,PROP_DIGITS
,PROP_LOWER
,PROP_UPPER
,PROP_STEP
}; };
static void vn_column_spin_set_property (VnColumnSpin * obj, guint id, static void vn_column_spin_set_property (VnColumnSpin * obj, guint id,
@ -160,9 +140,6 @@ static void vn_column_spin_set_property (VnColumnSpin * obj, guint id,
{ {
switch (id) switch (id)
{ {
case PROP_CLIMB_RATE:
g_object_set (VN_COLUMN (obj)->cell, "climb-rate", g_value_get_double (value), NULL);
break;
case PROP_DIGITS: case PROP_DIGITS:
{ {
guint digits = g_value_get_uint (value); guint digits = g_value_get_uint (value);
@ -171,18 +148,6 @@ static void vn_column_spin_set_property (VnColumnSpin * obj, guint id,
obj->format = g_strdup_printf ("%%.%df", digits); obj->format = g_strdup_printf ("%%.%df", digits);
break; break;
} }
case PROP_LOWER:
g_object_set (obj->adjustment, "lower", g_value_get_double (value), NULL);
break;
case PROP_UPPER:
g_object_set (obj->adjustment, "upper", g_value_get_double (value), NULL);
break;
case PROP_STEP:
g_object_set (obj->adjustment,
"step-increment", g_value_get_double (value),
"page-increment", g_value_get_double (value) * 10,
NULL);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
} }
@ -193,21 +158,9 @@ static void vn_column_spin_get_property (VnColumnSpin * obj, guint id,
{ {
switch (id) switch (id)
{ {
case PROP_CLIMB_RATE:
g_object_get_property (G_OBJECT (VN_COLUMN (obj)->cell), "climb-rate", value);
break;
case PROP_DIGITS: case PROP_DIGITS:
g_object_get_property (G_OBJECT (VN_COLUMN (obj)->cell), "digits", value); g_object_get_property (G_OBJECT (VN_COLUMN (obj)->cell), "digits", value);
break; break;
case PROP_LOWER:
g_object_get_property (G_OBJECT (obj->adjustment), "lower", value);
break;
case PROP_UPPER:
g_object_get_property (G_OBJECT (obj->adjustment), "upper", value);
break;
case PROP_STEP:
g_object_get_property (G_OBJECT (obj->adjustment), "step-increment", value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
} }
@ -215,19 +168,16 @@ static void vn_column_spin_get_property (VnColumnSpin * obj, guint id,
static void vn_column_spin_init (VnColumnSpin * obj) static void vn_column_spin_init (VnColumnSpin * obj)
{ {
GtkCellRenderer * cell = gtk_cell_renderer_spin_new (); GtkCellRenderer * cell;
obj->adjustment = gtk_adjustment_new (0.0, G_MININT, G_MAXINT, 0.0, 1.0, 0.0); obj->format = NULL;
cell = gtk_cell_renderer_spin_new ();
g_object_set (cell g_object_set (cell
,"adjustment", obj->adjustment
,"xalign", 1.0 ,"xalign", 1.0
,"alignment", PANGO_ALIGN_RIGHT ,"alignment", PANGO_ALIGN_RIGHT
,NULL ,NULL
); );
obj->format = NULL;
VN_COLUMN_GET_CLASS (obj)->set_renderer (VN_COLUMN (obj), cell); VN_COLUMN_GET_CLASS (obj)->set_renderer (VN_COLUMN (obj), cell);
} }
@ -246,14 +196,6 @@ static void vn_column_spin_class_init (VnColumnSpinClass * klass)
col_k->set_value = (VnColumnSetValueFunc) vn_column_spin_set_value; col_k->set_value = (VnColumnSetValueFunc) vn_column_spin_set_value;
col_k->set_editable = (VnColumnSetEditableFunc) vn_column_spin_set_editable; col_k->set_editable = (VnColumnSetEditableFunc) vn_column_spin_set_editable;
g_object_class_install_property (k, PROP_CLIMB_RATE,
g_param_spec_double ("climb-rate"
,_("Climb rate")
,_("The acceleration rate when you hold down a button.")
,0.0 ,G_MAXDOUBLE ,0.0
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
));
g_object_class_install_property (k, PROP_DIGITS, g_object_class_install_property (k, PROP_DIGITS,
g_param_spec_uint ("digits" g_param_spec_uint ("digits"
,_("Digits") ,_("Digits")
@ -261,28 +203,4 @@ static void vn_column_spin_class_init (VnColumnSpinClass * klass)
,0 ,20 ,0 ,0 ,20 ,0
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE ,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
)); ));
g_object_class_install_property (k, PROP_LOWER,
g_param_spec_double ("lower"
,_("Minimum value")
,_("The minimum value of the internal adjustment.")
,-G_MAXDOUBLE ,G_MAXDOUBLE ,-G_MAXDOUBLE
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
));
g_object_class_install_property (k, PROP_UPPER,
g_param_spec_double ("upper"
,_("Maximum value")
,_("The maximum value of the internal adjustment.")
,-G_MAXDOUBLE ,G_MAXDOUBLE ,G_MAXDOUBLE
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
));
g_object_class_install_property (k, PROP_STEP,
g_param_spec_double ("step-increment"
,_("Step Increment")
,_("The step increment of the internal adjustment")
,0.00000000000000000001 ,10000000000.0 ,1.0
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
));
} }

View File

@ -33,7 +33,6 @@ typedef struct _VnColumnSpinClass VnColumnSpinClass;
struct _VnColumnSpin struct _VnColumnSpin
{ {
VnColumn parent; VnColumn parent;
GtkAdjustment * adjustment;
gchar * format; gchar * format;
}; };

View File

@ -55,14 +55,14 @@ static void vn_column_value_changed (VnColumn * obj, const gchar * path, const G
static void vn_column_data_func (GtkTreeViewColumn * col, GtkCellRenderer * cell, static void vn_column_data_func (GtkTreeViewColumn * col, GtkCellRenderer * cell,
GtkTreeModel * model, GtkTreeIter * iter, VnColumn * obj) GtkTreeModel * model, GtkTreeIter * iter, VnColumn * obj)
{ {
GdkRGBA * background; /* GdkRGBA * background;
DbIter dbiter; DbIter dbiter;
DbModelRowOp ops; DbModelRowOp ops;
*/
GValue value = G_VALUE_INIT; GValue value = G_VALUE_INIT;
gtk_tree_model_get_value (model, iter, obj->column_index, &value); gtk_tree_model_get_value (model, iter, obj->column_index, &value);
obj->set_value (obj, model, iter, cell, &value); obj->set_value (obj, model, iter, cell, &value);
/*
vn_gtk_tree_iter_to_db_iter (iter, &dbiter); vn_gtk_tree_iter_to_db_iter (iter, &dbiter);
ops = db_model_get_row_operations ( ops = db_model_get_row_operations (
vn_grid_model_get_model (VN_GRID_MODEL (model)) vn_grid_model_get_model (VN_GRID_MODEL (model))
@ -76,9 +76,8 @@ static void vn_column_data_func (GtkTreeViewColumn * col, GtkCellRenderer * cell
else else
background = NULL; background = NULL;
if (background)
g_object_set (cell, "cell-background-rgba", background, NULL); g_object_set (cell, "cell-background-rgba", background, NULL);
*/
if (obj->style_func) if (obj->style_func)
obj->style_func (VN_COLUMN (col), cell, iter, &value); obj->style_func (VN_COLUMN (col), cell, iter, &value);