/** * fm_config_load_from_key_file * @cfg: pointer to configuration * @kf: a #GKeyFile with configuration keys and values * * Fills configuration @cfg with data from #GKeyFile @kf. * * Since: 0.1.0 */ void fm_config_load_from_key_file(FmConfig* cfg, GKeyFile* kf) { char **strv; fm_key_file_get_bool(kf, "config", "use_trash", &cfg->use_trash); fm_key_file_get_bool(kf, "config", "single_click", &cfg->single_click); fm_key_file_get_int(kf, "config", "auto_selection_delay", &cfg->auto_selection_delay); fm_key_file_get_bool(kf, "config", "confirm_del", &cfg->confirm_del); fm_key_file_get_bool(kf, "config", "confirm_trash", &cfg->confirm_trash); if(cfg->terminal) g_free(cfg->terminal); cfg->terminal = g_key_file_get_string(kf, "config", "terminal", NULL); if(cfg->archiver) g_free(cfg->archiver); cfg->archiver = g_key_file_get_string(kf, "config", "archiver", NULL); fm_key_file_get_bool(kf, "config", "thumbnail_local", &cfg->thumbnail_local); fm_key_file_get_int(kf, "config", "thumbnail_max", &cfg->thumbnail_max); fm_key_file_get_bool(kf, "config", "advanced_mode", &cfg->advanced_mode); fm_key_file_get_bool(kf, "config", "si_unit", &cfg->si_unit); fm_key_file_get_bool(kf, "config", "force_startup_notify", &cfg->force_startup_notify); fm_key_file_get_bool(kf, "config", "backup_as_hidden", &cfg->backup_as_hidden); fm_key_file_get_bool(kf, "config", "no_usb_trash", &cfg->no_usb_trash); fm_key_file_get_bool(kf, "config", "no_child_non_expandable", &cfg->no_child_non_expandable); _parse_drop_default_action(kf, &cfg->drop_default_action); fm_key_file_get_bool(kf, "config", "show_full_names", &cfg->show_full_names); fm_key_file_get_bool(kf, "config", "only_user_templates", &cfg->only_user_templates); fm_key_file_get_bool(kf, "config", "template_run_app", &cfg->template_run_app); fm_key_file_get_bool(kf, "config", "template_type_once", &cfg->template_type_once); fm_key_file_get_bool(kf, "config", "defer_content_test", &cfg->defer_content_test); fm_key_file_get_bool(kf, "config", "quick_exec", &cfg->quick_exec); fm_key_file_get_bool(kf, "config", "smart_desktop_autodrop", &cfg->smart_desktop_autodrop); g_free(cfg->format_cmd); cfg->format_cmd = g_key_file_get_string(kf, "config", "format_cmd", NULL); /* append blacklist */ strv = g_key_file_get_string_list(kf, "config", "modules_blacklist", NULL, NULL); fm_strcatv(&cfg->modules_blacklist, strv); g_strfreev(strv); /* replace whitelist */ g_strfreev(cfg->modules_whitelist); cfg->modules_whitelist = g_key_file_get_string_list(kf, "config", "modules_whitelist", NULL, NULL); #ifdef USE_UDISKS fm_key_file_get_bool(kf, "config", "show_internal_volumes", &cfg->show_internal_volumes); #endif fm_key_file_get_int(kf, "ui", "big_icon_size", &cfg->big_icon_size); fm_key_file_get_int(kf, "ui", "small_icon_size", &cfg->small_icon_size); fm_key_file_get_int(kf, "ui", "pane_icon_size", &cfg->pane_icon_size); fm_key_file_get_int(kf, "ui", "thumbnail_size", &cfg->thumbnail_size); fm_key_file_get_bool(kf, "ui", "show_thumbnail", &cfg->show_thumbnail); fm_key_file_get_bool(kf, "ui", "shadow_hidden", &cfg->shadow_hidden); g_free(cfg->list_view_size_units); cfg->list_view_size_units = g_key_file_get_string(kf, "ui", "list_view_size_units", NULL); fm_key_file_get_bool(kf, "places", "places_home", &cfg->places_home); fm_key_file_get_bool(kf, "places", "places_desktop", &cfg->places_desktop); fm_key_file_get_bool(kf, "places", "places_root", &cfg->places_root); fm_key_file_get_bool(kf, "places", "places_computer", &cfg->places_computer); fm_key_file_get_bool(kf, "places", "places_trash", &cfg->places_trash); fm_key_file_get_bool(kf, "places", "places_applications", &cfg->places_applications); fm_key_file_get_bool(kf, "places", "places_network", &cfg->places_network); fm_key_file_get_bool(kf, "places", "places_unmounted", &cfg->places_unmounted); }
/** * fm_folder_config_get_boolean * @fc: a configuration descriptor * @key: a key to search * @val: (out): location to save the value * * Returns the value associated with @key as a boolean. * * Returns: %TRUE if key was found and parsed succesfully. * * Since: 1.2.0 */ gboolean fm_folder_config_get_boolean(FmFolderConfig *fc, const char *key, gboolean *val) { return fm_key_file_get_bool(fc->kf, fc->group, key, val); }