示例#1
0
void
dialogs_save_recent_docks (Gimp *gimp)
{
  gchar  *filename;
  GError *error = NULL;

  g_return_if_fail (GIMP_IS_GIMP (gimp));

  filename = gimp_personal_rc_file ("dockrc");

  if (gimp->be_verbose)
    g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));

  if (! gimp_config_serialize_to_file (GIMP_CONFIG (global_recent_docks),
                                       filename,
                                       "recently closed docks",
                                       "end of recently closed docks",
                                       NULL, &error))
    {
      gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message);
      g_clear_error (&error);
    }

  g_free (filename);
}
示例#2
0
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";

  gchar  *filename;
  GError *error = NULL;

  g_return_if_fail (GIMP_IS_GIMP (gimp));
  g_return_if_fail (GIMP_IS_LIST (gimp->templates));

  filename = gimp_personal_rc_file ("templaterc");

  if (gimp->be_verbose)
    g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));

  if (! gimp_config_serialize_to_file (GIMP_CONFIG (gimp->templates),
                                       filename,
                                       header, footer, NULL,
                                       &error))
    {
      gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
      g_error_free (error);
    }

  g_free (filename);
}
示例#3
0
gboolean
gimp_contexts_save (Gimp    *gimp,
                    GError **error)
{
  gchar    *filename;
  gboolean  success;

  g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);

  filename = gimp_personal_rc_file ("contextrc");

  if (gimp->be_verbose)
    g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));

  success = gimp_config_serialize_to_file (GIMP_CONFIG (gimp_get_user_context (gimp)),
                                           filename,
                                           "GIMP user context",
                                           "end of user context",
                                           NULL, error);

  g_free (filename);

  return success;
}
示例#4
0
gboolean
gimp_tool_preset_save (GimpData  *data,
                       GError   **error)
{
  g_return_val_if_fail (GIMP_IS_TOOL_PRESET (data), FALSE);
  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);

  return gimp_config_serialize_to_file (GIMP_CONFIG (data),
                                        gimp_data_get_filename (data),
                                        "GIMP tool preset file",
                                        "end of GIMP tool preset file",
                                        NULL, error);
}
示例#5
0
void
gimp_tools_save (Gimp     *gimp,
                 gboolean  save_tool_options,
                 gboolean  always_save)
{
  gchar *filename;

  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);
        }
    }

  filename = gimp_personal_rc_file ("toolrc");

  if (gimp->be_verbose)
    g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));

  gimp_config_serialize_to_file (GIMP_CONFIG (gimp->tool_info_list),
                                 filename,
                                 "GIMP toolrc",
                                 "end of toolrc",
                                 NULL, NULL);
  g_free (filename);
}
示例#6
0
/**
 * 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_file (GIMP_CONFIG (global),
                                rc->system_gimprc, NULL, NULL);

  header = g_strconcat (top, rc->system_gimprc, bottom, NULL);

  if (rc->verbose)
    g_print ("Writing '%s'\n",
             gimp_filename_to_utf8 (rc->user_gimprc));

  if (! gimp_config_serialize_to_file (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);
}
示例#7
0
void
gimp_devices_save (Gimp     *gimp,
                   gboolean  always_save)
{
  GimpDeviceManager *manager;
  gchar             *filename;
  GError            *error = NULL;

  g_return_if_fail (GIMP_IS_GIMP (gimp));

  manager = gimp_devices_get_manager (gimp);

  g_return_if_fail (GIMP_IS_DEVICE_MANAGER (manager));

  if (devicerc_deleted && ! always_save)
    return;

  filename = gimp_personal_rc_file ("devicerc");

  if (gimp->be_verbose)
    g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));

  if (! gimp_config_serialize_to_file (GIMP_CONFIG (manager),
                                       filename,
                                       "GIMP devicerc",
                                       "end of devicerc",
                                       NULL,
                                       &error))
    {
      gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
      g_error_free (error);
    }

  g_free (filename);

  devicerc_deleted = FALSE;
}
示例#8
0
void
gimp_controllers_save (Gimp *gimp)
{
  const gchar *header =
    "GIMP controllerrc\n"
    "\n"
    "This file will be entirely rewritten each time you exit.";
  const gchar *footer =
    "end of controllerrc";

  GimpControllerManager *manager;
  gchar                 *filename;
  GError                *error = NULL;

  g_return_if_fail (GIMP_IS_GIMP (gimp));

  manager = gimp_controller_manager_get (gimp);

  g_return_if_fail (manager != NULL);

  filename = gimp_personal_rc_file ("controllerrc");

  if (gimp->be_verbose)
    g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));

  if (! gimp_config_serialize_to_file (GIMP_CONFIG (manager->controllers),
                                       filename,
                                       header, footer, NULL,
                                       &error))
    {
      gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR, "%s", error->message);
      g_error_free (error);
    }

  g_free (filename);
}