/*
* Mark children as invisible, if needed.
*/
-static void gopt_set_children_visible(struct fio_option *parent, gboolean visible)
+static void gopt_set_children_visible(struct fio_option *parent,
+ gboolean visible)
{
struct fio_option *o;
int i;
gopt_widgets[idx] = gopt->box;
}
-static struct gopt *gopt_new_str_store(struct fio_option *o, const char *text, unsigned int idx)
+static void gopt_str_destroy(GtkWidget *w, gpointer data)
+{
+ struct gopt_str *s = (struct gopt_str *) data;
+
+ free(s);
+ gtk_widget_destroy(w);
+}
+
+static struct gopt *gopt_new_str_store(struct fio_option *o, const char *text,
+ unsigned int idx)
{
struct gopt_str *s;
GtkWidget *label;
gtk_entry_set_text(GTK_ENTRY(s->entry), text);
gtk_entry_set_editable(GTK_ENTRY(s->entry), 1);
s->gopt.sig_handler = g_signal_connect(GTK_OBJECT(s->entry), "changed", G_CALLBACK(gopt_str_changed), s);
+ g_signal_connect(GTK_OBJECT(s->entry), "destroy", G_CALLBACK(gopt_str_destroy), s);
if (o->def)
gtk_entry_set_text(GTK_ENTRY(s->entry), o->def);
printf("combo %s changed\n", o->name);
}
-static struct gopt_combo *__gopt_new_combo(struct fio_option *o, unsigned int idx)
+static void gopt_combo_destroy(GtkWidget *w, gpointer data)
+{
+ struct gopt_combo *c = (struct gopt_combo *) data;
+
+ free(c);
+ gtk_widget_destroy(w);
+}
+
+static struct gopt_combo *__gopt_new_combo(struct fio_option *o,
+ unsigned int idx)
{
struct gopt_combo *c;
GtkWidget *label;
c->combo = gtk_combo_box_new_text();
gopt_mark_index(&c->gopt, idx);
c->gopt.sig_handler = g_signal_connect(GTK_OBJECT(c->combo), "changed", G_CALLBACK(gopt_combo_changed), c);
+ g_signal_connect(GTK_OBJECT(c->combo), "destroy", G_CALLBACK(gopt_combo_destroy), c);
gtk_box_pack_start(GTK_BOX(c->gopt.box), c->combo, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(c->gopt.box), label, FALSE, FALSE, 0);
return c;
}
-static struct gopt *gopt_new_combo_str(struct fio_option *o, const char *text, unsigned int idx)
+static struct gopt *gopt_new_combo_str(struct fio_option *o, const char *text,
+ unsigned int idx)
{
struct gopt_combo *combo;
struct value_pair *vp;
return &combo->gopt;
}
-static struct gopt *gopt_new_combo_int(struct fio_option *o, unsigned int *ip, unsigned int idx)
+static struct gopt *gopt_new_combo_int(struct fio_option *o, unsigned int *ip,
+ unsigned int idx)
{
struct gopt_combo *combo;
struct value_pair *vp;
}
}
-static struct gopt_int *__gopt_new_int(struct fio_option *o, unsigned long long *p,
- unsigned int idx)
+static void gopt_int_destroy(GtkWidget *w, gpointer data)
+{
+ struct gopt_int *i = (struct gopt_int *) data;
+
+ free(i);
+ gtk_widget_destroy(w);
+}
+
+static struct gopt_int *__gopt_new_int(struct fio_option *o,
+ unsigned long long *p, unsigned int idx)
{
unsigned long long defval;
struct gopt_int *i;
gtk_spin_button_set_value(GTK_SPIN_BUTTON(i->spin), defval);
i->lastval = defval;
i->gopt.sig_handler = g_signal_connect(G_OBJECT(i->spin), "value-changed", G_CALLBACK(gopt_int_changed), i);
+ g_signal_connect(G_OBJECT(i->spin), "destroy", G_CALLBACK(gopt_int_destroy), i);
gtk_box_pack_start(GTK_BOX(i->gopt.box), i->spin, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(i->gopt.box), label, FALSE, FALSE, 0);
return i;
}
-static struct gopt *gopt_new_int(struct fio_option *o, unsigned int *ip, unsigned int idx)
+static struct gopt *gopt_new_int(struct fio_option *o, unsigned int *ip,
+ unsigned int idx)
{
unsigned long long ullp;
struct gopt_int *i;
gopt_set_children_visible(o, set);
}
-static struct gopt *gopt_new_bool(struct fio_option *o, unsigned int *val, unsigned int idx)
+static void gopt_bool_destroy(GtkWidget *w, gpointer data)
+{
+ struct gopt_bool *b = (struct gopt_bool *) data;
+
+ free(b);
+ gtk_widget_destroy(w);
+}
+
+static struct gopt *gopt_new_bool(struct fio_option *o, unsigned int *val,
+ unsigned int idx)
{
struct gopt_bool *b;
GtkWidget *label;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b->check), defstate);
b->gopt.sig_handler = g_signal_connect(G_OBJECT(b->check), "toggled", G_CALLBACK(gopt_bool_toggled), b);
+ g_signal_connect(G_OBJECT(b->check), "destroy", G_CALLBACK(gopt_bool_destroy), b);
gtk_box_pack_start(GTK_BOX(b->gopt.box), b->check, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(b->gopt.box), label, FALSE, FALSE, 0);
}
}
+static void gopt_range_destroy(GtkWidget *w, gpointer data)
+{
+ struct gopt_range *r = (struct gopt_range *) data;
+
+ free(r);
+ gtk_widget_destroy(w);
+}
+
static struct gopt *gopt_new_int_range(struct fio_option *o, unsigned int **ip,
unsigned int idx)
{
}
gtk_box_pack_start(GTK_BOX(r->gopt.box), label, FALSE, FALSE, 0);
+ g_signal_connect(G_OBJECT(r->gopt.box), "destroy", G_CALLBACK(gopt_range_destroy), r);
o->gui_data = r;
return &r->gopt;
}