diff --git a/ChangeLog b/ChangeLog index 1069f50856..07d0707a8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +2001-08-06 Michael Natterer + + * configure.in + * themes/Default/images/Makefile.am + * themes/Default/images/tools/Makefile.am: some new Makefiles to + make it installable. + + * Makefile.am + * gtkrc: removed... + + * themes/Default/Makefile.am + * themes/Default/gtkrc: ...added here. + + * themes/Default/imagerc: new file (not used, just for + documentation) which loads the default theme's images in the same + way the inlined pixbufs are registered with the stock system. + + * gimprc.in + * gimprc.win32 + * user_install + * user_install.bat + * app/gimprc.[ch]: added "theme-path" and "theme" gimprc variables. + + * app/app_procs.c: prase gimprc before initializing the GUI. + + * app/core/gimpdatafiles.[ch]: added support for getting only + subdirectories in the callback. + + * libgimpbase/gimpenv.c: as a temp_hack gimp_gtkrc(); returns the + default theme's gtkrc. + + * app/gui/gui.c: build a hash of theme directories and select + the one configured in gimprc.theme. Use gimp_gtkrc()'s default + value if there is no theme installed or configured. + + * app/gui/preferences-dialog.c: Added theme_path to the GUI. No + stuff for selection the theme yet. + + * app/gui/menus.c: beautify /Tools/ + + * app/tools/gimpcroptool.c: register in /Tools/Transform Tools/ + 2001-08-05 Michael Natterer * Makefile.am diff --git a/Makefile.am b/Makefile.am index c31a877fd7..a4b6a14d1b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,6 @@ EXTRA_DIST = \ PLUGIN_MAINTAINERS \ MAINTAINERS \ TODO \ - gtkrc \ gtkrc_user \ unitrc \ gimp_logo.ppm \ @@ -59,7 +58,6 @@ gimpdata_DATA = \ gimpsysconf_DATA = \ gimprc \ gimprc_user \ - gtkrc \ gtkrc_user \ unitrc \ ps-menurc diff --git a/app/app_procs.c b/app/app_procs.c index 6e9024f1d5..7dd60c98b9 100644 --- a/app/app_procs.c +++ b/app/app_procs.c @@ -126,11 +126,6 @@ app_init (gint gimp_argc, } } - if (! no_interface) - { - gui_libs_init (&gimp_argc, &gimp_argv); - } - /* The user_install dialog may have parsed unitrc and gimprc, so * check gimprc_init()'s return value */ @@ -145,6 +140,8 @@ app_init (gint gimp_argc, if (! no_interface) { + gui_libs_init (&gimp_argc, &gimp_argv); + get_standard_colormaps (); if (! no_splash) diff --git a/app/core/gimpdatafiles.c b/app/core/gimpdatafiles.c index 27f6837eaf..810fb84bf6 100644 --- a/app/core/gimpdatafiles.c +++ b/app/core/gimpdatafiles.c @@ -165,6 +165,12 @@ gimp_datafiles_read_directories (const gchar *path_str, { while ((dir_ent = readdir (dir))) { + if (! strcmp (dir_ent->d_name, ".") || + ! strcmp (dir_ent->d_name, "..")) + { + continue; + } + filename = g_strdup_printf ("%s%s", (gchar *) list->data, dir_ent->d_name); @@ -172,14 +178,21 @@ gimp_datafiles_read_directories (const gchar *path_str, /* Check the file and see that it is not a sub-directory */ err = stat (filename, &filestat); - if (!err && S_ISREG (filestat.st_mode) && - (!(flags & MODE_EXECUTABLE) || - (filestat.st_mode & S_IXUSR) || - is_script (filename))) + if (! err) { filestat_valid = TRUE; - (* loader_func) (filename, loader_data); + if (S_ISDIR (filestat.st_mode) && (flags & TYPE_DIRECTORY)) + { + (* loader_func) (filename, loader_data); + } + else if (S_ISREG (filestat.st_mode) && + (!(flags & MODE_EXECUTABLE) || + (filestat.st_mode & S_IXUSR) || + is_script (filename))) + { + (* loader_func) (filename, loader_data); + } filestat_valid = FALSE; } diff --git a/app/core/gimpdatafiles.h b/app/core/gimpdatafiles.h index a05f6ed197..42ced3649c 100644 --- a/app/core/gimpdatafiles.h +++ b/app/core/gimpdatafiles.h @@ -27,8 +27,8 @@ typedef enum { - INCLUDE_TEMP_DIR = 1 << 0, - MODE_EXECUTABLE = 1 << 1 + MODE_EXECUTABLE = 1 << 0, + TYPE_DIRECTORY = 1 << 1 } GimpDataFileFlags; diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index 7540579ebd..722f862eb4 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -146,6 +146,7 @@ static gchar * old_brush_path; static gchar * old_pattern_path; static gchar * old_palette_path; static gchar * old_gradient_path; +static gchar * old_theme_path; static gdouble old_monitor_xres; static gdouble old_monitor_yres; static gboolean old_using_xserver_resolution; @@ -182,6 +183,7 @@ static gchar * edit_brush_path = NULL; static gchar * edit_pattern_path = NULL; static gchar * edit_palette_path = NULL; static gchar * edit_gradient_path = NULL; +static gchar * edit_theme_path = NULL; /* variables which will be changed _after_ closing the dialog */ static guint edit_tile_cache_size; @@ -358,7 +360,8 @@ prefs_check_settings (void) prefs_strcmp (old_brush_path, edit_brush_path) || prefs_strcmp (old_pattern_path, edit_pattern_path) || prefs_strcmp (old_palette_path, edit_palette_path) || - prefs_strcmp (old_gradient_path, edit_gradient_path)) + prefs_strcmp (old_gradient_path, edit_gradient_path) || + prefs_strcmp (old_theme_path, edit_theme_path)) { return PREFS_RESTART; } @@ -489,6 +492,7 @@ prefs_save_callback (GtkWidget *widget, gchar *save_pattern_path; gchar *save_palette_path; gchar *save_gradient_path; + gchar *save_theme_path; state = prefs_check_settings (); switch (state) @@ -540,6 +544,8 @@ prefs_save_callback (GtkWidget *widget, save_palette_path = the_gimp->config->palette_path; save_gradient_path = the_gimp->config->gradient_path; + save_theme_path = gimprc.theme_path; + if (the_gimp->config->levels_of_undo != old_levels_of_undo) { update = g_list_append (update, "undo-levels"); @@ -806,6 +812,11 @@ prefs_save_callback (GtkWidget *widget, the_gimp->config->gradient_path = edit_gradient_path; update = g_list_append (update, "gradient-path"); } + if (prefs_strcmp (old_theme_path, edit_theme_path)) + { + gimprc.theme_path = edit_theme_path; + update = g_list_append (update, "theme-path"); + } /* values which are changed on "OK" or "Save" */ if (edit_tile_cache_size != old_tile_cache_size) @@ -842,6 +853,8 @@ prefs_save_callback (GtkWidget *widget, the_gimp->config->palette_path = save_palette_path; the_gimp->config->gradient_path = save_gradient_path; + gimprc.theme_path = save_theme_path; + /* no need to restore values which are only changed on "OK" and "Save" */ g_list_free (update); @@ -944,6 +957,8 @@ prefs_cancel_callback (GtkWidget *widget, prefs_strset (&edit_palette_path, old_palette_path); prefs_strset (&edit_gradient_path, old_gradient_path); + prefs_strset (&edit_theme_path, old_theme_path); + /* no need to restore values which are only changed on "OK" and "Save" */ } @@ -1444,6 +1459,8 @@ preferences_dialog_create (void) edit_pattern_path = prefs_strdup (the_gimp->config->pattern_path); edit_palette_path = prefs_strdup (the_gimp->config->palette_path); edit_gradient_path = prefs_strdup (the_gimp->config->gradient_path); + + edit_theme_path = prefs_strdup (gimprc.theme_path); } /* assign edit variables for values which get changed on "OK" and "Save" @@ -1515,6 +1532,7 @@ preferences_dialog_create (void) prefs_strset (&old_pattern_path, edit_pattern_path); prefs_strset (&old_palette_path, edit_palette_path); prefs_strset (&old_gradient_path, edit_gradient_path); + prefs_strset (&old_theme_path, edit_theme_path); /* values which will be changed on "OK" and "Save" */ old_tile_cache_size = edit_tile_cache_size; @@ -2684,7 +2702,11 @@ preferences_dialog_create (void) { N_("Modules"), N_("Modules Directories"), "dialogs/preferences/directories.html#modules", N_("Select Modules Dir"), - &edit_module_path } + &edit_module_path }, + { N_("Themes"), N_("Themes Directories"), + "dialogs/preferences/directories.html#themes", + N_("Select Themes Dir"), + &edit_theme_path } }; static gint npaths = sizeof (paths) / sizeof (paths[0]); diff --git a/app/gimprc.c b/app/gimprc.c index 05d8e08c48..19c101457e 100644 --- a/app/gimprc.c +++ b/app/gimprc.c @@ -237,7 +237,9 @@ GimpRc gimprc = /* info_window_follows_mouse */ TRUE, /* help_browser */ HELP_BROWSER_GIMP, /* cursor_mode */ CURSOR_MODE_TOOL_ICON, - /* disable_tearoff_menus */ FALSE + /* disable_tearoff_menus */ FALSE, + /* theme_path */ NULL, + /* theme */ NULL }; static GHashTable *parse_func_hash = NULL; @@ -358,7 +360,11 @@ static ParseFunc funcs[] = { "cursor-mode", TT_XCURSORMODE, &(gimprc.cursor_mode), NULL }, { "disable-tearoff-menus", TT_BOOLEAN, - &(gimprc.disable_tearoff_menus), NULL } + &(gimprc.disable_tearoff_menus), NULL }, + { "theme-path", TT_PATH, + &(gimprc.theme_path), NULL }, + { "theme", TT_STRING, + &(gimprc.theme), NULL } }; static gint n_funcs = (sizeof (funcs) / sizeof (funcs[0])); diff --git a/app/gimprc.h b/app/gimprc.h index 356e07f4b8..b3a46d5571 100644 --- a/app/gimprc.h +++ b/app/gimprc.h @@ -64,6 +64,8 @@ struct _GimpRc gint help_browser; gint cursor_mode; gboolean disable_tearoff_menus; + gchar *theme_path; + gchar *theme; }; extern GimpRc gimprc; diff --git a/app/gui/gui.c b/app/gui/gui.c index 03ce476ba5..27352f38ec 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -31,6 +31,7 @@ #include "core/gimp.h" #include "core/gimpcontainer.h" #include "core/gimpcontext.h" +#include "core/gimpdatafiles.h" #include "core/gimpimage.h" #include "widgets/gimpdialogfactory.h" @@ -119,35 +120,88 @@ static GQuark image_size_changed_handler_id = 0; static GQuark image_alpha_changed_handler_id = 0; static GQuark image_update_handler_id = 0; +static GHashTable *themes_hash = NULL; + /* public functions */ +static void +gui_themes_dir_foreach_func (const gchar *filename, + gpointer loader_data) +{ + GHashTable *hash; + gchar *basename; + + hash = (GHashTable *) loader_data; + + basename = g_path_get_basename (filename); + + if (be_verbose) + g_print (_("adding theme \"%s\" (%s)\n"), basename, filename); + + g_hash_table_insert (hash, + basename, + g_strdup (filename)); +} + void gui_libs_init (gint *argc, gchar ***argv) { - const gchar *gtkrc; - gchar *filename; + gchar *theme_dir; + gchar *gtkrc; gimp_stock_init (); - /* parse the systemwide gtkrc */ - gtkrc = gimp_gtkrc (); + themes_hash = g_hash_table_new_full (g_str_hash, + g_str_equal, + g_free, + g_free); + + if (gimprc.theme_path) + { + gimp_datafiles_read_directories (gimprc.theme_path, + TYPE_DIRECTORY, + gui_themes_dir_foreach_func, + themes_hash); + } + + if (gimprc.theme) + theme_dir = g_hash_table_lookup (themes_hash, gimprc.theme); + else + theme_dir = g_hash_table_lookup (themes_hash, "Default"); + + if (theme_dir) + { + gtkrc = g_strconcat (theme_dir, + G_DIR_SEPARATOR_S, + "gtkrc", + NULL); + } + else + { + /* get the hardcoded default theme gtkrc */ + + gtkrc = g_strdup (gimp_gtkrc ()); + } if (be_verbose) g_print (_("parsing \"%s\"\n"), gtkrc); gtk_rc_parse (gtkrc); + g_free (gtkrc); + /* parse the user gtkrc */ - filename = gimp_personal_rc_file ("gtkrc"); + + gtkrc = gimp_personal_rc_file ("gtkrc"); if (be_verbose) - g_print (_("parsing \"%s\"\n"), filename); + g_print (_("parsing \"%s\"\n"), gtkrc); - gtk_rc_parse (filename); + gtk_rc_parse (gtkrc); - g_free (filename); + g_free (gtkrc); } void @@ -321,6 +375,12 @@ gui_exit (Gimp *gimp) image_size_changed_handler_id = 0; image_alpha_changed_handler_id = 0; image_update_handler_id = 0; + + if (themes_hash) + { + g_hash_table_destroy (themes_hash); + themes_hash = NULL; + } } void diff --git a/app/gui/menus.c b/app/gui/menus.c index 189567390c..65a5119b63 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -778,6 +778,10 @@ static GimpItemFactoryEntry image_entries[] = SEPARATOR ("/Tools/---"), + BRANCH (N_("/Tools/Selection Tools")), + BRANCH (N_("/Tools/Paint Tools")), + BRANCH (N_("/Tools/Transform Tools")), + /* /Dialogs */ { { N_("/Dialogs/Layers, Channels & Paths..."), "L", diff --git a/app/gui/preferences-dialog.c b/app/gui/preferences-dialog.c index 7540579ebd..722f862eb4 100644 --- a/app/gui/preferences-dialog.c +++ b/app/gui/preferences-dialog.c @@ -146,6 +146,7 @@ static gchar * old_brush_path; static gchar * old_pattern_path; static gchar * old_palette_path; static gchar * old_gradient_path; +static gchar * old_theme_path; static gdouble old_monitor_xres; static gdouble old_monitor_yres; static gboolean old_using_xserver_resolution; @@ -182,6 +183,7 @@ static gchar * edit_brush_path = NULL; static gchar * edit_pattern_path = NULL; static gchar * edit_palette_path = NULL; static gchar * edit_gradient_path = NULL; +static gchar * edit_theme_path = NULL; /* variables which will be changed _after_ closing the dialog */ static guint edit_tile_cache_size; @@ -358,7 +360,8 @@ prefs_check_settings (void) prefs_strcmp (old_brush_path, edit_brush_path) || prefs_strcmp (old_pattern_path, edit_pattern_path) || prefs_strcmp (old_palette_path, edit_palette_path) || - prefs_strcmp (old_gradient_path, edit_gradient_path)) + prefs_strcmp (old_gradient_path, edit_gradient_path) || + prefs_strcmp (old_theme_path, edit_theme_path)) { return PREFS_RESTART; } @@ -489,6 +492,7 @@ prefs_save_callback (GtkWidget *widget, gchar *save_pattern_path; gchar *save_palette_path; gchar *save_gradient_path; + gchar *save_theme_path; state = prefs_check_settings (); switch (state) @@ -540,6 +544,8 @@ prefs_save_callback (GtkWidget *widget, save_palette_path = the_gimp->config->palette_path; save_gradient_path = the_gimp->config->gradient_path; + save_theme_path = gimprc.theme_path; + if (the_gimp->config->levels_of_undo != old_levels_of_undo) { update = g_list_append (update, "undo-levels"); @@ -806,6 +812,11 @@ prefs_save_callback (GtkWidget *widget, the_gimp->config->gradient_path = edit_gradient_path; update = g_list_append (update, "gradient-path"); } + if (prefs_strcmp (old_theme_path, edit_theme_path)) + { + gimprc.theme_path = edit_theme_path; + update = g_list_append (update, "theme-path"); + } /* values which are changed on "OK" or "Save" */ if (edit_tile_cache_size != old_tile_cache_size) @@ -842,6 +853,8 @@ prefs_save_callback (GtkWidget *widget, the_gimp->config->palette_path = save_palette_path; the_gimp->config->gradient_path = save_gradient_path; + gimprc.theme_path = save_theme_path; + /* no need to restore values which are only changed on "OK" and "Save" */ g_list_free (update); @@ -944,6 +957,8 @@ prefs_cancel_callback (GtkWidget *widget, prefs_strset (&edit_palette_path, old_palette_path); prefs_strset (&edit_gradient_path, old_gradient_path); + prefs_strset (&edit_theme_path, old_theme_path); + /* no need to restore values which are only changed on "OK" and "Save" */ } @@ -1444,6 +1459,8 @@ preferences_dialog_create (void) edit_pattern_path = prefs_strdup (the_gimp->config->pattern_path); edit_palette_path = prefs_strdup (the_gimp->config->palette_path); edit_gradient_path = prefs_strdup (the_gimp->config->gradient_path); + + edit_theme_path = prefs_strdup (gimprc.theme_path); } /* assign edit variables for values which get changed on "OK" and "Save" @@ -1515,6 +1532,7 @@ preferences_dialog_create (void) prefs_strset (&old_pattern_path, edit_pattern_path); prefs_strset (&old_palette_path, edit_palette_path); prefs_strset (&old_gradient_path, edit_gradient_path); + prefs_strset (&old_theme_path, edit_theme_path); /* values which will be changed on "OK" and "Save" */ old_tile_cache_size = edit_tile_cache_size; @@ -2684,7 +2702,11 @@ preferences_dialog_create (void) { N_("Modules"), N_("Modules Directories"), "dialogs/preferences/directories.html#modules", N_("Select Modules Dir"), - &edit_module_path } + &edit_module_path }, + { N_("Themes"), N_("Themes Directories"), + "dialogs/preferences/directories.html#themes", + N_("Select Themes Dir"), + &edit_theme_path } }; static gint npaths = sizeof (paths) / sizeof (paths[0]); diff --git a/app/menus/menus.c b/app/menus/menus.c index 189567390c..65a5119b63 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -778,6 +778,10 @@ static GimpItemFactoryEntry image_entries[] = SEPARATOR ("/Tools/---"), + BRANCH (N_("/Tools/Selection Tools")), + BRANCH (N_("/Tools/Paint Tools")), + BRANCH (N_("/Tools/Transform Tools")), + /* /Dialogs */ { { N_("/Dialogs/Layers, Channels & Paths..."), "L", diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c index 8b8cb76394..295f187d1d 100644 --- a/app/tools/gimpcroptool.c +++ b/app/tools/gimpcroptool.c @@ -174,7 +174,7 @@ gimp_crop_tool_register (Gimp *gimp) "gimp:crop_tool", _("Crop Tool"), _("Crop or Resize an image"), - N_("/Tools/Crop Tool"), "C", + N_("/Tools/Transform Tools/Crop Tool"), "C", NULL, "tools/crop_tool.html", GIMP_STOCK_TOOL_CROP); } diff --git a/app/widgets/gimpitemfactory.c b/app/widgets/gimpitemfactory.c index 189567390c..65a5119b63 100644 --- a/app/widgets/gimpitemfactory.c +++ b/app/widgets/gimpitemfactory.c @@ -778,6 +778,10 @@ static GimpItemFactoryEntry image_entries[] = SEPARATOR ("/Tools/---"), + BRANCH (N_("/Tools/Selection Tools")), + BRANCH (N_("/Tools/Paint Tools")), + BRANCH (N_("/Tools/Transform Tools")), + /* /Dialogs */ { { N_("/Dialogs/Layers, Channels & Paths..."), "L", diff --git a/configure.in b/configure.in index d3edf58f5b..43288271e9 100644 --- a/configure.in +++ b/configure.in @@ -809,7 +809,7 @@ AC_SUBST(GIMP_THREAD_LIBS) AC_SUBST(GIMP_MP_FLAGS) AC_SUBST(GIMP_MP_LIBS) AC_SUBST(GIMP_PERL) -AC_SUBST(GIMP_PERL_PO) +AC_SUBST(GIMP_PERL_PO) AC_SUBST(GIMPINSTALL) AC_SUBST(HELPBROWSER) AC_SUBST(GTKXMHTML_CFLAGS) @@ -835,6 +835,14 @@ gimptool-1.4 gimptool.1 gimp-remote.1 gimp.spec +Makefile +build/Makefile +build/win32/Makefile +intl/Makefile +tools/Makefile +tools/authorsgen/Makefile +tools/pdbgen/Makefile +regexrepl/Makefile libgimp/Makefile libgimp/makefile.mingw libgimpbase/gimpversion.h @@ -901,7 +909,6 @@ plug-ins/sgi/Makefile plug-ins/plugin-helper/Makefile modules/Makefile modules/makefile.mingw -cursors/Makefile devel-docs/Makefile devel-docs/libgimp/Makefile devel-docs/libgimpbase/Makefile @@ -909,28 +916,23 @@ devel-docs/libgimpcolor/Makefile devel-docs/libgimpmath/Makefile devel-docs/libgimpwidgets/Makefile docs/Makefile +tips/Makefile pixmaps/Makefile +cursors/Makefile themes/Makefile themes/Default/Makefile +themes/Default/images/Makefile +themes/Default/images/tools/Makefile data/Makefile data/brushes/Makefile data/gradients/Makefile data/palettes/Makefile data/patterns/Makefile -Makefile -build/Makefile -build/win32/Makefile po/Makefile.in po-libgimp/Makefile.in -plug-ins/perl/po/Makefile.in po-plug-ins/Makefile.in po-script-fu/Makefile.in -intl/Makefile -regexrepl/Makefile -tools/Makefile -tools/authorsgen/Makefile -tools/pdbgen/Makefile -tips/Makefile], +plug-ins/perl/po/Makefile.in], [ chmod +x gimptool-1.4 sed -e "s/^ ..\/..\/..\// ..\//" plug-ins/perl/po/Makefile > plug-ins/perl/po/Makefile.eek && mv plug-ins/perl/po/Makefile.eek plug-ins/perl/po/Makefile diff --git a/data/misc/user_install b/data/misc/user_install index dfc1d08c69..fb599695ec 100755 --- a/data/misc/user_install +++ b/data/misc/user_install @@ -22,6 +22,8 @@ cp $3/unitrc $2/unitrc echo "cp $3/gtkrc_user $2/gtkrc" cp $3/gtkrc_user $2/gtkrc +echo "mkdir $2/themes" +mkdir $2/themes echo "mkdir $2/brushes" mkdir $2/brushes echo "mkdir $2/gradients" diff --git a/data/misc/user_install.bat b/data/misc/user_install.bat index 4ff52bea26..fff55c1fb6 100644 --- a/data/misc/user_install.bat +++ b/data/misc/user_install.bat @@ -4,6 +4,7 @@ mkdir %2 copy %3\gimprc_user %2\gimprc copy %3\unitrc %2\unitrc copy %3\gtkrc_user %2\gtkrc +mkdir %2\themes mkdir %2\brushes mkdir %2\gradients mkdir %2\palettes diff --git a/etc/gimprc.in b/etc/gimprc.in index ef8006bd0b..c82f5eeda1 100644 --- a/etc/gimprc.in +++ b/etc/gimprc.in @@ -76,6 +76,12 @@ # Set the path to modules that are to be initialized at startup (module-path "${gimp_dir}/modules:${gimp_plugin_dir}/modules") +# Specify a theme for the GUI. If none is specified it defaults to "Default" +(theme "Default") + +# Set the theme path. +(theme-path "${gimp_dir}/themes:${gimp_data_dir}/themes") + # The tile cache is used to make sure the gimp doesn't thrash # tiles between memory and disk. Setting this value higher will # cause the gimp to use less swap space, but will also cause diff --git a/etc/gimprc.win32 b/etc/gimprc.win32 index 547becb874..0ca160730a 100644 --- a/etc/gimprc.win32 +++ b/etc/gimprc.win32 @@ -85,6 +85,12 @@ # Set the path to modules that are to be initialized at startup (module-path "${gimp_dir}\\modules;${gimp_plugin_dir}\\modules") +# Specify a theme for the GUI. If none is specified it defaults to "Default" +(theme "Default") + +# Set the theme path. +(theme-path "${gimp_dir}\\themes:${gimp_data_dir}\\themes") + # The tile cache is used to make sure the gimp doesn't thrash # tiles between memory and disk. Setting this value higher will # cause the gimp to use less swap space, but will also cause diff --git a/gimprc.in b/gimprc.in index ef8006bd0b..c82f5eeda1 100644 --- a/gimprc.in +++ b/gimprc.in @@ -76,6 +76,12 @@ # Set the path to modules that are to be initialized at startup (module-path "${gimp_dir}/modules:${gimp_plugin_dir}/modules") +# Specify a theme for the GUI. If none is specified it defaults to "Default" +(theme "Default") + +# Set the theme path. +(theme-path "${gimp_dir}/themes:${gimp_data_dir}/themes") + # The tile cache is used to make sure the gimp doesn't thrash # tiles between memory and disk. Setting this value higher will # cause the gimp to use less swap space, but will also cause diff --git a/gimprc.win32 b/gimprc.win32 index 547becb874..0ca160730a 100644 --- a/gimprc.win32 +++ b/gimprc.win32 @@ -85,6 +85,12 @@ # Set the path to modules that are to be initialized at startup (module-path "${gimp_dir}\\modules;${gimp_plugin_dir}\\modules") +# Specify a theme for the GUI. If none is specified it defaults to "Default" +(theme "Default") + +# Set the theme path. +(theme-path "${gimp_dir}\\themes:${gimp_data_dir}\\themes") + # The tile cache is used to make sure the gimp doesn't thrash # tiles between memory and disk. Setting this value higher will # cause the gimp to use less swap space, but will also cause diff --git a/libgimpbase/gimpdatafiles.c b/libgimpbase/gimpdatafiles.c index 27f6837eaf..810fb84bf6 100644 --- a/libgimpbase/gimpdatafiles.c +++ b/libgimpbase/gimpdatafiles.c @@ -165,6 +165,12 @@ gimp_datafiles_read_directories (const gchar *path_str, { while ((dir_ent = readdir (dir))) { + if (! strcmp (dir_ent->d_name, ".") || + ! strcmp (dir_ent->d_name, "..")) + { + continue; + } + filename = g_strdup_printf ("%s%s", (gchar *) list->data, dir_ent->d_name); @@ -172,14 +178,21 @@ gimp_datafiles_read_directories (const gchar *path_str, /* Check the file and see that it is not a sub-directory */ err = stat (filename, &filestat); - if (!err && S_ISREG (filestat.st_mode) && - (!(flags & MODE_EXECUTABLE) || - (filestat.st_mode & S_IXUSR) || - is_script (filename))) + if (! err) { filestat_valid = TRUE; - (* loader_func) (filename, loader_data); + if (S_ISDIR (filestat.st_mode) && (flags & TYPE_DIRECTORY)) + { + (* loader_func) (filename, loader_data); + } + else if (S_ISREG (filestat.st_mode) && + (!(flags & MODE_EXECUTABLE) || + (filestat.st_mode & S_IXUSR) || + is_script (filename))) + { + (* loader_func) (filename, loader_data); + } filestat_valid = FALSE; } diff --git a/libgimpbase/gimpdatafiles.h b/libgimpbase/gimpdatafiles.h index a05f6ed197..42ced3649c 100644 --- a/libgimpbase/gimpdatafiles.h +++ b/libgimpbase/gimpdatafiles.h @@ -27,8 +27,8 @@ typedef enum { - INCLUDE_TEMP_DIR = 1 << 0, - MODE_EXECUTABLE = 1 << 1 + MODE_EXECUTABLE = 1 << 0, + TYPE_DIRECTORY = 1 << 1 } GimpDataFileFlags; diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c index 9f6c255e6c..f74c948b07 100644 --- a/libgimpbase/gimpenv.c +++ b/libgimpbase/gimpenv.c @@ -343,10 +343,15 @@ gimp_gtkrc (void) if (gimp_gtkrc_filename != NULL) return gimp_gtkrc_filename; - gimp_gtkrc_filename = g_strconcat (gimp_sysconf_directory (), + gimp_gtkrc_filename = g_strconcat (gimp_data_directory (), + G_DIR_SEPARATOR_S, + "themes", + G_DIR_SEPARATOR_S, + "Default", G_DIR_SEPARATOR_S, "gtkrc", NULL); + return gimp_gtkrc_filename; } diff --git a/themes/Default/Makefile.am b/themes/Default/Makefile.am index 95628a3b13..fdc55f052b 100644 --- a/themes/Default/Makefile.am +++ b/themes/Default/Makefile.am @@ -1,23 +1,12 @@ ## Process this file with automake to produce Makefile.in -STOCK_IMAGES = @STRIP_BEGIN@ \ - images/stock-button-anchor.png \ - images/stock-button-delete.png \ - images/stock-button-duplicate.png \ - images/stock-button-edit.png \ - images/stock-button-eye.png \ - images/stock-button-linked.png \ - images/stock-button-lower.png \ - images/stock-button-new.png \ - images/stock-button-paste.png \ - images/stock-button-paste-as-new.png \ - images/stock-button-paste-into.png \ - images/stock-button-stroke.png \ - images/stock-button-raise.png \ - images/stock-button-refresh.png \ - images/stock-button-to-path.png \ - images/stock-button-to-selection.png \ -@STRIP_END@ +SUBDIRS = images + +themedatadir = $(gimpdatadir)/themes/Default + +themedata_DATA = gtkrc imagerc + +EXTRA_DIST = $(themedata_DATA) STOCK_VARIABLES = @STRIP_BEGIN@ \ stock_button_anchor \ @@ -54,47 +43,6 @@ STOCK_VARIABLES = @STRIP_BEGIN@ \ $(srcdir)/images/stock-button-to-selection.png \ @STRIP_END@ -STOCK_TOOL_IMAGES = @STRIP_BEGIN@ \ - images/tools/stock-tool-button-airbrush.png \ - images/tools/stock-tool-button-bezier-select.png \ - images/tools/stock-tool-button-blend.png \ - images/tools/stock-tool-button-blur.png \ - images/tools/stock-tool-button-brightness-contrast.png \ - images/tools/stock-tool-button-bucket-fill.png \ - images/tools/stock-tool-button-by-color-select.png \ - images/tools/stock-tool-button-clone.png \ - images/tools/stock-tool-button-color-balance.png \ - images/tools/stock-tool-button-color-picker.png \ - images/tools/stock-tool-button-crop.png \ - images/tools/stock-tool-button-curves.png \ - images/tools/stock-tool-button-dodge.png \ - images/tools/stock-tool-button-ellipse-select.png \ - images/tools/stock-tool-button-eraser.png \ - images/tools/stock-tool-button-flip.png \ - images/tools/stock-tool-button-free-select.png \ - images/tools/stock-tool-button-fuzzy-select.png \ - images/tools/stock-tool-button-histogram.png \ - images/tools/stock-tool-button-hue-saturation.png \ - images/tools/stock-tool-button-ink.png \ - images/tools/stock-tool-button-iscissors.png \ - images/tools/stock-tool-button-levels.png \ - images/tools/stock-tool-button-measure.png \ - images/tools/stock-tool-button-move.png \ - images/tools/stock-tool-button-paintbrush.png \ - images/tools/stock-tool-button-path.png \ - images/tools/stock-tool-button-pencil.png \ - images/tools/stock-tool-button-perspective.png \ - images/tools/stock-tool-button-posterize.png \ - images/tools/stock-tool-button-rect-select.png \ - images/tools/stock-tool-button-rotate.png \ - images/tools/stock-tool-button-scale.png \ - images/tools/stock-tool-button-shear.png \ - images/tools/stock-tool-button-smudge.png \ - images/tools/stock-tool-button-text.png \ - images/tools/stock-tool-button-threshold.png \ - images/tools/stock-tool-button-zoom.png \ -@STRIP_END@ - STOCK_TOOL_VARIABLES = @STRIP_BEGIN@ \ stock_tool_button_airbrush \ $(srcdir)/images/tools/stock-tool-button-airbrush.png \ @@ -174,8 +122,6 @@ STOCK_TOOL_VARIABLES = @STRIP_BEGIN@ \ $(srcdir)/images/tools/stock-tool-button-zoom.png \ @STRIP_END@ -EXTRA_DIST = $(STOCK_IMAGES) $(STOCK_TOOL_IMAGES) - noinst_DATA = gimp-stock-pixbufs.h CLEANFILES += $(noinst_DATA) diff --git a/gtkrc b/themes/Default/gtkrc similarity index 93% rename from gtkrc rename to themes/Default/gtkrc index 56006d45ac..78b56d56d3 100644 --- a/gtkrc +++ b/themes/Default/gtkrc @@ -11,6 +11,11 @@ # widget_class style +# Don't define icons for the Default theme as they are compiled in +# +# include "imagerc" + + style "gimp-global-style" { GtkDialog::content_area_border = 0 diff --git a/themes/Default/imagerc b/themes/Default/imagerc new file mode 100644 index 0000000000..7d1b3ff5bf --- /dev/null +++ b/themes/Default/imagerc @@ -0,0 +1,310 @@ +# pixmap_path ":::..." +# +# include "rc-file" +# +# style [= ] +# { +#