~vcs-imports/balsa/master

« back to all changes in this revision

Viewing changes to libbalsa/libbalsa-conf.c

  • Committer: Pawel Salek
  • Date: 2009-02-07 22:20:25 UTC
  • Revision ID: git-v1:750bab1bc2273852311a96325e04bc194547498a
minimum gtk version upgraded, link cleanup (Incomplete!). Check min

* INSTALL: minimum gtk version upgraded, link cleanup (Incomplete!).
* configure.in: Check min versions, new option for Mac OS X desktop,
  check for *time_r funcs, remove unnecessary check for iconv
* src/filter-edit.h, src/balsa-index.c, src/balsa-mblist.c
* src/mailbox-conf.c, src/filter-edit-dialog.c, src/pref-manager.c
* src/address-book-config.c, libbalsa/misc.[hc]
* libbalsa/libbalsa-conf.[hc], libbalsa/address.c, libbalsa/identity.c
* src/filter-edit-callbacks.c: Assume we have Gtk+/glib >= 2.6.0
* libbalsa/imap/imap_search.c:
  use GDate instead of localtime_r (avoid dependency to libbalsa)
* libbalsa/rfc3156.c: use glib random func
* libbalsa/Makefile.am, libbalsa/missing{_time.c,.h}:
  add system-dependent time_r funcs
* src/main-window.c:
  Add basic Mac OS X menu integration, assume we have Gtk+/glib >= 2.6.0
* src/sendmsg-window.c: Add basic Mac OS X menu integration, use g_strdup.
* src/save-restore.[hc], libinit_balsa/assistant_page_defclient.[hc],
* libinit_balsa/assistant_init.c: No Gnome default client without Gnome
* src/toolbar-factory.c, src/main.c, src/Makefile.am:
  Build without Gnome support
* src/print-gtk.c: Mac OS X doesn't define _NL_MEASUREMENT_MEASUREMENT
* src/balsa-icons.c:  Remove unnecessary include.
* src/balsa-bonobo.[hc]: Only compiled if building with Gnome support
* src/balsa-app.c:
  Gdk on Mac OS X cannot create a new colour map, fall back to system
* src/ab-main.c:
  Build Gnome stuff only when available, assume we have Gtk+/glib >=
  2.6.0, add basic Mac OS X menu integration.

svn path=/trunk/; revision=8068

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <string.h>
24
24
#include "libbalsa-conf.h"
25
25
 
26
 
#if !GLIB_CHECK_VERSION(2, 6, 0)
27
 
 
28
 
#define BALSA_CONFIG_PREFIX "balsa/"
29
 
 
30
 
/* 
31
 
 * Call @func for each section name that begins with @prefix.
32
 
 * @func is called with arguments:
33
 
 *   const gchar * @key         the section;
34
 
 *   const gchar * @value       the trailing part of the section name,
35
 
 *                              following the @prefix;
36
 
 *   gpointer @data             the @data passed in.
37
 
 * Iteration terminates when @func returns TRUE.
38
 
 */
39
 
void
40
 
libbalsa_conf_foreach_group(const gchar * prefix,
41
 
                            LibBalsaConfForeachFunc func, gpointer data)
42
 
{
43
 
    gsize pref_len;
44
 
    void *iterator;
45
 
    gchar *key;
46
 
 
47
 
    pref_len = strlen(prefix);
48
 
    iterator = gnome_config_init_iterator_sections(BALSA_CONFIG_PREFIX);
49
 
    while ((iterator = gnome_config_iterator_next(iterator, &key, NULL))) {
50
 
        if (strncmp(key, prefix, pref_len) == 0
51
 
            && func(key, key + pref_len, data)) {
52
 
            g_free(key);
53
 
            g_free(iterator);
54
 
            break;
55
 
        }
56
 
        g_free(key);
57
 
    }
58
 
}
59
 
 
60
 
void
61
 
libbalsa_conf_push_group(const char *group)
62
 
{
63
 
    gchar *prefix = g_strconcat(BALSA_CONFIG_PREFIX, group, "/", NULL);
64
 
    gnome_config_push_prefix(prefix);
65
 
    g_free(prefix);
66
 
}
67
 
 
68
 
void
69
 
libbalsa_conf_remove_group_(const char *group, gboolean priv)
70
 
{
71
 
    gchar *prefix = g_strconcat(BALSA_CONFIG_PREFIX, group, "/", NULL);
72
 
    gnome_config_clean_section_(prefix, priv);
73
 
    g_free(prefix);
74
 
}
75
 
 
76
 
gboolean
77
 
libbalsa_conf_has_group(const char *group)
78
 
{
79
 
    gchar *prefix = g_strconcat(BALSA_CONFIG_PREFIX, group, "/", NULL);
80
 
    gboolean retval = gnome_config_has_section(prefix);
81
 
    g_free(prefix);
82
 
    return retval;
83
 
}
84
 
 
85
 
#else                           /* !GLIB_CHECK_VERSION(2, 6, 0) */
86
 
 
87
26
#include <sys/types.h>
88
27
#include <sys/stat.h>
89
28
#include <fcntl.h>
663
602
    lbc_sync(&lbc_conf_priv);
664
603
    lbc_unlock();
665
604
}
666
 
 
667
 
#endif                          /* !GLIB_CHECK_VERSION(2, 6, 0) */