mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
app: small ordering cleanup.
No functional change, just some include cleanup, as well as reordering with a private function made public. Also adding a comment saying why we have somewhat unrelated code (about color-scheme) in gui-unique.c. Maybe eventually we should generalize this message-handling invible window code into a separate file, if it becomes further used for more message handling.
This commit is contained in:
parent
38f8aec0df
commit
3e46549880
3 changed files with 57 additions and 50 deletions
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include "gui/gui-types.h"
|
||||
|
||||
#include "config/gimpguiconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
|
||||
|
@ -41,7 +43,6 @@
|
|||
|
||||
#include "gimpdbusservice.h"
|
||||
#include "gui-unique.h"
|
||||
#include "config/gimpguiconfig.h"
|
||||
#include "themes.h"
|
||||
|
||||
|
||||
|
@ -205,6 +206,11 @@ gui_unique_win32_message_handler (HWND hWnd,
|
|||
return TRUE;
|
||||
|
||||
case WM_SETTINGCHANGE:
|
||||
/* This message is not about the unique GUI code, but we reuse the
|
||||
* existing top-level (hidden) window used for receiving messages
|
||||
* for other purposes too, such as color scheme in this case.
|
||||
* See !2308.
|
||||
*/
|
||||
if (lParam != 0 && lstrcmpW((LPCWSTR)lParam, L"ImmersiveColorSet") == 0)
|
||||
{
|
||||
themes_theme_change_notify (GIMP_GUI_CONFIG (unique_gimp->config), NULL, unique_gimp);
|
||||
|
|
|
@ -276,6 +276,44 @@ themes_get_theme_file (Gimp *gimp,
|
|||
return file;
|
||||
}
|
||||
|
||||
void
|
||||
themes_theme_change_notify (GimpGuiConfig *config,
|
||||
GParamSpec *pspec,
|
||||
Gimp *gimp)
|
||||
{
|
||||
GFile *theme_css;
|
||||
GError *error = NULL;
|
||||
|
||||
g_object_set (gtk_settings_get_for_screen (gdk_screen_get_default ()),
|
||||
"gtk-application-prefer-dark-theme",
|
||||
config->theme_scheme != GIMP_THEME_LIGHT,
|
||||
NULL);
|
||||
|
||||
themes_apply_theme (gimp, config);
|
||||
|
||||
theme_css = gimp_directory_file ("theme.css", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n",
|
||||
gimp_file_get_utf8_name (theme_css));
|
||||
|
||||
if (! gtk_css_provider_load_from_file (GTK_CSS_PROVIDER (themes_style_provider),
|
||||
theme_css, &error))
|
||||
{
|
||||
g_printerr ("%s: error parsing %s: %s\n", G_STRFUNC,
|
||||
gimp_file_get_utf8_name (theme_css), error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
g_object_unref (theme_css);
|
||||
|
||||
gtk_style_context_reset_widgets (gdk_screen_get_default ());
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
themes_set_title_bar (gimp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
|
@ -713,44 +751,6 @@ themes_name_compare (const void *p1,
|
|||
return strcmp (* (char **) p1, * (char **) p2);
|
||||
}
|
||||
|
||||
void
|
||||
themes_theme_change_notify (GimpGuiConfig *config,
|
||||
GParamSpec *pspec,
|
||||
Gimp *gimp)
|
||||
{
|
||||
GFile *theme_css;
|
||||
GError *error = NULL;
|
||||
|
||||
g_object_set (gtk_settings_get_for_screen (gdk_screen_get_default ()),
|
||||
"gtk-application-prefer-dark-theme",
|
||||
config->theme_scheme != GIMP_THEME_LIGHT,
|
||||
NULL);
|
||||
|
||||
themes_apply_theme (gimp, config);
|
||||
|
||||
theme_css = gimp_directory_file ("theme.css", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n",
|
||||
gimp_file_get_utf8_name (theme_css));
|
||||
|
||||
if (! gtk_css_provider_load_from_file (GTK_CSS_PROVIDER (themes_style_provider),
|
||||
theme_css, &error))
|
||||
{
|
||||
g_printerr ("%s: error parsing %s: %s\n", G_STRFUNC,
|
||||
gimp_file_get_utf8_name (theme_css), error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
g_object_unref (theme_css);
|
||||
|
||||
gtk_style_context_reset_widgets (gdk_screen_get_default ());
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
themes_set_title_bar (gimp);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
themes_theme_paths_notify (GimpExtensionManager *manager,
|
||||
GParamSpec *pspec,
|
||||
|
@ -892,5 +892,4 @@ themes_win32_is_darkmode_active (void)
|
|||
|
||||
return status == ERROR_SUCCESS && val == 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,9 +28,11 @@ GFile * themes_get_theme_dir (Gimp *gimp,
|
|||
GFile * themes_get_theme_file (Gimp *gimp,
|
||||
const gchar *first_component,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
void themes_theme_change_notify (GimpGuiConfig *config,
|
||||
GParamSpec *pspec,
|
||||
Gimp *gimp);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
void themes_set_title_bar (Gimp *gimp);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue