Пример #1
0
static void
destroy_config (GConfClient *client)
{
	/* Unset the source stuff */
	gconf_client_unset (client, "/apps/evolution/calendar/sources", NULL);
	gconf_client_unset (client, "/apps/evolution/tasks/sources", NULL);
	gconf_client_unset (client, "/apps/evolution/addressbook/sources", NULL);

	/* Reset the version */
	gconf_client_set_string (client, "/apps/evolution/version", "1.4.0", NULL);

	/* Clear the dir */
	system ("rm -Rf ~/.evolution");
}
Пример #2
0
static gboolean
migrate_old_categories (void)
{
	/* Try migrating old category settings from GConf to the new
         * category XML file.  If successful, unset the old GConf key
         * so that this is a one-time-only operation. */

	const gchar *key = "/apps/evolution/general/category_master_list";

	GConfClient *client;
	gchar *string;
	gint n_added = 0;

	client = gconf_client_get_default ();
	string = gconf_client_get_string (client, key, NULL);
	if (string == NULL || *string == '\0')
		goto exit;

	g_debug ("Loading categories from GConf key \"%s\"", key);

	n_added = parse_categories (string, strlen (string));
	if (n_added == 0)
		goto exit;

	/* default icon files are now in an unversioned directory */
	g_hash_table_foreach (categories_table, migrate_old_icon_file, NULL);

	gconf_client_unset (client, key, NULL);

exit:
	g_object_unref (client);
	g_free (string);

	return n_added;
}
Пример #3
0
void
gnc_gconf_unset (const gchar *section,
                 const gchar *name,
                 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_unset(our_client, key, &error))
    {
        if (caller_error)
        {
            g_propagate_error(caller_error, error);
        }
        else
        {
            printf("Failed to unset key %s: %s", key, error->message);
            g_error_free(error);
        }
    }
    g_free(key);
}
Пример #4
0
/*
 * Class:     gnu_java_util_prefs_gconf_GConfNativePeer
 * Method:    gconf_client_unset
 * Signature: (Ljava/lang/String;)Z
 */
