summaryrefslogtreecommitdiff
path: root/src/trg-json-widgets.h
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-06 22:28:09 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-06 22:28:09 +0000
commitc8a12c44dd8a44d3f44190fc18d7df5346ef9dbb (patch)
tree02561e43fd19b36053132258580c5e17da859b70 /src/trg-json-widgets.h
parentebeb4eb92a8334eb90f748c3c752c3e09a54a968 (diff)
big refactoring of the trg-remote-preferences and trg-torrent-props to reduce duplicated code. looks much nicer now.
Diffstat (limited to 'src/trg-json-widgets.h')
-rw-r--r--src/trg-json-widgets.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/trg-json-widgets.h b/src/trg-json-widgets.h
index 792c9fb..a82818b 100644
--- a/src/trg-json-widgets.h
+++ b/src/trg-json-widgets.h
@@ -23,18 +23,33 @@
#include <gtk/gtk.h>
#include <json-glib/json-glib.h>
-#define JSON_OBJECT_KEY "json-object-key"
-#define JSON_OBJECT_VALUE "json-object-value"
-
-void widget_set_json_key(GtkWidget * w, gchar * key);
-
-void gtk_spin_button_json_int_out(GtkSpinButton * spin, JsonObject * out);
-void gtk_spin_button_json_double_out(GtkSpinButton * spin,
- JsonObject * out);
-gboolean gtk_toggle_button_json_out(GtkToggleButton * button,
- JsonObject * out);
-void gtk_entry_json_output(GtkEntry * e, JsonObject * out);
-void gtk_combo_box_json_string_output(GtkComboBox * c, JsonObject * out);
+typedef struct {
+ GtkWidget *widget;
+ gchar *key;
+ void (*saveFunc)(GtkWidget *widget, JsonObject *obj, gchar *key);
+} trg_json_widget_desc;
+
+typedef enum {
+ TRG_JSON_WIDGET_SPIN_INT,
+ TRG_JSON_WIDGET_SPIN_DOUBLE
+} trg_json_widget_spin_type;
+
void toggle_active_arg_is_sensitive(GtkToggleButton * b, gpointer data);
+GtkWidget *trg_json_widget_check_new(GList **wl, JsonObject *obj, const gchar *key, const gchar *label, GtkWidget *toggleDep);
+GtkWidget *trg_json_widget_entry_new(GList **wl, JsonObject *obj, const gchar *key, GtkWidget *toggleDep);
+GtkWidget *trg_json_widget_spin_new_int(GList **wl, JsonObject *obj, const gchar *key, GtkWidget *toggleDep,
+ gint min, gint max, gint step);
+GtkWidget *trg_json_widget_spin_new_double(GList **wl, JsonObject *obj, const gchar *key, GtkWidget *toggleDep,
+ gint min, gint max, gdouble step);
+
+void trg_json_widget_check_save(GtkWidget *widget, JsonObject *obj, gchar *key);
+void trg_json_widget_entry_save(GtkWidget *widget, JsonObject *obj, gchar *key);
+void trg_json_widget_spin_save_int(GtkWidget *widget, JsonObject *obj, gchar *key);
+void trg_json_widget_spin_save_double(GtkWidget *widget, JsonObject *obj, gchar *key);
+
+void trg_json_widget_desc_free(trg_json_widget_desc *wd);
+void trg_json_widget_desc_list_free(GList *list);
+void trg_json_widgets_save(GList *list, JsonObject *out);
+
#endif /* TRG_JSON_WIDGETS_H_ */