[gimp] app: do not hardcode default theme and icon theme all over the code.



commit fa9e5b8f98bc00433ac802973dd3564144e6be16
Author: Jehan <jehan girinstud io>
Date:   Mon Jan 11 03:03:28 2016 +0100

    app: do not hardcode default theme and icon theme all over the code.
    
    Create GIMP_CONFIG_DEFAULT_(ICON_)?THEME in gimpguiconfig.h to set
    defaults in a single place, except for libgimpwidgets/ which cannot
    include from app/.

 app/config/gimpguiconfig.c |    7 ++-----
 app/config/gimpguiconfig.h |    4 ++++
 app/gui/icon-themes.c      |    4 ++--
 app/gui/themes.c           |    2 +-
 libgimpwidgets/gimpicons.c |   14 +++++++++-----
 5 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c
index c087813..ef08362 100644
--- a/app/config/gimpguiconfig.c
+++ b/app/config/gimpguiconfig.c
@@ -39,9 +39,6 @@
 #define DEFAULT_HELP_BROWSER   GIMP_HELP_BROWSER_WEB_BROWSER
 #endif
 
-#define DEFAULT_THEME          "Default"
-#define DEFAULT_ICON_THEME     "Default"
-
 #define DEFAULT_USER_MANUAL_ONLINE_URI \
   "http://docs.gimp.org/"; GIMP_APP_VERSION_STRING
 
@@ -228,7 +225,7 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
   g_free (path);
   GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_THEME,
                                    "theme", THEME_BLURB,
-                                   DEFAULT_THEME,
+                                   GIMP_CONFIG_DEFAULT_THEME,
                                    GIMP_PARAM_STATIC_STRINGS);
   path = gimp_config_build_data_path ("icons");
   GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_ICON_THEME_PATH,
@@ -239,7 +236,7 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
   g_free (path);
   GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_ICON_THEME,
                                    "icon-theme", ICON_THEME_BLURB,
-                                   DEFAULT_ICON_THEME,
+                                   GIMP_CONFIG_DEFAULT_ICON_THEME,
                                    GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_HELP,
                                     "use-help", USE_HELP_BLURB,
diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h
index f5372d2..9fcdec2 100644
--- a/app/config/gimpguiconfig.h
+++ b/app/config/gimpguiconfig.h
@@ -24,6 +24,10 @@
 #include "config/gimpdisplayconfig.h"
 
 
+#define GIMP_CONFIG_DEFAULT_THEME          "Default"
+#define GIMP_CONFIG_DEFAULT_ICON_THEME     "Default"
+
+
 #define GIMP_TYPE_GUI_CONFIG            (gimp_gui_config_get_type ())
 #define GIMP_GUI_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_GUI_CONFIG, 
GimpGuiConfig))
 #define GIMP_GUI_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_GUI_CONFIG, 
GimpGuiConfigClass))
diff --git a/app/gui/icon-themes.c b/app/gui/icon-themes.c
index 2e3bc4f..00d7ed2 100644
--- a/app/gui/icon-themes.c
+++ b/app/gui/icon-themes.c
@@ -199,7 +199,7 @@ icon_themes_get_theme_dir (Gimp        *gimp,
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
   if (! icon_theme_name)
-    icon_theme_name = "Default";
+    icon_theme_name = GIMP_CONFIG_DEFAULT_ICON_THEME;
 
   return g_hash_table_lookup (icon_themes_hash, icon_theme_name);
 }
@@ -211,7 +211,7 @@ icons_apply_theme (Gimp        *gimp,
   g_return_if_fail (GIMP_IS_GIMP (gimp));
 
   if (! icon_theme_name)
-    icon_theme_name = "Default";
+    icon_theme_name = GIMP_CONFIG_DEFAULT_ICON_THEME;
 
   if (gimp->be_verbose)
     g_print ("Loading icon theme '%s'\n", icon_theme_name);
diff --git a/app/gui/themes.c b/app/gui/themes.c
index 567096b..7e8556b 100644
--- a/app/gui/themes.c
+++ b/app/gui/themes.c
@@ -190,7 +190,7 @@ themes_get_theme_dir (Gimp        *gimp,
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
   if (! theme_name)
-    theme_name = "Default";
+    theme_name = GIMP_CONFIG_DEFAULT_THEME;
 
   return g_hash_table_lookup (themes_hash, theme_name);
 }
diff --git a/libgimpwidgets/gimpicons.c b/libgimpwidgets/gimpicons.c
index 387ecd4..d7b3c82 100644
--- a/libgimpwidgets/gimpicons.c
+++ b/libgimpwidgets/gimpicons.c
@@ -48,8 +48,9 @@
  **/
 
 
-#define LIBGIMP_DOMAIN     GETTEXT_PACKAGE "-libgimp"
-#define GIMP_TOILET_PAPER  "gimp-toilet-paper"
+#define LIBGIMP_DOMAIN          GETTEXT_PACKAGE "-libgimp"
+#define GIMP_TOILET_PAPER       "gimp-toilet-paper"
+#define GIMP_DEFAULT_ICON_THEME "Default"
 
 
 static GtkIconFactory *gimp_stock_factory = NULL;
@@ -354,7 +355,8 @@ static void
 gimp_icons_change_icon_theme (GFile *path)
 {
   if (! default_icon_theme_path)
-    default_icon_theme_path = gimp_data_directory_file ("icons", "Default",
+    default_icon_theme_path = gimp_data_directory_file ("icons",
+                                                        GIMP_DEFAULT_ICON_THEME,
                                                         NULL);
 
   if (! g_file_equal (path, icon_theme_path))
@@ -420,7 +422,8 @@ gimp_icons_set_icon_theme (GFile *path)
   if (path)
     path = g_object_ref (path);
   else
-    path = gimp_data_directory_file (gimp_data_directory (), "icons", "Default",
+    path = gimp_data_directory_file (gimp_data_directory (),
+                                     "icons", GIMP_DEFAULT_ICON_THEME,
                                      NULL);
 
   if (! g_file_query_exists (path, NULL))
@@ -543,7 +546,8 @@ gimp_icons_init (void)
    *  themes.
    */
   if (! default_icon_theme_path)
-    default_icon_theme_path = gimp_data_directory_file ("icons", "Default",
+    default_icon_theme_path = gimp_data_directory_file ("icons",
+                                                        GIMP_DEFAULT_ICON_THEME,
                                                         NULL);
 
   icons_dir = g_file_get_path (default_icon_theme_path);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]