Exemple #1
0
void
sync_with_option(void)
{
    if (PagerMax < LINES)
	PagerMax = LINES;
    WrapSearch = WrapDefault;
    parse_proxy();
#ifdef USE_COOKIE
    parse_cookie();
#endif
    initMailcap();
    initMimeTypes();
#ifdef USE_EXTERNAL_URI_LOADER
    initURIMethods();
#endif
#ifdef USE_MIGEMO
    init_migemo();
#endif
#ifdef USE_IMAGE
    if (fmInitialized && displayImage)
	initImage();
#else
    displayImage = FALSE;	/* XXX */
#endif
    loadPasswd();
    loadPreForm();

    if (AcceptLang == NULL || *AcceptLang == '\0') {
	/* TRANSLATORS: 
	 * AcceptLang default: this is used in Accept-Language: HTTP request 
	 * header. For example, ja.po should translate it as
	 * "ja;q=1.0, en;q=0.5" like that.
	 */
	AcceptLang = _("en;q=1.0");
    }
    if (AcceptEncoding == NULL || *AcceptEncoding == '\0')
	AcceptEncoding = acceptableEncoding();
    if (AcceptMedia == NULL || *AcceptMedia == '\0')
	AcceptMedia = acceptableMimeTypes();
    if (fmInitialized) {
	initKeymap(FALSE);
#ifdef USE_MOUSE
	initMouseAction();
#endif				/* MOUSE */
#ifdef USE_MENU
	initMenu();
#endif				/* MENU */
    }
}
static bool update_service_property(DBusMessageIter *arg, void *user_data)
{
	struct connman_service *service = user_data;
	const char *name, *value;
	gboolean boolean_value;
	char **array;
	int length;

	if (cui_dbus_get_basic(arg, DBUS_TYPE_STRING, &name) != 0)
		return FALSE;

	dbus_message_iter_next(arg);

	if (g_strcmp0(name, "Name") == 0) {
		cui_dbus_get_basic_variant(arg, DBUS_TYPE_STRING, &value);
		service->name = g_strdup(value);
	} else if (g_strcmp0(name, "Type") == 0) {
		cui_dbus_get_basic_variant(arg, DBUS_TYPE_STRING, &value);
		service->type = g_strdup(value);
	} else if (g_strcmp0(name, "Security") == 0) {
		cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array);

		g_free(service->security);
		if (array != NULL) {
			service->security = g_strjoinv(";", array);
			g_free(array);
		} else
			service->security = NULL;
	} else if (g_strcmp0(name, "Immutable") == 0) {
		cui_dbus_get_basic_variant(arg,
				DBUS_TYPE_BOOLEAN, &boolean_value);
		service->immutable = boolean_value;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_STATE)) == 0) {
		cui_dbus_get_basic_variant(arg, DBUS_TYPE_STRING, &value);

		service->state = string2enum_state(value);

		service->update_index = SERVICE_STATE;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_ERROR)) == 0) {
		cui_dbus_get_basic_variant(arg, DBUS_TYPE_STRING, &value);

		g_free(service->error);
		service->error = g_strdup(value);

		service->update_index = SERVICE_ERROR;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_STRENGTH)) == 0) {
		uint8_t uint8_value;

		cui_dbus_get_basic_variant(arg, DBUS_TYPE_BYTE, &uint8_value);
		service->strength = uint8_value;

		service->update_index = SERVICE_STRENGTH;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_FAVORITE)) == 0) {
		cui_dbus_get_basic_variant(arg,
				DBUS_TYPE_BOOLEAN, &boolean_value);
		service->favorite = boolean_value;

		service->update_index = SERVICE_FAVORITE;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_AUTOCONNECT)) == 0) {
		cui_dbus_get_basic_variant(arg,
				DBUS_TYPE_BOOLEAN, &boolean_value);
		service->autoconnect = boolean_value;

		service->update_index = SERVICE_AUTOCONNECT;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_ROAMING)) == 0) {
		cui_dbus_get_basic_variant(arg,
				DBUS_TYPE_BOOLEAN, &boolean_value);
		service->roaming = boolean_value;

		service->update_index = SERVICE_ROAMING;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_NAMESERVERS)) == 0) {
		cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array);

		g_free(service->nameservers);
		if (array != NULL) {
			service->nameservers = g_strjoinv(";", array);
			g_free(array);
		} else
			service->nameservers = NULL;

		service->update_index = SERVICE_NAMESERVERS;
	} else if (g_strcmp0(name,
			PROPERTY(SERVICE_NAMESERVERS_CONFIGURATION)) == 0) {
		cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array);

		g_free(service->nameservers_conf);
		if (array != NULL) {
			service->nameservers_conf = g_strjoinv(";", array);
			g_free(array);
		} else
			 service->nameservers_conf = NULL;

		service->update_index = SERVICE_NAMESERVERS_CONFIGURATION;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_DOMAINS)) == 0) {
		cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array);

		g_free(service->domains);
		if (array != NULL) {
			service->domains = g_strjoinv(";", array);
			g_free(array);
		} else
			service->domains = NULL;

		service->update_index = SERVICE_DOMAINS;
	} else if (g_strcmp0(name,
			PROPERTY(SERVICE_DOMAINS_CONFIGURATION)) == 0) {
		cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array);

		g_free(service->domains_conf);
		if (array != NULL) {
			service->domains_conf = g_strjoinv(";", array);
			g_free(array);
		} else
			service->domains_conf = NULL;

		service->update_index = SERVICE_DOMAINS_CONFIGURATION;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_TIMESERVERS)) == 0) {
		cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array);

		g_free(service->timeservers);
		if (array != NULL) {
			service->timeservers = g_strjoinv(";", array);
			g_free(array);
		} else
			service->timeservers = NULL;

		service->update_index = SERVICE_TIMESERVERS;
	} else if (g_strcmp0(name,
			PROPERTY(SERVICE_TIMESERVERS_CONFIGURATION)) == 0) {
		cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array);

		g_free(service->timeservers_conf);
		if (array != NULL) {
			service->timeservers_conf = g_strjoinv(";", array);
			g_free(array);
		} else
			service->timeservers_conf = NULL;

		service->update_index = SERVICE_TIMESERVERS_CONFIGURATION;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_IPv4)) == 0) {
		service->ipv4 = parse_ipv4(arg, service->ipv4);
		service->update_index = SERVICE_IPv4;
	} else if (g_strcmp0(name,
			PROPERTY(SERVICE_IPv4_CONFIGURATION)) == 0) {
		service->ipv4_conf = parse_ipv4(arg, service->ipv4_conf);
		service->update_index = SERVICE_IPv4_CONFIGURATION;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_IPv6)) == 0) {
		service->ipv6 = parse_ipv6(arg, service->ipv6);
		service->update_index = SERVICE_IPv6;
	} else if (g_strcmp0(name,
			PROPERTY(SERVICE_IPv6_CONFIGURATION)) == 0) {
		service->ipv6_conf = parse_ipv6(arg, service->ipv6_conf);
		service->update_index = SERVICE_IPv6_CONFIGURATION;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_PROXY)) == 0) {
		service->proxy = parse_proxy(arg, service->proxy);
		service->update_index = SERVICE_PROXY;
	} else if (g_strcmp0(name,
			PROPERTY(SERVICE_PROXY_CONFIGURATION)) == 0) {
		service->proxy_conf = parse_proxy(arg, service->proxy_conf);
		service->update_index = SERVICE_PROXY_CONFIGURATION;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_PROVIDER)) == 0) {
		service->provider = parse_provider(arg, service->provider);
		service->update_index = SERVICE_PROVIDER;
	} else if (g_strcmp0(name, PROPERTY(SERVICE_ETHERNET)) == 0) {
		service->ethernet = parse_ethernet(arg, service->ethernet);
		service->update_index = SERVICE_ETHERNET;
	}

	return FALSE;
}