summaryrefslogtreecommitdiff
path: root/src/trg-json-widgets.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-12-11 15:08:03 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-12-11 15:08:03 +0000
commit763abd8c8fc32b29c5f989cd0d4cab1b6e472997 (patch)
tree4ff54223e8526dbb20e9fe87e9c21d9a3b80975c /src/trg-json-widgets.c
parent0d08a471f9ebfdfadded6c92abc700c706475644 (diff)
oops, no tabs. (indent -kr -nut)
Diffstat (limited to 'src/trg-json-widgets.c')
-rw-r--r--src/trg-json-widgets.c113
1 files changed, 56 insertions, 57 deletions
diff --git a/src/trg-json-widgets.c b/src/trg-json-widgets.c
index 64cc757..e4e5ac5 100644
--- a/src/trg-json-widgets.c
+++ b/src/trg-json-widgets.c
@@ -35,8 +35,8 @@ void trg_json_widgets_save(GList * list, JsonObject * out)
{
GList *li;
for (li = list; li; li = g_list_next(li)) {
- trg_json_widget_desc *wd = (trg_json_widget_desc *) li->data;
- wd->saveFunc(wd->widget, out, wd->key);
+ trg_json_widget_desc *wd = (trg_json_widget_desc *) li->data;
+ wd->saveFunc(wd->widget, out, wd->key);
}
}
@@ -50,7 +50,7 @@ void trg_json_widget_desc_list_free(GList * list)
{
GList *li;
for (li = list; li; li = g_list_next(li))
- trg_json_widget_desc_free((trg_json_widget_desc *) li->data);
+ trg_json_widget_desc_free((trg_json_widget_desc *) li->data);
g_list_free(list);
}
@@ -58,13 +58,13 @@ void trg_json_widget_desc_list_free(GList * list)
void toggle_active_arg_is_sensitive(GtkToggleButton * b, gpointer data)
{
gtk_widget_set_sensitive(GTK_WIDGET(data),
- gtk_toggle_button_get_active(b));
+ gtk_toggle_button_get_active(b));
}
GtkWidget *trg_json_widget_check_new(GList ** wl, JsonObject * obj,
- const gchar * key,
- const gchar * label,
- GtkWidget * toggleDep)
+ const gchar * key,
+ const gchar * label,
+ GtkWidget * toggleDep)
{
GtkWidget *w = gtk_check_button_new_with_mnemonic(label);
trg_json_widget_desc *wd = g_new0(trg_json_widget_desc, 1);
@@ -74,15 +74,15 @@ GtkWidget *trg_json_widget_check_new(GList ** wl, JsonObject * obj,
wd->widget = w;
if (toggleDep) {
- gtk_widget_set_sensitive(w,
- gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON(toggleDep)));
- g_signal_connect(G_OBJECT(toggleDep), "toggled",
- G_CALLBACK(toggle_active_arg_is_sensitive), w);
+ gtk_widget_set_sensitive(w,
+ gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON(toggleDep)));
+ g_signal_connect(G_OBJECT(toggleDep), "toggled",
+ G_CALLBACK(toggle_active_arg_is_sensitive), w);
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
- json_object_get_boolean_member(obj, key));
+ json_object_get_boolean_member(obj, key));
*wl = g_list_append(*wl, wd);
@@ -90,8 +90,8 @@ GtkWidget *trg_json_widget_check_new(GList ** wl, JsonObject * obj,
}
GtkWidget *trg_json_widget_entry_new(GList ** wl, JsonObject * obj,
- const gchar * key,
- GtkWidget * toggleDep)
+ const gchar * key,
+ GtkWidget * toggleDep)
{
GtkWidget *w = gtk_entry_new();
trg_json_widget_desc *wd = g_new0(trg_json_widget_desc, 1);
@@ -101,15 +101,15 @@ GtkWidget *trg_json_widget_entry_new(GList ** wl, JsonObject * obj,
wd->widget = w;
if (toggleDep) {
- gtk_widget_set_sensitive(w,
- gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON(toggleDep)));
- g_signal_connect(G_OBJECT(toggleDep), "toggled",
- G_CALLBACK(toggle_active_arg_is_sensitive), w);
+ gtk_widget_set_sensitive(w,
+ gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON(toggleDep)));
+ g_signal_connect(G_OBJECT(toggleDep), "toggled",
+ G_CALLBACK(toggle_active_arg_is_sensitive), w);
}
gtk_entry_set_text(GTK_ENTRY(w),
- json_object_get_string_member(obj, key));
+ json_object_get_string_member(obj, key));
*wl = g_list_append(*wl, wd);
@@ -117,35 +117,35 @@ GtkWidget *trg_json_widget_entry_new(GList ** wl, JsonObject * obj,
}
static GtkWidget *trg_json_widget_spin_common_new(GList ** wl,
- JsonObject * obj,
- const gchar * key,
- GtkWidget * toggleDep,
- trg_json_widget_spin_type
- type, gint min, gint max,
- gdouble step)
+ JsonObject * obj,
+ const gchar * key,
+ GtkWidget * toggleDep,
+ trg_json_widget_spin_type
+ type, gint min, gint max,
+ gdouble step)
{
GtkWidget *w = gtk_spin_button_new_with_range(min, max, step);
trg_json_widget_desc *wd = g_new0(trg_json_widget_desc, 1);
JsonNode *node = json_object_get_member(obj, key);
if (type == TRG_JSON_WIDGET_SPIN_DOUBLE)
- wd->saveFunc = trg_json_widget_spin_save_double;
+ wd->saveFunc = trg_json_widget_spin_save_double;
else
- wd->saveFunc = trg_json_widget_spin_save_int;
+ wd->saveFunc = trg_json_widget_spin_save_int;
wd->key = g_strdup(key);
wd->widget = w;
if (toggleDep) {
- gtk_widget_set_sensitive(w,
- gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON(toggleDep)));
- g_signal_connect(G_OBJECT(toggleDep), "toggled",
- G_CALLBACK(toggle_active_arg_is_sensitive), w);
+ gtk_widget_set_sensitive(w,
+ gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON(toggleDep)));
+ g_signal_connect(G_OBJECT(toggleDep), "toggled",
+ G_CALLBACK(toggle_active_arg_is_sensitive), w);
}
gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
- json_node_really_get_double(node));
+ json_node_really_get_double(node));
*wl = g_list_append(*wl, wd);
@@ -153,53 +153,52 @@ static GtkWidget *trg_json_widget_spin_common_new(GList ** wl,
}
GtkWidget *trg_json_widget_spin_new_int(GList ** wl, JsonObject * obj,
- const gchar * key,
- GtkWidget * toggleDep, gint min,
- gint max, gint step)
+ const gchar * key,
+ GtkWidget * toggleDep, gint min,
+ gint max, gint step)
{
return trg_json_widget_spin_common_new(wl, obj, key, toggleDep,
- TRG_JSON_WIDGET_SPIN_INT, min,
- max, (gdouble) step);
+ TRG_JSON_WIDGET_SPIN_INT, min,
+ max, (gdouble) step);
}
GtkWidget *trg_json_widget_spin_new_double(GList ** wl, JsonObject * obj,
- const gchar * key,
- GtkWidget * toggleDep, gint min,
- gint max, gdouble step)
+ const gchar * key,
+ GtkWidget * toggleDep, gint min,
+ gint max, gdouble step)
{
return trg_json_widget_spin_common_new(wl, obj, key, toggleDep,
- TRG_JSON_WIDGET_SPIN_DOUBLE,
- min, max, step);
+ TRG_JSON_WIDGET_SPIN_DOUBLE,
+ min, max, step);
}
void trg_json_widget_check_save(GtkWidget * widget, JsonObject * obj,
- gchar * key)
+ gchar * key)
{
gboolean active =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
json_object_set_boolean_member(obj, key, active);
}
void trg_json_widget_entry_save(GtkWidget * widget, JsonObject * obj,
- gchar * key)
+ gchar * key)
{
json_object_set_string_member(obj, key,
- gtk_entry_get_text(GTK_ENTRY(widget)));
+ gtk_entry_get_text(GTK_ENTRY(widget)));
}
void trg_json_widget_spin_save_int(GtkWidget * widget, JsonObject * obj,
- gchar * key)
+ gchar * key)
{
- json_object_set_int_member(obj, key,
- (gint)
- gtk_spin_button_get_value(GTK_SPIN_BUTTON
- (widget)));
+ json_object_set_int_member(obj, key, (gint)
+ gtk_spin_button_get_value(GTK_SPIN_BUTTON
+ (widget)));
}
void trg_json_widget_spin_save_double(GtkWidget * widget, JsonObject * obj,
- gchar * key)
+ gchar * key)
{
json_object_set_double_member(obj, key,
- gtk_spin_button_get_value(GTK_SPIN_BUTTON
- (widget)));
+ gtk_spin_button_get_value(GTK_SPIN_BUTTON
+ (widget)));
}