summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-05-14 21:35:33 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-05-14 21:35:33 +0000
commit021c7fa891b23d8623beebf3f9ee79a36a1ff174 (patch)
treef2ab9c8a89efcc5856c66f4268a556ae262e090a
parent00869eb23b642c63a20998575aa4497baad5a3d1 (diff)
Introduce g_key_file_get_integer to eglib.
-rw-r--r--eglib/gmain.c19
-rw-r--r--eglib/gmain.h5
2 files changed, 24 insertions, 0 deletions
diff --git a/eglib/gmain.c b/eglib/gmain.c
index 27b2dd9a..a3fa95a9 100644
--- a/eglib/gmain.c
+++ b/eglib/gmain.c
@@ -1703,6 +1703,25 @@ gboolean g_key_file_get_boolean(GKeyFile *key_file,
return ret;
}
+gint g_key_file_get_integer(GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error)
+{
+ int ret;
+ gchar *str;
+
+ str = g_key_file_get_string(key_file, group_name, key, error);
+ if (!str)
+ return 0;
+
+ ret = atoi(str);
+
+ g_free(str);
+
+ return ret;
+}
+
/* GString */
#define MY_MAXSIZE ((gsize)-1)
diff --git a/eglib/gmain.h b/eglib/gmain.h
index 1691b76a..ac12c617 100644
--- a/eglib/gmain.h
+++ b/eglib/gmain.h
@@ -285,6 +285,11 @@ gboolean g_key_file_get_boolean(GKeyFile *key_file,
const gchar *key,
GError **error);
+gint g_key_file_get_integer(GKeyFile *key_file,
+ const gchar *group_name,
+ const gchar *key,
+ GError **error);
+
/* GString */
typedef struct {