CR: Add functionality to read List from Gconf
"Zheng, Huan" <[email protected]>
| Newsgroups | gmane.comp.multimedia.helix.devel |
|---|---|
| Message-ID | <EFE0C8A50A5D94448E3C7DD762E4FAA2018ADCA0@pdsmsx413.ccr.corp.intel.com> |
Project: [Helix-Client-dev] CR: Add functionality to read List from
Gconf
Synopsis:
Add functionality to read List from Gconf
Overview:
Related bug 8357: The RP4MID cannot handle the ignore host list in
http proxy setting on MID(Hardy based)
Helix preference Key NoProxyFor is related to key
/system/http_proxy/ignore_hosts, but this key is of type LIST which is
not considered in current implementation. So that RP4MID cannot read it
from gconf.
This patch add the functionality to read List information from gconf
and form a string to return back, so that RP4MID could get the value of
/system/http_proxy/ignore_hosts.
Files Added:
None
Files Modified:
hxpref.cpp: (player/kit/dbus-server/src/hxpref.cpp)
Add code to handle reading List from gconf
Image Size and Heap Use impact (Client -Only):
little
Platforms and Profiles Affected:
platform: linux-2.2-libc6-gcc32-i586
profile: helix-client-all-defines
Distribution Libraries Affected:
<helix-dbus-server.bin>
Distribution library impact and planned action:
<None>
Platforms and Profiles Build Verified:
Set BIF branch -> hxdbus_3_1_0_atlas
Set Target(s) -> dbus_server_with_video
Set Profile -> helix-client-all-defines
System ID -> linux-2.2-libc6-gcc32-i586
Branch:
HEAD, hxclient_3_1_0_atlas
Copyright assignment: <MUST be one of the following statements >
2. Intel has signed and delivered a Joint Copyright Assignment
to RealNetworks, and received acknowledgment that the
agreement was received.
Files Attached:
Pref_gconf_list.diff
Best Regards, Zheng, Huan(ZBT)
OTC/SSD/SSG
Intel Aisa-Pacific Research & Developement Ltd
Tel: 021-6116 6435
Inet: 8821 6435
Cub: 3W035
_______________________________________________
Helix-client-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
Pref_gconf_list.diff
(application/octet-stream, 3.4 KB)
Index: dbus-server/src/hxpref.cpp
===================================================================
RCS file: /cvsroot/player/kit/dbus-server/src/hxpref.cpp,v
retrieving revision 1.1.2.3
diff -u -w -r1.1.2.3 hxpref.cpp
--- dbus-server/src/hxpref.cpp 3 Jun 2008 00:39:23 -0000 1.1.2.3
+++ dbus-server/src/hxpref.cpp 4 Jun 2008 02:36:49 -0000
@@ -47,14 +47,16 @@
char* key;
char* gconf_key;
GConfValueType type;
+ GConfValueType list_type;
}GConf_Table;
static GConf_Table gconf_table[] = {
- {"HTTPProxySupport", "/system/http_proxy/use_http_proxy", GCONF_VALUE_BOOL},
- {"HTTPProxyHost", "/system/http_proxy/host", GCONF_VALUE_STRING},
- {"HTTPProxyPort", "/system/http_proxy/port", GCONF_VALUE_INT},
- {"AlsaPCMDeviceName", "/system/gstreamer/0.10/default/musicaudiosink", GCONF_VALUE_STRING},
- {NULL, NULL, GCONF_VALUE_INVALID},
+ {"HTTPProxySupport", "/system/http_proxy/use_http_proxy", GCONF_VALUE_BOOL, GCONF_VALUE_BOOL},
+ {"HTTPProxyHost", "/system/http_proxy/host", GCONF_VALUE_STRING, GCONF_VALUE_STRING},
+ {"HTTPProxyPort", "/system/http_proxy/port", GCONF_VALUE_INT, GCONF_VALUE_INT},
+ {"AlsaPCMDeviceName", "/system/gstreamer/0.10/default/musicaudiosink", GCONF_VALUE_STRING, GCONF_VALUE_STRING},
+ {"NoProxyFor", "/system/http_proxy/ignore_hosts", GCONF_VALUE_LIST, GCONF_VALUE_STRING},
+ {NULL, NULL, GCONF_VALUE_INVALID, GCONF_VALUE_INVALID},
};
/* Calculate how many configure items inside configure file,
@@ -376,13 +378,44 @@
while(gconf_p->key != NULL)
{
if(!strcmp(gconf_p->key, key))
+ {
break;
+ }
gconf_p++;
}
if(gconf_p->key == NULL)
return -1;
client = gconf_client_get_default();
+ // Deal with LIST in different way
+ if (gconf_p->type == GCONF_VALUE_LIST)
+ {
+ if (gconf_p->list_type == GCONF_VALUE_STRING)
+ {
+ GSList* list = NULL;
+ GSList* p;
+ list = gconf_client_get_list(client, gconf_p->gconf_key, GCONF_VALUE_STRING, NULL);
+ if (list == NULL)
+ {
+ return -1;
+ }
+ p = list;
+ GString* final_value = g_string_new(p->data);
+ g_free(p->data);
+ p = p->next;
+ while (p != NULL)
+ {
+ g_string_append_c(final_value, ',');
+ g_string_append(final_value, p->data);
+ g_free(p->data);
+ p = p->next;
+ }
+ *value = g_strdup(final_value->str);
+ g_slist_free(list);
+ }
+ }
+ else // deal with simple type
+ {
gconfvalue = gconf_client_get(client, gconf_p->gconf_key, NULL);
if(NULL == gconfvalue)
goto NONE;
@@ -467,7 +500,7 @@
gconf_value_free(gconfvalue);
goto NONE;
}
-
+ }
PRINTF("Read From Gconf key is %s, value is %s\n", key, *value);
g_object_unref(client);
return 0;