JNIEXPORT jboolean JNICALL
Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1unset
  (JNIEnv *env, jclass clazz __attribute__ ((unused)), jstring key)
{
  const char *_key = NULL;
  gboolean result = JNI_FALSE;
  GError *err = NULL;

  _key = JCL_jstring_to_cstring (env, key);
  if (_key == NULL)
    {
      return JNI_FALSE;
    }

  gdk_threads_enter ();
  result = gconf_client_unset (client, _key, &err);
  gdk_threads_leave ();
  if (err != NULL)
    {
      result = JNI_FALSE;
      g_error_free (err);
      err = NULL;
    }
    
  JCL_free_cstring (env, key, _key);

  return result;
}
Пример #5
0
NS_IMETHODIMP
nsGConfService::SetAppForProtocol(const nsACString &aScheme,
                                  const nsACString &aCommand)
{
  nsCAutoString key("/desktop/gnome/url-handlers/");
  key.Append(aScheme);
  key.Append("/command");

  PRBool res = gconf_client_set_string(mClient, key.get(),
                                       PromiseFlatCString(aCommand).get(),
                                       nsnull);
  if (res) {
    key.Replace(key.Length() - 7, 7, NS_LITERAL_CSTRING("enabled"));
    res = gconf_client_set_bool(mClient, key.get(), PR_TRUE, nsnull);
    if (res) {
      key.Replace(key.Length() - 7, 7, NS_LITERAL_CSTRING("needs_terminal"));
      res = gconf_client_set_bool(mClient, key.get(), PR_FALSE, nsnull);
      if (res) {
        key.Replace(key.Length() - 14, 14, NS_LITERAL_CSTRING("command-id"));
        res = gconf_client_unset(mClient, key.get(), nsnull);
      }
    }
  }

  return res ? NS_OK : NS_ERROR_FAILURE;
}
Пример #6
0
void gm_pref_store_set_string(GmPrefStore * store, const gchar * key, gchar * value)
{

    if (store == NULL)
        return;
#if HAVE_GSETTINGS
    if (value == NULL) {
        g_settings_reset(store->settings, key);
    } else {
        g_settings_set_string(store->settings, key, value);
    }
#else
#ifdef HAVE_GCONF
    gchar *full_key;

    full_key = g_strdup_printf("/apps/%s/preferences/%s", store->context, key);
    gconf_client_unset(store->gconf, full_key, NULL);
    if (value != NULL && strlen(g_strstrip(value)) > 0)
        gconf_client_set_string(store->gconf, full_key, value, NULL);
    g_free(full_key);
#else
    if (value != NULL && strlen(g_strstrip(value)) > 0) {
        g_key_file_set_string(store->keyfile, store->context, key, value);
    } else {
        g_key_file_remove_key(store->keyfile, store->context, key, NULL);
    }
#endif
#endif
}
Пример #7
0
Файл: main.c Проект: hsgg/quark
static void
config_load (GConfClient *gconf)
{
    GSList *paths, *it;

    main_set_loop_at_end (gconf_client_get_bool (gconf, LOOP_PLAYLIST, NULL));
    main_set_random_order (gconf_client_get_bool (gconf, RANDOM_ORDER, NULL));

    paths = gconf_client_get_list (gconf, PLAYLIST, GCONF_VALUE_STRING, NULL);
    for (it = paths; it; it = g_slist_next (it)) {
        GError *e = NULL;
        gchar *p = g_filename_from_utf8 (it->data, -1, NULL, NULL, &e);
        if (p) { playlist_append_single (p); g_free(p); }
        if (e) {
            g_warning ("Error loading playlist: %s", e->message);
            g_error_free(e);
        }
        g_free(it->data);
    }
    g_slist_free(paths);

    /* don't need another copy of the playlist in memory, and
       gconf_client_clear_cache makes a nice segfault when I try save stuff
       later. This value can't be edited while quark is running anyways.
    */
    gconf_client_unset (gconf, PLAYLIST, NULL);

    playlist_seek (gconf_client_get_int (gconf, PLAYLIST_POSITION, NULL));
}
Пример #8
0
void
preferences_unset (const char *key)
{
        GError *err;

        err = NULL;
        gconf_client_unset (warlock_gconf_client, key, &err);
        print_error (err);
}
Пример #9
0
static void
gconf_settings_backend_reset (GSettingsBackend *backend,
                              const gchar      *key,
                              gpointer          origin_tag)
{
  GConfSettingsBackend *gconf = GCONF_SETTINGS_BACKEND (backend);

  if (gconf_client_unset (gconf->priv->client, key, NULL))
    g_settings_backend_changed (backend, key, origin_tag);
}
Пример #10
0
/**
 * e_account_list_remove:
 * @accounts:
 * @account:
 *
 * Remove an account from the account list, and emit the
 * account-removed signal.  If the account was the default account,
 * then reset the default to the first account.
 **/
