[gnome-photos/gnome-3-14] Ensure that icon-only buttons get the 'image-button' style class



commit d3e407961620aefb1c7e1ce7b760735f905f6f91
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Oct 30 11:51:13 2014 +0100

    Ensure that icon-only buttons get the 'image-button' style class
    
    Due to the way GtkButton works, when a GtkImage is added via
    gtk_container_add the button does not get the 'image-button' style
    class attached to it. We need to add it via gtk_button_set_image for
    that to happen.
    
    Fixes: https://bugzilla.gnome.org/737310

 src/photos-delete-notification.c   |    2 +-
 src/photos-indexing-notification.c |    2 +-
 src/photos-preview-nav-buttons.c   |    4 ++--
 src/photos-print-notification.c    |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-delete-notification.c b/src/photos-delete-notification.c
index e10d9a8..7735d18 100644
--- a/src/photos-delete-notification.c
+++ b/src/photos-delete-notification.c
@@ -151,7 +151,7 @@ photos_delete_notification_constructed (GObject *object)
   gtk_widget_set_valign (close, GTK_ALIGN_CENTER);
   gtk_button_set_focus_on_click (GTK_BUTTON (close), FALSE);
   gtk_button_set_relief (GTK_BUTTON (close), GTK_RELIEF_NONE);
-  gtk_container_add (GTK_CONTAINER (close), image);
+  gtk_button_set_image (GTK_BUTTON (close), image);
   gtk_container_add (GTK_CONTAINER (self), close);
   g_signal_connect_swapped (close, "clicked", G_CALLBACK (photos_delete_notification_delete_items), self);
 
diff --git a/src/photos-indexing-notification.c b/src/photos-indexing-notification.c
index 047bff3..b04f3db 100644
--- a/src/photos-indexing-notification.c
+++ b/src/photos-indexing-notification.c
@@ -297,7 +297,7 @@ photos_indexing_notification_init (PhotosIndexingNotification *self)
 
   close = gtk_button_new ();
   gtk_widget_set_valign (close, GTK_ALIGN_CENTER);
-  gtk_container_add (GTK_CONTAINER (close), image);
+  gtk_button_set_image (GTK_BUTTON (close), image);
   gtk_container_add (GTK_CONTAINER (self), close);
   g_signal_connect_swapped (close, "clicked", G_CALLBACK (photos_indexing_notification_close_clicked), self);
 
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index 1fc9307..999c34c 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -324,7 +324,7 @@ photos_preview_nav_buttons_constructed (GObject *object)
   gtk_image_set_pixel_size (GTK_IMAGE (image), 16);
 
   button = gtk_button_new ();
-  gtk_container_add (GTK_CONTAINER (button), image);
+  gtk_button_set_image (GTK_BUTTON (button), image);
   context = gtk_widget_get_style_context (button);
   gtk_style_context_add_class (context, "osd");
   gtk_container_add (GTK_CONTAINER (priv->prev_widget), button);
@@ -353,7 +353,7 @@ photos_preview_nav_buttons_constructed (GObject *object)
   gtk_image_set_pixel_size (GTK_IMAGE (image), 16);
 
   button = gtk_button_new ();
-  gtk_container_add (GTK_CONTAINER (button), image);
+  gtk_button_set_image (GTK_BUTTON (button), image);
   context = gtk_widget_get_style_context (button);
   gtk_style_context_add_class (context, "osd");
   gtk_container_add (GTK_CONTAINER (priv->next_widget), button);
diff --git a/src/photos-print-notification.c b/src/photos-print-notification.c
index 97734ae..d886864 100644
--- a/src/photos-print-notification.c
+++ b/src/photos-print-notification.c
@@ -170,7 +170,7 @@ photos_print_notification_init (PhotosPrintNotification *self)
 
   priv->stop_button = gtk_button_new ();
   gtk_widget_set_valign (priv->stop_button, GTK_ALIGN_CENTER);
-  gtk_container_add (GTK_CONTAINER (priv->stop_button), image);
+  gtk_button_set_image (GTK_BUTTON (priv->stop_button), image);
   gtk_container_add (GTK_CONTAINER (self), priv->stop_button);
   g_signal_connect_swapped (priv->stop_button,
                             "clicked",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]