aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-11-25 10:22:38 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-11-25 10:22:38 +0800
commit8896a36925cc5ec873878caf1a0842f0c830f33e (patch)
tree3139a74323e921fe180ce6d3a3cdd854a9be23cc /composer
parent3324e67a17442c8e3c8a3936d2f063ee675004d3 (diff)
downloadgsoc2013-evolution-8896a36925cc5ec873878caf1a0842f0c830f33e.tar
gsoc2013-evolution-8896a36925cc5ec873878caf1a0842f0c830f33e.tar.gz
gsoc2013-evolution-8896a36925cc5ec873878caf1a0842f0c830f33e.tar.bz2
gsoc2013-evolution-8896a36925cc5ec873878caf1a0842f0c830f33e.tar.lz
gsoc2013-evolution-8896a36925cc5ec873878caf1a0842f0c830f33e.tar.xz
gsoc2013-evolution-8896a36925cc5ec873878caf1a0842f0c830f33e.tar.zst
gsoc2013-evolution-8896a36925cc5ec873878caf1a0842f0c830f33e.zip
Remove the window size setting. (e_msg_composer_attachment_bar_new): Move
2002-11-25 Not Zed <NotZed@Ximian.com> * e-msg-composer-attachment-bar.c (init): Remove the window size setting. (e_msg_composer_attachment_bar_new): Move the window size setting here. Also set icon width based on 15 approximate characters, so the icon text is more readable. svn path=/trunk/; revision=18906
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog8
-rw-r--r--composer/e-msg-composer-attachment-bar.c36
2 files changed, 26 insertions, 18 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index fae9f682d1..0f74ef29ff 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,11 @@
+2002-11-25 Not Zed <NotZed@Ximian.com>
+
+ * e-msg-composer-attachment-bar.c (init): Remove the window size
+ setting.
+ (e_msg_composer_attachment_bar_new): Move the window size setting
+ here. Also set icon width based on 15 approximate characters, so
+ the icon text is more readable.
+
2002-11-22 Not Zed <NotZed@Ximian.com>
* e-msg-composer-select-file.c: rewrote most of this. Just use
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index 01438e82a8..dbcf37dc33 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -642,9 +642,7 @@ static void
init (EMsgComposerAttachmentBar *bar)
{
EMsgComposerAttachmentBarPrivate *priv;
- guint icon_size, icon_height;
- GdkFont *font;
-
+
priv = g_new (EMsgComposerAttachmentBarPrivate, 1);
priv->attachments = NULL;
@@ -654,20 +652,6 @@ init (EMsgComposerAttachmentBar *bar)
priv->num_attachments = 0;
bar->priv = priv;
-
- /* FIXME partly hardcoded. We should compute height from the font, and
- allow at least 2 lines for every item. */
- icon_size = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING;
-
- /*font = GTK_WIDGET (bar)->style->font;
- icon_height = icon_size + ((font->ascent + font->descent) * 2);*/
-#warning "FIXME: check icon_hight calculation with pango_font"
- icon_height = icon_size + pango_font_description_get_size(GTK_WIDGET (bar)->style->font_desc)*2;
- icon_size += 24;
-
- printf("set size %d,%d\n", icon_size*4, icon_height);
-
- gtk_widget_set_size_request (GTK_WIDGET (bar), icon_size * 4, icon_height);
}
@@ -698,12 +682,28 @@ e_msg_composer_attachment_bar_new (GtkAdjustment *adj)
{
EMsgComposerAttachmentBar *new;
EIconList *icon_list;
+ int width, height, icon_width, window_height;
+ PangoFontMetrics *metrics;
+ PangoContext *context;
new = g_object_new (e_msg_composer_attachment_bar_get_type (), NULL);
icon_list = E_ICON_LIST (new);
+
+ context = gtk_widget_get_pango_context(((GtkWidget *)new));
+ metrics = pango_context_get_metrics(context, ((GtkWidget *)new)->style->font_desc, pango_context_get_language(context));
+ width = PANGO_PIXELS(pango_font_metrics_get_approximate_char_width(metrics)) * 15;
+ /* This should be *2, but the icon list creates too much space above ... */
+ height = PANGO_PIXELS(pango_font_metrics_get_ascent(metrics) + pango_font_metrics_get_descent(metrics)) * 3;
+ pango_font_metrics_unref(metrics);
+
+ icon_width = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING;
+ icon_width = MAX(icon_width, width);
- e_icon_list_construct (icon_list, ICON_WIDTH, 0);
+ e_icon_list_construct (icon_list, icon_width, 0);
+
+ window_height = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING + height;
+ gtk_widget_set_size_request (GTK_WIDGET (new), icon_width * 4, window_height);
e_icon_list_set_separators (icon_list, ICON_SEPARATORS);
e_icon_list_set_row_spacing (icon_list, ICON_ROW_SPACING);