[gimp] Rename GimpLangRc to GimpEarlyRc
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Rename GimpLangRc to GimpEarlyRc
- Date: Wed, 25 Aug 2021 23:24:53 +0000 (UTC)
commit f6fc9d424571f69da5603afc7388cc116c48bc26
Author: Luca Bacci <luca bacci982 gmail com>
Date: Sat Aug 7 11:14:49 2021 +0200
Rename GimpLangRc to GimpEarlyRc
app/app.c | 24 ++++---
app/config/Makefile.am | 4 +-
app/config/config-types.h | 2 +-
app/config/{gimplangrc.c => gimpearlyrc.c} | 106 +++++++++++++++--------------
app/config/gimpearlyrc.h | 62 +++++++++++++++++
app/config/gimplangrc.h | 60 ----------------
app/config/meson.build | 2 +-
7 files changed, 134 insertions(+), 126 deletions(-)
---
diff --git a/app/app.c b/app/app.c
index 2fd30176fa..931dc8d833 100644
--- a/app/app.c
+++ b/app/app.c
@@ -48,7 +48,7 @@
#include "core/core-types.h"
-#include "config/gimplangrc.h"
+#include "config/gimpearlyrc.h"
#include "config/gimprc.h"
#include "gegl/gimp-gegl.h"
@@ -194,7 +194,7 @@ app_run (const gchar *full_prog_name,
GFile *default_folder = NULL;
GFile *gimpdir;
const gchar *abort_message;
- GimpLangRc *temprc;
+ GimpEarlyRc *earlyrc;
gchar *language = NULL;
GError *font_error = NULL;
@@ -218,26 +218,30 @@ app_run (const gchar *full_prog_name,
filenames = NULL;
}
+ /* Here we do a first pass on "gimprc" file for the sole purpose
+ * of getting some configuration data that's required during early
+ * initialization, before the gimp singleton is constructed
+ */
+ earlyrc = gimp_early_rc_new (alternate_system_gimprc,
+ alternate_gimprc,
+ be_verbose);
+
/* Language needs to be determined first, before any GimpContext is
* instantiated (which happens when the Gimp object is created)
* because its properties need to be properly localized in the
* settings language (if different from system language). Otherwise we
* end up with pieces of GUI always using the system language (cf. bug
- * 787457). Therefore we do a first pass on "gimprc" file for the sole
- * purpose of getting the settings language, so that we can initialize
- * it before anything else.
+ * 787457)
*/
- temprc = gimp_lang_rc_new (alternate_system_gimprc,
- alternate_gimprc,
- be_verbose);
- language = gimp_lang_rc_get_language (temprc);
- g_object_unref (temprc);
+ language = gimp_early_rc_get_language (earlyrc);
/* change the locale if a language if specified */
language_init (language);
if (language)
g_free (language);
+ g_object_unref (earlyrc);
+
/* Create an instance of the "Gimp" object which is the root of the
* core object system
*/
diff --git a/app/config/Makefile.am b/app/config/Makefile.am
index 0632f8c8b1..9686e357c1 100644
--- a/app/config/Makefile.am
+++ b/app/config/Makefile.am
@@ -46,12 +46,12 @@ libappconfig_a_sources = \
gimpdisplayconfig.h \
gimpdisplayoptions.c \
gimpdisplayoptions.h \
+ gimpearlyrc.c \
+ gimpearlyrc.h \
gimpgeglconfig.c \
gimpgeglconfig.h \
gimpguiconfig.c \
gimpguiconfig.h \
- gimplangrc.c \
- gimplangrc.h \
gimppluginconfig.c \
gimppluginconfig.h \
gimprc.c \
diff --git a/app/config/config-types.h b/app/config/config-types.h
index 40b0802679..1fe55943ab 100644
--- a/app/config/config-types.h
+++ b/app/config/config-types.h
@@ -36,7 +36,7 @@ typedef struct _GimpCoreConfig GimpCoreConfig;
typedef struct _GimpDisplayConfig GimpDisplayConfig;
typedef struct _GimpGuiConfig GimpGuiConfig;
typedef struct _GimpDialogConfig GimpDialogConfig;
-typedef struct _GimpLangRc GimpLangRc;
+typedef struct _GimpEarlyRc GimpEarlyRc;
typedef struct _GimpPluginConfig GimpPluginConfig;
typedef struct _GimpRc GimpRc;
diff --git a/app/config/gimplangrc.c b/app/config/gimpearlyrc.c
similarity index 68%
rename from app/config/gimplangrc.c
rename to app/config/gimpearlyrc.c
index b713733572..f70340722a 100644
--- a/app/config/gimplangrc.c
+++ b/app/config/gimpearlyrc.c
@@ -1,7 +1,9 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
- * GimpLangRc: pre-parsing of gimprc returning the language.
+ * GimpEarlyRc: pre-parsing of gimprc suitable for use during early
+ * initialization, when the gimp singleton is not constructed yet
+ *
* Copyright (C) 2017 Jehan <jehan gimp org>
*
* This program is free software: you can redistribute it and/or modify
@@ -27,7 +29,7 @@
#include "config-types.h"
-#include "gimplangrc.h"
+#include "gimpearlyrc.h"
enum
{
@@ -39,35 +41,35 @@ enum
};
-static void gimp_lang_rc_constructed (GObject *object);
-static void gimp_lang_rc_finalize (GObject *object);
-static void gimp_lang_rc_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_lang_rc_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+static void gimp_early_rc_constructed (GObject *object);
+static void gimp_early_rc_finalize (GObject *object);
+static void gimp_early_rc_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_early_rc_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
/* Just use GimpConfig interface's default implementation which will
- * fill the PROP_LANGUAGE property. */
-G_DEFINE_TYPE_WITH_CODE (GimpLangRc, gimp_lang_rc, G_TYPE_OBJECT,
+ * fill the properties. */
+G_DEFINE_TYPE_WITH_CODE (GimpEarlyRc, gimp_early_rc, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
-#define parent_class gimp_lang_rc_parent_class
+#define parent_class gimp_early_rc_parent_class
static void
-gimp_lang_rc_class_init (GimpLangRcClass *klass)
+gimp_early_rc_class_init (GimpEarlyRcClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->constructed = gimp_lang_rc_constructed;
- object_class->finalize = gimp_lang_rc_finalize;
- object_class->set_property = gimp_lang_rc_set_property;
- object_class->get_property = gimp_lang_rc_get_property;
+ object_class->constructed = gimp_early_rc_constructed;
+ object_class->finalize = gimp_early_rc_finalize;
+ object_class->set_property = gimp_early_rc_set_property;
+ object_class->get_property = gimp_early_rc_get_property;
g_object_class_install_property (object_class, PROP_VERBOSE,
g_param_spec_boolean ("verbose",
@@ -97,18 +99,18 @@ gimp_lang_rc_class_init (GimpLangRcClass *klass)
}
static void
-gimp_lang_rc_init (GimpLangRc *rc)
+gimp_early_rc_init (GimpEarlyRc *rc)
{
}
static void
-gimp_lang_rc_constructed (GObject *object)
+gimp_early_rc_constructed (GObject *object)
{
- GimpLangRc *rc = GIMP_LANG_RC (object);
- GError *error = NULL;
+ GimpEarlyRc *rc = GIMP_EARLY_RC (object);
+ GError *error = NULL;
if (rc->verbose)
- g_print ("Parsing '%s' for configured language.\n",
+ g_print ("Parsing '%s' for configuration data required during early initialization.\n",
gimp_file_get_utf8_name (rc->system_gimprc));
if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
@@ -121,7 +123,7 @@ gimp_lang_rc_constructed (GObject *object)
}
if (rc->verbose)
- g_print ("Parsing '%s' for configured language.\n",
+ g_print ("Parsing '%s' for configuration data required during early initialization.\n",
gimp_file_get_utf8_name (rc->user_gimprc));
if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
@@ -143,9 +145,9 @@ gimp_lang_rc_constructed (GObject *object)
}
static void
-gimp_lang_rc_finalize (GObject *object)
+gimp_early_rc_finalize (GObject *object)
{
- GimpLangRc *rc = GIMP_LANG_RC (object);
+ GimpEarlyRc *rc = GIMP_EARLY_RC (object);
g_clear_object (&rc->system_gimprc);
g_clear_object (&rc->user_gimprc);
@@ -156,12 +158,12 @@ gimp_lang_rc_finalize (GObject *object)
}
static void
-gimp_lang_rc_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+gimp_early_rc_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GimpLangRc *rc = GIMP_LANG_RC (object);
+ GimpEarlyRc *rc = GIMP_EARLY_RC (object);
switch (property_id)
{
@@ -202,12 +204,12 @@ gimp_lang_rc_set_property (GObject *object,
}
static void
-gimp_lang_rc_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+gimp_early_rc_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- GimpLangRc *rc = GIMP_LANG_RC (object);
+ GimpEarlyRc *rc = GIMP_EARLY_RC (object);
switch (property_id)
{
@@ -231,31 +233,31 @@ gimp_lang_rc_get_property (GObject *object,
}
/**
- * gimp_lang_rc_new:
+ * gimp_early_rc_new:
* @system_gimprc: the name of the system-wide gimprc file or %NULL to
* use the standard location
* @user_gimprc: the name of the user gimprc file or %NULL to use the
* standard location
- * @verbose: enable console messages about loading the language
+ * @verbose: enable console messages about loading the preferences
*
- * Creates a new GimpLangRc object which only looks for the configure
- * language.
+ * Creates a new GimpEarlyRc object which looks for some configuration
+ * data required during early initialization steps
*
- * Returns: the new #GimpLangRc.
+ * Returns: the new #GimpEarlyRc.
*/
-GimpLangRc *
-gimp_lang_rc_new (GFile *system_gimprc,
- GFile *user_gimprc,
- gboolean verbose)
+GimpEarlyRc *
+gimp_early_rc_new (GFile *system_gimprc,
+ GFile *user_gimprc,
+ gboolean verbose)
{
- GimpLangRc *rc;
+ GimpEarlyRc *rc;
g_return_val_if_fail (system_gimprc == NULL || G_IS_FILE (system_gimprc),
NULL);
g_return_val_if_fail (user_gimprc == NULL || G_IS_FILE (user_gimprc),
NULL);
- rc = g_object_new (GIMP_TYPE_LANG_RC,
+ rc = g_object_new (GIMP_TYPE_EARLY_RC,
"verbose", verbose,
"system-gimprc", system_gimprc,
"user-gimprc", user_gimprc,
@@ -265,8 +267,8 @@ gimp_lang_rc_new (GFile *system_gimprc,
}
/**
- * gimp_lang_rc_get_language:
- * @lang_rc: a #GimpLangRc object.
+ * gimp_early_rc_get_language:
+ * @rc: a #GimpEarlyRc object.
*
* This function looks up the language set in `gimprc`.
*
@@ -274,7 +276,7 @@ gimp_lang_rc_new (GFile *system_gimprc,
* %NULL if the key couldn't be found.
**/
gchar *
-gimp_lang_rc_get_language (GimpLangRc *rc)
+gimp_early_rc_get_language (GimpEarlyRc *rc)
{
return rc->language ? g_strdup (rc->language) : NULL;
}
diff --git a/app/config/gimpearlyrc.h b/app/config/gimpearlyrc.h
new file mode 100644
index 0000000000..0abbb91659
--- /dev/null
+++ b/app/config/gimpearlyrc.h
@@ -0,0 +1,62 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * GimpEarlyRc: pre-parsing of gimprc suitable for use during early
+ * initialization, when the gimp singleton is not constructed yet
+ *
+ * Copyright (C) 2017 Jehan <jehan 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 <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_EARLY_RC_H__
+#define __GIMP_EARLY_RC_H__
+
+
+#define GIMP_TYPE_EARLY_RC (gimp_early_rc_get_type ())
+#define GIMP_EARLY_RC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_EARLY_RC, GimpEarlyRc))
+#define GIMP_EARLY_RC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_EARLY_RC,
GimpEarlyRcClass))
+#define GIMP_IS_EARLY_RC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_EARLY_RC))
+#define GIMP_IS_EARLY_RC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_EARLY_RC))
+
+
+typedef struct _GimpEarlyRcClass GimpEarlyRcClass;
+
+struct _GimpEarlyRc
+{
+ GObject parent_instance;
+
+ GFile *user_gimprc;
+ GFile *system_gimprc;
+ gboolean verbose;
+
+ gchar *language;
+};
+
+struct _GimpEarlyRcClass
+{
+ GObjectClass parent_class;
+};
+
+
+GType gimp_early_rc_get_type (void) G_GNUC_CONST;
+
+GimpEarlyRc * gimp_early_rc_new (GFile *system_gimprc,
+ GFile *user_gimprc,
+ gboolean verbose);
+gchar * gimp_early_rc_get_language (GimpEarlyRc *rc);
+
+
+#endif /* GIMP_EARLY_RC_H__ */
+
diff --git a/app/config/meson.build b/app/config/meson.build
index b36285fe5e..b1482ae057 100644
--- a/app/config/meson.build
+++ b/app/config/meson.build
@@ -23,9 +23,9 @@ libappconfig_sources = [
'gimpdialogconfig.c',
'gimpdisplayconfig.c',
'gimpdisplayoptions.c',
+ 'gimpearlyrc.c',
'gimpgeglconfig.c',
'gimpguiconfig.c',
- 'gimplangrc.c',
'gimppluginconfig.c',
'gimprc-deserialize.c',
'gimprc-serialize.c',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]