static void ignore_hosts_entry_changed_cb (GtkWidget *widget, const gchar *key) { const gchar *value; GSList *lst = NULL; GConfClient *client; g_return_if_fail (widget != NULL); g_return_if_fail (key != NULL); g_return_if_fail (GTK_IS_ENTRY (widget)); /* transform comma-separated list of ignore_hosts to a string-list */ value = gtk_entry_get_text (GTK_ENTRY (widget)); if (value && *value) { gchar **split = g_strsplit (value, ",", -1); if (split) { gint ii; for (ii = 0; split[ii]; ii++) { const gchar *tmp = split[ii]; if (tmp && *tmp) { gchar *val = g_strstrip (g_strdup (tmp)); if (val && *val) lst = g_slist_append (lst, val); else g_free (val); } } } g_strfreev (split); } client = gconf_client_get_default (); if (!gconf_client_set_list (client, key, GCONF_VALUE_STRING, lst, NULL)) { /* for cases where migration didn't happen, get rid of the old GConf key and "re-type" it */ gconf_client_unset (client, key, NULL); gconf_client_set_list (client, key, GCONF_VALUE_STRING, lst, NULL); } g_object_unref (client); g_slist_foreach (lst, (GFunc) g_free, NULL); g_slist_free (lst); }
void calendar_config_set_memos_selected (GSList *selected) { calendar_config_init (); gconf_client_set_list (config, CALENDAR_CONFIG_MEMOS_SELECTED_MEMOS, GCONF_VALUE_STRING, selected, NULL); }
static void gconf_bookmarks_dialog_update_gconf_key (GConfBookmarksDialog *dialog) { GSList *list; GtkTreeIter iter; char *bookmark; GConfClient *client; list = NULL; if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->list_store), &iter)) { do { gtk_tree_model_get (GTK_TREE_MODEL (dialog->list_store), &iter, 0, &bookmark, -1); list = g_slist_append (list, bookmark); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->list_store), &iter)); } client = gconf_client_get_default (); dialog->changing_key = TRUE; gconf_client_set_list (client, BOOKMARKS_KEY, GCONF_VALUE_STRING, list, NULL); g_object_unref (client); }
static void commit_changes (UIData *ui) { GtkTreeModel *model = NULL; GSList *clue_list = NULL; GtkTreeIter iter; gboolean valid; model = gtk_tree_view_get_model (GTK_TREE_VIEW (ui->treeview)); valid = gtk_tree_model_get_iter_first (model, &iter); while (valid) { char *keyword; gtk_tree_model_get (model, &iter, CLUE_KEYWORD_COLUMN, &keyword, -1); /* Check if the keyword is not empty */ if ((keyword) && (g_utf8_strlen(g_strstrip(keyword), -1) > 0)) clue_list = g_slist_append (clue_list, keyword); valid = gtk_tree_model_iter_next (model, &iter); } gconf_client_set_list (ui->gconf, GCONF_KEY_ATTACH_REMINDER_CLUES, GCONF_VALUE_STRING, clue_list, NULL); g_slist_foreach (clue_list, (GFunc) g_free, NULL); g_slist_free (clue_list); }
void eee_accounts_manager_enable_account(EeeAccountsManager *self, const char *name) { GSList *accounts; GSList *item; g_return_if_fail(IS_EEE_ACCOUNTS_MANAGER(self)); g_return_if_fail(name != NULL); accounts = gconf_client_get_list(self->priv->gconf, EEE_KEY "disabled_accounts", GCONF_VALUE_STRING, NULL); while (TRUE) { item = g_slist_find_custom(accounts, name, (GCompareFunc)strcmp); if (item == NULL) { break; } g_free(item->data); accounts = g_slist_remove_link(accounts, item); } gconf_client_set_list(self->priv->gconf, EEE_KEY "disabled_accounts", GCONF_VALUE_STRING, accounts, NULL); g_slist_foreach(accounts, (GFunc)g_free, NULL); g_slist_free(accounts); }
gint saveServers(gchar *newitem) { GList *tmplist = NULL; gint i, max=0; guint count; /* don't save empty lists */ count = g_list_length(hostnames); if((count == 0) && (newitem == NULL)) return(0); if(strlen(newitem) > 0) { /* make sure the current hostname is first */ max++; tmplist = g_list_append(tmplist, newitem); } for(i=0; i<count; i++) { gchar *item; item = g_list_nth_data(hostnames, i); if(!l_strncasecmp(item, newitem, MAXHOSTNAMELEN)) continue; if(max >= MAXHOSTS) /* store only max hosts */ break; max++; tmplist = g_list_append(tmplist, item); } gconf_client_set_list(gcfg, GCONF_BASE"/hostnames", GCONF_VALUE_STRING, (GSList*)tmplist, NULL); return(0); }
/** * e_account_list_save: * @account_list: an #EAccountList * * Saves @account_list to GConf. Signals will be emitted for changes. **/ void e_account_list_save (EAccountList *account_list) { GSList *list = NULL; EAccount *account; EIterator *iter; char *xmlbuf; for (iter = e_list_get_iterator (E_LIST (account_list)); e_iterator_is_valid (iter); e_iterator_next (iter)) { account = (EAccount *)e_iterator_get (iter); xmlbuf = e_account_to_xml (account); if (xmlbuf) list = g_slist_append (list, xmlbuf); } g_object_unref (iter); gconf_client_set_list (account_list->priv->gconf, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, list, NULL); while (list) { g_free (list->data); list = g_slist_remove (list, list->data); } gconf_client_suggest_sync (account_list->priv->gconf, NULL); }
void gm_conf_set_string_list (const gchar *key, GSList *l) { g_return_if_fail (key != NULL); gconf_client_set_list (client, key, GCONF_VALUE_STRING, l, NULL); }
static void unsubscribe_dialog_response (GtkDialog *dialog, int response, gpointer data) { if (response == GTK_RESPONSE_OK) { GSList *ids, *node_to_be_deleted; ExchangeAccount *account = NULL; gchar *path = NULL; gchar *ruri = NULL; const char *source_uid = NULL; GConfClient *client; ESourceGroup *source_group = NULL; ESource *source = NULL; ECalPopupTargetSource *target = data; client = gconf_client_get_default (); account = exchange_operations_get_exchange_account (); if (!account) return; source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); ruri = (gchar *) e_source_peek_relative_uri (source); source_uid = e_source_peek_uid (source); path = g_strdup (ruri + strlen (account->account_filename)); exchange_account_remove_shared_folder (account, path); ids = gconf_client_get_list (client, CONF_KEY_SELECTED_CAL_SOURCES, GCONF_VALUE_STRING, NULL); if (ids) { node_to_be_deleted = g_slist_find_custom ( ids, source_uid, (GCompareFunc) strcmp); if (node_to_be_deleted) { g_free (node_to_be_deleted->data); ids = g_slist_delete_link (ids, node_to_be_deleted); gconf_client_set_list (client, CONF_KEY_SELECTED_CAL_SOURCES, GCONF_VALUE_STRING, ids, NULL); } g_slist_foreach (ids, (GFunc) g_free, NULL); g_slist_free (ids); } source_group = e_source_peek_group (source); e_source_group_remove_source_by_uid (source_group, source_uid); g_free (path); gtk_widget_destroy (GTK_WIDGET (dialog)); } if (response == GTK_RESPONSE_CANCEL) gtk_widget_destroy (GTK_WIDGET (dialog)); if (response == GTK_RESPONSE_DELETE_EVENT) gtk_widget_destroy (GTK_WIDGET (dialog)); }
ESourceList * config_data_get_calendars (const char *key) { ESourceList *cal_sources; gboolean state; GSList *gconf_list; if (!inited) conf_client = gconf_client_get_default (); gconf_list = gconf_client_get_list (conf_client, key, GCONF_VALUE_STRING, NULL); cal_sources = e_source_list_new_for_gconf (conf_client, key); if (cal_sources && g_slist_length (gconf_list)) { g_slist_foreach (gconf_list, (GFunc) g_free, NULL); g_slist_free (gconf_list); return cal_sources; } state = gconf_client_get_bool (conf_client, "/apps/evolution/calendar/notify/notify_with_tray", NULL); if (!state) /* Should be old client*/ { GSList *source; gconf_client_set_bool (conf_client, "/apps/evolution/calendar/notify/notify_with_tray", TRUE, NULL); source = gconf_client_get_list (conf_client, "/apps/evolution/calendar/sources", GCONF_VALUE_STRING, NULL); gconf_client_set_list (conf_client, key, GCONF_VALUE_STRING, source, NULL); cal_sources = e_source_list_new_for_gconf (conf_client, key); if (source) { g_slist_foreach (source, (GFunc) g_free, NULL); g_slist_free (source); } } if (gconf_list) { g_slist_foreach (gconf_list, (GFunc) g_free, NULL); g_slist_free (gconf_list); } return cal_sources; }
static void search_preferences_remove_setting(gchar *name) { GConfClient *client; client = gconf_client_get_default(); gconf_client_set_list(client, gconf_concat_dir_and_key(SEARCH_PREF_PATH, "list_pref"), GCONF_VALUE_STRING, list_pref, NULL); // FIXME : Remove Setting Directory gconf_client_remove_dir(client, gconf_concat_dir_and_key(SEARCH_PREF_PATH, name), NULL); }
void marina_prefs_set_active_plugins (const GSList *plugins) { g_return_if_fail (gconf_client != NULL); g_return_if_fail (marina_prefs_active_plugins_can_set ()); gconf_client_set_list (gconf_client, MPM_ACTIVE_PLUGINS, GCONF_VALUE_STRING, (GSList *) plugins, NULL); }
static void search_preferences_save_search_pref(gchar *name) { GConfClient *client; gchar *path; client = gconf_client_get_default(); gconf_client_set_list(client, gconf_concat_dir_and_key(SEARCH_PREF_PATH, "list_pref"), GCONF_VALUE_STRING, list_pref, NULL); path = gconf_concat_dir_and_key(SEARCH_PREF_PATH, name); gconf_client_add_dir(client, path, GCONF_CLIENT_PRELOAD_NONE, NULL); search_preferences_save_setting(name); }
static void mixer_tracks_selection_changed (GtkTreeSelection *selection, gpointer user_data) { GSList *label_list = NULL; gtk_tree_selection_selected_foreach (selection, (GtkTreeSelectionForeachFunc)add_track_label_to_list, &label_list); label_list = g_slist_reverse (label_list); gconf_client_set_list (gconf_client, DEFAULT_MIXER_TRACKS_KEY, GCONF_VALUE_STRING, label_list, NULL); g_slist_foreach (label_list, (GFunc)g_free, NULL); g_slist_free (label_list); }
static void save_toolbar_state (GConfClient *client, MtpToolbar *toolbar) { GError *error = NULL; if (mtp_toolbar_was_modified (MTP_TOOLBAR (toolbar))) { GList *panels = mtp_toolbar_get_panel_buttons (MTP_TOOLBAR (toolbar)); GList *applets = mtp_toolbar_get_applet_buttons (MTP_TOOLBAR (toolbar)); GSList *children = NULL; GList *dl; for (dl = panels; dl; dl = dl->next) { MtpToolbarButton *tb = dl->data; const gchar *name = mtp_toolbar_button_get_name (tb); children = g_slist_prepend (children, (gchar*)name); } for (dl = g_list_last (applets); dl; dl = dl->prev) { MtpToolbarButton *tb = dl->data; const gchar *name = mtp_toolbar_button_get_name (tb); g_debug ("Adding %s to list", name); children = g_slist_prepend (children, (gchar*)name); } children = g_slist_reverse (children); if (!gconf_client_set_list (client, KEY_ORDER, GCONF_VALUE_STRING, children, &error)) { g_warning ("Failed to set key " KEY_ORDER ": %s", error ? error->message : "unknown error"); g_clear_error (&error); } g_list_free (panels); g_list_free (applets); g_slist_free (children); } else g_debug ("Toolbar not modified"); }
void gsearchtool_gconf_set_list (const gchar * key, GSList * list, GConfValueType list_type) { GConfClient * client; GError * error = NULL; g_return_if_fail (key != NULL); client = gsearchtool_gconf_client_get_global (); g_return_if_fail (client != NULL); gconf_client_set_list (client, key, list_type, list, &error); gsearchtool_gconf_handle_error (&error); }
bool Conf::SetStringList(const gchar *key, std::list < std::string > &list) { GSList *slist = NULL; gboolean ret = false; if (!gconf_client) return false; for (std::list < std::string >::iterator i = list.begin(); i != list.end(); ++i) { slist = g_slist_append(slist, (gpointer) i->c_str()); } if (slist) { ret = gconf_client_set_list(gconf_client, key, GCONF_VALUE_STRING, slist, NULL); g_slist_free(slist); } return ret; }
void eel_gconf_set_string_list (const char *key, const GSList *slist) { GConfClient *client; GError *error; g_return_if_fail (key != NULL); client = eel_gconf_client_get_global (); g_return_if_fail (client != NULL); error = NULL; gconf_client_set_list (client, key, GCONF_VALUE_STRING, /* Need cast cause of GConf api bug */ (GSList *) slist, &error); eel_gconf_handle_error (&error); }
void preferences_set_list (const char *key, PreferencesValue val, GSList *list) { GError *err; int gval; switch (val) { case PREFERENCES_VALUE_INT: gval = GCONF_VALUE_INT; break; case PREFERENCES_VALUE_STRING: gval = GCONF_VALUE_STRING; break; } err = NULL; gconf_client_set_list (warlock_gconf_client, key, gval, list, &err); print_error (err); }
/* these method are useful to manipulate disabled accounts list, these are * account names that plugin should not try to access or show in any way, user * can disable/enable account only manually using evo. account preferences */ void eee_accounts_manager_disable_account(EeeAccountsManager *self, const char *name) { GSList *accounts; g_return_if_fail(IS_EEE_ACCOUNTS_MANAGER(self)); g_return_if_fail(name != NULL); if (eee_accounts_manager_account_is_disabled(self, name)) { return; } accounts = gconf_client_get_list(self->priv->gconf, EEE_KEY "disabled_accounts", GCONF_VALUE_STRING, NULL); accounts = g_slist_append(accounts, g_strdup(name)); gconf_client_set_list(self->priv->gconf, EEE_KEY "disabled_accounts", GCONF_VALUE_STRING, accounts, NULL); g_slist_foreach(accounts, (GFunc)g_free, NULL); g_slist_free(accounts); }
/** * panel_applet_gconf_set_list: * @applet: a #PanelApplet. * @key: a GConf key name. * @list_type: type of items in @list. * @list: new value for @key. * @error: a #GError, or %NULL. * * Convenience wrapper around gconf_client_set_list() to update @key in the * per-instance GConf directory of @applet. * * Deprecated: 3.0: Use #GSettings to store per-instance settings. **/ void panel_applet_gconf_set_list (PanelApplet *applet, const gchar *key, GConfValueType list_type, GSList *list, GError **error) { GConfClient *client; gchar *full_key; g_return_if_fail (PANEL_IS_APPLET (applet)); full_key = panel_applet_gconf_get_full_key (applet, key); client = panel_applet_gconf_get_client (); gconf_client_set_list (client, full_key, list_type, list, error); g_free (full_key); }
void gnc_gconf_set_list (const gchar *section, const gchar *name, GConfValueType list_type, GSList *value, GError **caller_error) { GError *error = NULL; gchar *key; if (our_client == NULL) our_client = gconf_client_get_default(); key = gnc_gconf_make_key(section, name); if (!gconf_client_set_list(our_client, key, list_type, value, &error)) { gnc_gconf_save_error(key, caller_error, error); } g_free(key); }
static void config_save (GConfClient *gconf) { GList *it; GSList *paths = NULL; gconf_client_set_bool (gconf, LOOP_PLAYLIST, main_loop_at_end, NULL); gconf_client_set_bool (gconf, RANDOM_ORDER, main_random_order, NULL); gconf_client_set_int (gconf, PLAYLIST_POSITION, g_list_position (playlist, playlist_current), NULL); for (it = playlist; it; it = g_list_next(it)) { paths = g_slist_append (paths, MAIN_PATH (it->data)); } gconf_client_set_list (gconf, PLAYLIST, GCONF_VALUE_STRING, paths, NULL); g_slist_free(paths); gconf_client_suggest_sync (gconf, NULL); }
static void alarm_del (MnpAlarmItem *item) { GSList *list, *tmp, *del_node; GConfClient *client; client = gconf_client_get_default(); list = gconf_client_get_list (client,"/apps/date-time-panel/alarms", GCONF_VALUE_STRING, NULL); tmp = list; while(tmp) { char *data = (char *)tmp->data; int id, on_off, hour, min, am_pm, recur, snooze, sound; sscanf(data, "%d %d %d %d %d %d %d %d", &id, &on_off, &hour, &min, &am_pm, &recur, &snooze, &sound); if (id == item->id) { del_node = tmp; break; } tmp = tmp->next; } if (del_node) { list = g_slist_remove_link (list, del_node); gconf_client_set_list(client,"/apps/date-time-panel/alarms", GCONF_VALUE_STRING, list, NULL); g_free (del_node->data); g_slist_free_1 (del_node); } g_slist_foreach(list, (GFunc)g_free, NULL); g_slist_free(list); g_object_unref(client); }
static void dbus_migration_remove_autoload (void) { GConfClient *client; GSList *enabled_plugins, *l; client = gconf_client_get_default (); enabled_plugins = gconf_client_get_list (client, "/apps/xchat/plugins/loaded", GCONF_VALUE_STRING, NULL); l = enabled_plugins; while (l != NULL) { if (g_str_has_suffix (l->data, "dbus.so")) { /* Remove the dbus plugin from the autoload list */ GSList *tmp = l->next; enabled_plugins = g_slist_delete_link (enabled_plugins, l); l = tmp; } else { l = l->next; } } gconf_client_set_list (client, "/apps/xchat/plugins/loaded", GCONF_VALUE_STRING, enabled_plugins, NULL); g_object_unref (client); }
static gboolean gsd_chk_file_list (void) { GDir *home_dir; const char *fname; GSList *file_list = NULL; GSList *last_login_file_list = NULL; GSList *tmp = NULL; GSList *tmp_l = NULL; gboolean new_file_exist = FALSE; GConfClient *conf_client; home_dir = g_dir_open (g_get_home_dir (), 0, NULL); while ((fname = g_dir_read_name (home_dir)) != NULL) { if (g_strrstr (fname, "modmap")) { file_list = g_slist_append (file_list, g_strdup (fname)); } } g_dir_close (home_dir); conf_client = gconf_client_get_default (); last_login_file_list = gconf_client_get_list (conf_client, KNOWN_FILES_KEY, GCONF_VALUE_STRING, NULL); /* Compare between the two file list, currently available modmap files and the files available in the last log in */ tmp = file_list; while (tmp != NULL) { tmp_l = last_login_file_list; new_file_exist = TRUE; while (tmp_l != NULL) { if (strcmp (tmp->data, tmp_l->data) == 0) { new_file_exist = FALSE; break; } else { tmp_l = tmp_l->next; } } if (new_file_exist) { break; } else { tmp = tmp->next; } } if (new_file_exist) { gconf_client_set_list (conf_client, KNOWN_FILES_KEY, GCONF_VALUE_STRING, file_list, NULL); } g_object_unref (conf_client); g_slist_foreach (file_list, (GFunc) g_free, NULL); g_slist_free (file_list); g_slist_foreach (last_login_file_list, (GFunc) g_free, NULL); g_slist_free (last_login_file_list); return new_file_exist; }
static void apply_xkb_settings (void) { GConfClient *conf_client; GkbdKeyboardConfig current_sys_kbd_config; int group_to_activate = -1; char *gdm_layout; char *s; if (!inited_ok) return; conf_client = gconf_client_get_default (); /* With GDM the user can already set a layout from the login * screen. Try to keep that setting. * We clear gdm_keyboard_layout early, so we don't risk * recursion from gconf notification. */ gdm_layout = g_strdup (gdm_keyboard_layout); gdm_keyboard_layout = NULL; /* gdm's configuration and $GDM_KEYBOARD_LAYOUT separates layout and * variant with a space, but gconf uses tabs; so convert to be robust * with both */ for (s = gdm_layout; s && *s; ++s) { if (*s == ' ') { *s = '\t'; } } if (gdm_layout != NULL) { GSList *layouts; GSList *found_node; int max_groups; max_groups = xkl_engine_get_max_num_groups (xkl_engine); layouts = gconf_client_get_list (conf_client, GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS, GCONF_VALUE_STRING, NULL); /* Add the layout if it doesn't already exist. XKB limits the * total number of layouts. If we already have the maximum * number of layouts configured, we replace the last one. This * prevents the list from becoming full if the user has a habit * of selecting many different keyboard layouts in GDM. */ found_node = g_slist_find_custom (layouts, gdm_layout, (GCompareFunc) g_strcmp0); if (!found_node) { /* Insert at the last valid place, or at the end of * list, whichever comes first */ layouts = g_slist_insert (layouts, g_strdup (gdm_layout), max_groups - 1); if (g_slist_length (layouts) > max_groups) { GSList *last; GSList *free_layouts; last = g_slist_nth (layouts, max_groups - 1); free_layouts = last->next; last->next = NULL; g_slist_foreach (free_layouts, (GFunc) g_free, NULL); g_slist_free (free_layouts); } gconf_client_set_list (conf_client, GKBD_KEYBOARD_CONFIG_KEY_LAYOUTS, GCONF_VALUE_STRING, layouts, NULL); } g_slist_foreach (layouts, (GFunc) g_free, NULL); g_slist_free (layouts); } gkbd_keyboard_config_init (¤t_sys_kbd_config, conf_client, xkl_engine); gkbd_keyboard_config_load_from_gconf (¤t_kbd_config, &initial_sys_kbd_config); gkbd_keyboard_config_load_from_x_current (¤t_sys_kbd_config, NULL); if (!try_activating_xkb_config_if_new (¤t_sys_kbd_config)) { if (filter_xkb_config ()) { if (!try_activating_xkb_config_if_new (¤t_sys_kbd_config)) { g_warning ("Could not activate the filtered XKB configuration"); activation_error (); } } else { g_warning ("Could not activate the XKB configuration"); activation_error (); } } else xkl_debug (100, "Actual KBD configuration was not changed: redundant notification\n"); if (gdm_layout != NULL) { /* If there are multiple layouts, * try to find the one closest to the gdm layout */ GSList *l; int i; size_t len = strlen (gdm_layout); for (i = 0, l = current_kbd_config.layouts_variants; l; i++, l = l->next) { char *lv = l->data; if (strncmp (lv, gdm_layout, len) == 0 && (lv[len] == '\0' || lv[len] == '\t')) { group_to_activate = i; break; } } } g_free (gdm_layout); if (group_to_activate != -1) xkl_engine_lock_group (current_config.engine, group_to_activate); gkbd_keyboard_config_term (¤t_sys_kbd_config); }
void dates_autoselect_calendars (DatesData *d, ESourceList * cal_list) { GSList *selected_list; if (!cal_list) return; selected_list = gconf_client_get_list (gconf_client_get_default (), CALENDAR_GCONF_SELECTED, GCONF_VALUE_STRING, NULL); if (!selected_list) { /* select all available calendars */ GSList *list = NULL, *groups, *g; groups = e_source_list_peek_groups (cal_list); #ifdef DEBUG if (d->debug & DATES_DEBUG_CALENDAR) g_debug ("Attempting to autoselect"); #endif for (g = groups; g; g = g->next) { GSList *sources, *s; sources = e_source_group_peek_sources (E_SOURCE_GROUP (g->data)); for (s = sources; s; s = s->next) { ESource *source = E_SOURCE (s->data); ECal *ecal; gchar * uid; ecal = dates_load_esource (source, E_CAL_SOURCE_TYPE_EVENT, NULL, d); if (!ecal) { #ifdef DEBUG if (d->debug & DATES_DEBUG_CALENDAR) g_debug ("No ecal"); #endif continue; } uid = (gchar *)e_source_peek_uid (e_cal_get_source (ecal)); list = g_slist_prepend (list, uid); } } if (list) { #ifdef DEBUG if (d->debug & DATES_DEBUG_CALENDAR) g_debug ("Setting new list"); #endif gconf_client_set_list (gconf_client_get_default (), CALENDAR_GCONF_SELECTED, GCONF_VALUE_STRING, list, NULL); } } else #ifdef DEBUG if (d->debug & DATES_DEBUG_CALENDAR) g_debug ("Have selected list"); #endif }
void awn_applet_manager_load_applets (AwnAppletManager *manager) { AwnAppletManagerPrivate *priv; GError *err = NULL; GSList *keys = NULL, *k; GConfClient *client = gconf_client_get_default (); g_return_if_fail (AWN_IS_APPLET_MANAGER (manager)); priv = AWN_APPLET_MANAGER_GET_PRIVATE (manager); priv->applets = g_hash_table_new (g_str_hash, g_str_equal); keys = gconf_client_get_list (client, AWN_APPLETS_KEY, GCONF_VALUE_STRING, &err); if (keys == NULL || err) { keys = g_slist_append (keys, LIBDIR"/awn/applets/taskman.desktop::1"); gconf_client_set_list (client, AWN_APPLETS_KEY, GCONF_VALUE_STRING, keys, NULL); if (err) g_print ("%s\n", err->message); return; } for (k = keys; k != NULL; k = k->next) { GtkWidget *applet = NULL; gchar **tokens = NULL; tokens = g_strsplit (k->data, "::", 2); if (tokens == NULL) { g_warning ("Bad key: %s", (gchar*)k->data); continue; } if (g_strstr_len (tokens[0], strlen (tokens[0]), "taskman")) { applet = _load_taskmanager (manager); } else { applet = awn_applet_proxy_new (tokens[0], tokens[1]); g_object_set (G_OBJECT (applet), "orient", AWN_ORIENTATION_BOTTOM, "height", priv->settings->bar_height, NULL); } gtk_widget_set_size_request (applet, -1, (priv->settings->bar_height)*2 +priv->settings->icon_offset); gtk_box_pack_start (GTK_BOX (manager), applet, FALSE, FALSE, 0); gtk_widget_show_all (GTK_WIDGET (applet)); g_object_set_qdata (G_OBJECT (applet), touch_quark, GINT_TO_POINTER (0)); g_hash_table_insert (priv->applets, g_strdup (tokens[1]), applet); if (AWN_IS_APPLET_PROXY (applet)) awn_applet_proxy_exec (AWN_APPLET_PROXY (applet)); if (g_strstr_len (tokens[0], strlen (tokens[0]), "separator")) { awn_bar_add_separator (AWN_BAR (priv->settings->bar), applet); } g_print ("APPLET : %s\n", tokens[0]); g_strfreev (tokens); } }
static EPublishUri * migrateURI (const gchar *xml, xmlDocPtr doc) { GConfClient *client; GSList *uris, *l, *events = NULL; xmlChar *location, *enabled, *frequency, *username; xmlNodePtr root, p; EPublishUri *uri; gchar *password, *temp; EUri *euri; client = gconf_client_get_default (); uris = gconf_client_get_list (client, "/apps/evolution/calendar/publish/uris", GCONF_VALUE_STRING, NULL); l = uris; while (l && l->data) { gchar *str = l->data; if (strcmp (xml, str) == 0) { uris = g_slist_remove (uris, str); g_free (str); } l = g_slist_next (l); } uri = g_new0 (EPublishUri, 1); root = doc->children; location = xmlGetProp (root, (const unsigned char *)"location"); enabled = xmlGetProp (root, (const unsigned char *)"enabled"); frequency = xmlGetProp (root, (const unsigned char *)"frequency"); username = xmlGetProp (root, (const unsigned char *)"username"); euri = e_uri_new ((const char *)location); if (!euri) { g_warning ("Could not form the uri for %s \n", location); goto cleanup; } if (euri->user) g_free (euri->user); euri->user = g_strdup ((const char *)username); temp = e_uri_to_string (euri, FALSE); uri->location = g_strdup_printf ("dav://%s", strstr (temp, "//") + 2); g_free (temp); e_uri_free (euri); if (enabled != NULL) uri->enabled = atoi ((char *)enabled); if (frequency != NULL) uri->publish_frequency = atoi ((char *)frequency); uri->publish_format = URI_PUBLISH_AS_FB; password = e_passwords_get_password ("Calendar", (char *)location); if (password) { e_passwords_forget_password ("Calendar", (char *)location); e_passwords_add_password (uri->location, password); e_passwords_remember_password ("Calendar", uri->location); } for (p = root->children; p != NULL; p = p->next) { xmlChar *uid = xmlGetProp (p, (const unsigned char *)"uid"); if (strcmp ((char *)p->name, "source") == 0) { events = g_slist_append (events, uid); } else { g_free (uid); } } uri->events = events; uris = g_slist_prepend (uris, e_publish_uri_to_xml (uri)); gconf_client_set_list (client, "/apps/evolution/calendar/publish/uris", GCONF_VALUE_STRING, uris, NULL); g_slist_foreach (uris, (GFunc) g_free, NULL); g_slist_free (uris); g_object_unref (client); cleanup: xmlFree (location); xmlFree (enabled); xmlFree (frequency); xmlFree (username); xmlFreeDoc (doc); return uri; }