[evolution/webkit: 21/196] 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/196] Add a GtkLabel to EAttachmentButton to display name of the attachment.
- Date: Tue, 27 Mar 2012 16:02:29 +0000 (UTC)
commit debe851d2a7772a9a8cd9dfb32b692b49ed8bb98
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 44bd372..48bf38b 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>
+
#define E_ATTACHMENT_BUTTON_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_ATTACHMENT_BUTTON, EAttachmentButtonPrivate))
@@ -44,6 +46,7 @@ struct _EAttachmentButtonPrivate {
GtkWidget *toggle_button;
GtkWidget *cell_view;
GtkWidget *popup_menu;
+ GtkWidget *label;
guint expandable : 1;
guint expanded : 1;
@@ -619,6 +622,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);
@@ -757,6 +765,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",
@@ -780,6 +790,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]