void
e_account_list_remove(EAccountList *accounts, EAccount *account)
{
	if (account == e_account_list_get_default(accounts))
		gconf_client_unset (accounts->priv->gconf, "/apps/evolution/mail/default_account", NULL);

	/* not sure if need to ref but no harm */
	g_object_ref (account);
	e_list_remove ((EList *) accounts, account);
	g_signal_emit(accounts, signals[ACCOUNT_REMOVED], 0, account);
	g_object_unref (account);
}
Пример #11
0
void
gnc_gconf_unset_dir (const gchar *section,
                     GError **caller_error)
{
    GError *error = NULL;
    GSList *entries, *tmp;
    const gchar *key;
    gchar *dir_key;

    if (our_client == NULL)
        our_client = gconf_client_get_default();

    dir_key = gnc_gconf_make_key(section, NULL);
    entries = gconf_client_all_entries(our_client, dir_key, &error);
    g_free(dir_key);
    if (error)
    {
        if (caller_error)
        {
            g_propagate_error(caller_error, error);
        }
        else
        {
            printf("Failed to get directory entries for key %s: %s",
                   dir_key, error->message);
            g_error_free(error);
        }
        return;
    }

    for (tmp = entries; tmp; tmp = g_slist_next(tmp))
    {
        key = gconf_entry_get_key(tmp->data);
        if (!gconf_client_unset(our_client, key, &error))
        {
            if (caller_error)
            {
                g_propagate_error(caller_error, error);
            }
            else
            {
                printf("Failed to unset key %s: %s", key, error->message);
                g_error_free(error);
            }
            break;
        }
    }

    g_slist_foreach(entries, (GFunc)gconf_entry_free, NULL);
    g_slist_free(entries);
}
void 
eel_gconf_unset (const char *key)
{
        GConfClient *client;
        GError *error = NULL;

        g_return_if_fail (key != NULL);

        client = eel_gconf_client_get_global ();
        g_return_if_fail (client != NULL);
        
        gconf_client_unset (client, key, &error);
        eel_gconf_handle_error (&error);
}
Пример #13
0
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);
}
Пример #14
0
static void
_set_ignore_ca_cert (const char *uuid, gboolean phase2, gboolean ignore)
{
	GConfClient *client;
	char *key = NULL;

	g_return_if_fail (uuid != NULL);

	client = gconf_client_get_default ();

	key = _get_ca_ignore_path (uuid, phase2);
	if (ignore)
		gconf_client_set_bool (client, key, ignore, NULL);
	else
		gconf_client_unset (client, key, NULL);
	g_free (key);

	g_object_unref (client);
}
Пример #15
0
void gm_pref_store_unset(GmPrefStore * store, const gchar * key)
{

    if (store == NULL)
        return;
#if HAVE_GSETTINGS
    g_settings_reset(store->settings, key);
#else
#ifdef HAVE_GCONF
    gchar *full_key;

    full_key = g_strdup_printf("/apps/%s/preferences/%s", store->context, key);
    gconf_client_unset(store->gconf, full_key, NULL);
    g_free(full_key);
#else
    g_key_file_remove_key(store->keyfile, store->context, key, NULL);
#endif
#endif
}
Пример #16
0
/* Commit changes to the GConf database. */
static gboolean
config_entry_commit (GtkWidget *entry, GdkEvent *event, gpointer callback_data)
{
  gchar *text;
  const gchar *key;
  GConfClient *client;
  
  client = g_object_get_data (G_OBJECT (entry), "client");  

  text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);

  key = g_object_get_data (G_OBJECT (entry), "key");

  /* Unset if the string is zero-length, otherwise set */
  if (*text != '\0')
    gconf_client_set_string (client, key, text, NULL);
  else
    gconf_client_unset (client, key, NULL);
  
  g_free (text);

  return FALSE;
}
Пример #17
0
Файл: config.c Проект: BBIO/ibus
static gboolean
ibus_config_gconf_unset (IBusConfigService      *config,
                         const gchar            *section,
                         const gchar            *name,
                         IBusError             **error)
{
    gchar *key;
    GError *gerror = NULL;

    key = g_strdup_printf (GCONF_PREFIX"/%s/%s", section, name);

    gconf_client_unset (((IBusConfigGConf *)config)->client, key, &gerror);
    g_free (key);

    if (gerror != NULL) {
        if (error) {
            *error = ibus_error_new_from_text (DBUS_ERROR_FAILED, gerror->message);
            g_error_free (gerror);
        }
        return FALSE;
    }

    return TRUE;
}
Пример #18
0
void subsurface_unset_conf(char *name)
{
	gconf_client_unset(gconf, gconf_name(name), NULL);
}
Пример #19
0
gboolean
t_update_program_in_gconf (const gchar *program, const gchar *key, GError **error)
{
	GConfClient *gconf;
	GError *err = NULL;
	gchar *bin, *bin_name;
	gboolean ret;
	
	g_return_val_if_fail (program, FALSE);
	g_return_val_if_fail (key, FALSE);
	g_return_val_if_fail (!error || !*error, FALSE);
	
	gconf = gconf_client_get_default ();
	
	bin = gconf_client_get_string(gconf, key, &err);
	if (err) {
		if (bin)
			g_free (bin);
		g_warning (
			"t_update_program_in_gconf: Error retrieving key %s: %s",
			key,
			err->message
		);
		g_error_free (err);
		err = NULL;
	}
	
	if (bin && g_path_is_absolute (bin) && 
               g_file_test(bin, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_EXECUTABLE)) {

		/* make sure program in gconf is the one we are checking */
		bin_name = g_path_get_basename (bin);
		ret = !strcmp (bin_name, program);
		g_free (bin_name);
		/* if the name is not the same, go on */
		
		if (ret) {
			g_object_unref (gconf);
			return TRUE;
		} else {
			/* since the gconf entry is not valid we'll try to remove it */
			gconf_client_unset (gconf, key, &err);
			if (err) {
				g_warning (
					"t_update_program_in_gconf: Could not unset key %s: %s",
					key,
					err->message
				);
				g_error_free (err);
				err = NULL;
			}
		}
	}
	
	if (bin)
		g_free (bin);
	
	bin = g_find_program_in_path (program);
	ret = TRUE;
	if (bin) {
		/* we found it, we must put it in gconf key */
		gconf_client_set_string (gconf, key, bin, error);
		if (*error) {
			ret = FALSE;
		}
	} else {
		*error = g_error_new (T_UTIL_ERROR, T_UTIL_ERROR_PROGRAM_NOT_FOUND, _("Program %s was not found."), program);
		ret = FALSE;
	}
	g_object_unref (gconf);
	return ret;
}
Пример #20
0
/* Not used for now as there is no API to remove completely gconf keys.
 * So we reuse existing accounts instead of creating new ones */
