diff options
author | Dan Winship <danw@src.gnome.org> | 2001-06-13 02:04:15 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-06-13 02:04:15 +0800 |
commit | 1391cd5ced4c2c7e1caab5e0d61b02db83edcbd8 (patch) | |
tree | e624d3aa1d8a67817baa750c80c2502f72f59252 /composer/e-msg-composer-select-file.c | |
parent | 0d6e9d6a8de480714d53636f04847944e23eee77 (diff) | |
download | gsoc2013-evolution-1391cd5ced4c2c7e1caab5e0d61b02db83edcbd8.tar.gz gsoc2013-evolution-1391cd5ced4c2c7e1caab5e0d61b02db83edcbd8.tar.zst gsoc2013-evolution-1391cd5ced4c2c7e1caab5e0d61b02db83edcbd8.zip |
Replace the disposition option menu with a checkbox.
* e-msg-composer-attachment.glade: Replace the disposition option
menu with a checkbox.
* e-msg-composer-select-file.c
(e_msg_composer_select_file_attachment): New function to select a
file to attach. Adds a "suggest inline disposition" checkbox.
* e-msg-composer-attachment.c (e_msg_composer_attachment_new): Add
a disposition argument rather than always defaulting to
"attachment".
(struct _DialogData, ok_cb, e_msg_composer_attachment_edit):
Update for optionmenu->checkbox change for disposition.
* e-msg-composer-attachment-bar.c (add_from_file): Add a
disposition argument.
(add_from_user): Use e_msg_composer_select_file_attachment, pass
chosen disposition to add_from_file.
(e_msg_composer_attachment_bar_attach): Pass "attachment" to
add_from_file for the disposition.
svn path=/trunk/; revision=10200
Diffstat (limited to 'composer/e-msg-composer-select-file.c')
-rw-r--r-- | composer/e-msg-composer-select-file.c | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/composer/e-msg-composer-select-file.c b/composer/e-msg-composer-select-file.c index c575a6d4ad..338b96aaa4 100644 --- a/composer/e-msg-composer-select-file.c +++ b/composer/e-msg-composer-select-file.c @@ -21,6 +21,8 @@ * Author: Ettore Perazzoli */ +#include <gtk/gtkbox.h> +#include <gtk/gtkcheckbutton.h> #include <gtk/gtkfilesel.h> #include <gtk/gtkmain.h> #include <gtk/gtksignal.h> @@ -29,6 +31,7 @@ struct _FileSelectionInfo { GtkWidget *widget; + GtkToggleButton *inline_checkbox; char *selected_file; }; typedef struct _FileSelectionInfo FileSelectionInfo; @@ -103,11 +106,13 @@ create_file_selection (EMsgComposer *composer) GtkWidget *widget; GtkWidget *ok_button; GtkWidget *cancel_button; + GtkWidget *inline_checkbox; + GtkWidget *box; char *path; info = g_new (FileSelectionInfo, 1); - widget = gtk_file_selection_new (NULL); + widget = gtk_file_selection_new (NULL); path = g_strdup_printf ("%s/", g_get_home_dir ()); gtk_file_selection_set_filename (GTK_FILE_SELECTION (widget), path); g_free (path); @@ -123,8 +128,13 @@ create_file_selection (EMsgComposer *composer) gtk_signal_connect (GTK_OBJECT (widget), "delete_event", GTK_SIGNAL_FUNC (delete_event_cb), info); - info->widget = widget; - info->selected_file = NULL; + inline_checkbox = gtk_check_button_new_with_label (_("Suggest automatic display of attachment")); + box = gtk_widget_get_ancestor (GTK_FILE_SELECTION (widget)->selection_entry, GTK_TYPE_BOX); + gtk_box_pack_end (GTK_BOX (box), inline_checkbox, FALSE, FALSE, 4); + + info->widget = widget; + info->selected_file = NULL; + info->inline_checkbox = GTK_TOGGLE_BUTTON (inline_checkbox); return info; } @@ -141,14 +151,14 @@ file_selection_info_destroy_notify (void *data) } -char * -e_msg_composer_select_file (EMsgComposer *composer, - const char *title) +static char * +select_file_internal (EMsgComposer *composer, + const char *title, + gboolean *inline_p) { FileSelectionInfo *info; char *retval; - g_return_val_if_fail (composer != NULL, NULL); g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); info = gtk_object_get_data (GTK_OBJECT (composer), @@ -165,6 +175,10 @@ e_msg_composer_select_file (EMsgComposer *composer, return NULL; /* Busy! */ gtk_window_set_title (GTK_WINDOW (info->widget), title); + if (inline_p) + gtk_widget_show (GTK_WIDGET (info->inline_checkbox)); + else + gtk_widget_hide (GTK_WIDGET (info->inline_checkbox)); gtk_widget_show (info->widget); GDK_THREADS_ENTER(); @@ -174,5 +188,35 @@ e_msg_composer_select_file (EMsgComposer *composer, retval = info->selected_file; info->selected_file = NULL; + if (inline_p) { + *inline_p = gtk_toggle_button_get_active (info->inline_checkbox); + gtk_toggle_button_set_active (info->inline_checkbox, FALSE); + } + return retval; } + +/** + * e_msg_composer_select_file: + * @composer: a composer + * @title: the title for the file selection dialog box + * + * This pops up a file selection dialog box with the given title + * and allows the user to select a file. + * + * Return value: the selected filename, or %NULL if the user + * cancelled. + **/ +char * +e_msg_composer_select_file (EMsgComposer *composer, + const char *title) +{ + return select_file_internal (composer, title, NULL); +} + +char * +e_msg_composer_select_file_attachment (EMsgComposer *composer, + gboolean *inline_p) +{ + return select_file_internal (composer, _("Attach a file"), inline_p); +} |