diff options
author | raveit65 <[email protected]> | 2017-08-09 15:13:17 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-08-11 13:58:24 +0200 |
commit | c91e919ac36a0a34358fd4cd698e8c9e891502cc (patch) | |
tree | 78de7702d18c6000dd285a097a94eec22894f90b | |
parent | 4fc263679c77c7db26e0259efd44fd2a9d513712 (diff) | |
download | atril-c91e919ac36a0a34358fd4cd698e8c9e891502cc.tar.bz2 atril-c91e919ac36a0a34358fd4cd698e8c9e891502cc.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 de5c8876..217873e5 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, @@ -104,17 +102,6 @@ get_screen_dpi (EvAnnotationWindow *window) return ev_document_misc_get_screen_dpi (screen); } -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) { @@ -282,6 +269,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); @@ -304,7 +295,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); @@ -342,7 +335,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); @@ -357,7 +352,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); |