void
destroy_test_account (EmpathyAccount *account)
{
  GConfClient *client;
  gchar *path;
  GError *error = NULL;
  GSList *entries = NULL, *l;
  EmpathyAccountManager *manager;

  client = gconf_client_get_default ();
  path = g_strdup_printf ("/apps/telepathy/mc/accounts/%s",
      empathy_account_get_unique_name (account));

  entries = gconf_client_all_entries (client, path, &error);
  if (error != NULL)
    {
      g_print ("failed to list entries in %s: %s\n", path, error->message);
      g_error_free (error);
      error = NULL;
    }

  for (l = entries; l != NULL; l = g_slist_next (l))
    {
      GConfEntry *entry = l->data;

      if (g_str_has_suffix (entry->key, "data_dir"))
        {
          gchar *dir;

          dir = gconf_client_get_string (client, entry->key, &error);
          if (error != NULL)
            {
              g_print ("get data_dir string failed: %s\n", entry->key);
              g_error_free (error);
              error = NULL;
            }
          else
            {
              if (g_rmdir (dir) != 0)
                g_print ("can't remove %s\n", dir);
            }

          g_free (dir);
        }

      /* FIXME: this doesn't remove the key */
      gconf_client_unset (client, entry->key, &error);
      if (error != NULL)
        {
          g_print ("unset of %s failed: %s\n", path, error->message);
          g_error_free (error);
          error = NULL;
        }

      gconf_entry_unref (entry);
    }

  g_slist_free (entries);

  g_object_unref (client);
  g_free (path);

  manager = empathy_account_manager_dup_singleton ();
  empathy_account_manager_remove (manager, account);
  g_object_unref (account);
  g_object_unref (manager);
}
Пример #21
0
static void
unmount_connected_server (GnomeVFSVolume *volume,
			  GnomeVFSVolumeOpCallback  callback,
			  gpointer                   user_data)
{
	GConfClient *client;
	gboolean res;
	char *key;
	gboolean success;
	char *detailed_error;
	GError *error;

	success = TRUE;
	detailed_error = NULL;
	
	client = gconf_client_get_default ();

	key = g_strconcat (CONNECTED_SERVERS_DIR "/",
			   volume->priv->gconf_id,
			   "/uri", NULL);
	error = NULL;
	res = gconf_client_unset (client, key, &error);
	g_free (key);
	if (!res) {
		if (success) {
			detailed_error = g_strdup (error->message);
		}
		success = FALSE;
		g_error_free (error);
	}
	
	key = g_strconcat (CONNECTED_SERVERS_DIR "/",
			   volume->priv->gconf_id,
			   "/icon", NULL);
	res = gconf_client_unset (client, key, &error);
	g_free (key);
	if (!res) {
		if (success) {
			detailed_error = g_strdup (error->message);
		}
		success = FALSE;
		g_error_free (error);
	}
	
	key = g_strconcat (CONNECTED_SERVERS_DIR "/",
			   volume->priv->gconf_id,
			   "/display_name", NULL);
	res = gconf_client_unset (client, key, &error);
	g_free (key);
	if (!res) {
		if (success) {
			detailed_error = g_strdup (error->message);
		}
		success = FALSE;
		g_error_free (error);
	}
	
	g_object_unref (client);

	if (success) {
		(*callback) (success, NULL, NULL, user_data);
	} else {
		(*callback) (success, (char *) _("Unable to unmount connected server"), detailed_error, user_data);
	}
	g_free (detailed_error);
}