diff options
author | raveit65 <[email protected]> | 2017-08-09 15:13:17 +0200 |
---|---|---|
committer | monsta <[email protected]> | 2018-04-02 14:12:57 +0300 |
commit | 2164784f77870b6a74b4bb4f378f2dde42f03f0e (patch) | |
tree | 5529a8d9b04fd4338443eac3bad87904bfd46f9d | |
parent | 14d976238984f99a1f79f1329ef6d05be6c9f8e3 (diff) | |
download | atril-2164784f77870b6a74b4bb4f378f2dde42f03f0e.tar.bz2 atril-2164784f77870b6a74b4bb4f378f2dde42f03f0e.tar.xz |
libview: setting annotation window icons sizes
After a gtk update, the sizes of the icons on the
annotation window (close and resize handles) are
48x48. This patch fixes this by using GtkIconTheme
to force the loading of the icon on a different
size than the file
taken from:
https://git.gnome.org/browse/evince/commit/?id=63d0b4b
-rw-r--r-- | libview/ev-annotation-window.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c index 847e8750..a6c48d15 100644 --- a/libview/ev-annotation-window.c +++ b/libview/ev-annotation-window.c @@ -75,8 +75,6 @@ static guint signals[N_SIGNALS] = { 0 }; G_DEFINE_TYPE (EvAnnotationWindow, ev_annotation_window, GTK_TYPE_WINDOW) -#define EV_ICON_SIZE_ANNOT_WINDOW (ev_annotation_window_get_icon_size()) - /* Cut and paste from gtkwindow.c */ static void send_focus_change (GtkWidget *widget, @@ -106,17 +104,6 @@ get_screen_dpi (EvAnnotationWindow *window) return ev_document_misc_get_screen_dpi (screen, monitor); } -static GtkIconSize -ev_annotation_window_get_icon_size (void) -{ - static GtkIconSize icon_size = 0; - - if (G_UNLIKELY (icon_size == 0)) - icon_size = gtk_icon_size_register ("ev-icon-size-annot-window", 8, 8); - - return icon_size; -} - static void ev_annotation_window_sync_contents (EvAnnotationWindow *window) { @@ -284,6 +271,10 @@ ev_annotation_window_init (EvAnnotationWindow *window) GtkWidget *vbox, *hbox; GtkWidget *icon; GtkWidget *swindow; + GtkIconTheme *icon_theme; + GdkPixbuf *pixbuf; + + icon_theme = gtk_icon_theme_get_default (); gtk_widget_set_can_focus (GTK_WIDGET (window), TRUE); @@ -306,7 +297,9 @@ ev_annotation_window_init (EvAnnotationWindow *window) g_signal_connect_swapped (window->close_button, "clicked", G_CALLBACK (ev_annotation_window_close), window); - icon = gtk_image_new_from_stock (EV_STOCK_CLOSE, EV_ICON_SIZE_ANNOT_WINDOW); + pixbuf = gtk_icon_theme_load_icon (icon_theme, EV_STOCK_CLOSE, 8, GTK_ICON_LOOKUP_FORCE_SIZE, NULL); + icon = gtk_image_new_from_pixbuf (pixbuf); + g_object_unref (pixbuf); gtk_container_add (GTK_CONTAINER (window->close_button), icon); gtk_widget_show (icon); @@ -344,7 +337,9 @@ ev_annotation_window_init (EvAnnotationWindow *window) G_CALLBACK (ev_annotation_window_set_resize_cursor), window); - icon = gtk_image_new_from_stock (EV_STOCK_RESIZE_SW, EV_ICON_SIZE_ANNOT_WINDOW); + pixbuf = gtk_icon_theme_load_icon (icon_theme, EV_STOCK_RESIZE_SW, 8, GTK_ICON_LOOKUP_FORCE_SIZE, NULL); + icon = gtk_image_new_from_pixbuf (pixbuf); + g_object_unref (pixbuf); gtk_container_add (GTK_CONTAINER (window->resize_sw), icon); gtk_widget_show (icon); gtk_box_pack_start (GTK_BOX (hbox), window->resize_sw, FALSE, FALSE, 0); @@ -359,7 +354,9 @@ ev_annotation_window_init (EvAnnotationWindow *window) G_CALLBACK (ev_annotation_window_set_resize_cursor), window); - icon = gtk_image_new_from_stock (EV_STOCK_RESIZE_SE, EV_ICON_SIZE_ANNOT_WINDOW); + pixbuf = gtk_icon_theme_load_icon (icon_theme, EV_STOCK_RESIZE_SE, 8, GTK_ICON_LOOKUP_FORCE_SIZE, NULL); + icon = gtk_image_new_from_pixbuf (pixbuf); + g_object_unref (pixbuf); gtk_container_add (GTK_CONTAINER (window->resize_se), icon); gtk_widget_show (icon); gtk_box_pack_end (GTK_BOX (hbox), window->resize_se, FALSE, FALSE, 0); |