[evolution] I#1291 - EAttachmentIconView: Improve display settings
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1291 - EAttachmentIconView: Improve display settings
- Date: Tue, 31 Aug 2021 08:57:31 +0000 (UTC)
commit 277a602d092c3c657017121be4815de1fe2c1979
Author: Milan Crha <mcrha redhat com>
Date: Tue Aug 31 10:55:02 2021 +0200
I#1291 - EAttachmentIconView: Improve display settings
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1291
src/e-util/e-attachment-icon-view.c | 29 ++++++++++++++-------------
src/e-util/e-attachment-icon-view.h | 3 +--
src/e-util/e-picture-gallery.c | 39 ++++++++++++++++++++++++++++++-------
3 files changed, 49 insertions(+), 22 deletions(-)
---
diff --git a/src/e-util/e-attachment-icon-view.c b/src/e-util/e-attachment-icon-view.c
index 6a49982193..3e587e78e3 100644
--- a/src/e-util/e-attachment-icon-view.c
+++ b/src/e-util/e-attachment-icon-view.c
@@ -43,8 +43,6 @@ enum {
PROP_EDITABLE
};
-static gint icon_size = GTK_ICON_SIZE_DIALOG;
-
/* Forward Declarations */
static void e_attachment_icon_view_interface_init
(EAttachmentViewInterface *iface);
@@ -59,12 +57,6 @@ G_DEFINE_TYPE_WITH_CODE (
G_IMPLEMENT_INTERFACE (
E_TYPE_EXTENSIBLE, NULL))
-void
-e_attachment_icon_view_set_default_icon_size (gint size)
-{
- icon_size = size;
-}
-
static void
attachment_icon_view_set_property (GObject *object,
guint property_id,
@@ -139,6 +131,7 @@ attachment_icon_view_constructed (GObject *object)
G_OBJECT_CLASS (e_attachment_icon_view_parent_class)->constructed (object);
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (object), GTK_SELECTION_MULTIPLE);
+ gtk_icon_view_set_item_width (GTK_ICON_VIEW (object), 96);
cell_layout = GTK_CELL_LAYOUT (object);
@@ -146,7 +139,11 @@ attachment_icon_view_constructed (GObject *object)
* so that GtkCellLayout.get_area() returns something valid. */
renderer = gtk_cell_renderer_pixbuf_new ();
- g_object_set (renderer, "stock-size", icon_size, NULL);
+ g_object_set (renderer,
+ "stock-size", GTK_ICON_SIZE_DIALOG,
+ "xalign", 0.5,
+ "yalign", 0.5,
+ NULL);
gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
gtk_cell_layout_add_attribute (
@@ -154,10 +151,16 @@ attachment_icon_view_constructed (GObject *object)
E_ATTACHMENT_STORE_COLUMN_ICON);
renderer = gtk_cell_renderer_text_new ();
- g_object_set (
- renderer, "alignment", PANGO_ALIGN_CENTER,
- "wrap-mode", PANGO_WRAP_WORD, "wrap-width", 150,
- "yalign", 0.0, NULL);
+ g_object_set (renderer,
+ "alignment", PANGO_ALIGN_LEFT,
+ "ellipsize", PANGO_ELLIPSIZE_END,
+ "wrap-mode", PANGO_WRAP_WORD,
+ "wrap-width", 96,
+ "scale", 0.8,
+ "xpad", 0,
+ "xalign", 0.5,
+ "yalign", 0.0,
+ NULL);
gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
gtk_cell_layout_add_attribute (
diff --git a/src/e-util/e-attachment-icon-view.h b/src/e-util/e-attachment-icon-view.h
index 9bab98bf26..a2433e5fd0 100644
--- a/src/e-util/e-attachment-icon-view.h
+++ b/src/e-util/e-attachment-icon-view.h
@@ -63,8 +63,7 @@ struct _EAttachmentIconViewClass {
GType e_attachment_icon_view_get_type (void) G_GNUC_CONST;
GtkWidget * e_attachment_icon_view_new (void);
-void e_attachment_icon_view_set_default_icon_size
- (gint size);
+
G_END_DECLS
#endif /* E_ATTACHMENT_ICON_VIEW_H */
diff --git a/src/e-util/e-picture-gallery.c b/src/e-util/e-picture-gallery.c
index 0970743b6d..a727201d77 100644
--- a/src/e-util/e-picture-gallery.c
+++ b/src/e-util/e-picture-gallery.c
@@ -347,6 +347,8 @@ static void
picture_gallery_constructed (GObject *object)
{
GtkIconView *icon_view;
+ GtkCellLayout *cell_layout;
+ GtkCellRenderer *renderer;
GtkListStore *list_store;
GtkTargetEntry *targets;
GtkTargetList *list;
@@ -362,14 +364,37 @@ picture_gallery_constructed (GObject *object)
gtk_icon_view_set_model (icon_view, GTK_TREE_MODEL (list_store));
g_object_unref (list_store);
- gtk_icon_view_set_pixbuf_column (icon_view, COL_PIXBUF);
- gtk_icon_view_set_text_column (icon_view, COL_FILENAME_TEXT);
- gtk_icon_view_set_tooltip_column (icon_view, -1);
+ gtk_icon_view_set_item_width (icon_view, 96);
- /* Fit more icons by letting text wrap, especially with long filenames.
- * The thumbnail is usually 128x128, so match it, as the text won't wrap
- * smaller than the thumbnail width anyway. */
- gtk_icon_view_set_item_width (icon_view, 128);
+ cell_layout = GTK_CELL_LAYOUT (icon_view);
+
+ /* This needs to happen after constructor properties are set
+ * so that GtkCellLayout.get_area() returns something valid. */
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ g_object_set (renderer,
+ "stock-size", GTK_ICON_SIZE_DIALOG,
+ "xalign", 0.5,
+ "yalign", 0.5,
+ NULL);
+ gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
+
+ gtk_cell_layout_add_attribute (cell_layout, renderer, "pixbuf", COL_PIXBUF);
+
+ renderer = gtk_cell_renderer_text_new ();
+ g_object_set (renderer,
+ "alignment", PANGO_ALIGN_LEFT,
+ "ellipsize", PANGO_ELLIPSIZE_END,
+ "wrap-mode", PANGO_WRAP_WORD,
+ "wrap-width", 96,
+ "scale", 0.8,
+ "xpad", 0,
+ "xalign", 0.5,
+ "yalign", 0.0,
+ NULL);
+ gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
+
+ gtk_cell_layout_add_attribute (cell_layout, renderer, "text", COL_FILENAME_TEXT);
list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_uri_targets (list, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]