[evolution/webkit: 21/124] Add a GtkLabel to EAttachmentButton to display name of the attachment.
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit: 21/124] Add a GtkLabel to EAttachmentButton to display name of the attachment.
- Date: Mon, 23 Jan 2012 13:05:17 +0000 (UTC)
commit 2a7d9f59b335deb8c944a2c30a9632e347a22b2d
Author: Dan VrÃtil <dvratil redhat com>
Date: Wed Sep 14 11:40:33 2011 +0200
Add a GtkLabel to EAttachmentButton to display name of the attachment.
Before this was done by putting EAttachmentButton into HTML table and
writing the name next to it. But since we now embed the button directly
to GtkWidget structure, we need to display the name of the attachment
via a GtkLabel now.
widgets/misc/e-attachment-button.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/widgets/misc/e-attachment-button.c b/widgets/misc/e-attachment-button.c
index efc184b..dba1155 100644
--- a/widgets/misc/e-attachment-button.c
+++ b/widgets/misc/e-attachment-button.c
@@ -27,6 +27,8 @@
#include "e-attachment-button.h"
+#include <glib/gi18n.h>
+
struct _EAttachmentButtonPrivate {
EAttachmentView *view;
@@ -40,6 +42,7 @@ struct _EAttachmentButtonPrivate {
GtkWidget *toggle_button;
GtkWidget *cell_view;
GtkWidget *popup_menu;
+ GtkWidget *label;
guint expandable : 1;
guint expanded : 1;
@@ -613,6 +616,11 @@ e_attachment_button_init (EAttachmentButton *button)
gtk_container_add (GTK_CONTAINER (container), widget);
gtk_widget_show (widget);
+ widget = gtk_label_new ("");
+ gtk_box_pack_start (GTK_BOX (button), widget, FALSE, FALSE, 10);
+ gtk_widget_show (widget);
+ button->priv->label = widget;
+
/* Configure Renderers */
cell_layout = GTK_CELL_LAYOUT (button->priv->cell_view);
@@ -751,6 +759,8 @@ e_attachment_button_set_attachment (EAttachmentButton *button,
if (attachment != NULL) {
GBinding *binding;
gulong handler_id;
+ GFileInfo *finfo;
+ const gchar *name;
binding = g_object_bind_property (
attachment, "can-show",
@@ -774,6 +784,13 @@ e_attachment_button_set_attachment (EAttachmentButton *button,
attachment_button_update_cell_view (button);
attachment_button_update_pixbufs (button);
+
+ finfo = e_attachment_get_file_info (attachment);
+ name = g_file_info_get_display_name (finfo);
+ if (name && *name)
+ gtk_label_set_text (GTK_LABEL (button->priv->label), name);
+ else
+ gtk_label_set_text (GTK_LABEL (button->priv->label), _("attachment.dat"));
}
/* update drag sources */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]