/* Properties dialog */ static void save_macros_to_gsettings (MCData *mc) { MCPrefsDialog *dialog; GtkTreeIter iter; GArray *patterns; GArray *commands; dialog = &mc->prefs_dialog; if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->macros_store), &iter)) return; patterns = g_array_new (TRUE, TRUE, sizeof (gchar *)); commands = g_array_new (TRUE, TRUE, sizeof (gchar *)); do { char *pattern = NULL; char *command = NULL; gtk_tree_model_get (GTK_TREE_MODEL (dialog->macros_store), &iter, 0, &pattern, 1, &command, -1); patterns = g_array_append_val (patterns, pattern); commands = g_array_append_val (commands, command); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->macros_store), &iter)); g_settings_set_strv (mc->global_settings, KEY_MACRO_PATTERNS, (const char **) patterns->data); g_settings_set_strv (mc->global_settings, KEY_MACRO_COMMANDS, (const char **) commands->data); g_array_free (patterns, TRUE); g_array_free (commands, TRUE); }
static void update_active_encodings_gsettings (void) { GSList *list, *l; GArray *strings; const gchar *id_string; GSettings *settings; list = terminal_app_get_active_encodings (terminal_app_get ()); strings = g_array_new (TRUE, TRUE, sizeof (gchar *)); for (l = list; l != NULL; l = l->next) { TerminalEncoding *encoding = (TerminalEncoding *) l->data; id_string = terminal_encoding_get_id (encoding); strings = g_array_append_val (strings, id_string); } settings = g_settings_new (CONF_GLOBAL_SCHEMA); g_settings_set_strv (settings, "active-encodings", (const gchar **) strings->data); g_object_unref (settings); g_array_free (strings, TRUE); g_slist_foreach (list, (GFunc) terminal_encoding_unref, NULL); g_slist_free (list); }
void logview_prefs_remove_stored_log (LogviewPrefs *prefs, GFile *target) { gchar **stored_logs; GFile *stored; GPtrArray *new_value; gint idx; gboolean removed = FALSE; g_assert (LOGVIEW_IS_PREFS (prefs)); g_assert (G_IS_FILE (target)); stored_logs = logview_prefs_get_stored_logfiles (prefs); new_value = g_ptr_array_new (); for (idx = 0; stored_logs[idx] != NULL; idx++) { stored = g_file_parse_name (stored_logs[idx]); if (!g_file_equal (stored, target)) { g_ptr_array_add (new_value, g_strdup (stored_logs[idx])); } g_object_unref (stored); } g_ptr_array_add (new_value, NULL); g_strfreev (stored_logs); stored_logs = (gchar **) g_ptr_array_free (new_value, FALSE); g_settings_set_strv (prefs->priv->logview_prefs, PREF_LOGFILES, (const gchar **) stored_logs); g_strfreev (stored_logs); }
static void do_setup (GtkWidget * widget, gpointer data) { const gchar *type_name = NULL; int i; char **player_names; gsize n_player_names; NumberOfComputers = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ComputerSpinner)); NumberOfHumans = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (HumanSpinner)); if (tmpDoDelay == -1) tmpDoDelay = DoDelay; else DoDelay = tmpDoDelay; DisplayComputerThoughts = tmpDisplayComputerThoughts; for (i = 0; i < MAX_NUMBER_OF_PLAYERS; i++) { if (players[i].name != _(DefaultPlayerNames[i])) g_free (players[i].name); players[i].name = g_strdup (gtk_entry_get_text (GTK_ENTRY (PlayerNames[i]))); if (i < NumberOfPlayers) score_list_set_column_title (ScoreList, i + 1, players[i].name); } setupdialog_destroy (setupdialog, 1); n_player_names = MAX_NUMBER_OF_PLAYERS; player_names = g_newa (char *, n_player_names + 1); for (i = 0; i < MAX_NUMBER_OF_PLAYERS; ++i) { player_names[i] = players[i].name; } player_names[i] = NULL; g_settings_set_strv (settings, "player-names", (const gchar *const *) player_names); g_settings_set_int (settings, "number-of-computer-opponents", NumberOfComputers); g_settings_set_int (settings, "number-of-human-opponents", NumberOfHumans); g_settings_set_boolean (settings, "delay-between-rolls", DoDelay); type_name = game_type_name (NewGameType); if (type_name) { g_settings_set_string (settings, "game-type", type_name); } g_settings_set_int (settings, "monte-carlo-trials", NUM_TRIALS); if (((NumberOfComputers != OriginalNumberOfComputers) || (NumberOfHumans != OriginalNumberOfHumans) || (NewGameType != game_type)) && !GameIsOver ()) WarnNumPlayersChanged (); }
static void nimf_settings_page_key_update_gsettings_strv (NimfSettingsPageKey *page_key, GtkTreeModel *model) { gchar **vals; GtkTreeIter iter; gint i; vals = g_malloc0_n (1, sizeof (gchar *)); if (gtk_tree_model_get_iter_first (model, &iter)) { i = 0; do { gtk_tree_model_get (model, &iter, 0, &vals[i], -1); vals = g_realloc_n (vals, sizeof (gchar *), i + 2); vals[i + 1] = NULL; i++; } while (gtk_tree_model_iter_next (model, &iter)); } g_settings_set_strv (page_key->gsettings, page_key->key, (const gchar **) vals); g_strfreev (vals); }
static void assign_custom_key_to_dir_button (CcWacomButtonRow *row, gchar *custom_key) { GsdWacomTabletButton *button; GtkDirectionType dir; char *strs[3]; char **strv; button = row->priv->button; dir = row->priv->direction; strs[2] = NULL; strs[0] = strs[1] = ""; strv = g_settings_get_strv (button->settings, KEY_CUSTOM_ELEVATOR_ACTION); if (strv != NULL) { if (g_strv_length (strv) >= 1) strs[0] = strv[0]; if (g_strv_length (strv) >= 2) strs[1] = strv[1]; } if (dir == GTK_DIR_UP) strs[0] = custom_key; else strs[1] = custom_key; g_settings_set_strv (button->settings, KEY_CUSTOM_ELEVATOR_ACTION, (const gchar * const*) strs); g_clear_pointer (&strv, g_strfreev); }
static void on_enable_clicked (GtkWidget *button, NemoExtensionConfigWidget *widget) { g_settings_set_strv (nemo_plugin_preferences, NEMO_PLUGIN_PREFERENCES_DISABLED_EXTENSIONS, NULL); }
static void _panel_run_save_recent_programs_list (PanelRunDialog *dialog, GtkComboBox *entry, char *lastcommand) { GtkTreeModel *model; GtkTreeIter iter; GArray *items; gint i = 0; items = g_array_new (TRUE, TRUE, sizeof (gchar *)); g_array_append_val (items, lastcommand); i++; model = gtk_combo_box_get_model (GTK_COMBO_BOX (entry)); if (gtk_tree_model_get_iter_first (model, &iter)) { char *command; do { gtk_tree_model_get (model, &iter, 0, &command, -1); if (g_strcmp0 (command, lastcommand) == 0) continue; g_array_append_val (items, command); i++; } while (gtk_tree_model_iter_next (model, &iter) && i < PANEL_RUN_MAX_HISTORY); } g_settings_set_strv (dialog->settings, PANEL_RUN_HISTORY_KEY, (const gchar **) items->data); g_array_free (items, TRUE); }
static void icon_captions_changed_callback (GtkComboBox *combo_box, gpointer user_data) { GPtrArray *captions; GtkBuilder *builder; int i; builder = GTK_BUILDER (user_data); captions = g_ptr_array_new (); for (i = 0; icon_captions_components[i] != NULL; i++) { GtkWidget *combo_box; int active; GPtrArray *column_names; char *name; combo_box = GTK_WIDGET (gtk_builder_get_object (builder, icon_captions_components[i])); active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)); column_names = g_object_get_data (G_OBJECT (combo_box), "column_names"); name = g_ptr_array_index (column_names, active); g_ptr_array_add (captions, name); } g_ptr_array_add (captions, NULL); g_settings_set_strv (nemo_icon_view_preferences, NEMO_PREFERENCES_ICON_VIEW_CAPTIONS, (const char **)captions->pdata); g_ptr_array_free (captions, TRUE); }
static void add_file_chooser_response (GtkDialog *widget, GtkResponseType response, gpointer user_data) { Place *place; GPtrArray *new_values; if (response != GTK_RESPONSE_OK) { gtk_widget_destroy (GTK_WIDGET (widget)); return; } place = g_slice_new0 (Place); place->location = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (widget)); place->settings_key = TRACKER_KEY_RECURSIVE_DIRECTORIES; place->display_name = g_file_get_basename (place->location); new_values = place_get_new_settings_values (place, FALSE); g_settings_set_strv (tracker_preferences, place->settings_key, (const gchar **) new_values->pdata); g_ptr_array_unref (new_values); gtk_widget_destroy (GTK_WIDGET (widget)); place_free (place); }
static void on_enable_clicked (GtkWidget *button, NemoScriptConfigWidget *widget) { g_settings_set_strv (nemo_plugin_preferences, NEMO_PLUGIN_PREFERENCES_DISABLED_SCRIPTS, NULL); }
static void accel_cleared_callback (GtkCellRendererText *cell, const char *path_string, CcWacomPage *page) { GtkTreeView *view; GtkTreePath *path = gtk_tree_path_new_from_string (path_string); GtkTreeIter iter; GtkTreeModel *model; CsdWacomTabletButton *button; CcWacomPagePrivate *priv; GtkDirectionType dir; priv = page->priv; view = GTK_TREE_VIEW (MWID("shortcut_treeview")); model = gtk_tree_view_get_model (view); gtk_tree_model_get_iter (model, &iter, path); gtk_tree_path_free (path); gtk_tree_model_get (model, &iter, MAPPING_BUTTON_COLUMN, &button, MAPPING_BUTTON_DIRECTION, &dir, -1); /* sanity check */ if (button == NULL) return; /* Unset the key */ if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP || button->type == WACOM_TABLET_BUTTON_TYPE_RING) { char *strs[3]; char **strv; strs[2] = NULL; strs[0] = strs[1] = ""; strv = g_settings_get_strv (button->settings, KEY_CUSTOM_ELEVATOR_ACTION); if (strv != NULL) { if (g_strv_length (strv) >= 1) strs[0] = strv[0]; if (g_strv_length (strv) >= 2) strs[1] = strv[1]; } if (dir == GTK_DIR_UP) strs[0] = ""; else strs[1] = ""; if (*strs[0] == '\0' && *strs[1] == '\0') g_settings_set_enum (button->settings, ACTION_TYPE_KEY, CSD_WACOM_ACTION_TYPE_NONE); g_settings_set_strv (button->settings, KEY_CUSTOM_ELEVATOR_ACTION, (const gchar * const*) strs); if (strv != NULL) g_strfreev (strv); } else { g_settings_set_enum (button->settings, ACTION_TYPE_KEY, CSD_WACOM_ACTION_TYPE_NONE); g_settings_set_string (button->settings, CUSTOM_ACTION_KEY, ""); } }
static void csd_autorun_set_preferences (const char *x_content_type, gboolean pref_start_app, gboolean pref_ignore, gboolean pref_open_folder) { GSettings *settings; char **x_content_start_app; char **x_content_ignore; char **x_content_open_folder; g_assert (x_content_type != NULL); settings = g_settings_new ("org.cinnamon.desktop.media-handling"); x_content_start_app = g_settings_get_strv (settings, "autorun-x-content-start-app"); x_content_ignore = g_settings_get_strv (settings, "autorun-x-content-ignore"); x_content_open_folder = g_settings_get_strv (settings, "autorun-x-content-open-folder"); x_content_start_app = remove_elem_from_str_array (x_content_start_app, x_content_type); if (pref_start_app) { x_content_start_app = add_elem_to_str_array (x_content_start_app, x_content_type); } g_settings_set_strv (settings, "autorun-x-content-start-app", (const gchar * const*) x_content_start_app); x_content_ignore = remove_elem_from_str_array (x_content_ignore, x_content_type); if (pref_ignore) { x_content_ignore = add_elem_to_str_array (x_content_ignore, x_content_type); } g_settings_set_strv (settings, "autorun-x-content-ignore", (const gchar * const*) x_content_ignore); x_content_open_folder = remove_elem_from_str_array (x_content_open_folder, x_content_type); if (pref_open_folder) { x_content_open_folder = add_elem_to_str_array (x_content_open_folder, x_content_type); } g_settings_set_strv (settings, "autorun-x-content-open-folder", (const gchar * const*) x_content_open_folder); g_strfreev (x_content_open_folder); g_strfreev (x_content_ignore); g_strfreev (x_content_start_app); g_object_unref (settings); }
void caja_autorun_set_preferences (const char *x_content_type, gboolean pref_start_app, gboolean pref_ignore, gboolean pref_open_folder) { char **x_content_start_app; char **x_content_ignore; char **x_content_open_folder; g_assert (x_content_type != NULL); x_content_start_app = g_settings_get_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP); x_content_ignore = g_settings_get_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE); x_content_open_folder = g_settings_get_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER); remove_elem_from_str_array (x_content_start_app, x_content_type); if (pref_start_app) { x_content_start_app = add_elem_to_str_array (x_content_start_app, x_content_type); } g_settings_set_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP, (const gchar * const*) x_content_start_app); remove_elem_from_str_array (x_content_ignore, x_content_type); if (pref_ignore) { x_content_ignore = add_elem_to_str_array (x_content_ignore, x_content_type); } g_settings_set_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE, (const gchar * const*) x_content_ignore); remove_elem_from_str_array (x_content_open_folder, x_content_type); if (pref_open_folder) { x_content_open_folder = add_elem_to_str_array (x_content_open_folder, x_content_type); } g_settings_set_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER, (const gchar * const*) x_content_open_folder); g_strfreev (x_content_open_folder); g_strfreev (x_content_ignore); g_strfreev (x_content_start_app); }
static void open_cb (GtkWidget *widget, gpointer callback_data) { DialogData *data = callback_data; const char *application; gboolean present = FALSE; char *command = NULL; GList *scan; char **editors; int i; application = gtk_entry_get_text (GTK_ENTRY (data->o_app_entry)); for (scan = data->app_list; scan; scan = scan->next) { GAppInfo *app = scan->data; if (strcmp (g_app_info_get_executable (app), application) == 0) { fr_window_open_files_with_application (data->window, data->file_list, app); gtk_widget_destroy (data->dialog); return; } } /* add the command to the editors list if not already present. */ editors = g_settings_get_strv (data->settings, PREF_GENERAL_EDITORS); for (i = 0; ! present && editors[i] != NULL; i++) { if (strcmp (editors[i], application) == 0) { command = g_strdup (editors[i]); present = TRUE; } } if (! present) { char **new_editors; new_editors = _g_strv_prepend (editors, g_strdup (application)); command = g_strdup (application); g_settings_set_strv (data->settings, PREF_GENERAL_EDITORS, (const gchar * const *) new_editors); g_strfreev (new_editors); } g_strfreev (editors); /* exec the application */ if (command != NULL) { fr_window_open_files_with_command (data->window, data->file_list, command); g_free (command); } gtk_widget_destroy (data->dialog); }
static void save_ignore_hosts_to_gsettings (void) { GArray *array; GSList *l; array = g_array_new (TRUE, TRUE, sizeof (gchar *)); for (l = ignore_hosts; l; l = l->next) { array = g_array_append_val (array, l->data); } g_settings_set_strv (proxy_settings, IGNORE_HOSTS_KEY, (const gchar **) array->data); g_array_free (array, TRUE); }
static void columns_changed_callback (NemoColumnChooser *chooser, gpointer callback_data) { char **visible_columns; char **column_order; nemo_column_chooser_get_settings (NEMO_COLUMN_CHOOSER (chooser), &visible_columns, &column_order); g_settings_set_strv (nemo_list_view_preferences, NEMO_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS, (const char * const *)visible_columns); g_settings_set_strv (nemo_list_view_preferences, NEMO_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER, (const char * const *)column_order); g_strfreev (visible_columns); g_strfreev (column_order); }
/* keeps max 'day_second_zones_max' zones, if 'location' * is already in a list, then it'll became first there */ void calendar_config_set_day_second_zone (const gchar *location) { calendar_config_init (); if (location && *location) { GSList *lst, *l; gint max_zones; GPtrArray *array; gint i; /* configurable max number of timezones to remember */ max_zones = g_settings_get_int (config, "day-second-zones-max"); if (max_zones <= 0) max_zones = 5; lst = calendar_config_get_day_second_zones (); for (l = lst; l; l = l->next) { if (l->data && g_str_equal (l->data, location)) { if (l != lst) { /* isn't first in the list */ gchar *val = l->data; lst = g_slist_remove (lst, val); lst = g_slist_prepend (lst, val); } break; } } if (!l) { /* not in the list yet */ lst = g_slist_prepend (lst, g_strdup (location)); } array = g_ptr_array_new (); for (i = 0, l = lst; i < max_zones && l != NULL; i++, l = l->next) g_ptr_array_add (array, l->data); g_ptr_array_add (array, NULL); g_settings_set_strv ( config, "day-second-zones", (const gchar * const *) array->pdata); calendar_config_free_day_second_zones (lst); g_ptr_array_free (array, FALSE); } g_settings_set_string ( config, "day-second-zone", (location != NULL) ? location : ""); }
/* load_history indicates whether the history list is being loaded at startup. ** If true then don't save the new entries with gconf (since they are being read ** using gconf */ void append_history_entry(MCData *mcdata, const char * entry, gboolean load_history) { GArray *history; int pos, i; /* remove older dupes */ for(pos = 0; pos <= MC_HISTORY_LIST_LENGTH - 1; pos++) { if(exists_history_entry(pos) && strcmp(entry, history_command[pos]) == 0) /* dupe found */ delete_history_entry(pos); } /* delete oldest entry */ if(history_command[0] != NULL) free(history_command[0]); /* move entries */ for(pos = 0; pos < MC_HISTORY_LIST_LENGTH - 1; pos++) { history_command[pos] = history_command[pos+1]; /* printf("%s\n", history_command[pos]); */ } /* append entry */ history_command[MC_HISTORY_LIST_LENGTH - 1] = (char *)malloc(sizeof(char) * (strlen(entry) + 1)); strcpy(history_command[MC_HISTORY_LIST_LENGTH - 1], entry); if (load_history) return; /* If not writable, just keeps the history around for this session */ if (!g_settings_is_writable (mcdata->settings, KEY_HISTORY)) return; /* Save history - this seems like a waste to do it every time it's updated ** but it doesn't seem to work when called on the destroy signal of the applet */ history = g_array_new (TRUE, TRUE, sizeof (gchar *)); for (i = 0; i < MC_HISTORY_LIST_LENGTH; i++) { if (exists_history_entry(i)) { gchar *entry = g_strdup (get_history_entry (i)); history = g_array_append_val (history, entry); } } g_settings_set_strv (mcdata->settings, KEY_HISTORY, (const gchar **) history->data); g_array_free (history, TRUE); }
static void save_excluded_uris (GtkTreeModel *model) { gchar **uris; uris = get_excluded_locations (model); g_settings_set_strv (baobab.prefs_settings, BAOBAB_SETTINGS_EXCLUDED_URIS, (const gchar * const *) uris); g_strfreev (uris); }
gboolean eom_plugin_engine_activate_plugin (EomPluginInfo *info) { eom_debug (DEBUG_PLUGINS); g_return_val_if_fail (info != NULL, FALSE); if (!info->available) return FALSE; if (info->active) return TRUE; if (eom_plugin_engine_activate_plugin_real (info)) { GSList *list; /* Update plugin state */ info->active = TRUE; list = active_plugins; while (list != NULL) { if (strcmp (info->location, (gchar *)list->data) == 0) { g_warning ("Plugin '%s' is already active.", info->name); return TRUE; } list = g_slist_next (list); } active_plugins = g_slist_insert_sorted (active_plugins, g_strdup (info->location), (GCompareFunc)strcmp); GArray *array; GSList *l; array = g_array_new (TRUE, TRUE, sizeof (gchar *)); for (l = active_plugins; l; l = l->next) { array = g_array_append_val (array, l->data); } g_settings_set_strv (eom_plugin_engine_settings, EOM_CONF_PLUGINS_ACTIVE_PLUGINS, (const gchar **) array->data); g_array_free (array, TRUE); return TRUE; } return FALSE; }
static void delete_recent_cb (GtkWidget *widget, gpointer callback_data) { DialogData *data = callback_data; GtkTreeSelection *selection; GtkTreeIter iter; if (data->last_clicked_list == data->o_recent_tree_view) { char *editor; char **editors; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->o_recent_tree_view)); if (! gtk_tree_selection_get_selected (selection, NULL, &iter)) return; gtk_tree_model_get (data->recent_model, &iter, 0, &editor, -1); gtk_list_store_remove (GTK_LIST_STORE (data->recent_model), &iter); /**/ editors = g_settings_get_strv (data->settings, PREF_GENERAL_EDITORS); if (_g_strv_remove (editors, editor)) g_settings_set_strv (data->settings, PREF_GENERAL_EDITORS, (const gchar * const *) editors); g_strfreev (editors); g_free (editor); } else if (data->last_clicked_list == data->o_app_tree_view) { GAppInfo *app; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->o_app_tree_view)); if (! gtk_tree_selection_get_selected (selection, NULL, &iter)) return; gtk_tree_model_get (data->app_model, &iter, DATA_COLUMN, &app, -1); gtk_list_store_remove (GTK_LIST_STORE (data->app_model), &iter); if (g_app_info_can_remove_supports_type (app)) { const char *mime_type; mime_type = get_file_mime_type_for_path ((char*) data->file_list->data, FALSE); g_app_info_remove_supports_type (app, mime_type, NULL); } } }
gboolean eom_plugin_engine_deactivate_plugin (EomPluginInfo *info) { gboolean res; GSList *list; eom_debug (DEBUG_PLUGINS); g_return_val_if_fail (info != NULL, FALSE); if (!info->active || !info->available) return TRUE; eom_plugin_engine_deactivate_plugin_real (info); /* Update plugin state */ info->active = FALSE; list = active_plugins; res = (list == NULL); while (list != NULL) { if (strcmp (info->location, (gchar *)list->data) == 0) { g_free (list->data); active_plugins = g_slist_delete_link (active_plugins, list); list = NULL; res = TRUE; } else { list = g_slist_next (list); } } if (!res) { g_warning ("Plugin '%s' is already deactivated.", info->name); return TRUE; } GArray *array; GSList *l; array = g_array_new (TRUE, TRUE, sizeof (gchar *)); for (l = active_plugins; l; l = l->next) { array = g_array_append_val (array, l->data); } g_settings_set_strv (eom_plugin_engine_settings, EOM_CONF_PLUGINS_ACTIVE_PLUGINS, (const gchar **) array->data); g_array_free (array, TRUE); return TRUE; }
void xkb_save_gslist_as_strv (gchar *schema, gchar *key, GSList *list) { GSettings *settings; GArray *array; GSList *l; array = g_array_new (TRUE, TRUE, sizeof (gchar *)); for (l = list; l; l = l->next) { array = g_array_append_val (array, l->data); } settings = g_settings_new (schema); g_settings_set_strv (settings, key, (const gchar **) array->data); g_array_free (array, TRUE); g_object_unref (settings); }
static void ignore_check_button_toggled_cb (GtkToggleButton *button, gpointer user_data) { MsdLdsmDialog *dialog = (MsdLdsmDialog *)user_data; GSettings *settings; gchar **settings_list; GSList *ignore_paths = NULL; GError *error = NULL; gboolean ignore, ret, updated; gint i; settings = g_settings_new (SETTINGS_SCHEMA); settings_list = g_settings_get_strv (settings, SETTINGS_IGNORE_PATHS); for (i = 0; i < G_N_ELEMENTS (settings_list); i++) { if (settings_list[i] != NULL) ignore_paths = g_slist_prepend (ignore_paths, g_strdup (settings_list[i])); } g_strfreev (settings_list); if (i > 0) ignore_paths = g_slist_reverse (ignore_paths); ignore = gtk_toggle_button_get_active (button); updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore); if (updated) { GSList *l; GPtrArray *array = g_ptr_array_new (); for (l = ignore_paths; l != NULL; l = l->next) g_ptr_array_add (array, l->data); g_ptr_array_add (array, NULL); if (!g_settings_set_strv (settings, SETTINGS_IGNORE_PATHS, (const gchar **) array->pdata)) { g_warning ("Cannot change ignore preference - failed to commit changes"); } g_ptr_array_free (array, FALSE); } g_slist_foreach (ignore_paths, (GFunc) g_free, NULL); g_slist_free (ignore_paths); g_object_unref (settings); }
static void remove_button_clicked (GtkWidget *widget, gpointer user_data) { GtkWidget *list_box = user_data; GtkWidget *child; Place *place; GPtrArray *new_values; child = egg_list_box_get_selected_child (EGG_LIST_BOX (list_box)); place = g_object_get_data (G_OBJECT (child), "place"); new_values = place_get_new_settings_values (place, TRUE); g_settings_set_strv (tracker_preferences, place->settings_key, (const gchar **) new_values->pdata); g_ptr_array_unref (new_values); }
static void on_disable_clicked (GtkWidget *button, NemoExtensionConfigWidget *widget) { GPtrArray *new_list = g_ptr_array_new (); GList *l; for (l = widget->current_extensions; l != NULL; l = l->next) g_ptr_array_add (new_list, g_strdup (((ExtensionProxy *) l->data)->name)); g_ptr_array_add (new_list, NULL); gchar **new_list_ptr = (char **) g_ptr_array_free (new_list, FALSE); g_settings_set_strv (widget->settings, BLACKLIST_KEY, (const gchar * const *) new_list_ptr); g_strfreev (new_list_ptr); }
static void gn_combo_history_settings_save (GnComboHistory *history) { const gchar **items; GSList *item; gint i; g_return_if_fail (GN_IS_COMBO_HISTORY (history)); g_return_if_fail (history->priv->id != NULL); items = g_malloc (sizeof (gchar *) * (g_slist_length (history->priv->items) + 1)); for (item = history->priv->items, i = 0; item; item = item->next, i++) items[i] = item->data; items[i] = NULL; g_settings_set_strv (history->priv->settings, history->priv->id, items); g_free (items); }
static void save_filters (LogviewPrefs *prefs) { GPtrArray *filters; gchar **filters_strv; filters = g_ptr_array_new (); g_hash_table_foreach (prefs->priv->filters, save_filter_foreach_func, filters); g_ptr_array_add (filters, NULL); filters_strv = (gchar **) g_ptr_array_free (filters, FALSE); g_settings_set_strv (prefs->priv->logview_prefs, PREF_FILTERS, (const gchar **) filters_strv); g_strfreev (filters_strv); }
static void on_disable_clicked (GtkWidget *button, NemoExtensionConfigWidget *widget) { GPtrArray *new_list = g_ptr_array_new (); GList *l; for (l = widget->current_extensions; l != NULL; l = l->next) g_ptr_array_add (new_list, g_strdup (((ExtensionProxy *) l->data)->name)); g_ptr_array_add (new_list, NULL); gchar **new_list_ptr = (char **) g_ptr_array_free (new_list, FALSE); g_settings_set_strv (nemo_plugin_preferences, NEMO_PLUGIN_PREFERENCES_DISABLED_EXTENSIONS, (const gchar * const *) new_list_ptr); g_strfreev (new_list_ptr); }