static void
update_shortcuts (GtkWidget *options)
{
        CcInputOptionsPrivate *priv = GET_PRIVATE (options);
        gchar **previous;
        gchar **next;
        gchar *previous_shortcut;
        GSettings *settings;

        settings = g_settings_new ("org.gnome.desktop.wm.keybindings");

        previous = g_settings_get_strv (settings, "switch-input-source-backward");
        next = g_settings_get_strv (settings, "switch-input-source");

        previous_shortcut = g_strdup (previous[0]);

        update_shortcut_label (priv->previous_source, previous_shortcut);
        update_shortcut_label (priv->next_source, next[0]);

        g_free (previous_shortcut);

        g_strfreev (previous);
        g_strfreev (next);

        g_object_unref (settings);
}
Ejemplo n.º 2
0
GSList *
go_conf_load_str_list (GOConfNode *node, gchar const *key)
{
	char **strs = NULL, **ptr;
	GSList *list = NULL;

	if (node) {
		if (key && !strchr (key, '/') &&  !strchr (key, '.'))
			strs = g_settings_get_strv (node->settings, key);
		else if (node->key)
			strs = g_settings_get_strv (node->settings, node->key);
	}
	if (strs == NULL) {
		GOConfNode *real_node = go_conf_get_node (node, key);
		strs = real_node? g_settings_get_strv (node->settings, real_node->key): NULL;
		go_conf_free_node (real_node);
	}
	if (strs) {
		for (ptr = strs; *ptr; ptr++)
			list = g_slist_prepend (list, g_strdup (*ptr));
		g_strfreev (strs);
	}

	return list;
}
Ejemplo n.º 3
0
static GSList *
mc_load_macros (MCData *mc)
{
    gchar  **macro_patterns;
    gchar  **macro_commands;
    GSList  *macros_list = NULL;
    guint    i;

	macro_patterns = g_settings_get_strv (mc->global_settings, KEY_MACRO_PATTERNS);
	macro_commands = g_settings_get_strv (mc->global_settings, KEY_MACRO_COMMANDS);

    for (i = 0; macro_patterns[i] != NULL && macro_commands[i] != NULL; i++) {
        MCMacro *macro;

        if (!(macro = mc_macro_new (macro_patterns[i], macro_commands[i])))
            continue;

        macros_list = g_slist_prepend (macros_list, macro);
    }

    g_strfreev (macro_patterns);
    g_strfreev (macro_commands);

    macros_list = g_slist_reverse (macros_list);

    return macros_list;
}
static void
update_modifiers_shortcut (GtkWidget *dialog)
{
        CcInputOptionsPrivate *priv = GET_PRIVATE (dialog);
        gchar **options, **p;
        GSettings *settings;
        GnomeXkbInfo *xkb_info;
        const gchar *text;

        xkb_info = gnome_xkb_info_new ();
        settings = g_settings_new ("org.gnome.desktop.input-sources");
        options = g_settings_get_strv (settings, "xkb-options");

        for (p = options; p && *p; ++p)
                if (g_str_has_prefix (*p, "grp:"))
                        break;

        if (p && *p) {
                text = gnome_xkb_info_description_for_option (xkb_info, "grp", *p);
                gtk_label_set_text (GTK_LABEL (priv->alt_next_source), text);
        } else {
                gtk_widget_hide (priv->alt_next_source);
        }

        g_strfreev (options);
        g_object_unref (settings);
        g_object_unref (xkb_info);
}
Ejemplo n.º 5
0
static void
update_restart_visiblity (NemoExtensionConfigWidget *widget)
{
    GList *tmp = g_list_copy (widget->initial_extension_ids);
    gchar **new_settings = g_settings_get_strv (widget->settings, BLACKLIST_KEY);

    gboolean needs_restart = FALSE;

    if (g_list_length (tmp) != g_strv_length (new_settings)) {
        needs_restart = TRUE;
        goto out;
    }

    int i;
    for (i = 0; i < g_strv_length (new_settings); i++) {
        GList *l = g_list_find_custom (tmp, new_settings[i], (GCompareFunc) g_strcmp0);
        if (!l) {
            needs_restart = TRUE;
            break;
        }
    }

out:
    g_strfreev (new_settings);
    g_list_free (tmp);

    gtk_widget_set_visible (widget->restart_button, needs_restart);
}
Ejemplo n.º 6
0
/* This doesn't contain the required components, so we need to always
 * call append_required_apps() after a call to append_default_apps(). */
