app: move color history loading/saving to core/gimp-palettes.c

and remove gui/color-history.[ch] completely.
This commit is contained in:
Michael Natterer 2014-11-27 01:10:46 +01:00
parent 09628cfa4c
commit ac90ba1dc4
7 changed files with 50 additions and 115 deletions

View File

@ -23,6 +23,8 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
#include "libgimpbase/gimpbase.h"
#include "core-types.h"
#include "gimp.h"
@ -60,6 +62,46 @@ gimp_palettes_init (Gimp *gimp)
gimp_context_set_palette (gimp->user_context, palette);
}
void
gimp_palettes_load (Gimp *gimp)
{
GimpPalette *palette;
GFile *file;
g_return_if_fail (GIMP_IS_GIMP (gimp));
palette = gimp_palettes_get_color_history (gimp);
file = gimp_directory_file ("colorrc", NULL);
if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
gimp_palette_mru_load (GIMP_PALETTE_MRU (palette), file);
g_object_unref (file);
}
void
gimp_palettes_save (Gimp *gimp)
{
GimpPalette *palette;
GFile *file;
g_return_if_fail (GIMP_IS_GIMP (gimp));
palette = gimp_palettes_get_color_history (gimp);
file = gimp_directory_file ("colorrc", NULL);
if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
gimp_palette_mru_save (GIMP_PALETTE_MRU (palette), file);
g_object_unref (file);
}
GimpPalette *
gimp_palettes_get_color_history (Gimp *gimp)
{

View File

@ -24,6 +24,9 @@
void gimp_palettes_init (Gimp *gimp);
void gimp_palettes_load (Gimp *gimp);
void gimp_palettes_save (Gimp *gimp);
GimpPalette * gimp_palettes_get_color_history (Gimp *gimp);

View File

@ -810,6 +810,8 @@ gimp_real_exit (Gimp *gimp,
gimp_fonts_reset (gimp);
gimp_palettes_save (gimp);
gimp_templates_save (gimp);
gimp_parasiterc_save (gimp);
gimp_unitrc_save (gimp);
@ -1063,6 +1065,9 @@ gimp_restore (Gimp *gimp,
if (! gimp->no_fonts)
gimp_fonts_load (gimp);
/* initialize the color history */
gimp_palettes_load (gimp);
/* initialize the list of gimp tool presets if we have a GUI */
if (! gimp->no_interface)
{

View File

@ -22,8 +22,6 @@ AM_CPPFLAGS = \
noinst_LIBRARIES = libappgui.a
libappgui_a_sources = \
color-history.c \
color-history.h \
gimpdbusservice.c \
gimpdbusservice.h \
gimpuiconfigurer.c \

View File

@ -1,77 +0,0 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* color-history.c
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimp-palettes.h"
#include "core/gimppalettemru.h"
#include "color-history.h"
#include "gimp-intl.h"
void
color_history_save (Gimp *gimp)
{
GimpPalette *palette;
GFile *file;
g_return_if_fail (GIMP_IS_GIMP (gimp));
palette = gimp_palettes_get_color_history (gimp);
file = gimp_directory_file ("colorrc", NULL);
if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
gimp_palette_mru_save (GIMP_PALETTE_MRU (palette), file);
g_object_unref (file);
}
void
color_history_restore (Gimp *gimp)
{
GimpPalette *palette;
GFile *file;
g_return_if_fail (GIMP_IS_GIMP (gimp));
palette = gimp_palettes_get_color_history (gimp);
file = gimp_directory_file ("colorrc", NULL);
if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
gimp_palette_mru_load (GIMP_PALETTE_MRU (palette), file);
g_object_unref (file);
}

View File

@ -1,31 +0,0 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* color-history.h
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __COLOR_HISTORY_H__
#define __COLOR_HISTORY_H__
#define COLOR_HISTORY_SIZE 12
void color_history_save (Gimp *gimp);
void color_history_restore (Gimp *gimp);
#endif /* __COLOR_HISTORY_H__ */

View File

@ -70,7 +70,6 @@
#include "dialogs/dialogs.h"
#include "color-history.h"
#include "gimpuiconfigurer.h"
#include "gui.h"
#include "gui-unique.h"
@ -597,8 +596,6 @@ gui_restore_after_callback (Gimp *gimp,
if (status_callback == splash_update)
splash_destroy ();
color_history_restore (gimp);
if (gimp_get_show_gui (gimp))
{
GimpDisplayShell *shell;
@ -660,8 +657,6 @@ gui_exit_callback (Gimp *gimp,
if (gui_config->save_session_info)
session_save (gimp, FALSE);
color_history_save (gimp);
if (gui_config->save_accels)
menus_save (gimp, FALSE);