void gimp_templates_save (Gimp *gimp) { const gchar *header = "GIMP templaterc\n" "\n" "This file will be entirely rewritten each time you exit."; const gchar *footer = "end of templaterc"; GFile *file; GError *error = NULL; g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_LIST (gimp->templates)); file = gimp_directory_file ("templaterc", NULL); if (gimp->be_verbose) g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (gimp->templates), file, header, footer, NULL, &error)) { gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message); g_error_free (error); } g_object_unref (file); }
gboolean gimp_contexts_save (Gimp *gimp, GError **error) { GFile *file; gboolean success; g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); file = gimp_directory_file ("contextrc", NULL); if (gimp->be_verbose) g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); success = gimp_config_serialize_to_gfile (GIMP_CONFIG (gimp_get_user_context (gimp)), file, "GIMP user context", "end of user context", NULL, error); g_object_unref (file); return success; }
void gimp_tools_save (Gimp *gimp, gboolean save_tool_options, gboolean always_save) { GFile *file; g_return_if_fail (GIMP_IS_GIMP (gimp)); if (save_tool_options && (! tool_options_deleted || always_save)) { GList *list; GError *error = NULL; if (! gimp_contexts_save (gimp, &error)) { gimp_message_literal (gimp, NULL, GIMP_MESSAGE_WARNING, error->message); g_clear_error (&error); } gimp_tool_options_create_folder (); for (list = gimp_get_tool_info_iter (gimp); list; list = g_list_next (list)) { GimpToolInfo *tool_info = GIMP_TOOL_INFO (list->data); gimp_tool_options_serialize (tool_info->tool_options, NULL); } } file = gimp_directory_file ("toolrc", NULL); if (gimp->be_verbose) g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); gimp_config_serialize_to_gfile (GIMP_CONFIG (gimp->tool_info_list), file, "GIMP toolrc", "end of toolrc", NULL, NULL); g_object_unref (file); }
/** * gimp_rc_save: * @gimprc: a #GimpRc object. * * Saves any settings that differ from the system-wide defined * defaults to the users personal gimprc file. **/ void gimp_rc_save (GimpRc *rc) { GimpRc *global; gchar *header; GError *error = NULL; const gchar *top = "GIMP gimprc\n" "\n" "This is your personal gimprc file. Any variable defined in this file " "takes precedence over the value defined in the system-wide gimprc: "; const gchar *bottom = "\n" "Most values can be set within GIMP by changing some options in " "the Preferences dialog."; const gchar *footer = "end of gimprc"; g_return_if_fail (GIMP_IS_RC (rc)); global = g_object_new (GIMP_TYPE_RC, NULL); gimp_config_deserialize_gfile (GIMP_CONFIG (global), rc->system_gimprc, NULL, NULL); header = g_strconcat (top, gimp_file_get_utf8_name (rc->system_gimprc), bottom, NULL); if (rc->verbose) g_print ("Writing '%s'\n", gimp_file_get_utf8_name (rc->user_gimprc)); if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (rc), rc->user_gimprc, header, footer, global, &error)) { g_message ("%s", error->message); g_error_free (error); } g_free (header); g_object_unref (global); }