aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>1999-11-12 11:15:30 +0800
committerEttore Perazzoli <ettore@src.gnome.org>1999-11-12 11:15:30 +0800
commit15b4b77c8ae5dabda4e3c4eb30e4345d5effdfb1 (patch)
treec88b3bcb07f06d85a25627a8e6ce58b9aebf92ee
parent0ebe0334b1aefd2082dbcdadda2742eeaaf17943 (diff)
downloadgsoc2013-evolution-15b4b77c8ae5dabda4e3c4eb30e4345d5effdfb1.tar
gsoc2013-evolution-15b4b77c8ae5dabda4e3c4eb30e4345d5effdfb1.tar.gz
gsoc2013-evolution-15b4b77c8ae5dabda4e3c4eb30e4345d5effdfb1.tar.bz2
gsoc2013-evolution-15b4b77c8ae5dabda4e3c4eb30e4345d5effdfb1.tar.lz
gsoc2013-evolution-15b4b77c8ae5dabda4e3c4eb30e4345d5effdfb1.tar.xz
gsoc2013-evolution-15b4b77c8ae5dabda4e3c4eb30e4345d5effdfb1.tar.zst
gsoc2013-evolution-15b4b77c8ae5dabda4e3c4eb30e4345d5effdfb1.zip
Some message composer improvements.
svn path=/trunk/; revision=1382
-rw-r--r--widgets/ChangeLog46
-rw-r--r--widgets/Makefile.am10
-rw-r--r--widgets/e-msg-composer-address-dialog.glade297
-rw-r--r--widgets/e-msg-composer-attachment-bar.c86
-rw-r--r--widgets/e-msg-composer-attachment.c20
-rw-r--r--widgets/e-msg-composer-attachment.h3
-rw-r--r--widgets/e-msg-composer-hdrs.c55
-rw-r--r--widgets/e-msg-composer-hdrs.h2
-rw-r--r--widgets/e-msg-composer.c8
-rw-r--r--widgets/e-table/ChangeLog46
-rw-r--r--widgets/e-table/Makefile.am10
11 files changed, 402 insertions, 181 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog
index 430c404172..d0c7b288e4 100644
--- a/widgets/ChangeLog
+++ b/widgets/ChangeLog
@@ -1,3 +1,49 @@
+1999-11-12 Ettore Perazzoli <ettore@gnu.org>
+
+ * e-msg-composer-address-dialog.glade: Cosmetical changes.
+
+ * e-msg-composer-attachment-bar.c (size_to_string): New helper
+ function.
+ (update): Put the size in the icon's label using this function.
+ (ICON_SEPARATORS): Remove '.' to avoid wrapping of the size string
+ on the decimal dot. But gnome-libs is broken and this has no real
+ effect! :-(
+ (e_msg_composer_attachment_bar_new): No longer make text editable.
+ Use the `GTK_SELECTION_MULTIPLE' selection mode.
+ (remove_selected): No longer assume only one attachment is
+ selected.
+
+ * e-msg-composer-attachment.c: #include <sys/stat.h>
+ (init): Initialize all the members.
+ (e_msg_composer_attachment_new): Set size using `stat()'.
+
+ * e-msg-composer-attachment.h: New member `size' in `struct
+ _EMsgComposerAttachment'.
+
+ * e-msg-composer.c (setup_signals): Connect `address_dialog_cb' to
+ the "show_address_dialog" signal of the header widget.
+
+ * e-msg-composer-hdrs.c (add_address_header): Renamed to
+ `add_header'. New parameter `addrbook_button': if true, use a
+ button instead of a label and make it trigger an
+ "show_address_dialog" signal.
+ (address_button_clicked_cb): Signal handler to handle this on a
+ "clicked" signal from the button.
+ (setup_headers): Updated accordingly. Also, make "Subject" the
+ last item. (This makes it look more like Outlook and friends.)
+
+ * e-msg-composer-hdrs.c: New signal "show_address_dialog".
+ * e-msg-composer-hdrs.h: Updated accordingly.
+
+ * e-msg-composer-hdrs.c (add_address_header): Reduce padding
+ considerably.
+
+ * e-msg-composer.c (e_msg_composer_construct): Do not use any
+ padding in the main vbox.
+
+ * Makefile.am: Moved the `e-table*' sources to `EXTRA_DIST'.
+ Compile as a shared library.
+
1999-11-08 Ettore Perazzoli <ettore@gnu.org>
* e-msg-composer-address-dialog.c: Implemented cut & paste for the
diff --git a/widgets/Makefile.am b/widgets/Makefile.am
index 1a410e298e..875e61f6b1 100644
--- a/widgets/Makefile.am
+++ b/widgets/Makefile.am
@@ -13,10 +13,10 @@ INCLUDES = \
CPPFLAGS = \
-DE_GUIDIR=\"$(guidir)\"
-noinst_LIBRARIES = \
- libevolutionwidgets.a
+noinst_LTLIBRARIES = \
+ libevolutionwidgets.la
-libevolutionwidgets_a_SOURCES = \
+libevolutionwidgets_la_SOURCES = \
e-msg-composer-address-dialog.c \
e-msg-composer-address-dialog.h \
e-msg-composer-address-entry.c \
@@ -28,7 +28,9 @@ libevolutionwidgets_a_SOURCES = \
e-msg-composer-hdrs.c \
e-msg-composer-hdrs.h \
e-msg-composer.c \
- e-msg-composer.h \
+ e-msg-composer.h
+
+EXTRA_DIST = \
e-table-group.c \
e-table-group.h \
e-table-header.c \
diff --git a/widgets/e-msg-composer-address-dialog.glade b/widgets/e-msg-composer-address-dialog.glade
index 03452ea25b..2249c27daf 100644
--- a/widgets/e-msg-composer-address-dialog.glade
+++ b/widgets/e-msg-composer-address-dialog.glade
@@ -55,7 +55,7 @@
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
- <column_spacing>0</column_spacing>
+ <column_spacing>2</column_spacing>
<child>
<padding>0</padding>
<expand>True</expand>
@@ -89,32 +89,78 @@
</widget>
<widget>
+ <class>GtkLabel</class>
+ <name>label1</name>
+ <label>Recipient list:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>True</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
<class>GtkHBox</class>
- <name>hbox2</name>
- <homogeneous>True</homogeneous>
- <spacing>0</spacing>
+ <name>hbox1</name>
+ <homogeneous>False</homogeneous>
+ <spacing>5</spacing>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
+ <xfill>False</xfill>
+ <yfill>False</yfill>
</child>
<widget>
- <class>GtkButton</class>
- <name>button5</name>
+ <class>GtkLabel</class>
+ <name>label2</name>
+ <label>Name:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>name_entry</name>
<can_focus>True</can_focus>
- <label>Properties...</label>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
<child>
- <padding>10</padding>
+ <padding>5</padding>
<expand>True</expand>
<fill>True</fill>
</child>
@@ -122,13 +168,14 @@
<widget>
<class>GtkButton</class>
- <name>button6</name>
+ <name>search_button</name>
+ <width>65</width>
<can_focus>True</can_focus>
- <label>Add...</label>
+ <label>Search...</label>
<child>
- <padding>10</padding>
- <expand>True</expand>
- <fill>True</fill>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
</widget>
</widget>
@@ -136,8 +183,6 @@
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow1</name>
- <width>200</width>
- <height>200</height>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
@@ -147,8 +192,8 @@
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
- <xpad>5</xpad>
- <ypad>10</ypad>
+ <xpad>0</xpad>
+ <ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
@@ -160,9 +205,11 @@
<widget>
<class>GtkCList</class>
<name>address_clist</name>
+ <width>180</width>
+ <height>200</height>
<can_focus>True</can_focus>
<columns>2</columns>
- <column_widths>128,80</column_widths>
+ <column_widths>128,107</column_widths>
<selection_mode>GTK_SELECTION_BROWSE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
@@ -171,7 +218,7 @@
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label5</name>
- <width>150</width>
+ <width>50</width>
<label>Name</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
@@ -185,7 +232,7 @@
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label6</name>
- <width>1024</width>
+ <width>100</width>
<label>Address</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
@@ -198,6 +245,51 @@
</widget>
<widget>
+ <class>GtkHBox</class>
+ <name>hbox2</name>
+ <homogeneous>True</homogeneous>
+ <spacing>10</spacing>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button5</name>
+ <can_focus>True</can_focus>
+ <label>Properties...</label>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button6</name>
+ <can_focus>True</can_focus>
+ <label>Add...</label>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
<class>GtkTable</class>
<name>table2</name>
<rows>3</rows>
@@ -211,7 +303,7 @@
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
- <ypad>10</ypad>
+ <ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
@@ -222,16 +314,16 @@
<widget>
<class>GtkButton</class>
- <name>cc_add_button</name>
+ <name>to_add_button</name>
<width>60</width>
<can_focus>True</can_focus>
- <label>Cc: -&gt;</label>
+ <label>To: &gt;&gt;</label>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>10</xpad>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>5</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
@@ -244,16 +336,16 @@
<widget>
<class>GtkButton</class>
- <name>to_add_button</name>
+ <name>cc_add_button</name>
<width>60</width>
<can_focus>True</can_focus>
- <label>To: -&gt;</label>
+ <label>Cc: &gt;&gt;</label>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>10</xpad>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>5</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
@@ -269,13 +361,13 @@
<name>bcc_add_button</name>
<width>60</width>
<can_focus>True</can_focus>
- <label>Bcc: -&gt;</label>
+ <label>Bcc: &gt;&gt;</label>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
- <xpad>10</xpad>
+ <xpad>5</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
@@ -288,7 +380,7 @@
<widget>
<class>GtkScrolledWindow</class>
- <name>scrolledwindow2</name>
+ <name>scrolledwindow4</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
@@ -296,9 +388,9 @@
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>5</xpad>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>2</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
@@ -310,8 +402,8 @@
<widget>
<class>GtkCList</class>
- <name>to_clist</name>
- <width>200</width>
+ <name>bcc_clist</name>
+ <width>180</width>
<height>100</height>
<can_focus>True</can_focus>
<columns>1</columns>
@@ -323,8 +415,8 @@
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
- <name>label7</name>
- <label>label7</label>
+ <name>label9</name>
+ <label>label9</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -337,7 +429,7 @@
<widget>
<class>GtkScrolledWindow</class>
- <name>scrolledwindow4</name>
+ <name>scrolledwindow2</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
@@ -345,9 +437,9 @@
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>5</xpad>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>2</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
@@ -359,8 +451,8 @@
<widget>
<class>GtkCList</class>
- <name>bcc_clist</name>
- <width>200</width>
+ <name>to_clist</name>
+ <width>180</width>
<height>100</height>
<can_focus>True</can_focus>
<columns>1</columns>
@@ -372,8 +464,8 @@
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
- <name>label9</name>
- <label>label9</label>
+ <name>label7</name>
+ <label>label7</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -396,8 +488,8 @@
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
- <xpad>5</xpad>
- <ypad>10</ypad>
+ <xpad>2</xpad>
+ <ypad>4</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
@@ -409,7 +501,7 @@
<widget>
<class>GtkCList</class>
<name>cc_clist</name>
- <width>200</width>
+ <width>180</width>
<height>100</height>
<can_focus>True</can_focus>
<columns>1</columns>
@@ -433,98 +525,6 @@
</widget>
</widget>
</widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>Recipient list:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>5</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>False</xfill>
- <yfill>False</yfill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>Name:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>5</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>name_entry</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <padding>5</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>search_button</name>
- <width>65</width>
- <can_focus>True</can_focus>
- <label>Search...</label>
- <child>
- <padding>5</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
</widget>
<widget>
@@ -548,6 +548,7 @@
<class>GtkButton</class>
<name>button1</name>
<can_default>True</can_default>
+ <has_default>True</has_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
diff --git a/widgets/e-msg-composer-attachment-bar.c b/widgets/e-msg-composer-attachment-bar.c
index 9722741a0c..f30b953d2b 100644
--- a/widgets/e-msg-composer-attachment-bar.c
+++ b/widgets/e-msg-composer-attachment-bar.c
@@ -29,7 +29,7 @@
#define ICON_WIDTH 64
-#define ICON_SEPARATORS " /-_."
+#define ICON_SEPARATORS " /-_"
#define ICON_SPACING 2
#define ICON_ROW_SPACING ICON_SPACING
#define ICON_COL_SPACING ICON_SPACING
@@ -59,6 +59,43 @@ static guint signals[LAST_SIGNAL] = { 0 };
static void update (EMsgComposerAttachmentBar *bar);
+static gchar *
+size_to_string (gulong size)
+{
+ gchar *size_string;
+
+ /* FIXME: The following should probably go into a separate module, as
+ we might have to do the same thing in other places as well. Also,
+ I am not sure this will be OK for all the languages. */
+
+ if (size < 1e3L) {
+ if (size == 1)
+ size_string = g_strdup (_("1 byte"));
+ else
+ size_string = g_strdup_printf (_("%u bytes"),
+ (guint) size);
+ } else {
+ gdouble displayed_size;
+
+ if (size < 1e6L) {
+ displayed_size = (gdouble) size / 1.0e3;
+ size_string = g_strdup_printf (_("%.1fK"),
+ displayed_size);
+ } else if (size < 1e9L) {
+ displayed_size = (gdouble) size / 1.0e6;
+ size_string = g_strdup_printf (_("%.1fM"),
+ displayed_size);
+ } else {
+ displayed_size = (gdouble) size / 1.0e9;
+ size_string = g_strdup_printf (_("%.1fG"),
+ displayed_size);
+ }
+ }
+
+ return size_string;
+}
+
+
/* Sorting. */
static gint
@@ -162,6 +199,8 @@ update (EMsgComposerAttachmentBar *bar)
for (p = priv->attachments; p != NULL; p = p->next) {
EMsgComposerAttachment *attachment;
const gchar *icon_name;
+ gchar *size_string;
+ gchar *label;
attachment = p->data;
icon_name = gnome_mime_get_value (attachment->mime_type,
@@ -172,8 +211,17 @@ update (EMsgComposerAttachmentBar *bar)
icon_name = gnome_mime_get_value ("text/plain",
"icon-filename");
- gnome_icon_list_append (icon_list, icon_name,
- attachment->description);
+ size_string = size_to_string (attachment->size);
+
+ /* FIXME: If GnomeIconList honoured "\n", the result would be a
+ lot better. */
+ label = g_strconcat (attachment->description, "\n(",
+ size_string, ")", NULL);
+
+ gnome_icon_list_append (icon_list, icon_name, label);
+
+ g_free (label);
+ g_free (size_string);
}
gnome_icon_list_thaw (icon_list);
@@ -184,17 +232,29 @@ remove_selected (EMsgComposerAttachmentBar *bar)
{
GnomeIconList *icon_list;
EMsgComposerAttachment *attachment;
+ GList *attachment_list;
+ GList *p;
gint num;
icon_list = GNOME_ICON_LIST (bar);
- num = GPOINTER_TO_INT (icon_list->selection->data);
- /* FIXME do this with icon data. */
+ /* Weee! I am especially proud of this piece of cheesy code: it is
+ truly awful. But unless one attaches a huge number of files, it
+ will not be as greedy as intended. FIXME of course. */
+
+ attachment_list = NULL;
+ for (p = icon_list->selection; p != NULL; p = p->next) {
+ num = GPOINTER_TO_INT (p->data);
+ attachment = E_MSG_COMPOSER_ATTACHMENT
+ (g_list_nth (bar->priv->attachments, num)->data);
+ attachment_list = g_list_prepend (attachment_list, attachment);
+ }
+
+ for (p = attachment_list; p != NULL; p = p->next)
+ remove_attachment (bar, E_MSG_COMPOSER_ATTACHMENT (p->data));
- attachment = E_MSG_COMPOSER_ATTACHMENT
- (g_list_nth (bar->priv->attachments, num)->data);
+ g_list_free (attachment_list);
- remove_attachment (bar, attachment);
update (bar);
}
@@ -299,7 +359,7 @@ remove_cb (GtkWidget *widget,
static GnomeUIInfo icon_context_menu_info[] = {
GNOMEUIINFO_ITEM (N_("Remove"),
- N_("Remove this item from the attachment list"),
+ N_("Remove selected items from the attachment list"),
remove_cb, NULL),
GNOMEUIINFO_MENU_PROPERTIES_ITEM (properties_cb, NULL),
GNOMEUIINFO_END
@@ -481,7 +541,8 @@ init (EMsgComposerAttachmentBar *bar)
/* 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 + 24;
+ icon_size = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING;
+ icon_size += 24;
gtk_widget_set_usize (GTK_WIDGET (bar), icon_size * 4, icon_size);
}
@@ -524,15 +585,14 @@ e_msg_composer_attachment_bar_new (GtkAdjustment *adj)
icon_list = GNOME_ICON_LIST (new);
- gnome_icon_list_construct (icon_list, ICON_WIDTH, adj,
- GNOME_ICON_LIST_IS_EDITABLE);
+ gnome_icon_list_construct (icon_list, ICON_WIDTH, adj, 0);
gnome_icon_list_set_separators (icon_list, ICON_SEPARATORS);
gnome_icon_list_set_row_spacing (icon_list, ICON_ROW_SPACING);
gnome_icon_list_set_col_spacing (icon_list, ICON_COL_SPACING);
gnome_icon_list_set_icon_border (icon_list, ICON_BORDER);
gnome_icon_list_set_text_spacing (icon_list, ICON_TEXT_SPACING);
- gnome_icon_list_set_selection_mode (icon_list, GTK_SELECTION_SINGLE);
+ gnome_icon_list_set_selection_mode (icon_list, GTK_SELECTION_MULTIPLE);
return GTK_WIDGET (new);
}
diff --git a/widgets/e-msg-composer-attachment.c b/widgets/e-msg-composer-attachment.c
index c9e5029c9b..4ab8de42c4 100644
--- a/widgets/e-msg-composer-attachment.c
+++ b/widgets/e-msg-composer-attachment.c
@@ -21,7 +21,16 @@
* Author: Ettore Perazzoli
*/
+/* This is the object representing an email attachment. It is implemented as a
+ GtkObject to make it easier for the application to handle it. For example,
+ the "changed" signal is emitted whenever something changes in the
+ attachment. Also, this contains the code to let users edit the
+ attachment manually. */
+
+#include <sys/stat.h>
+
#include <gnome.h>
+
#include "e-msg-composer-attachment.h"
@@ -122,6 +131,11 @@ class_init (EMsgComposerAttachmentClass *klass)
static void
init (EMsgComposerAttachment *msg_composer_attachment)
{
+ msg_composer_attachment->editor_gui = NULL;
+ msg_composer_attachment->file_name = NULL;
+ msg_composer_attachment->description = NULL;
+ msg_composer_attachment->mime_type = NULL;
+ msg_composer_attachment->size = 0;
}
GtkType
@@ -158,6 +172,7 @@ EMsgComposerAttachment *
e_msg_composer_attachment_new (const gchar *file_name)
{
EMsgComposerAttachment *new;
+ struct stat statbuf;
g_return_val_if_fail (file_name != NULL, NULL);
@@ -168,6 +183,11 @@ e_msg_composer_attachment_new (const gchar *file_name)
new->file_name = g_strdup (file_name);
new->description = g_strdup (g_basename (new->file_name));
+ if (stat (file_name, &statbuf) < 0)
+ new->size = 0;
+ else
+ new->size = statbuf.st_size;
+
init_mime_type (new);
return new;
diff --git a/widgets/e-msg-composer-attachment.h b/widgets/e-msg-composer-attachment.h
index 07dd7f247d..7e3c88238b 100644
--- a/widgets/e-msg-composer-attachment.h
+++ b/widgets/e-msg-composer-attachment.h
@@ -49,12 +49,13 @@ struct _EMsgComposerAttachment {
gchar *file_name;
gchar *description;
gchar *mime_type;
+
+ gulong size;
};
struct _EMsgComposerAttachmentClass {
GtkObjectClass parent_class;
- /* Signals go here */
void (*changed) (EMsgComposerAttachment *msg_composer_attachment);
};
diff --git a/widgets/e-msg-composer-hdrs.c b/widgets/e-msg-composer-hdrs.c
index 2fe537dabf..cc5b892ffa 100644
--- a/widgets/e-msg-composer-hdrs.c
+++ b/widgets/e-msg-composer-hdrs.c
@@ -46,29 +46,55 @@ struct _EMsgComposerHdrsPrivate {
static GtkTableClass *parent_class = NULL;
+enum {
+ SHOW_ADDRESS_DIALOG,
+ LAST_SIGNAL
+};
+
+static gint signals[LAST_SIGNAL];
+
+static void
+address_button_clicked_cb (GtkButton *button,
+ gpointer data)
+{
+ gtk_signal_emit (GTK_OBJECT (data), signals[SHOW_ADDRESS_DIALOG]);
+}
+
static GtkWidget *
-add_address_header (EMsgComposerHdrs *hdrs,
- const gchar *name)
+add_header (EMsgComposerHdrs *hdrs,
+ const gchar *name,
+ gboolean addrbook_button)
{
EMsgComposerHdrsPrivate *priv;
GtkWidget *label;
GtkWidget *entry;
+ guint pad;
priv = hdrs->priv;
- label = gtk_label_new (name);
+ if (addrbook_button) {
+ label = gtk_button_new_with_label (name);
+ gtk_signal_connect (GTK_OBJECT (label), "clicked",
+ GTK_SIGNAL_FUNC (address_button_clicked_cb),
+ hdrs);
+ pad = 2;
+ } else {
+ label = gtk_label_new (name);
+ pad = GNOME_PAD;
+ }
+
gtk_table_attach (GTK_TABLE (hdrs), label,
0, 1, priv->num_hdrs, priv->num_hdrs + 1,
GTK_FILL, GTK_FILL,
- GNOME_PAD, GNOME_PAD);
+ pad, pad);
gtk_widget_show (label);
entry = e_msg_composer_address_entry_new ();
gtk_table_attach (GTK_TABLE (hdrs), entry,
1, 2, priv->num_hdrs, priv->num_hdrs + 1,
GTK_FILL | GTK_EXPAND, GTK_FILL,
- GNOME_PAD, GNOME_PAD);
+ 2, 2);
gtk_widget_show (entry);
priv->num_hdrs++;
@@ -83,10 +109,10 @@ setup_headers (EMsgComposerHdrs *hdrs)
priv = hdrs->priv;
- priv->subject_entry = add_address_header (hdrs, _("Subject:"));
- priv->to_entry = add_address_header (hdrs, _("To:"));
- priv->cc_entry = add_address_header (hdrs, _("Cc:"));
- priv->bcc_entry = add_address_header (hdrs, _("Bcc:"));
+ priv->to_entry = add_header (hdrs, _("To:"), TRUE);
+ priv->cc_entry = add_header (hdrs, _("Cc:"), TRUE);
+ priv->bcc_entry = add_header (hdrs, _("Bcc:"), TRUE);
+ priv->subject_entry = add_header (hdrs, _("Subject:"), FALSE);
}
@@ -98,6 +124,17 @@ class_init (EMsgComposerHdrsClass *klass)
object_class = (GtkObjectClass*) klass;
parent_class = gtk_type_class (gtk_table_get_type ());
+
+ signals[SHOW_ADDRESS_DIALOG] =
+ gtk_signal_new ("show_address_dialog",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass,
+ show_address_dialog),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
static void
diff --git a/widgets/e-msg-composer-hdrs.h b/widgets/e-msg-composer-hdrs.h
index 404a4cb8ca..d053573d85 100644
--- a/widgets/e-msg-composer-hdrs.h
+++ b/widgets/e-msg-composer-hdrs.h
@@ -51,6 +51,8 @@ struct _EMsgComposerHdrs {
struct _EMsgComposerHdrsClass {
GtkTableClass parent_class;
+
+ void (* show_address_dialog) (EMsgComposerHdrs *hdrs);
};
diff --git a/widgets/e-msg-composer.c b/widgets/e-msg-composer.c
index 453bed57f0..8e83c3e11c 100644
--- a/widgets/e-msg-composer.c
+++ b/widgets/e-msg-composer.c
@@ -323,6 +323,10 @@ setup_signals (EMsgComposer *composer)
"changed",
GTK_SIGNAL_FUNC (attachment_bar_changed),
composer);
+
+ gtk_signal_connect (GTK_OBJECT (composer->hdrs), "show_address_dialog",
+ GTK_SIGNAL_FUNC (address_dialog_cb),
+ composer);
}
@@ -455,7 +459,7 @@ e_msg_composer_construct (EMsgComposer *composer)
glade_xml_get_widget (composer->appbar_gui,
"appbar"));
- vbox = gtk_vbox_new (FALSE, GNOME_PAD);
+ vbox = gtk_vbox_new (FALSE, 0);
composer->hdrs = e_msg_composer_hdrs_new ();
gtk_box_pack_start (GTK_BOX (vbox), composer->hdrs, FALSE, TRUE, 0);
@@ -492,7 +496,7 @@ e_msg_composer_construct (EMsgComposer *composer)
composer->attachment_bar);
gtk_box_pack_start (GTK_BOX (vbox),
composer->attachment_scrolled_window,
- FALSE, TRUE, 0);
+ FALSE, TRUE, GNOME_PAD_SMALL);
gnome_app_set_contents (GNOME_APP (composer), vbox);
gtk_widget_show (vbox);
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 430c404172..d0c7b288e4 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,49 @@
+1999-11-12 Ettore Perazzoli <ettore@gnu.org>
+
+ * e-msg-composer-address-dialog.glade: Cosmetical changes.
+
+ * e-msg-composer-attachment-bar.c (size_to_string): New helper
+ function.
+ (update): Put the size in the icon's label using this function.
+ (ICON_SEPARATORS): Remove '.' to avoid wrapping of the size string
+ on the decimal dot. But gnome-libs is broken and this has no real
+ effect! :-(
+ (e_msg_composer_attachment_bar_new): No longer make text editable.
+ Use the `GTK_SELECTION_MULTIPLE' selection mode.
+ (remove_selected): No longer assume only one attachment is
+ selected.
+
+ * e-msg-composer-attachment.c: #include <sys/stat.h>
+ (init): Initialize all the members.
+ (e_msg_composer_attachment_new): Set size using `stat()'.
+
+ * e-msg-composer-attachment.h: New member `size' in `struct
+ _EMsgComposerAttachment'.
+
+ * e-msg-composer.c (setup_signals): Connect `address_dialog_cb' to
+ the "show_address_dialog" signal of the header widget.
+
+ * e-msg-composer-hdrs.c (add_address_header): Renamed to
+ `add_header'. New parameter `addrbook_button': if true, use a
+ button instead of a label and make it trigger an
+ "show_address_dialog" signal.
+ (address_button_clicked_cb): Signal handler to handle this on a
+ "clicked" signal from the button.
+ (setup_headers): Updated accordingly. Also, make "Subject" the
+ last item. (This makes it look more like Outlook and friends.)
+
+ * e-msg-composer-hdrs.c: New signal "show_address_dialog".
+ * e-msg-composer-hdrs.h: Updated accordingly.
+
+ * e-msg-composer-hdrs.c (add_address_header): Reduce padding
+ considerably.
+
+ * e-msg-composer.c (e_msg_composer_construct): Do not use any
+ padding in the main vbox.
+
+ * Makefile.am: Moved the `e-table*' sources to `EXTRA_DIST'.
+ Compile as a shared library.
+
1999-11-08 Ettore Perazzoli <ettore@gnu.org>
* e-msg-composer-address-dialog.c: Implemented cut & paste for the
diff --git a/widgets/e-table/Makefile.am b/widgets/e-table/Makefile.am
index 1a410e298e..875e61f6b1 100644
--- a/widgets/e-table/Makefile.am
+++ b/widgets/e-table/Makefile.am
@@ -13,10 +13,10 @@ INCLUDES = \
CPPFLAGS = \
-DE_GUIDIR=\"$(guidir)\"
-noinst_LIBRARIES = \
- libevolutionwidgets.a
+noinst_LTLIBRARIES = \
+ libevolutionwidgets.la
-libevolutionwidgets_a_SOURCES = \
+libevolutionwidgets_la_SOURCES = \
e-msg-composer-address-dialog.c \
e-msg-composer-address-dialog.h \
e-msg-composer-address-entry.c \
@@ -28,7 +28,9 @@ libevolutionwidgets_a_SOURCES = \
e-msg-composer-hdrs.c \
e-msg-composer-hdrs.h \
e-msg-composer.c \
- e-msg-composer.h \
+ e-msg-composer.h
+
+EXTRA_DIST = \
e-table-group.c \
e-table-group.h \
e-table-header.c \