From d01fc8f7dc99936dd63a85c710d19a57407a37d4 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Sun, 24 Oct 1999 13:10:22 +0000 Subject: [PATCH] Sun Oct 24 13:05:15 PDT 1999 (KainX) Added Epplet_query_config_data_with_def(). See the header file for syntax. For some reason, the compiler didn't like it when I spelled out "default." SVN revision: 964 --- ChangeLog | 8 ++++++++ api/epplet.c | 19 +++++++++++++++++++ api/epplet.h.in | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7b57a2f..7156fef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -78,3 +78,11 @@ work here, but I'll need lots of testing. PLEASE remove all .lock files from ~/.enlightenment/epplet_config/*/ and close all running epplets before running any new ones! + +------------------------------------------------------------------------------- + +Sun Oct 24 13:05:15 PDT 1999 +(KainX) + +Added Epplet_query_config_data_with_def(). See the header file for syntax. +For some reason, the compiler didn't like it when I spelled out "default." diff --git a/api/epplet.c b/api/epplet.c index ee634e3..910901e 100644 --- a/api/epplet.c +++ b/api/epplet.c @@ -3942,6 +3942,25 @@ Epplet_query_config_data(char *key) return ((char *) NULL); } +char * +Epplet_query_config_data_with_def(char *key, char *def) +{ + int i; + ConfigItem *ci; + + if (config_dict) + { + for (i = 0; i < config_dict->num_entries; i++) + { + ci = &(config_dict->entries[i]); + if ((ci->key) && !strcmp(key, ci->key)) + /* we've found the key */ + return (ci->value); + } + } + return (def); +} + void Epplet_modify_config_data(char *key, char *value) { diff --git a/api/epplet.h.in b/api/epplet.h.in index 25b597f..d50016e 100644 --- a/api/epplet.h.in +++ b/api/epplet.h.in @@ -364,6 +364,10 @@ int Epplet_get_instance(void); /* Here you can query a config setting. */ char *Epplet_query_config_data(char *key); +/* Same as above, but returns the value of default instead of NULL if no */ +/* match is found. */ +char *Epplet_query_config_data_with_def(char *key, char *def); + /* Use this to change or add a config setting. */ void Epplet_modify_config_data(char *key, char *value);