GLeaker

GLeaker Commit Details

Date:2013-04-10 17:16:28 (5 years 3 months ago)
Author:Nicola Fontana
Branch:master
Commit:acabc02252d63e2648cc7830c7c9b5f7c4598cb0
Parents: f8a8d321a2be371dc819799b05360e4c8ebd1688
Message:Added basic setup support

Changes:
Msrc/gleaker.c (2 diffs)

File differences

src/gleaker.c
9696
9797
9898
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
99185
100186
101187
102
188
189
103190
104191
105192
......
108195
109196
110197
198
199
200
201
202
203
204
205
206
207
208
111209
112210
113211
return GTK_WIDGET(object);
}
typedef struct _GleakerSetup GleakerSetup;
struct _GleakerSetup {
gboolean changed;
gdouble min_pressure;
gdouble max_pressure;
gdouble immission_time;
gdouble decay_time;
gdouble test_time;
gdouble min_leakage;
gdouble max_leakage;
gdouble drain_delay;
};
static GleakerSetup *
gleaker_setup_new(void)
{
GleakerSetup *setup = g_new(GleakerSetup, 1);
setup->changed = FALSE;
setup->min_pressure = 0;
setup->max_pressure = 0;
setup->immission_time = 0;
setup->decay_time = 0;
setup->test_time = 0;
setup->min_leakage = 0;
setup->max_leakage = 0;
setup->drain_delay = 0;
return setup;
}
static void
gleaker_setup_dump(const GleakerSetup *setup)
{
g_print("changed = %s\n"
"min_pressure = %lf\n"
"max_pressure = %lf\n"
"immission_time = %lf\n"
"decay_time = %lf\n"
"test_time = %lf\n"
"min_leakage = %lf\n"
"max_leakage = %lf\n"
"drain_delay = %lf\n",
setup->changed ? "TRUE" : "FALSE",
setup->min_pressure, setup->max_pressure,
setup->immission_time, setup->decay_time, setup->test_time,
setup->min_leakage, setup->max_leakage,
setup->drain_delay);
}
static GleakerSetup *
default_setup(void)
{
static GleakerSetup *setup = NULL;
if (G_UNLIKELY(setup == NULL)) {
setup = gleaker_setup_new();
}
return setup;
}
static void
adjustment_changed(GtkAdjustment *adjustment, gdouble *value)
{
GleakerSetup *setup;
if (value != NULL) {
*value = gtk_adjustment_get_value(adjustment);
}
setup = default_setup();
setup->changed = TRUE;
gleaker_setup_dump(setup);
}
#define SETUP_VALUE(variable, widget) \
G_STMT_START{ \
GObject *object = gtk_builder_get_object(builder, (widget)); \
g_signal_connect(object, "value-changed", \
G_CALLBACK(adjustment_changed), \
variable); \
}G_STMT_END
static GtkWidget *
get_main_window(GtkBuilder *builder)
{
GtkWidget *window;
GtkWidget *window;
GleakerSetup *setup;
window = get_widget(builder, "wndMain");
if (window == NULL)
g_signal_connect(window, "delete-event",
G_CALLBACK(gtk_main_quit), NULL);
setup = default_setup();
SETUP_VALUE(& setup->min_pressure, "adjMinPressure");
SETUP_VALUE(& setup->max_pressure, "adjMaxPressure");
SETUP_VALUE(& setup->immission_time, "adjImmissionTime");
SETUP_VALUE(& setup->decay_time, "adjDecayTime");
SETUP_VALUE(& setup->test_time, "adjTestTime");
SETUP_VALUE(& setup->min_leakage, "adjMinLeakage");
SETUP_VALUE(& setup->max_leakage, "adjMaxLeakage");
SETUP_VALUE(& setup->drain_delay, "adjDrainDelay");
return window;
}

Archive Download the corresponding diff file

Branches