~ubuntu-branches/ubuntu/trusty/rawstudio/trusty-proposed

« back to all changes in this revision

Viewing changes to src/conf_interface.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-10-18 17:58:00 UTC
  • mfrom: (2.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20081018175800-r1s7ke1xwy9wxv5b
Tags: 1.1.1-1
MergingĀ upstreamĀ versionĀ 1.1.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 #undef WITH_GCONF
30
30
#endif
31
31
 
 
32
static GStaticMutex lock = G_STATIC_MUTEX_INIT;
 
33
 
32
34
#ifdef WITH_GCONF
33
35
 #include <gconf/gconf.h>
34
36
 #define GCONF_PATH "/apps/rawstudio/"
35
37
static GConfEngine *
36
38
get_gconf_engine(void)
37
39
{
38
 
        GStaticMutex lock = G_STATIC_MUTEX_INIT;
39
40
        /* Initialize *engine first time we're called. Otherwise just return the one we've got. */
40
41
        g_static_mutex_lock(&lock);
41
42
        static GConfEngine *engine = NULL;
63
64
        g_string_append(fullname, name);
64
65
        if (engine)
65
66
        {
 
67
                g_static_mutex_lock(&lock);
66
68
                gvalue = gconf_engine_get(engine, fullname->str, NULL);
 
69
                g_static_mutex_unlock(&lock);
67
70
                if (gvalue)
68
71
                {
69
72
                        if (gvalue->type == GCONF_VALUE_BOOL)
96
99
        g_string_append(fullname, name);
97
100
        if (engine)
98
101
        {
 
102
                g_static_mutex_lock(&lock);
99
103
                gvalue = gconf_engine_get(engine, fullname->str, NULL);
 
104
                g_static_mutex_unlock(&lock);
100
105
                if (gvalue)
101
106
                {
102
107
                        if (gvalue->type == GCONF_VALUE_BOOL)
124
129
        GConfEngine *engine = get_gconf_engine();
125
130
        GString *fullname = g_string_new(GCONF_PATH);
126
131
        g_string_append(fullname, name);
 
132
        g_static_mutex_lock(&lock);
127
133
        if (engine)
128
134
                ret = gconf_engine_set_bool(engine, fullname->str, bool_value, NULL);
 
135
        g_static_mutex_unlock(&lock);
129
136
        g_string_free(fullname, TRUE);
130
137
#endif
131
138
#ifdef WITH_REGISTRY
145
152
        g_string_append(fullname, name);
146
153
        if (engine)
147
154
        {
 
155
                g_static_mutex_lock(&lock);
148
156
                gvalue = gconf_engine_get(engine, fullname->str, NULL);
 
157
                g_static_mutex_unlock(&lock);
149
158
                if (gvalue)
150
159
                {
151
160
                        if (gvalue->type == GCONF_VALUE_STRING)
190
199
        g_string_append(fullname, name);
191
200
        if (engine)
192
201
        {
 
202
                g_static_mutex_lock(&lock);
193
203
                gvalue = gconf_value_new(GCONF_VALUE_STRING);
194
204
                gconf_value_set_string(gvalue, string_value);
195
205
                ret = gconf_engine_set(engine, fullname->str, gvalue, NULL);
196
206
                gconf_value_free(gvalue);
 
207
                g_static_mutex_unlock(&lock);
197
208
        }
198
209
        g_string_free(fullname, TRUE);
199
210
#endif
221
232
        g_string_append(fullname, name);
222
233
        if (engine)
223
234
        {
 
235
                g_static_mutex_lock(&lock);
224
236
                gvalue = gconf_engine_get(engine, fullname->str, NULL);
 
237
                g_static_mutex_unlock(&lock);
225
238
                if (gvalue)
226
239
                {
227
240
                        if (gvalue->type == GCONF_VALUE_INT)
267
280
        GConfEngine *engine = get_gconf_engine();
268
281
        GString *fullname = g_string_new(GCONF_PATH);
269
282
        g_string_append(fullname, name);
 
283
        g_static_mutex_lock(&lock);
270
284
        if (engine)
271
285
                ret = gconf_engine_set_int(engine, fullname->str, integer_value, NULL);
 
286
        g_static_mutex_unlock(&lock);
272
287
        g_string_free(fullname, TRUE);
273
288
#endif
274
289
#ifdef WITH_REGISTRY
380
395
{
381
396
        gchar *ret = NULL;
382
397
        gint selected = 0;
383
 
        if (type == RS_CMS_PROFILE_IN)
 
398
        if (type == CMS_PROFILE_INPUT)
384
399
        {
385
400
                rs_conf_get_integer(CONF_CMS_IN_PROFILE_SELECTED, &selected);
386
401
                if (selected > 0)
387
402
                        ret = rs_conf_get_nth_string_from_list_string(CONF_CMS_IN_PROFILE_LIST, --selected);
388
403
        }
389
 
        else if (type == RS_CMS_PROFILE_DISPLAY)
 
404
        else if (type == CMS_PROFILE_DISPLAY)
390
405
        {
391
406
                rs_conf_get_integer(CONF_CMS_DI_PROFILE_SELECTED, &selected);
392
407
                if (selected > 0)
393
408
                        ret = rs_conf_get_nth_string_from_list_string(CONF_CMS_DI_PROFILE_LIST, --selected);
394
409
        } 
395
 
        else if (type == RS_CMS_PROFILE_EXPORT)
 
410
        else if (type == CMS_PROFILE_EXPORT)
396
411
        {
397
412
                rs_conf_get_integer(CONF_CMS_EX_PROFILE_SELECTED, &selected);
398
413
                if (selected > 0)
453
468
        g_string_append(fullname, name);
454
469
        if (engine)
455
470
        {
 
471
                g_static_mutex_lock(&lock);
456
472
                gvalue = gconf_engine_get(engine, fullname->str, NULL);
 
473
                g_static_mutex_unlock(&lock);
457
474
                if (gvalue)
458
475
                {
459
476
                        if (gvalue->type == GCONF_VALUE_FLOAT)
499
516
        GConfEngine *engine = get_gconf_engine();
500
517
        GString *fullname = g_string_new(GCONF_PATH);
501
518
        g_string_append(fullname, name);
 
519
        g_static_mutex_lock(&lock);
502
520
        if (engine)
503
521
                ret = gconf_engine_set_float(engine, fullname->str, float_value, NULL);
 
522
        g_static_mutex_unlock(&lock);
504
523
        g_string_free(fullname, TRUE);
505
524
#endif
506
525
#ifdef WITH_REGISTRY
525
544
        GString *fullname = g_string_new(GCONF_PATH);
526
545
 
527
546
        g_string_append(fullname, name);
 
547
        g_static_mutex_lock(&lock);
528
548
        if (engine)
529
549
                list = gconf_engine_get_list(engine, fullname->str, GCONF_VALUE_STRING, NULL);
 
550
        g_static_mutex_unlock(&lock);
530
551
        g_string_free(fullname, TRUE);
531
552
#else
532
553
        /* FIXME: windows stub */
543
564
        GString *fullname = g_string_new(GCONF_PATH);
544
565
 
545
566
        g_string_append(fullname, name);
 
567
        g_static_mutex_lock(&lock);
546
568
        if (engine)
547
569
                ret = gconf_engine_set_list(engine, fullname->str, GCONF_VALUE_STRING, list, NULL);
 
570
        g_static_mutex_unlock(&lock);
548
571
        g_string_free(fullname, TRUE);
549
572
#else
550
573
        /* FIXME: windows stub */