From 74325ce55b6f25801f6a23f0fe33b3cfedb6181e Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Wed, 17 Jan 2001 20:09:52 +0000 Subject: Add a "Send as:" option on the edit attachment dialog. svn path=/trunk/; revision=7594 --- composer/ChangeLog | 11 +++ composer/e-msg-composer-attachment.c | 41 +++++++- composer/e-msg-composer-attachment.glade | 148 ++++++++++++++++++++++------- composer/e-msg-composer-attachment.glade.h | 10 +- 4 files changed, 170 insertions(+), 40 deletions(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index 75a183b1e0..6b9e8bfd75 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,14 @@ +2001-01-17 Iain Holmes + + * e-msg-composer-attachment.c (e_msg_composer_attachment_edit): + Get the option menu from the XML file. + (ok_cb): Set the attachment disposition depending on the option + menu results. + (option_menu_get_history): Really should have been in GTK at some + point. + + * e-msg-composer-attachment.glade: Add the option menu. + 2001-01-17 Michael Meeks * evolution-composer.c (enum_objects): comment out for now diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c index 75df63d2bd..223d118de5 100644 --- a/composer/e-msg-composer-attachment.c +++ b/composer/e-msg-composer-attachment.c @@ -226,6 +226,7 @@ struct _DialogData { GtkEntry *file_name_entry; GtkEntry *description_entry; GtkEntry *mime_type_entry; + GtkOptionMenu *disposition_option; EMsgComposerAttachment *attachment; }; typedef struct _DialogData DialogData; @@ -303,6 +304,27 @@ close_cb (GtkWidget *widget, destroy_dialog_data (dialog_data); } +/* Why was this never part of GTK? */ +static int +option_menu_get_history (GtkOptionMenu *menu) +{ + GtkWidget *active; + + g_return_val_if_fail (menu != NULL, -1); + g_return_val_if_fail (GTK_IS_OPTION_MENU (menu), -1); + + if (menu->menu) { + active = gtk_menu_get_active (GTK_MENU (menu->menu)); + + if (active) + return g_list_index (GTK_MENU_SHELL (menu->menu)->children, + active); + else + return -1; + } else + return -1; +} + static void ok_cb (GtkWidget *widget, gpointer data) @@ -310,7 +332,8 @@ ok_cb (GtkWidget *widget, DialogData *dialog_data; EMsgComposerAttachment *attachment; gchar *str; - + int option; + dialog_data = (DialogData *) data; attachment = dialog_data->attachment; @@ -329,6 +352,19 @@ ok_cb (GtkWidget *widget, camel_medium_get_content_object (CAMEL_MEDIUM (attachment->body)), str); g_free (str); + option = option_menu_get_history (dialog_data->disposition_option); + switch (option) { + case 0: + camel_mime_part_set_disposition (attachment->body, "attachment"); + break; + case 1: + camel_mime_part_set_disposition (attachment->body, "inline"); + break; + default: + /* Hmmmm? */ + break; + } + changed (attachment); close_cb (widget, data); } @@ -389,6 +425,9 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment, dialog_data->mime_type_entry = GTK_ENTRY (glade_xml_get_widget (editor_gui, "mime_type_entry")); + dialog_data->disposition_option = GTK_OPTION_MENU (glade_xml_get_widget + (editor_gui, + "disposition_option")); if (attachment != NULL) { CamelContentType *content_type; diff --git a/composer/e-msg-composer-attachment.glade b/composer/e-msg-composer-attachment.glade index a9717bef69..fe25b6a4fd 100644 --- a/composer/e-msg-composer-attachment.glade +++ b/composer/e-msg-composer-attachment.glade @@ -10,6 +10,17 @@ C True True + False + False + True + True + True + interface.c + interface.h + callbacks.c + callbacks.h + support.c + support.h True e-msg-composer-attachment.glade.h @@ -17,6 +28,7 @@ GnomeDialog dialog + True Attachment properties GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE @@ -31,6 +43,7 @@ GtkVBox GnomeDialog:vbox dialog-vbox1 + True False 8 @@ -39,45 +52,11 @@ True - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - ok_button - True - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - close_button - True - True - GNOME_STOCK_BUTTON_CLOSE - - - GtkTable table1 - 3 + True + 4 2 False 10 @@ -91,6 +70,7 @@ GtkEntry description_entry + True True True True @@ -115,6 +95,7 @@ GtkHBox hbox3 + True False 10 @@ -136,6 +117,7 @@ GtkEntry file_name_entry 290 + True True True True @@ -152,6 +134,7 @@ GtkEntry mime_type_entry + True False True False @@ -177,6 +160,7 @@ GtkLabel label3 + True GTK_JUSTIFY_LEFT False @@ -203,6 +187,7 @@ GtkLabel label1 + True GTK_JUSTIFY_CENTER False @@ -229,6 +214,7 @@ GtkLabel label2 + True GTK_JUSTIFY_CENTER False @@ -251,6 +237,96 @@ False + + + GtkLabel + label4 + True + + GTK_JUSTIFY_LEFT + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GtkOptionMenu + disposition_option + True + True + Attachment +Inline attachment + + 1 + + 1 + 2 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + + + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + True + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + ok_button + True + True + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + close_button + True + True + True + GNOME_STOCK_BUTTON_CLOSE + diff --git a/composer/e-msg-composer-attachment.glade.h b/composer/e-msg-composer-attachment.glade.h index 2f7bb7d044..f8bcebf1d7 100644 --- a/composer/e-msg-composer-attachment.glade.h +++ b/composer/e-msg-composer-attachment.glade.h @@ -1,10 +1,14 @@ /* - * Translatable strings file generated by extract-ui. - * Add this file to your project's POTFILES.in + * Translatable strings file generated by Glade. + * Add this file to your project's POTFILES.in. * DO NOT compile it as part of your application. */ gchar *s = N_("Attachment properties"); +gchar *s = N_("MIME type:"); gchar *s = N_("Description:"); gchar *s = N_("File name:"); -gchar *s = N_("MIME type:"); +gchar *s = N_("Send as:"); +gchar *s = N_("Attachment\n" + "Inline attachment\n" + ""); -- cgit v1.2.3