Commit 2334cb41 authored by Michael Natterer's avatar Michael Natterer 😴

Bug 760579 - Plug-in dialogs fail to use UI themes

Something must have changed in GTK+, probably a long time ago, because
this code definitely used to work in the past.

Anyway, change gimp_ui_init() in libgimpui to use gtk_rc_parse()
instead of gtk_rc_add_default_file() which fixes the plug-in's initial
theme, and install a GFileMonitor on themerc which calls
gtk_rc_reparse_all() when themerc changes.
parent 98ecd4a0
...@@ -96,7 +96,8 @@ gimp_ui_init (const gchar *prog_name, ...@@ -96,7 +96,8 @@ gimp_ui_init (const gchar *prog_name,
GdkScreen *screen; GdkScreen *screen;
const gchar *display_name; const gchar *display_name;
gchar *themerc; gchar *themerc;
GFile *icon_theme; GFileMonitor *rc_monitor;
GFile *file;
g_return_if_fail (prog_name != NULL); g_return_if_fail (prog_name != NULL);
...@@ -130,17 +131,26 @@ gimp_ui_init (const gchar *prog_name, ...@@ -130,17 +131,26 @@ gimp_ui_init (const gchar *prog_name,
gtk_init (NULL, NULL); gtk_init (NULL, NULL);
themerc = gimp_personal_rc_file ("themerc"); themerc = gimp_personal_rc_file ("themerc");
gtk_rc_add_default_file (themerc); gtk_rc_parse (themerc);
file = g_file_new_for_path (themerc);
g_free (themerc); g_free (themerc);
rc_monitor = g_file_monitor (file, G_FILE_MONITOR_NONE, NULL, NULL);
g_object_unref (file);
g_signal_connect (rc_monitor, "changed",
G_CALLBACK (gtk_rc_reparse_all),
NULL);
gdk_set_program_class (gimp_wm_class ()); gdk_set_program_class (gimp_wm_class ());
screen = gdk_screen_get_default (); screen = gdk_screen_get_default ();
gtk_widget_set_default_colormap (gdk_screen_get_rgb_colormap (screen)); gtk_widget_set_default_colormap (gdk_screen_get_rgb_colormap (screen));
icon_theme = g_file_new_for_path (gimp_get_icon_theme_dir ()); file = g_file_new_for_path (gimp_get_icon_theme_dir ());
gimp_icons_set_icon_theme (icon_theme); gimp_icons_set_icon_theme (file);
g_object_unref (icon_theme); g_object_unref (file);
gimp_widgets_init (gimp_ui_help_func, gimp_widgets_init (gimp_ui_help_func,
gimp_context_get_foreground, gimp_context_get_foreground,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment