int main (int argc, char **argv) { GConfClient *client; GConfEngine *conf; GError *error = NULL; const char *config_source; if (g_getenv ("GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL")) { fprintf (stderr, _("GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL is set, not installing schemas\n")); return 0; } g_type_init (); config_source = g_getenv ("GCONF_CONFIG_SOURCE"); if (!config_source) { fprintf (stderr, _("Must set the GCONF_CONFIG_SOURCE environment variable\n")); return -1; } if (*config_source == '\0') config_source = NULL; /* shut down daemon, this is a race condition, but will usually work. */ gconf_shutdown_daemon (NULL); if (!config_source) conf = gconf_engine_get_default (); else conf = gconf_engine_get_local (config_source, &error); if (!conf) { g_assert (error != NULL); fprintf (stderr, _("Failed to access configuration source(s): %s\n"), error->message); g_error_free (error); return -1; } client = gconf_client_get_for_engine (conf); install_default_macros_list (client, MC_PATTERNS_SHEMA_KEY, G_STRUCT_OFFSET (MCDefaultMacro, pattern)); install_default_macros_list (client, MC_COMMANDS_SHEMA_KEY, G_STRUCT_OFFSET (MCDefaultMacro, command)); install_default_macros_list (client, MC_DEPRECATED_PATTERNS_SHEMA_KEY, G_STRUCT_OFFSET (MCDefaultMacro, pattern)); install_default_macros_list (client, MC_DEPRECATED_COMMANDS_SHEMA_KEY, G_STRUCT_OFFSET (MCDefaultMacro, command)); gconf_client_suggest_sync (client, &error); if (error) { fprintf (stderr, _("Error syncing config data: %s"), error->message); g_error_free (error); return 1; } gconf_engine_unref (conf); g_object_unref (client); 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 gam_toggle_set_visible (GamToggle *gam_toggle, gboolean visible) { GamTogglePrivate *priv; gchar *key; g_return_if_fail (GAM_IS_TOGGLE (gam_toggle)); priv = GAM_TOGGLE_GET_PRIVATE (gam_toggle); key = g_strdup_printf ("/apps/gnome-alsamixer/display_toggles/%s-%s", gam_mixer_get_config_name (GAM_MIXER (priv->mixer)), gam_toggle_get_config_name (gam_toggle)); gconf_client_set_bool (gam_app_get_gconf_client (GAM_APP (priv->app)), key, visible, NULL); gconf_client_suggest_sync (gam_app_get_gconf_client (GAM_APP (priv->app)), NULL); if (visible) gtk_widget_show (GTK_WIDGET (gam_toggle)); else gtk_widget_hide (GTK_WIDGET (gam_toggle)); }
static void mud_connections_refresh_iconview(MudConnections *conn) { GConfClient *client = gconf_client_get_default(); gtk_list_store_clear(GTK_LIST_STORE(conn->priv->icon_model)); gconf_client_suggest_sync(client, NULL); mud_connections_populate_iconview(conn); }
gboolean on_userlist_import_page_2_next (GnomeDruidPage * druidpage, GtkWidget * widget, gpointer user_data) { GtkWidget *file_chooser = glade_xml_get_widget (gladexml_import_userlist, "ImportFileChooser"); GIOChannel *channel = NULL; gchar *line = NULL; gsize len, terminator_pos; gchar *filename = NULL; gsize status = -1; g_assert (file_chooser); filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser)); channel = g_io_channel_new_file (filename, "r", NULL); if (!channel) { GtkDialog *msgdialog = gtk_message_dialog_new_with_markup (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "<span weight=\"bold\"size=\"larger\">Plik nie został wybrany</span>\n\nWymagane pola nie zostały wypełnione prawidłowo, spróbuj jeszcze raz."); gtk_dialog_run (GTK_DIALOG (msgdialog)); gtk_widget_destroy (GTK_WIDGET (msgdialog)); goto end; } g_io_channel_set_encoding (channel, NULL, NULL); GConfChangeSet *changeset = gconf_change_set_new(); while (status != G_IO_STATUS_ERROR && status != G_IO_STATUS_EOF) { status = g_io_channel_read_line (channel, &line, &len, &terminator_pos, NULL); if (status == G_IO_STATUS_ERROR || status == G_IO_STATUS_EOF) { g_free (line); continue; } gnomegadu_ui_import_userlist_process_line (line, changeset); if (!gconf_client_commit_change_set(gconf, changeset, TRUE, NULL)) g_printerr("Some error while import"); g_free (line); } gconf_change_set_unref(changeset); gconf_client_suggest_sync (gconf, NULL); g_io_channel_unref (channel); end: g_free (filename); return FALSE; }
void eel_gconf_suggest_sync (void) { GConfClient *client; GError *error = NULL; client = eel_gconf_client_get_global (); g_return_if_fail (client != NULL); gconf_client_suggest_sync (client, &error); eel_gconf_handle_error (&error); }
void on_game_mgr_delete_game (GtkWidget *widget, gpointer user_data) { GtkWidget *iconlist = lookup_widget("game_mgr_iconlist"); GwpGameState *state = NULL; GList *selections = NULL; selections = gnome_icon_list_get_selection(GNOME_ICON_LIST(iconlist)); if(selections) { gint icon_idx = (gint)g_list_nth_data(selections, 0); GtkResponseType response; GtkWidget *warn; gchar *game_name; state = (GwpGameState *) gnome_icon_list_get_icon_data(GNOME_ICON_LIST(iconlist), icon_idx); g_assert(state != NULL); game_name = g_strdup(gwp_game_state_get_name(state)); game_mgr_game_name_mangle(game_name); /* Are you sureeee? */ warn = gtk_message_dialog_new((GtkWindow*) game_mgr_properties, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, _("Are you sure you want to delete '%s'?"), game_name); response = gtk_dialog_run(GTK_DIALOG(warn)); gtk_widget_destroy(warn); /* Oh well... */ if(response == GTK_RESPONSE_YES) { /* Remove it from GConf */ game_mgr_delete_game(game_name); gconf_client_suggest_sync(gwp_gconf, NULL); /* Free memory from GameState struct */ /* FIXME!!: Destroy current GwpGameState object */ /*game_state_free(state);*/ /* Remove icon */ gnome_icon_list_remove(GNOME_ICON_LIST(iconlist), icon_idx); /* Update appbar info */ game_mgr_update_appbar(); } } }
void gam_app_set_slider_toggle_style (GamApp *gam_app, gint style) { const gchar *key = "/apps/gnome-alsamixer/geometry/mixer_slider_toggle_style"; g_return_if_fail (GAM_IS_APP (gam_app)); gconf_client_set_bool (gam_app_get_gconf_client (gam_app), key, style, NULL); gconf_client_suggest_sync (gam_app_get_gconf_client (gam_app), NULL); }
void gnc_gconf_suggest_sync (void) { GError *error = NULL; if (our_client == NULL) our_client = gconf_client_get_default(); gconf_client_suggest_sync(our_client, &error); if (error != NULL) { printf("Failed to sync gconf: %s", error->message); g_error_free(error); } }
/* * Class: gnu_java_util_prefs_gconf_GConfNativePeer * Method: gconf_client_suggest_sync * Signature: ()V */ JNIEXPORT void JNICALL Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1suggest_1sync (JNIEnv *env, jclass clazz __attribute__ ((unused))) { GError *err = NULL; gdk_threads_enter (); gconf_client_suggest_sync (client, &err); gdk_threads_leave (); if (err != NULL) { throw_exception_by_name (env, "java/util/prefs/BackingStoreException", err->message); g_error_free (err); err = NULL; } }
void gwp_quit(void) { /* Save game state */ game_mgr_close_game(game_state); /* Disconnect from GConf server */ gconf_client_suggest_sync(gwp_gconf, NULL); g_object_unref(gwp_gconf); #ifdef USE_PYTHON /* Stop Python interpreter */ gwp_python_quit(); #endif /* bye bye... */ gtk_main_quit(); }
void mail_config_write (void) { GConfClient *client; EAccountList *account_list; ESignatureList *signature_list; if (!config) return; account_list = e_get_account_list (); signature_list = e_get_signature_list (); e_account_list_save (account_list); e_signature_list_save (signature_list); client = gconf_client_get_default (); gconf_client_suggest_sync (client, NULL); g_object_unref (client); }
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); }
/** * Set an string GConf key to the specified value * * @param key The GConf key to set the value of * @param value The value to set the key to * @return TRUE on success, FALSE on failure */ gboolean mce_gconf_set_string(const gchar *const key, const gchar *const value) { gboolean status = FALSE; if( gconf_disabled ) { mce_log(LL_DEBUG, "blocked %s = \"%s\"", key, value); goto EXIT; } if (gconf_client_set_string(gconf_client, key, value, NULL) == FALSE) { mce_log(LL_WARN, "Failed to write %s to GConf", key); goto EXIT; } /* synchronise if possible, ignore errors */ gconf_client_suggest_sync(gconf_client, NULL); status = TRUE; EXIT: return status; }
static void unset_in_db (GConfDefaults *mechanism, const gchar *address, const gchar **includes, const gchar **excludes, GError **error) { GConfEngine *engine; GConfClient *dest = NULL; GConfChangeSet *changes = NULL; int i; engine = gconf_engine_get_local (address, error); if (*error) goto out; dest = gconf_client_get_for_engine (engine); gconf_engine_unref (engine); changes = gconf_change_set_new (); /* recursively copy each include, leaving out the excludes */ for (i = 0; includes[i]; i++) { if (gconf_client_dir_exists (dest, includes[i], NULL)) unset_tree (dest, includes[i], changes, excludes); else unset_entry (dest, includes[i], changes, excludes); } gconf_client_commit_change_set (dest, changes, TRUE, error); gconf_client_suggest_sync (dest, NULL); out: if (dest) g_object_unref (dest); if (changes) gconf_change_set_unref (changes); }
static void gam_app_save_prefs (GamApp *gam_app) { GamAppPrivate *priv; gint height, width; g_return_if_fail (GAM_IS_APP (gam_app)); priv = GAM_APP_GET_PRIVATE (gam_app); gdk_window_get_geometry (GDK_WINDOW (GTK_WIDGET (gam_app)->window), NULL, NULL, &width, &height, NULL); gconf_client_set_int (priv->gconf_client, "/apps/gnome-alsamixer/geometry/main_window_height", height, NULL); gconf_client_set_int (priv->gconf_client, "/apps/gnome-alsamixer/geometry/main_window_width", width, NULL); gconf_client_suggest_sync (priv->gconf_client, NULL); }
void gam_toggle_set_display_name (GamToggle *gam_toggle, const gchar *name) { GamTogglePrivate *priv; gchar *key; g_return_if_fail (GAM_IS_TOGGLE (gam_toggle)); priv = GAM_TOGGLE_GET_PRIVATE (gam_toggle); key = g_strdup_printf ("/apps/gnome-alsamixer/toggle_display_names/%s-%s", gam_mixer_get_config_name (GAM_MIXER (priv->mixer)), gam_toggle_get_config_name (gam_toggle)); gconf_client_set_string (gam_app_get_gconf_client (GAM_APP (priv->app)), key, name, NULL); gconf_client_suggest_sync (gam_app_get_gconf_client (GAM_APP (priv->app)), NULL); gtk_button_set_label (GTK_BUTTON (gam_toggle), name); }
static void do_copy (GConfDefaults *mechanism, gboolean mandatory, const char **includes, const char **excludes, DBusGMethodInvocation *context, GConfChangeSet **changeset_out) { char *address = NULL; GConfClient *source = NULL; GConfClient *dest = NULL; GConfChangeSet *changes = NULL; GConfEngine *engine; GError *error; GError *error2; const char *action; const char *annotation_key; const char *default_action; const char *dest_address; int i; if (changeset_out) *changeset_out = NULL; stop_killtimer (); /* check privileges for each include */ if (mandatory) { annotation_key = "org.gnome.gconf.defaults.set-mandatory.prefix"; default_action = "org.gnome.gconf.defaults.set-mandatory"; dest_address = "xml:merged:" SYSGCONFDIR "/gconf.xml.mandatory"; } else { annotation_key = "org.gnome.gconf.defaults.set-system.prefix"; default_action = "org.gnome.gconf.defaults.set-system"; dest_address = "xml:merged:" SYSGCONFDIR "/gconf.xml.system"; } for (i = 0; includes[i]; i++) { action = polkit_action_for_gconf_path (mechanism, annotation_key, includes[i]); if (action == NULL) action = default_action; if (!check_polkit_for_action (mechanism, context, action)) goto out; } error = NULL; engine = gconf_engine_get_local (dest_address, &error); if (error) goto cleanup; dest = gconf_client_get_for_engine (engine); gconf_engine_unref (engine); /* find the address to from the caller id */ address = gconf_address_for_caller (mechanism, context, &error); if (error) goto cleanup; engine = gconf_engine_get_local (address, &error); if (error) goto cleanup; source = gconf_client_get_for_engine (engine); gconf_engine_unref (engine); changes = gconf_change_set_new (); /* recursively copy each include, leaving out the excludes */ for (i = 0; includes[i]; i++) { if (gconf_client_dir_exists (source, includes[i], NULL)) copy_tree (source, includes[i], changes, excludes); else copy_entry (source, includes[i], changes, excludes); } gconf_client_commit_change_set (dest, changes, FALSE, &error); gconf_client_suggest_sync (dest, NULL); if (changeset_out) { *changeset_out = changes; changes = NULL; } cleanup: g_free (address); if (changes) gconf_change_set_unref (changes); if (dest) g_object_unref (dest); if (source) g_object_unref (source); if (error) { g_print ("failed to set GConf values: %s\n", error->message); error2 = g_error_new_literal (GCONF_DEFAULTS_ERROR, GCONF_DEFAULTS_ERROR_GENERAL, error->message); g_error_free (error); dbus_g_method_return_error (context, error2); g_error_free (error2); } else dbus_g_method_return (context); out: start_killtimer (); }
static void do_set_value (GConfDefaults *mechanism, gboolean mandatory, const char *path, const char *value, DBusGMethodInvocation *context, GConfChangeSet **changeset_out) { GConfClient *dest = NULL; GConfChangeSet *changes = NULL; GConfEngine *engine; GConfValue *gvalue; GError *error; GError *error2; const char *action; const char *annotation_key; const char *default_action; const char *dest_address; if (changeset_out) *changeset_out = NULL; stop_killtimer (); if (mandatory) { annotation_key = "org.gnome.gconf.defaults.set-mandatory.prefix"; default_action = "org.gnome.gconf.defaults.set-mandatory"; dest_address = "xml:merged:/etc/gconf/gconf.xml.mandatory"; } else { annotation_key = "org.gnome.gconf.defaults.set-system.prefix"; default_action = "org.gnome.gconf.defaults.set-system"; dest_address = "xml:merged:/etc/gconf/gconf.xml.system"; } action = polkit_action_for_gconf_path (mechanism, annotation_key, path); if (action == NULL) action = default_action; if (!check_polkit_for_action (mechanism, context, action)) goto out; error = NULL; engine = gconf_engine_get_local (dest_address, &error); if (error) goto cleanup; dest = gconf_client_get_for_engine (engine); gconf_engine_unref (engine); changes = gconf_change_set_new (); gvalue = gconf_value_decode (value); if (!gvalue) goto cleanup; gconf_change_set_set (changes, path, gvalue); gconf_value_free (gvalue); gconf_client_commit_change_set (dest, changes, FALSE, &error); gconf_client_suggest_sync (dest, NULL); if (changeset_out) { *changeset_out = changes; changes = NULL; } cleanup: if (changes) gconf_change_set_unref (changes); if (dest) g_object_unref (dest); if (error) { g_print ("failed to set GConf values: %s\n", error->message); error2 = g_error_new_literal (GCONF_DEFAULTS_ERROR, GCONF_DEFAULTS_ERROR_GENERAL, error->message); g_error_free (error); dbus_g_method_return_error (context, error2); g_error_free (error2); } else dbus_g_method_return (context); out: start_killtimer (); }
static void do_copy_authorized (GConfDefaults *mechanism, DBusGMethodInvocation *context, gpointer user_data) { CopyData *data = user_data; GConfClient *source = NULL; GConfClient *dest = NULL; GConfChangeSet *changes = NULL; GConfEngine *engine; char *address = NULL; gint i; GError *error; error = NULL; engine = gconf_engine_get_local (data->dest_address, &error); if (error) goto cleanup; dest = gconf_client_get_for_engine (engine); gconf_engine_unref (engine); /* find the address to from the caller id */ address = gconf_address_for_caller (data->mechanism, data->context, &error); if (error) goto cleanup; engine = gconf_engine_get_local (address, &error); if (error) goto cleanup; source = gconf_client_get_for_engine (engine); gconf_engine_unref (engine); changes = gconf_change_set_new (); if (data->value) { g_assert (data->includes[1] == NULL); g_assert (data->excludes == NULL); gconf_change_set_set (changes, data->includes[0], data->value); } else { /* recursively copy each include, leaving out the excludes */ for (i = 0; data->includes[i]; i++) { if (gconf_client_dir_exists (source, data->includes[i], NULL)) copy_tree (source, data->includes[i], changes, (const char **)data->excludes); else copy_entry (source, data->includes[i], changes, (const char **)data->excludes); } } gconf_client_commit_change_set (dest, changes, FALSE, &error); gconf_client_suggest_sync (dest, NULL); if (data->changeset_callback) { data->changeset_callback (data->mechanism, changes, data->user_data); } cleanup: g_free (address); if (changes) gconf_change_set_unref (changes); if (dest) g_object_unref (dest); if (source) g_object_unref (source); if (error) { throw_error (data->context, GCONF_DEFAULTS_ERROR_GENERAL, "%s", error->message); g_error_free (error); } else dbus_g_method_return (data->context); }
static void mud_connections_delete_cb(GtkWidget *widget, MudConnections *conn) { GList *selected = gtk_icon_view_get_selected_items( GTK_ICON_VIEW(conn->priv->iconview)); GtkTreeIter iter; gchar *buf, *mud_name, *key, *strip_name, *strip_char_name, *char_name; gchar **mud_tuple; gint len; GConfClient *client = gconf_client_get_default(); if(g_list_length(selected) == 0) return; char_name = strip_name = NULL; gtk_tree_model_get_iter(conn->priv->icon_model, &iter, (GtkTreePath *)selected->data); gtk_tree_model_get(conn->priv->icon_model, &iter, 0, &buf, -1); mud_tuple = g_strsplit(buf, "\n", -1); g_free(buf); len = g_strv_length(mud_tuple); switch(len) { /* Delete Mud */ case 1: mud_name = g_strdup(mud_tuple[0]); break; /* Delete Character */ case 2: char_name = g_strdup(mud_tuple[0]); mud_name = g_strdup(mud_tuple[1]); break; default: g_warning("Malformed mud name passed to delete."); return; } if(!mud_connections_delete_confirm(mud_tuple[0])) { g_free(mud_name); if(char_name) g_free(char_name); g_strfreev(mud_tuple); g_object_unref(client); g_list_foreach(selected, (GFunc)gtk_tree_path_free, NULL); g_list_free(selected); return; } g_strfreev(mud_tuple); if(len == 1) { strip_name = gconf_escape_key(mud_name, -1); key = g_strdup_printf("/apps/gnome-mud/muds/%s", strip_name); gconf_client_recursive_unset(client, key, 0, NULL); g_free(key); gconf_client_suggest_sync(client, NULL); } else if(len == 2) { strip_name = gconf_escape_key(mud_name, -1); strip_char_name = gconf_escape_key(char_name, -1); key = g_strdup_printf("/apps/gnome-mud/muds/%s/characters/%s", strip_name, strip_char_name); gconf_client_recursive_unset(client, key, 0, NULL); g_free(key); g_free(strip_char_name); g_free(char_name); gconf_client_suggest_sync(client, NULL); } g_free(mud_name); g_free(strip_name); g_object_unref(client); g_list_foreach(selected, (GFunc)gtk_tree_path_free, NULL); g_list_free(selected); }