dialogs: Set "Quit Save" icon size based on theme
The "Save"/"Save as" icons that appear in the Quit Dialog when there are two or more images with unsaved changes were always sized as GTK_ICON_SIZE_MENU, or 16px, regardless of icon theme settings. This patch adds code on Quit Dialog creation to check the current theme and update the icon size accordingly via `quit_style_updated ()`. Note that this is a limited implementation due to the pending release of GIMP 3.2. It is not connected to notify::custom-icon-size signals to reduce complexity and potential issues. In the future, we may move this to the parent GimpMessageDialog if other dialogs would also benefit from getting a button icon size from the theme.
This commit is contained in:
parent
fc84cdbe87
commit
8e4e83911c
1 changed files with 36 additions and 0 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include "dialogs-types.h"
|
||||
|
||||
#include "config/gimpcoreconfig.h"
|
||||
#include "config/gimpguiconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
|
|
@ -113,6 +114,10 @@ static gboolean quit_close_all_dialog_query_tooltip (GtkWidget *w
|
|||
QuitDialog *private);
|
||||
static gboolean quit_close_all_idle (QuitDialog *private);
|
||||
|
||||
static void quit_style_updated (GimpGuiConfig *config,
|
||||
GParamSpec *pspec,
|
||||
GObject *button);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
|
|
@ -251,6 +256,8 @@ quit_close_all_dialog_new (Gimp *gimp,
|
|||
g_object_set (renderer,
|
||||
"icon-name", "document-save",
|
||||
NULL);
|
||||
quit_style_updated (GIMP_GUI_CONFIG (gimp->config), NULL,
|
||||
G_OBJECT (renderer));
|
||||
gtk_tree_view_column_pack_end (column, renderer, FALSE);
|
||||
gtk_tree_view_column_set_attributes (column, renderer, NULL);
|
||||
|
||||
|
|
@ -640,3 +647,32 @@ quit_close_all_idle (QuitDialog *private)
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
quit_style_updated (GimpGuiConfig *config,
|
||||
GParamSpec *pspec,
|
||||
GObject *button)
|
||||
{
|
||||
GtkIconSize icon_size = GTK_ICON_SIZE_MENU;
|
||||
|
||||
if (config->override_icon_size)
|
||||
{
|
||||
switch (config->custom_icon_size)
|
||||
{
|
||||
case GIMP_ICON_SIZE_LARGE:
|
||||
icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
break;
|
||||
|
||||
case GIMP_ICON_SIZE_HUGE:
|
||||
icon_size = GTK_ICON_SIZE_DND;
|
||||
break;
|
||||
|
||||
case GIMP_ICON_SIZE_MEDIUM:
|
||||
case GIMP_ICON_SIZE_SMALL:
|
||||
default:
|
||||
icon_size = GTK_ICON_SIZE_MENU;
|
||||
}
|
||||
}
|
||||
|
||||
g_object_set (button, "stock-size", icon_size, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue