[libgd/wip/rishi/letterbox: 2/2] main-icon-box-child: Make the icon expand horizontally



commit 42013aabe689aa438d304b28fbb795c0d61103d8
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 21 13:22:16 2017 +0100

    main-icon-box-child: Make the icon expand horizontally
    
    Use GdMainIconBoxIcon, instead of GtkImage, to ensure that the icons
    expand horizontally as the GtkFlowBox gets resized. For this to work,
    the GtkGrid can no longer be horizontally centred.

 libgd/gd-main-icon-box-child.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/libgd/gd-main-icon-box-child.c b/libgd/gd-main-icon-box-child.c
index 386c4f9..3bf06f0 100644
--- a/libgd/gd-main-icon-box-child.c
+++ b/libgd/gd-main-icon-box-child.c
@@ -21,6 +21,7 @@
 
 #include "gd-main-box-child.h"
 #include "gd-main-icon-box-child.h"
+#include "gd-main-icon-box-icon.h"
 
 #include <gio/gio.h>
 #include <glib.h>
@@ -169,16 +170,15 @@ gd_main_icon_box_child_update_layout (GdMainIconBoxChild *self)
 {
   GdMainIconBoxChildPrivate *priv;
   GtkWidget *grid;
-  GtkWidget *image;
+  GtkWidget *icon;
   GtkWidget *overlay;
-  cairo_surface_t *icon;
+  cairo_surface_t *surface;
 
   priv = gd_main_icon_box_child_get_instance_private (self);
 
   gtk_container_foreach (GTK_CONTAINER (self), (GtkCallback) gtk_widget_destroy, NULL);
 
   grid = gtk_grid_new ();
-  gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
   gtk_widget_set_valign (grid, GTK_ALIGN_CENTER);
   gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);
   gtk_container_add (GTK_CONTAINER (self), grid);
@@ -187,10 +187,11 @@ gd_main_icon_box_child_update_layout (GdMainIconBoxChild *self)
   gtk_widget_set_margin_bottom (overlay, 4);
   gtk_container_add (GTK_CONTAINER (grid), overlay);
 
-  icon = gd_main_box_item_get_icon (priv->item);
-  image = gtk_image_new_from_surface (icon);
-  g_object_bind_property (priv->item, "icon", image, "surface", G_BINDING_DEFAULT);
-  gtk_container_add (GTK_CONTAINER (overlay), image);
+  surface = gd_main_box_item_get_icon (priv->item);
+  icon = gd_main_icon_box_icon_new (surface);
+  gtk_widget_set_hexpand (icon, TRUE);
+  g_object_bind_property (priv->item, "icon", icon, "surface", G_BINDING_DEFAULT);
+  gtk_container_add (GTK_CONTAINER (overlay), icon);
 
   priv->check_button = gtk_check_button_new ();
   gtk_widget_set_can_focus (priv->check_button, FALSE);


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