[gimp] app: move error console highlight flags to aux-info
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move error console highlight flags to aux-info
- Date: Mon, 13 Nov 2017 15:19:29 +0000 (UTC)
commit 8aa5e7825e09a4f902213f773fa22d4347159929
Author: Ell <ell_se yahoo com>
Date: Mon Nov 13 10:07:03 2017 -0500
app: move error console highlight flags to aux-info
Move the highlight flags of the error console from GimpGuiConfig
and sessionrc to GimpErrorConsole and its aux-info, respectively.
app/actions/error-console-actions.c | 11 +---
app/actions/error-console-commands.c | 12 +---
app/config/gimpguiconfig.c | 45 ---------------
app/config/gimpguiconfig.h | 1 -
app/config/gimprc-blurbs.h | 9 ---
app/gui/gui-message.c | 17 +++---
app/gui/session.c | 68 +----------------------
app/widgets/gimperrorconsole.c | 102 +++++++++++++++++++++++++++++++--
app/widgets/gimperrorconsole.h | 2 +
9 files changed, 113 insertions(+), 154 deletions(-)
---
diff --git a/app/actions/error-console-actions.c b/app/actions/error-console-actions.c
index 3bd04ec..d420db5 100644
--- a/app/actions/error-console-actions.c
+++ b/app/actions/error-console-actions.c
@@ -24,10 +24,6 @@
#include "actions-types.h"
-#include "config/gimpguiconfig.h"
-
-#include "core/gimp.h"
-
#include "widgets/gimpactiongroup.h"
#include "widgets/gimperrorconsole.h"
#include "widgets/gimphelp-ids.h"
@@ -123,7 +119,6 @@ error_console_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
- GimpGuiConfig *config = GIMP_GUI_CONFIG (console->gimp->config);
gboolean selection;
selection = gtk_text_buffer_get_selection_bounds (console->text_buffer,
@@ -142,15 +137,15 @@ error_console_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("error-console-highlight-error", TRUE);
SET_ACTIVE ("error-console-highlight-error",
- config->error_console_highlight[GIMP_MESSAGE_ERROR]);
+ console->highlight[GIMP_MESSAGE_ERROR]);
SET_SENSITIVE ("error-console-highlight-warning", TRUE);
SET_ACTIVE ("error-console-highlight-warning",
- config->error_console_highlight[GIMP_MESSAGE_WARNING]);
+ console->highlight[GIMP_MESSAGE_WARNING]);
SET_SENSITIVE ("error-console-highlight-info", TRUE);
SET_ACTIVE ("error-console-highlight-info",
- config->error_console_highlight[GIMP_MESSAGE_INFO]);
+ console->highlight[GIMP_MESSAGE_INFO]);
#undef SET_ACTIVE
#undef SET_SENSITIVE
diff --git a/app/actions/error-console-commands.c b/app/actions/error-console-commands.c
index 97374c3..dea2c68 100644
--- a/app/actions/error-console-commands.c
+++ b/app/actions/error-console-commands.c
@@ -140,9 +140,7 @@ error_console_highlight_error_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- g_object_set (console->gimp->config,
- "error-console-highlight-error", active,
- NULL);
+ console->highlight[GIMP_MESSAGE_ERROR] = active;
}
void
@@ -154,9 +152,7 @@ error_console_highlight_warning_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- g_object_set (console->gimp->config,
- "error-console-highlight-warning", active,
- NULL);
+ console->highlight[GIMP_MESSAGE_WARNING] = active;
}
void
@@ -168,9 +164,7 @@ error_console_highlight_info_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- g_object_set (console->gimp->config,
- "error-console-highlight-info", active,
- NULL);
+ console->highlight[GIMP_MESSAGE_INFO] = active;
}
diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c
index 496d784..aa1f700 100644
--- a/app/config/gimpguiconfig.c
+++ b/app/config/gimpguiconfig.c
@@ -96,9 +96,6 @@ enum
PROP_SINGLE_WINDOW_MODE,
PROP_TABS_POSITION,
PROP_LAST_TIP_SHOWN,
- PROP_ERROR_CONSOLE_HIGHLIGHT_ERROR,
- PROP_ERROR_CONSOLE_HIGHLIGHT_WARNING,
- PROP_ERROR_CONSOLE_HIGHLIGHT_INFO,
/* ignored, only for backward compatibility: */
PROP_CURSOR_FORMAT,
@@ -462,30 +459,6 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
GIMP_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, PROP_ERROR_CONSOLE_HIGHLIGHT_ERROR,
- g_param_spec_boolean ("error-console-highlight-error",
- NULL,
- ERROR_CONSOLE_HIGHLIGHT_ERROR_BLURB,
- TRUE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- GIMP_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, PROP_ERROR_CONSOLE_HIGHLIGHT_WARNING,
- g_param_spec_boolean ("error-console-highlight-warning",
- NULL,
- ERROR_CONSOLE_HIGHLIGHT_WARNING_BLURB,
- TRUE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- GIMP_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, PROP_ERROR_CONSOLE_HIGHLIGHT_INFO,
- g_param_spec_boolean ("error-console-highlight-info",
- NULL,
- ERROR_CONSOLE_HIGHLIGHT_INFO_BLURB,
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- GIMP_PARAM_STATIC_STRINGS));
/* only for backward compatibility: */
GIMP_CONFIG_PROP_ENUM (object_class, PROP_CURSOR_FORMAT,
@@ -739,15 +712,6 @@ gimp_gui_config_set_property (GObject *object,
case PROP_LAST_TIP_SHOWN:
gui_config->last_tip_shown = g_value_get_int (value);
break;
- case PROP_ERROR_CONSOLE_HIGHLIGHT_ERROR:
- gui_config->error_console_highlight[GIMP_MESSAGE_ERROR] = g_value_get_boolean (value);
- break;
- case PROP_ERROR_CONSOLE_HIGHLIGHT_WARNING:
- gui_config->error_console_highlight[GIMP_MESSAGE_WARNING] = g_value_get_boolean (value);
- break;
- case PROP_ERROR_CONSOLE_HIGHLIGHT_INFO:
- gui_config->error_console_highlight[GIMP_MESSAGE_INFO] = g_value_get_boolean (value);
- break;
case PROP_CURSOR_FORMAT:
case PROP_INFO_WINDOW_PER_DISPLAY:
@@ -905,15 +869,6 @@ gimp_gui_config_get_property (GObject *object,
case PROP_LAST_TIP_SHOWN:
g_value_set_int (value, gui_config->last_tip_shown);
break;
- case PROP_ERROR_CONSOLE_HIGHLIGHT_ERROR:
- g_value_set_boolean (value, gui_config->error_console_highlight[GIMP_MESSAGE_ERROR]);
- break;
- case PROP_ERROR_CONSOLE_HIGHLIGHT_WARNING:
- g_value_set_boolean (value, gui_config->error_console_highlight[GIMP_MESSAGE_WARNING]);
- break;
- case PROP_ERROR_CONSOLE_HIGHLIGHT_INFO:
- g_value_set_boolean (value, gui_config->error_console_highlight[GIMP_MESSAGE_INFO]);
- break;
case PROP_CURSOR_FORMAT:
case PROP_INFO_WINDOW_PER_DISPLAY:
diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h
index 9892e35..bbb8130 100644
--- a/app/config/gimpguiconfig.h
+++ b/app/config/gimpguiconfig.h
@@ -87,7 +87,6 @@ struct _GimpGuiConfig
gboolean single_window_mode;
GimpPosition tabs_position;
gint last_tip_shown;
- gboolean error_console_highlight[GIMP_MESSAGE_ERROR + 1];
};
struct _GimpGuiConfigClass
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index cb05f2b..599b044 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -126,15 +126,6 @@ _("The window type hint that is set on dock windows and the toolbox " \
#define ENVIRON_PATH_BLURB \
"Sets the environ search path."
-#define ERROR_CONSOLE_HIGHLIGHT_ERROR_BLURB \
-"Highlight error console on errors"
-
-#define ERROR_CONSOLE_HIGHLIGHT_INFO_BLURB \
-"Highlight error console on messages"
-
-#define ERROR_CONSOLE_HIGHLIGHT_WARNING_BLURB \
-"Highlight error console on warnings"
-
#define FRACTALEXPLORER_PATH_BLURB \
"Where to search for fractals used by the Fractal Explorer plug-in."
diff --git a/app/gui/gui-message.c b/app/gui/gui-message.c
index b9cc078..5ab7608 100644
--- a/app/gui/gui-message.c
+++ b/app/gui/gui-message.c
@@ -153,17 +153,18 @@ gui_message_error_console (Gimp *gimp,
const gchar *domain,
const gchar *message)
{
- GimpGuiConfig *config = GIMP_GUI_CONFIG (gimp->config);
- GtkWidget *dockable = NULL;
+ GtkWidget *dockable;
+
+ dockable = gimp_dialog_factory_find_widget (gimp_dialog_factory_get_singleton (),
+ "gimp-error-console");
/* avoid raising the error console for unhighlighted messages */
- if (! config->error_console_highlight[severity])
+ if (dockable)
{
- GtkWidget *widget =
- gimp_dialog_factory_find_widget (gimp_dialog_factory_get_singleton (),
- "gimp-error-console");
- if (GIMP_IS_DOCKABLE (widget))
- dockable = widget;
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
+
+ if (GIMP_ERROR_CONSOLE (child)->highlight[severity])
+ dockable = NULL;
}
if (! dockable)
diff --git a/app/gui/session.c b/app/gui/session.c
index 35fabc9..5e98079 100644
--- a/app/gui/session.c
+++ b/app/gui/session.c
@@ -52,10 +52,7 @@ enum
HIDE_DOCKS,
SINGLE_WINDOW_MODE,
TABS_POSITION,
- LAST_TIP_SHOWN,
- ERROR_CONSOLE_HIGHLIGHT_ERROR,
- ERROR_CONSOLE_HIGHLIGHT_WARNING,
- ERROR_CONSOLE_HIGHLIGHT_INFO
+ LAST_TIP_SHOWN
};
@@ -113,12 +110,6 @@ session_init (Gimp *gimp)
GINT_TO_POINTER (TABS_POSITION));
g_scanner_scope_add_symbol (scanner, 0, "last-tip-shown",
GINT_TO_POINTER (LAST_TIP_SHOWN));
- g_scanner_scope_add_symbol (scanner, 0, "error-console-highlight-error",
- GINT_TO_POINTER (ERROR_CONSOLE_HIGHLIGHT_ERROR));
- g_scanner_scope_add_symbol (scanner, 0, "error-console-highlight-warning",
- GINT_TO_POINTER (ERROR_CONSOLE_HIGHLIGHT_WARNING));
- g_scanner_scope_add_symbol (scanner, 0, "error-console-highlight-info",
- GINT_TO_POINTER (ERROR_CONSOLE_HIGHLIGHT_INFO));
token = G_TOKEN_LEFT_PAREN;
@@ -281,45 +272,6 @@ session_init (Gimp *gimp)
"last-tip-shown", last_tip_shown,
NULL);
}
- else if (scanner->value.v_symbol == GINT_TO_POINTER (ERROR_CONSOLE_HIGHLIGHT_ERROR))
- {
- gboolean error_console_highlight_error;
-
- token = G_TOKEN_IDENTIFIER;
-
- if (! gimp_scanner_parse_boolean (scanner, &error_console_highlight_error))
- break;
-
- g_object_set (gimp->config,
- "error-console-highlight-error", error_console_highlight_error,
- NULL);
- }
- else if (scanner->value.v_symbol == GINT_TO_POINTER (ERROR_CONSOLE_HIGHLIGHT_WARNING))
- {
- gboolean error_console_highlight_warning;
-
- token = G_TOKEN_IDENTIFIER;
-
- if (! gimp_scanner_parse_boolean (scanner, &error_console_highlight_warning))
- break;
-
- g_object_set (gimp->config,
- "error-console-highlight-warning", error_console_highlight_warning,
- NULL);
- }
- else if (scanner->value.v_symbol == GINT_TO_POINTER (ERROR_CONSOLE_HIGHLIGHT_INFO))
- {
- gboolean error_console_highlight_info;
-
- token = G_TOKEN_IDENTIFIER;
-
- if (! gimp_scanner_parse_boolean (scanner, &error_console_highlight_info))
- break;
-
- g_object_set (gimp->config,
- "error-console-highlight-info", error_console_highlight_info,
- NULL);
- }
token = G_TOKEN_RIGHT_PAREN;
break;
@@ -443,24 +395,6 @@ session_save (Gimp *gimp,
GIMP_GUI_CONFIG (gimp->config)->last_tip_shown);
gimp_config_writer_close (writer);
- gimp_config_writer_open (writer, "error-console-highlight-error");
- gimp_config_writer_identifier (writer,
- GIMP_GUI_CONFIG (gimp->config)->error_console_highlight[GIMP_MESSAGE_ERROR]
?
- "yes" : "no");
- gimp_config_writer_close (writer);
-
- gimp_config_writer_open (writer, "error-console-highlight-warning");
- gimp_config_writer_identifier (writer,
- GIMP_GUI_CONFIG
(gimp->config)->error_console_highlight[GIMP_MESSAGE_WARNING] ?
- "yes" : "no");
- gimp_config_writer_close (writer);
-
- gimp_config_writer_open (writer, "error-console-highlight-info");
- gimp_config_writer_identifier (writer,
- GIMP_GUI_CONFIG (gimp->config)->error_console_highlight[GIMP_MESSAGE_INFO] ?
- "yes" : "no");
- gimp_config_writer_close (writer);
-
if (! gimp_config_writer_finish (writer, "end of sessionrc", &error))
{
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
diff --git a/app/widgets/gimperrorconsole.c b/app/widgets/gimperrorconsole.c
index e615003..9939677 100644
--- a/app/widgets/gimperrorconsole.c
+++ b/app/widgets/gimperrorconsole.c
@@ -33,28 +33,48 @@
#include "core/gimp.h"
+#include "gimpdocked.h"
#include "gimperrorconsole.h"
#include "gimpmenufactory.h"
+#include "gimpsessioninfo-aux.h"
#include "gimptextbuffer.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
-static void gimp_error_console_constructed (GObject *object);
-static void gimp_error_console_dispose (GObject *object);
+static const gboolean default_highlight[] =
+{
+ [GIMP_MESSAGE_ERROR] = TRUE,
+ [GIMP_MESSAGE_WARNING] = TRUE,
+ [GIMP_MESSAGE_INFO] = FALSE
+};
+
+
+static void gimp_error_console_docked_iface_init (GimpDockedInterface *iface);
+
+static void gimp_error_console_constructed (GObject *object);
+static void gimp_error_console_dispose (GObject *object);
+
+static void gimp_error_console_unmap (GtkWidget *widget);
-static void gimp_error_console_unmap (GtkWidget *widget);
+static gboolean gimp_error_console_button_press (GtkWidget *widget,
+ GdkEventButton *event,
+ GimpErrorConsole *console);
-static gboolean gimp_error_console_button_press (GtkWidget *widget,
- GdkEventButton *event,
- GimpErrorConsole *console);
+static void gimp_error_console_set_aux_info (GimpDocked *docked,
+ GList *aux_info);
+static GList * gimp_error_console_get_aux_info (GimpDocked *docked);
-G_DEFINE_TYPE (GimpErrorConsole, gimp_error_console, GIMP_TYPE_EDITOR)
+G_DEFINE_TYPE_WITH_CODE (GimpErrorConsole, gimp_error_console, GIMP_TYPE_EDITOR,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
+ gimp_error_console_docked_iface_init))
#define parent_class gimp_error_console_parent_class
+static GimpDockedInterface *parent_docked_iface = NULL;
+
static void
gimp_error_console_class_init (GimpErrorConsoleClass *klass)
@@ -103,6 +123,20 @@ gimp_error_console_init (GimpErrorConsole *console)
console);
console->file_dialog = NULL;
+
+ memcpy (console->highlight, default_highlight, sizeof (default_highlight));
+}
+
+static void
+gimp_error_console_docked_iface_init (GimpDockedInterface *iface)
+{
+ parent_docked_iface = g_type_interface_peek_parent (iface);
+
+ if (! parent_docked_iface)
+ parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED);
+
+ iface->set_aux_info = gimp_error_console_set_aux_info;
+ iface->get_aux_info = gimp_error_console_get_aux_info;
}
static void
@@ -236,3 +270,57 @@ gimp_error_console_button_press (GtkWidget *widget,
return FALSE;
}
+
+static const gchar * const aux_info_highlight[] =
+{
+ [GIMP_MESSAGE_ERROR] = "highlight-error",
+ [GIMP_MESSAGE_WARNING] = "highlight-warning",
+ [GIMP_MESSAGE_INFO] = "highlight-info"
+};
+
+static void
+gimp_error_console_set_aux_info (GimpDocked *docked,
+ GList *aux_info)
+{
+ GimpErrorConsole *console = GIMP_ERROR_CONSOLE (docked);
+ GList *list;
+
+ parent_docked_iface->set_aux_info (docked, aux_info);
+
+ for (list = aux_info; list; list = g_list_next (list))
+ {
+ GimpSessionInfoAux *aux = list->data;
+ gint i;
+
+ for (i = 0; i < G_N_ELEMENTS (aux_info_highlight); i++)
+ {
+ if (! strcmp (aux->name, aux_info_highlight[i]))
+ {
+ console->highlight[i] = ! strcmp (aux->value, "yes");
+ break;
+ }
+ }
+ }
+}
+
+static GList *
+gimp_error_console_get_aux_info (GimpDocked *docked)
+{
+ GimpErrorConsole *console = GIMP_ERROR_CONSOLE (docked);
+ GList *aux_info;
+ gint i;
+
+ aux_info = parent_docked_iface->get_aux_info (docked);
+
+ for (i = 0; i < G_N_ELEMENTS (aux_info_highlight); i++)
+ {
+ GimpSessionInfoAux *aux;
+
+ aux = gimp_session_info_aux_new (aux_info_highlight[i],
+ console->highlight[i] ? "yes" : "no");
+
+ aux_info = g_list_append (aux_info, aux);
+ }
+
+ return aux_info;
+}
diff --git a/app/widgets/gimperrorconsole.h b/app/widgets/gimperrorconsole.h
index 6240db1..9ea1b01 100644
--- a/app/widgets/gimperrorconsole.h
+++ b/app/widgets/gimperrorconsole.h
@@ -49,6 +49,8 @@ struct _GimpErrorConsole
GtkWidget *file_dialog;
gboolean save_selection;
+
+ gboolean highlight[GIMP_MESSAGE_ERROR + 1];
};
struct _GimpErrorConsoleClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]