static void append_default_apps(GsmManager* manager, const char* default_session_key, char** autostart_dirs)
{
	gint i;
	gchar** default_apps;
	GSettings* settings;

	g_debug("main: *** Adding default apps");

	g_assert(default_session_key != NULL);
	g_assert(autostart_dirs != NULL);

	settings = g_settings_new (GSM_SCHEMA);
	default_apps = g_settings_get_strv (settings, default_session_key);
	g_object_unref(settings);

	for (i = 0; default_apps[i]; i++)
	{
		char* app_path;

		if (IS_STRING_EMPTY((char*) default_apps[i]))
		{
			continue;
		}

		app_path = gsm_util_find_desktop_file_for_app_name(default_apps[i], autostart_dirs);

		if (app_path != NULL)
		{
			gsm_manager_add_autostart_app(manager, app_path, NULL);
			g_free(app_path);
		}
	}

	g_strfreev (default_apps);
}
Ejemplo n.º 7
0
static void
gsd_ldsm_get_config (void)
{
        gchar **settings_list;

        free_percent_notify = g_settings_get_double (settings, SETTINGS_FREE_PC_NOTIFY_KEY);
        free_percent_notify_again = g_settings_get_double (settings, SETTINGS_FREE_PC_NOTIFY_AGAIN_KEY);

        free_size_gb_no_notify = g_settings_get_int (settings, SETTINGS_FREE_SIZE_NO_NOTIFY);
        min_notify_period = g_settings_get_int (settings, SETTINGS_MIN_NOTIFY_PERIOD);

        if (ignore_paths != NULL) {
                g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);
                g_clear_pointer (&ignore_paths, g_slist_free);
        }

        settings_list = g_settings_get_strv (settings, SETTINGS_IGNORE_PATHS);
        if (settings_list != NULL) {
                guint i;

                for (i = 0; settings_list[i] != NULL; i++)
                        ignore_paths = g_slist_prepend (ignore_paths, g_strdup (settings_list[i]));

                /* Make sure we dont leave stale entries in ldsm_notified_hash */
                g_hash_table_foreach_remove (ldsm_notified_hash,
                                             ldsm_is_hash_item_in_ignore_paths, NULL);

                g_strfreev (settings_list);
        }

        purge_trash = g_settings_get_boolean (privacy_settings, SETTINGS_PURGE_TRASH);
        purge_temp_files = g_settings_get_boolean (privacy_settings, SETTINGS_PURGE_TEMP_FILES);
        purge_after = g_settings_get_uint (privacy_settings, SETTINGS_PURGE_AFTER);
}
Ejemplo n.º 8
0
static void
aim_sunpinyin_init (AimSunpinyin *pinyin)
{
  g_debug (G_STRLOC ": %s", G_STRFUNC);

  gchar **zh_en_keys;

  pinyin->settings = g_settings_new ("org.aim.engines.sunpinyin");
  zh_en_keys = g_settings_get_strv (pinyin->settings, "zh-en-keys");
  pinyin->zh_en_keys = aim_key_newv ((const gchar **) zh_en_keys);
  g_strfreev (zh_en_keys);

  pinyin->id = g_strdup ("aim-sunpinyin");
  pinyin->zh_name = g_strdup ("zh");
  pinyin->en_name = g_strdup ("zh-en");
  pinyin->is_english_mode = TRUE;
  pinyin->preedit_string = g_strdup ("");

  CSunpinyinSessionFactory& factory = CSunpinyinSessionFactory::getFactory();
  factory.setPinyinScheme(CSunpinyinSessionFactory::QUANPIN);
  factory.setCandiWindowSize(10);
  pinyin->view = factory.createSession();

  if (!pinyin->view)
  {
    g_warning (G_STRLOC ": %s: factory.createSession() failed", G_STRFUNC);
    return;
  }

  pinyin->hotkey_profile = new CHotkeyProfile();
  pinyin->view->setHotkeyProfile(pinyin->hotkey_profile);

  pinyin->win_handler = new AimWinHandler(AIM_ENGINE (pinyin));
  pinyin->view->attachWinHandler(pinyin->win_handler);
}
GSList *
xkb_options_get_selected_list (void)
{
	gchar **array;
	GSList *retval = NULL;
	gint i;
	array = g_settings_get_strv (xkb_kbd_settings, "options");
	if (array != NULL) {
		for (i = 0; array[i]; i++) {
			retval = g_slist_append (retval, g_strdup (array[i]));
		}
	}
	g_strfreev (array);

	if (retval == NULL) {
		if (initial_config.options != NULL) {
			for (i = 0; initial_config.options[i] != NULL; i++)
				retval = 
				    g_slist_prepend (retval, g_strdup (initial_config.options[i]));
		}
		retval = g_slist_reverse (retval);
	}

	return retval;
}
Ejemplo n.º 10
0
static void
update_restart_visiblity (NemoExtensionConfigWidget *widget)
{
    GList *tmp = g_list_copy (widget->initial_extension_ids);
    gchar **new_settings = g_settings_get_strv (nemo_plugin_preferences,
    		                                    NEMO_PLUGIN_PREFERENCES_DISABLED_EXTENSIONS);

    gboolean needs_restart = FALSE;

    if (g_list_length (tmp) != g_strv_length (new_settings)) {
        needs_restart = TRUE;
        goto out;
    }

    guint i;
    for (i = 0; i < g_strv_length (new_settings); i++) {
        GList *l = g_list_find_custom (tmp, new_settings[i], (GCompareFunc) g_strcmp0);
        if (!l) {
            needs_restart = TRUE;
            break;
        }
    }

out:
    g_strfreev (new_settings);
    g_list_free (tmp);

    gtk_widget_set_visible (widget->restart_button, needs_restart);
}
static GList *
get_tracker_locations (void)
{
  gchar **locations;
  GList *list;
  gint idx;
  Place *location;
  const gchar *path;

  locations = g_settings_get_strv (tracker_preferences, TRACKER_KEY_RECURSIVE_DIRECTORIES);
  list = NULL;

  for (idx = 0; locations[idx] != NULL; idx++)
    {
      path = path_from_tracker_dir (locations[idx]);

      location = g_slice_new0 (Place);
      location->location = g_file_new_for_commandline_arg (path);
      location->display_name = g_file_get_basename (location->location);
      location->place_type = PLACE_OTHER;

      list = g_list_prepend (list, location);
    }

  g_strfreev (locations);

  return g_list_reverse (list);
}
G_MODULE_EXPORT void
e_module_load (GTypeModule *type_module)
{
	GSettings *settings;
	gchar **disabled_plugins;
	gint i = 0;

	settings = e_util_ref_settings ("org.gnome.evolution");
	disabled_plugins = g_settings_get_strv (settings, "disabled-eplugins");

	for (i = 0; disabled_plugins && disabled_plugins[i] != NULL; i++) {

		if (g_strcmp0 (
			disabled_plugins[i],
			"org.gnome.evolution.itip_formatter") == 0) {

			g_strfreev (disabled_plugins);
			g_object_unref (settings);
			return;
		}

	}

	e_mail_part_itip_type_register (type_module);
	e_mail_parser_itip_type_register (type_module);
	e_mail_formatter_itip_type_register (type_module);

	g_strfreev (disabled_plugins);
	g_object_unref (settings);
}
Ejemplo n.º 13
0
static void
update_icon_captions_from_settings (GtkBuilder *builder)
{
	char **captions;
	int i, j;

	captions = g_settings_get_strv (nemo_icon_view_preferences, NEMO_PREFERENCES_ICON_VIEW_CAPTIONS);
	if (captions == NULL)
		return;

	for (i = 0, j = 0; 
	     icon_captions_components[i] != NULL;
	     i++) {
		char *data;

		if (captions[j]) {
			data = captions[j];
			++j;
		} else {
			data = "none";
		}

		update_caption_combo_box (builder, 
					  icon_captions_components[i],
					  data);
	}

	g_strfreev (captions);
}
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);
}
Ejemplo n.º 15
0
void
msm_gnome_start (void)
{
  GSettings* settings;
  gchar **array;

  if (gnome_compat_started == TRUE)
    return;

  settings = g_settings_new (GSM_SCHEMA);
  array = g_settings_get_strv (settings, GSM_GNOME_COMPAT_STARTUP_KEY);
  if (array) {
    guint i;

    for (i = 0; array[i]; i++) {
      if (strcmp (array[i], "smproxy") == 0) {
        g_debug ("MsmGnome: starting smproxy");
        msm_compat_gnome_smproxy_startup ();
        gnome_compat_started = TRUE;
      } else if (strcmp (array[i], "keyring") == 0) {
        g_debug ("MsmGnome: starting keyring");
        gnome_keyring_daemon_startup ();
        gnome_compat_started = TRUE;
      } else {
        g_debug ("MsmGnome: ignoring unknown component \"%s\"", array[i]);
      }
    }
    g_strfreev (array);
  } else {
    g_debug ("MsmGnome: No components found to start");
  }
  g_object_unref (settings);
}
Ejemplo n.º 16
0
static void
disabled_applets_notify (GSettings     *settings,
                         gchar         *key,
                         PanelLockdown *lockdown)
{
        lockdown->disabled_applets = g_settings_get_strv (settings, key);
        panel_lockdown_invoke_closures (lockdown);
}
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
cc_wacom_button_row_update_shortcut (CcWacomButtonRow *row,
                                     GsdWacomActionType action_type)
{
  CcWacomButtonRowPrivate *priv;
  GsdWacomTabletButton    *button;
  GtkDirectionType         dir;
  guint                    keyval;
  GdkModifierType          mask;
  char                    *shortcut;

  if (action_type != GSD_WACOM_ACTION_TYPE_CUSTOM)
    return;

  priv = row->priv;

  button = priv->button;
  dir = priv->direction;

  if (button->type == WACOM_TABLET_BUTTON_TYPE_STRIP ||
      button->type == WACOM_TABLET_BUTTON_TYPE_RING)
    {
      char *str;
      char **strv;

      strv = g_settings_get_strv (button->settings, KEY_CUSTOM_ELEVATOR_ACTION);

      if (strv != NULL)
        {
          if (dir == GTK_DIR_UP)
            str = strv[0];
          else
            str = strv[1];

          shortcut = g_strdup (str);

          g_strfreev (strv);
        }
      else
        {
          shortcut = NULL;
        }
    }
  else
    shortcut = g_settings_get_string (button->settings, CUSTOM_ACTION_KEY);

  if (shortcut != NULL)
    {
      gtk_accelerator_parse (shortcut, &keyval, &mask);

      g_object_set (priv->key_shortcut_button,
                    "key-value", keyval,
                    "key-mods", mask,
                    NULL);

      g_free (shortcut);
    }
}
static void
xkb_settings_changed (GSettings *settings,
                      const gchar *key,
                      GtkBuilder *dialog)
{
	guint i;
	GString *disp, *list, *variants;
	GtkWidget *label;
	gchar **layouts;

	layouts = g_settings_get_strv (settings, "layouts");
	if (layouts == NULL)
		return;

	label = WID ("user_input_source");
	disp = g_string_new ("");
	list = g_string_new ("");
	variants = g_string_new ("");

	for (i = 0; layouts[i]; i++) {
		gchar *utf_visible;
		char **split;
		gchar *layout, *variant;

		utf_visible = xkb_layout_description_utf8 (layouts[i]);
		if (disp->str[0] != '\0')
			g_string_append (disp, ", ");
		g_string_append (disp, utf_visible ? utf_visible : layouts[i]);
		g_free (utf_visible);

		split = g_strsplit_set (layouts[i], " \t", 2);

		if (split == NULL || split[0] == NULL)
			continue;

		layout = split[0];
		variant = split[1];

		if (list->str[0] != '\0')
			g_string_append (list, ",");
		g_string_append (list, layout);

		if (variants->str[0] != '\0')
			g_string_append (variants, ",");
		g_string_append (variants, variant ? variant : "");

		g_strfreev (split);
	}
	g_strfreev (layouts);

        g_object_set_data_full (G_OBJECT (label), "input_source", g_string_free (list, FALSE), g_free);
        g_object_set_data_full (G_OBJECT (label), "input_variants", g_string_free (variants, FALSE), g_free);
        gtk_label_set_text (GTK_LABEL (label), disp->str);
        g_string_free (disp, TRUE);

	update_copy_button (dialog);
}
Ejemplo n.º 20
0
static void
set_columns_from_settings (NemoColumnChooser *chooser)
{
	char **visible_columns;
	char **column_order;

	visible_columns = g_settings_get_strv (nemo_list_view_preferences,
					       NEMO_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS);
	column_order = g_settings_get_strv (nemo_list_view_preferences,
					    NEMO_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER);

	nemo_column_chooser_set_settings (NEMO_COLUMN_CHOOSER (chooser),
					      visible_columns,
					      column_order);

	g_strfreev (visible_columns);
	g_strfreev (column_order);
}
Ejemplo n.º 21
0
static void
on_settings_keyserver_changed (GSettings *settings, const gchar *key, gpointer user_data)
{
	SeahorseWidget *swidget = SEAHORSE_WIDGET (user_data);
	gchar **keyservers;

	keyservers = g_settings_get_strv (settings, key);
	populate_keyservers (swidget, keyservers);
	g_strfreev (keyservers);
}
Ejemplo n.º 22
0
static void
_panel_lockdown_disabled_applets_changed (GSettings     *settings,
                                          char          *key,
                                          PanelLockdown *lockdown)
{
        if (lockdown->priv->disabled_applets)
                g_strfreev (lockdown->priv->disabled_applets);
        lockdown->priv->disabled_applets = g_settings_get_strv (lockdown->priv->panel_settings,
                                                                PANEL_LOCKDOWN_DISABLED_APPLETS_KEY);
}
Ejemplo n.º 23
0
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
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);
}
Ejemplo n.º 25
0
gboolean
panel_layout_load (void)
{
        char **toplevels;
        char **objects;
        int    i;

        panel_layout_init ();

        toplevels = g_settings_get_strv (layout_settings,
                                         PANEL_LAYOUT_TOPLEVEL_ID_LIST_KEY);

        if (!toplevels[0])
          {
            g_strfreev (toplevels);

            toplevels = panel_layout_load_default ();

            if (!toplevels)
              return FALSE;
          }

        for (i = 0; toplevels[i] != NULL; i++)
                panel_layout_load_toplevel (toplevels[i]);

        g_strfreev (toplevels);

        objects = g_settings_get_strv (layout_settings,
                                       PANEL_LAYOUT_OBJECT_ID_LIST_KEY);

        for (i = 0; objects[i] != NULL; i++)
                panel_layout_load_object (objects[i]);

        g_strfreev (objects);

        g_signal_connect (layout_settings, "changed",
                          G_CALLBACK (panel_layout_changed), NULL);

        panel_object_loader_do_load (TRUE);

        return TRUE;
}
static char *
config_get_theme (gboolean *is_writable)
{
	GSettings *settings;
	char        *name;
	int          mode;

	settings = g_settings_new (GSETTINGS_SCHEMA);

	if (is_writable)
	{
		gboolean can_write_theme;
		gboolean can_write_mode;

		can_write_theme = g_settings_is_writable (settings,
		                                          KEY_THEMES);
		can_write_mode = g_settings_is_writable (settings,
		                                         KEY_MODE);
		*is_writable = can_write_theme && can_write_mode;
	}

	mode = config_get_mode (NULL);

	name = NULL;
	if (mode == GS_MODE_BLANK_ONLY)
	{
		name = g_strdup ("__blank-only");
	}
	else if (mode == GS_MODE_RANDOM)
	{
		name = g_strdup ("__random");
	}
	else
	{
		 gchar **strv;
                 strv = g_settings_get_strv (settings,
                                             KEY_THEMES);
                 if (strv != NULL) {
                          name = g_strdup (strv[0]);
		}
		else
		{
			/* TODO: handle error */
			/* default to blank */
			name = g_strdup ("__blank-only");
		}

		g_strfreev (strv);
	}

	g_object_unref (settings);

	return name;
}
Ejemplo n.º 27
0
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);
}
Ejemplo n.º 28
0
void
panel_layout_delete_toplevel (const char *toplevel_id)
{
        char  *path;
        char  *id_copy;
        char **objects;
        int    i;

        if (PANEL_GLIB_STR_EMPTY (toplevel_id))
                return;

        /* The original will be freed if removal succeeds */
        id_copy = g_strdup (toplevel_id);

        if (!panel_gsettings_remove_all_from_strv (layout_settings,
                                                   PANEL_LAYOUT_TOPLEVEL_ID_LIST_KEY,
                                                   id_copy)) {
                g_free (id_copy);
                return;
        }

        path = g_strdup_printf ("%s%s/",
                                PANEL_LAYOUT_TOPLEVEL_PATH, id_copy);
        panel_dconf_recursive_reset (path, NULL);

        /* remove all applets that were on this toplevel */

        objects = g_settings_get_strv (layout_settings,
                                       PANEL_LAYOUT_OBJECT_ID_LIST_KEY);

        for (i = 0; objects[i] != NULL; i++) {
                GSettings *settings;
                char       *object_toplevel_id;

                path = g_strdup_printf ("%s%s/",
                                        PANEL_LAYOUT_OBJECT_PATH, objects[i]);

                settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
                object_toplevel_id = g_settings_get_string (settings,
                                                            PANEL_OBJECT_TOPLEVEL_ID_KEY);

                g_object_unref (settings);
                g_free (path);

                if (g_strcmp0 (id_copy, object_toplevel_id) == 0)
                        panel_layout_delete_object (objects[i]);

                g_free (object_toplevel_id);
        }

        g_strfreev (objects);

        g_free (id_copy);
}
Ejemplo n.º 29
0
void
marlin_toolbar_editor_dialog_show (MarlinViewWindow *mvw)
{
    GtkTreeIter iter;
    GtkTreePath *path;
    TBEditorWidget *tbw;
    char **used_item;
    char **used_items;
    char **all_items;
    char **all_item;

    /* read the current active toolbar items */
    used_items = g_settings_get_strv (settings, CONF_UI_TOOLBAR_ITEMS);

    /* get all available actions */
    all_items = rb_get_toolbar_actions ();

    /* create the GUI */
    tbw = tb_editor_create_dialog(mvw);

    /* cache some pointers, this is safe enough since the dialog is run modally */
    tbw->mvw = mvw;

    /* fill the stores */
    for (all_item=all_items; *all_item; all_item++)
    {
        if (strcmp(*all_item, "Separator") == 0 ||
            !find_in_used_items(used_items, *all_item))
        {
            gtk_list_store_append(tbw->store_available, &iter);
            tb_editor_set_item_values(tbw, *all_item, tbw->store_available, &iter);
        }
    }
    for (used_item=used_items; *used_item; used_item++)
    {
        gtk_list_store_append(tbw->store_used, &iter);
        tb_editor_set_item_values(tbw, *used_item, tbw->store_used, &iter);
    }

    /* connect the changed signals after populating the store */
    g_signal_connect(tbw->store_used, "row-changed",
                     G_CALLBACK(tb_editor_available_items_changed_cb), tbw);
    g_signal_connect(tbw->store_used, "row-deleted",
                     G_CALLBACK(tb_editor_available_items_deleted_cb), tbw);

    /* run it */
    gtk_dialog_run(GTK_DIALOG(tbw->dialog));

    gtk_widget_destroy(tbw->dialog);

    g_strfreev (used_items);
    tb_editor_free_path(tbw);
    g_free(tbw);
}
Ejemplo n.º 30
0
static void load_hash_funcs(void)
{
	char **strv = g_settings_get_strv(prefs_priv.settings,
		PREFS_KEY_HASH_FUNCS);

	hash_funcs_enable_strv((const char **)strv);

	g_strfreev(strv);

	if (!hash_funcs_count_enabled())
		default_hash_funcs();
}