summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebarshi Ray <debarshir@gnome.org>2017-02-21 13:22:16 +0100
committerDebarshi Ray <debarshir@gnome.org>2017-03-02 07:46:43 +0100
commiteaef0ee3c2da2aa9b37f7a4ad0ffd5b2d1cae900 (patch)
tree42b0a1dd8d3e00a97f0f73cad5704bf2b4b054fd
parent0179badc1d5986dd3868351e4a59b95e1cac9854 (diff)
downloadlibgd-eaef0ee3c2da2aa9b37f7a4ad0ffd5b2d1cae900.tar.gz
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. https://bugzilla.gnome.org/show_bug.cgi?id=779032
-rw-r--r--libgd/gd-main-icon-box-child.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libgd/gd-main-icon-box-child.c b/libgd/gd-main-icon-box-child.c
index c6b5a0f..cfa3867 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,14 @@ gd_main_icon_box_child_update_layout (GdMainIconBoxChild *self)
{
GdMainIconBoxChildPrivate *priv;
GtkWidget *grid;
- GtkWidget *image;
+ GtkWidget *icon;
GtkWidget *overlay;
- cairo_surface_t *icon;
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);
@@ -186,10 +185,9 @@ gd_main_icon_box_child_update_layout (GdMainIconBoxChild *self)
overlay = gtk_overlay_new ();
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);
+ icon = gd_main_icon_box_icon_new (priv->item);
+ gtk_widget_set_hexpand (icon, TRUE);
+ gtk_container_add (GTK_CONTAINER (overlay), icon);
priv->check_button = gtk_check_button_new ();
gtk_widget_set_can_focus (priv->check_button, FALSE);