Attach to the parent widget's destroy signal - when that gets destroyed,
001-12-11 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer-attachment.c (e_msg_composer_attachment_edit): Attach to the parent widget's destroy signal - when that gets destroyed, we need to cancel the editor dialog too. Also connect to our parent window's "hide" signal so that when the composer gets hidden (ie, it's being sent), we also close the dialogs. * e-msg-composer.c (init): Default composer->enable_autosave to TRUE. svn path=/trunk/; revision=15016
This commit is contained in:

committed by
Jeffrey Stedfast

parent
fe2f7a99bb
commit
d103ae62e1
@ -1,3 +1,14 @@
|
|||||||
|
2001-12-11 Jeffrey Stedfast <fejj@ximian.com>
|
||||||
|
|
||||||
|
* e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
|
||||||
|
Attach to the parent widget's destroy signal - when that gets
|
||||||
|
destroyed, we need to cancel the editor dialog too. Also connect
|
||||||
|
to our parent window's "hide" signal so that when the composer
|
||||||
|
gets hidden (ie, it's being sent), we also close the dialogs.
|
||||||
|
|
||||||
|
* e-msg-composer.c (init): Default composer->enable_autosave to
|
||||||
|
TRUE.
|
||||||
|
|
||||||
2001-12-11 Jeffrey Stedfast <fejj@ximian.com>
|
2001-12-11 Jeffrey Stedfast <fejj@ximian.com>
|
||||||
|
|
||||||
* e-msg-composer-select-file.c (confirm): If multiple-selection is
|
* e-msg-composer-select-file.c (confirm): If multiple-selection is
|
||||||
@ -52,6 +63,11 @@
|
|||||||
* e-msg-composer.c (drag_data_received): Allow drag & drop for
|
* e-msg-composer.c (drag_data_received): Allow drag & drop for
|
||||||
vcards.
|
vcards.
|
||||||
|
|
||||||
|
2001-11-30 Jeffrey Stedfast <fejj@ximian.com>
|
||||||
|
|
||||||
|
* e-msg-composer.c (setup_ui): Change the FileSend tooltip the be
|
||||||
|
the same as the FileSendLater tooltip if we are in offline mode.
|
||||||
|
|
||||||
2001-11-14 Larry Ewing <lewing@ximian.com>
|
2001-11-14 Larry Ewing <lewing@ximian.com>
|
||||||
|
|
||||||
* e-msg-composer.c (create_composer): popup failure dialog if we
|
* e-msg-composer.c (create_composer): popup failure dialog if we
|
||||||
|
@ -91,11 +91,11 @@ static gchar *
|
|||||||
size_to_string (gulong size)
|
size_to_string (gulong size)
|
||||||
{
|
{
|
||||||
gchar *size_string;
|
gchar *size_string;
|
||||||
|
|
||||||
/* FIXME: The following should probably go into a separate module, as
|
/* 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,
|
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. */
|
I am not sure this will be OK for all the languages. */
|
||||||
|
|
||||||
if (size < 1e3L) {
|
if (size < 1e3L) {
|
||||||
if (size == 1)
|
if (size == 1)
|
||||||
size_string = g_strdup (_("1 byte"));
|
size_string = g_strdup (_("1 byte"));
|
||||||
@ -104,7 +104,7 @@ size_to_string (gulong size)
|
|||||||
(guint) size);
|
(guint) size);
|
||||||
} else {
|
} else {
|
||||||
gdouble displayed_size;
|
gdouble displayed_size;
|
||||||
|
|
||||||
if (size < 1e6L) {
|
if (size < 1e6L) {
|
||||||
displayed_size = (gdouble) size / 1.0e3;
|
displayed_size = (gdouble) size / 1.0e3;
|
||||||
size_string = g_strdup_printf (_("%.1fK"),
|
size_string = g_strdup_printf (_("%.1fK"),
|
||||||
@ -119,7 +119,7 @@ size_to_string (gulong size)
|
|||||||
displayed_size);
|
displayed_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return size_string;
|
return size_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,11 +130,13 @@ free_attachment_list (EMsgComposerAttachmentBar *bar)
|
|||||||
{
|
{
|
||||||
EMsgComposerAttachmentBarPrivate *priv;
|
EMsgComposerAttachmentBarPrivate *priv;
|
||||||
GList *p;
|
GList *p;
|
||||||
|
|
||||||
priv = bar->priv;
|
priv = bar->priv;
|
||||||
|
|
||||||
for (p = priv->attachments; p != NULL; p = p->next)
|
for (p = priv->attachments; p != NULL; p = p->next)
|
||||||
gtk_object_unref (GTK_OBJECT (p->data));
|
gtk_object_unref (GTK_OBJECT (p->data));
|
||||||
|
|
||||||
|
priv->attachments = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -203,9 +205,9 @@ remove_attachment (EMsgComposerAttachmentBar *bar,
|
|||||||
bar->priv->attachments = g_list_remove (bar->priv->attachments,
|
bar->priv->attachments = g_list_remove (bar->priv->attachments,
|
||||||
attachment);
|
attachment);
|
||||||
bar->priv->num_attachments--;
|
bar->priv->num_attachments--;
|
||||||
|
|
||||||
gtk_object_unref (GTK_OBJECT (attachment));
|
gtk_object_unref (GTK_OBJECT (attachment));
|
||||||
|
|
||||||
gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]);
|
gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +220,7 @@ pixbuf_for_mime_type (const char *mime_type)
|
|||||||
const char *icon_name;
|
const char *icon_name;
|
||||||
char *filename = NULL;
|
char *filename = NULL;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename");
|
icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename");
|
||||||
if (icon_name) {
|
if (icon_name) {
|
||||||
if (*icon_name == '/') {
|
if (*icon_name == '/') {
|
||||||
@ -256,14 +258,14 @@ update (EMsgComposerAttachmentBar *bar)
|
|||||||
EMsgComposerAttachmentBarPrivate *priv;
|
EMsgComposerAttachmentBarPrivate *priv;
|
||||||
EIconList *icon_list;
|
EIconList *icon_list;
|
||||||
GList *p;
|
GList *p;
|
||||||
|
|
||||||
priv = bar->priv;
|
priv = bar->priv;
|
||||||
icon_list = E_ICON_LIST (bar);
|
icon_list = E_ICON_LIST (bar);
|
||||||
|
|
||||||
e_icon_list_freeze (icon_list);
|
e_icon_list_freeze (icon_list);
|
||||||
|
|
||||||
e_icon_list_clear (icon_list);
|
e_icon_list_clear (icon_list);
|
||||||
|
|
||||||
/* FIXME could be faster, but we don't care. */
|
/* FIXME could be faster, but we don't care. */
|
||||||
for (p = priv->attachments; p != NULL; p = p->next) {
|
for (p = priv->attachments; p != NULL; p = p->next) {
|
||||||
EMsgComposerAttachment *attachment;
|
EMsgComposerAttachment *attachment;
|
||||||
@ -382,7 +384,7 @@ update (EMsgComposerAttachmentBar *bar)
|
|||||||
g_free (desc);
|
g_free (desc);
|
||||||
g_free (label);
|
g_free (label);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_icon_list_thaw (icon_list);
|
e_icon_list_thaw (icon_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,13 +396,13 @@ remove_selected (EMsgComposerAttachmentBar *bar)
|
|||||||
GList *attachment_list;
|
GList *attachment_list;
|
||||||
GList *p;
|
GList *p;
|
||||||
gint num;
|
gint num;
|
||||||
|
|
||||||
icon_list = E_ICON_LIST (bar);
|
icon_list = E_ICON_LIST (bar);
|
||||||
|
|
||||||
/* Weee! I am especially proud of this piece of cheesy code: it is
|
/* 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
|
truly awful. But unless one attaches a huge number of files, it
|
||||||
will not be as greedy as intended. FIXME of course. */
|
will not be as greedy as intended. FIXME of course. */
|
||||||
|
|
||||||
attachment_list = NULL;
|
attachment_list = NULL;
|
||||||
p = e_icon_list_get_selection (icon_list);
|
p = e_icon_list_get_selection (icon_list);
|
||||||
for (; p != NULL; p = p->next) {
|
for (; p != NULL; p = p->next) {
|
||||||
@ -409,12 +411,12 @@ remove_selected (EMsgComposerAttachmentBar *bar)
|
|||||||
(g_list_nth (bar->priv->attachments, num)->data);
|
(g_list_nth (bar->priv->attachments, num)->data);
|
||||||
attachment_list = g_list_prepend (attachment_list, attachment);
|
attachment_list = g_list_prepend (attachment_list, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = attachment_list; p != NULL; p = p->next)
|
for (p = attachment_list; p != NULL; p = p->next)
|
||||||
remove_attachment (bar, E_MSG_COMPOSER_ATTACHMENT (p->data));
|
remove_attachment (bar, E_MSG_COMPOSER_ATTACHMENT (p->data));
|
||||||
|
|
||||||
g_list_free (attachment_list);
|
g_list_free (attachment_list);
|
||||||
|
|
||||||
update (bar);
|
update (bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,13 +427,13 @@ edit_selected (EMsgComposerAttachmentBar *bar)
|
|||||||
EMsgComposerAttachment *attachment;
|
EMsgComposerAttachment *attachment;
|
||||||
GList *selection;
|
GList *selection;
|
||||||
gint num;
|
gint num;
|
||||||
|
|
||||||
icon_list = E_ICON_LIST (bar);
|
icon_list = E_ICON_LIST (bar);
|
||||||
|
|
||||||
selection = e_icon_list_get_selection (icon_list);
|
selection = e_icon_list_get_selection (icon_list);
|
||||||
num = GPOINTER_TO_INT (selection->data);
|
num = GPOINTER_TO_INT (selection->data);
|
||||||
attachment = g_list_nth (bar->priv->attachments, num)->data;
|
attachment = g_list_nth (bar->priv->attachments, num)->data;
|
||||||
|
|
||||||
e_msg_composer_attachment_edit (attachment, GTK_WIDGET (bar));
|
e_msg_composer_attachment_edit (attachment, GTK_WIDGET (bar));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,7 +470,7 @@ add_cb (GtkWidget *widget,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
|
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
|
||||||
|
|
||||||
add_from_user (E_MSG_COMPOSER_ATTACHMENT_BAR (data));
|
add_from_user (E_MSG_COMPOSER_ATTACHMENT_BAR (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,9 +479,9 @@ properties_cb (GtkWidget *widget,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
EMsgComposerAttachmentBar *bar;
|
EMsgComposerAttachmentBar *bar;
|
||||||
|
|
||||||
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
|
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
|
||||||
|
|
||||||
bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
|
bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
|
||||||
edit_selected (data);
|
edit_selected (data);
|
||||||
}
|
}
|
||||||
@ -489,9 +491,9 @@ remove_cb (GtkWidget *widget,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
EMsgComposerAttachmentBar *bar;
|
EMsgComposerAttachmentBar *bar;
|
||||||
|
|
||||||
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
|
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
|
||||||
|
|
||||||
bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
|
bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
|
||||||
remove_selected (bar);
|
remove_selected (bar);
|
||||||
}
|
}
|
||||||
@ -511,12 +513,12 @@ static GtkWidget *
|
|||||||
get_icon_context_menu (EMsgComposerAttachmentBar *bar)
|
get_icon_context_menu (EMsgComposerAttachmentBar *bar)
|
||||||
{
|
{
|
||||||
EMsgComposerAttachmentBarPrivate *priv;
|
EMsgComposerAttachmentBarPrivate *priv;
|
||||||
|
|
||||||
priv = bar->priv;
|
priv = bar->priv;
|
||||||
if (priv->icon_context_menu == NULL)
|
if (priv->icon_context_menu == NULL)
|
||||||
priv->icon_context_menu = gnome_popup_menu_new
|
priv->icon_context_menu = gnome_popup_menu_new
|
||||||
(icon_context_menu_info);
|
(icon_context_menu_info);
|
||||||
|
|
||||||
return priv->icon_context_menu;
|
return priv->icon_context_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,7 +528,7 @@ popup_icon_context_menu (EMsgComposerAttachmentBar *bar,
|
|||||||
GdkEventButton *event)
|
GdkEventButton *event)
|
||||||
{
|
{
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
|
|
||||||
menu = get_icon_context_menu (bar);
|
menu = get_icon_context_menu (bar);
|
||||||
gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar);
|
gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar);
|
||||||
}
|
}
|
||||||
@ -542,11 +544,11 @@ static GtkWidget *
|
|||||||
get_context_menu (EMsgComposerAttachmentBar *bar)
|
get_context_menu (EMsgComposerAttachmentBar *bar)
|
||||||
{
|
{
|
||||||
EMsgComposerAttachmentBarPrivate *priv;
|
EMsgComposerAttachmentBarPrivate *priv;
|
||||||
|
|
||||||
priv = bar->priv;
|
priv = bar->priv;
|
||||||
if (priv->context_menu == NULL)
|
if (priv->context_menu == NULL)
|
||||||
priv->context_menu = gnome_popup_menu_new (context_menu_info);
|
priv->context_menu = gnome_popup_menu_new (context_menu_info);
|
||||||
|
|
||||||
return priv->context_menu;
|
return priv->context_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,7 +557,7 @@ popup_context_menu (EMsgComposerAttachmentBar *bar,
|
|||||||
GdkEventButton *event)
|
GdkEventButton *event)
|
||||||
{
|
{
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
|
|
||||||
menu = get_context_menu (bar);
|
menu = get_context_menu (bar);
|
||||||
gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar);
|
gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar);
|
||||||
}
|
}
|
||||||
@ -567,11 +569,11 @@ static void
|
|||||||
destroy (GtkObject *object)
|
destroy (GtkObject *object)
|
||||||
{
|
{
|
||||||
EMsgComposerAttachmentBar *bar;
|
EMsgComposerAttachmentBar *bar;
|
||||||
|
|
||||||
bar = E_MSG_COMPOSER_ATTACHMENT_BAR (object);
|
bar = E_MSG_COMPOSER_ATTACHMENT_BAR (object);
|
||||||
|
|
||||||
free_attachment_list (bar);
|
free_attachment_list (bar);
|
||||||
|
|
||||||
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
|
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
|
||||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||||
}
|
}
|
||||||
@ -586,24 +588,23 @@ button_press_event (GtkWidget *widget,
|
|||||||
EMsgComposerAttachmentBar *bar;
|
EMsgComposerAttachmentBar *bar;
|
||||||
EIconList *icon_list;
|
EIconList *icon_list;
|
||||||
gint icon_number;
|
gint icon_number;
|
||||||
|
|
||||||
bar = E_MSG_COMPOSER_ATTACHMENT_BAR (widget);
|
bar = E_MSG_COMPOSER_ATTACHMENT_BAR (widget);
|
||||||
icon_list = E_ICON_LIST (widget);
|
icon_list = E_ICON_LIST (widget);
|
||||||
|
|
||||||
if (event->button != 3)
|
if (event->button != 3)
|
||||||
return GTK_WIDGET_CLASS (parent_class)->button_press_event
|
return GTK_WIDGET_CLASS (parent_class)->button_press_event
|
||||||
(widget, event);
|
(widget, event);
|
||||||
|
|
||||||
icon_number = e_icon_list_get_icon_at (icon_list,
|
icon_number = e_icon_list_get_icon_at (icon_list, event->x, event->y);
|
||||||
event->x, event->y);
|
|
||||||
|
|
||||||
if (icon_number >= 0) {
|
if (icon_number >= 0) {
|
||||||
e_icon_list_select_icon (icon_list, icon_number);
|
e_icon_list_select_icon (icon_list, icon_number);
|
||||||
popup_icon_context_menu (bar, icon_number, event);
|
popup_icon_context_menu (bar, icon_number, event);
|
||||||
} else {
|
} else {
|
||||||
popup_context_menu (bar, event);
|
popup_context_menu (bar, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,19 +617,19 @@ class_init (EMsgComposerAttachmentBarClass *class)
|
|||||||
GtkObjectClass *object_class;
|
GtkObjectClass *object_class;
|
||||||
GtkWidgetClass *widget_class;
|
GtkWidgetClass *widget_class;
|
||||||
EIconListClass *icon_list_class;
|
EIconListClass *icon_list_class;
|
||||||
|
|
||||||
object_class = GTK_OBJECT_CLASS (class);
|
object_class = GTK_OBJECT_CLASS (class);
|
||||||
widget_class = GTK_WIDGET_CLASS (class);
|
widget_class = GTK_WIDGET_CLASS (class);
|
||||||
icon_list_class = E_ICON_LIST_CLASS (class);
|
icon_list_class = E_ICON_LIST_CLASS (class);
|
||||||
|
|
||||||
parent_class = gtk_type_class (e_icon_list_get_type ());
|
parent_class = gtk_type_class (e_icon_list_get_type ());
|
||||||
|
|
||||||
object_class->destroy = destroy;
|
object_class->destroy = destroy;
|
||||||
|
|
||||||
widget_class->button_press_event = button_press_event;
|
widget_class->button_press_event = button_press_event;
|
||||||
|
|
||||||
/* Setup signals. */
|
/* Setup signals. */
|
||||||
|
|
||||||
signals[CHANGED] =
|
signals[CHANGED] =
|
||||||
gtk_signal_new ("changed",
|
gtk_signal_new ("changed",
|
||||||
GTK_RUN_LAST,
|
GTK_RUN_LAST,
|
||||||
@ -637,7 +638,7 @@ class_init (EMsgComposerAttachmentBarClass *class)
|
|||||||
changed),
|
changed),
|
||||||
gtk_marshal_NONE__NONE,
|
gtk_marshal_NONE__NONE,
|
||||||
GTK_TYPE_NONE, 0);
|
GTK_TYPE_NONE, 0);
|
||||||
|
|
||||||
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
|
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,21 +648,21 @@ init (EMsgComposerAttachmentBar *bar)
|
|||||||
EMsgComposerAttachmentBarPrivate *priv;
|
EMsgComposerAttachmentBarPrivate *priv;
|
||||||
guint icon_size, icon_height;
|
guint icon_size, icon_height;
|
||||||
GdkFont *font;
|
GdkFont *font;
|
||||||
|
|
||||||
priv = g_new (EMsgComposerAttachmentBarPrivate, 1);
|
priv = g_new (EMsgComposerAttachmentBarPrivate, 1);
|
||||||
|
|
||||||
priv->attachments = NULL;
|
priv->attachments = NULL;
|
||||||
priv->context_menu = NULL;
|
priv->context_menu = NULL;
|
||||||
priv->icon_context_menu = NULL;
|
priv->icon_context_menu = NULL;
|
||||||
|
|
||||||
priv->num_attachments = 0;
|
priv->num_attachments = 0;
|
||||||
|
|
||||||
bar->priv = priv;
|
bar->priv = priv;
|
||||||
|
|
||||||
/* FIXME partly hardcoded. We should compute height from the font, and
|
/* FIXME partly hardcoded. We should compute height from the font, and
|
||||||
allow at least 2 lines for every item. */
|
allow at least 2 lines for every item. */
|
||||||
icon_size = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING;
|
icon_size = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING;
|
||||||
|
|
||||||
font = GTK_WIDGET (bar)->style->font;
|
font = GTK_WIDGET (bar)->style->font;
|
||||||
icon_height = icon_size + ((font->ascent + font->descent) * 2);
|
icon_height = icon_size + ((font->ascent + font->descent) * 2);
|
||||||
icon_size += 24;
|
icon_size += 24;
|
||||||
@ -674,7 +675,7 @@ GtkType
|
|||||||
e_msg_composer_attachment_bar_get_type (void)
|
e_msg_composer_attachment_bar_get_type (void)
|
||||||
{
|
{
|
||||||
static GtkType type = 0;
|
static GtkType type = 0;
|
||||||
|
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
static const GtkTypeInfo info = {
|
static const GtkTypeInfo info = {
|
||||||
"EMsgComposerAttachmentBar",
|
"EMsgComposerAttachmentBar",
|
||||||
@ -686,10 +687,10 @@ e_msg_composer_attachment_bar_get_type (void)
|
|||||||
/* reserved_2 */ NULL,
|
/* reserved_2 */ NULL,
|
||||||
(GtkClassInitFunc) NULL,
|
(GtkClassInitFunc) NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
type = gtk_type_unique (e_icon_list_get_type (), &info);
|
type = gtk_type_unique (e_icon_list_get_type (), &info);
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,25 +699,25 @@ e_msg_composer_attachment_bar_new (GtkAdjustment *adj)
|
|||||||
{
|
{
|
||||||
EMsgComposerAttachmentBar *new;
|
EMsgComposerAttachmentBar *new;
|
||||||
EIconList *icon_list;
|
EIconList *icon_list;
|
||||||
|
|
||||||
gdk_rgb_init ();
|
gdk_rgb_init ();
|
||||||
gtk_widget_push_visual (gdk_rgb_get_visual ());
|
gtk_widget_push_visual (gdk_rgb_get_visual ());
|
||||||
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
|
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
|
||||||
new = gtk_type_new (e_msg_composer_attachment_bar_get_type ());
|
new = gtk_type_new (e_msg_composer_attachment_bar_get_type ());
|
||||||
gtk_widget_pop_visual ();
|
gtk_widget_pop_visual ();
|
||||||
gtk_widget_pop_colormap ();
|
gtk_widget_pop_colormap ();
|
||||||
|
|
||||||
icon_list = E_ICON_LIST (new);
|
icon_list = E_ICON_LIST (new);
|
||||||
|
|
||||||
e_icon_list_construct (icon_list, ICON_WIDTH, 0);
|
e_icon_list_construct (icon_list, ICON_WIDTH, 0);
|
||||||
|
|
||||||
e_icon_list_set_separators (icon_list, ICON_SEPARATORS);
|
e_icon_list_set_separators (icon_list, ICON_SEPARATORS);
|
||||||
e_icon_list_set_row_spacing (icon_list, ICON_ROW_SPACING);
|
e_icon_list_set_row_spacing (icon_list, ICON_ROW_SPACING);
|
||||||
e_icon_list_set_col_spacing (icon_list, ICON_COL_SPACING);
|
e_icon_list_set_col_spacing (icon_list, ICON_COL_SPACING);
|
||||||
e_icon_list_set_icon_border (icon_list, ICON_BORDER);
|
e_icon_list_set_icon_border (icon_list, ICON_BORDER);
|
||||||
e_icon_list_set_text_spacing (icon_list, ICON_TEXT_SPACING);
|
e_icon_list_set_text_spacing (icon_list, ICON_TEXT_SPACING);
|
||||||
e_icon_list_set_selection_mode (icon_list, GTK_SELECTION_MULTIPLE);
|
e_icon_list_set_selection_mode (icon_list, GTK_SELECTION_MULTIPLE);
|
||||||
|
|
||||||
return GTK_WIDGET (new);
|
return GTK_WIDGET (new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,7 +774,7 @@ e_msg_composer_attachment_bar_to_multipart (EMsgComposerAttachmentBar *bar,
|
|||||||
{
|
{
|
||||||
EMsgComposerAttachmentBarPrivate *priv;
|
EMsgComposerAttachmentBarPrivate *priv;
|
||||||
GList *p;
|
GList *p;
|
||||||
|
|
||||||
g_return_if_fail (bar != NULL);
|
g_return_if_fail (bar != NULL);
|
||||||
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
|
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
|
||||||
g_return_if_fail (multipart != NULL);
|
g_return_if_fail (multipart != NULL);
|
||||||
@ -795,7 +796,7 @@ e_msg_composer_attachment_bar_get_num_attachments (EMsgComposerAttachmentBar *ba
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (bar != NULL, 0);
|
g_return_val_if_fail (bar != NULL, 0);
|
||||||
g_return_val_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar), 0);
|
g_return_val_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar), 0);
|
||||||
|
|
||||||
return bar->priv->num_attachments;
|
return bar->priv->num_attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,7 +806,7 @@ e_msg_composer_attachment_bar_attach (EMsgComposerAttachmentBar *bar,
|
|||||||
const gchar *file_name)
|
const gchar *file_name)
|
||||||
{
|
{
|
||||||
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
|
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
|
||||||
|
|
||||||
if (file_name == NULL)
|
if (file_name == NULL)
|
||||||
add_from_user (bar);
|
add_from_user (bar);
|
||||||
else
|
else
|
||||||
@ -817,6 +818,6 @@ e_msg_composer_attachment_bar_attach_mime_part (EMsgComposerAttachmentBar *bar,
|
|||||||
CamelMimePart *part)
|
CamelMimePart *part)
|
||||||
{
|
{
|
||||||
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
|
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
|
||||||
|
|
||||||
add_from_mime_part (bar, part);
|
add_from_mime_part (bar, part);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||||
/* e-msg-composer-attachment.c
|
/* e-msg-composer-attachment.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Ximian, Inc.
|
* Copyright (C) 1999,2001 Ximian, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of version 2 of the GNU General Public
|
* modify it under the terms of version 2 of the GNU General Public
|
||||||
@ -185,6 +185,7 @@ e_msg_composer_attachment_new (const char *file_name,
|
|||||||
file_name, g_strerror (errno));
|
file_name, g_strerror (errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper = camel_data_wrapper_new ();
|
wrapper = camel_data_wrapper_new ();
|
||||||
camel_data_wrapper_construct_from_stream (wrapper, stream);
|
camel_data_wrapper_construct_from_stream (wrapper, stream);
|
||||||
camel_object_unref (CAMEL_OBJECT (stream));
|
camel_object_unref (CAMEL_OBJECT (stream));
|
||||||
@ -323,49 +324,47 @@ connect_widget (GladeXML *gui,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
close_cb (GtkWidget *widget,
|
close_cb (GtkWidget *widget, gpointer data)
|
||||||
gpointer data)
|
|
||||||
{
|
{
|
||||||
EMsgComposerAttachment *attachment;
|
EMsgComposerAttachment *attachment;
|
||||||
DialogData *dialog_data;
|
DialogData *dialog_data;
|
||||||
|
|
||||||
dialog_data = (DialogData *) data;
|
dialog_data = (DialogData *) data;
|
||||||
attachment = dialog_data->attachment;
|
attachment = dialog_data->attachment;
|
||||||
|
|
||||||
gtk_widget_destroy (glade_xml_get_widget (attachment->editor_gui,
|
gtk_widget_destroy (glade_xml_get_widget (attachment->editor_gui,
|
||||||
"dialog"));
|
"dialog"));
|
||||||
gtk_object_unref (GTK_OBJECT (attachment->editor_gui));
|
gtk_object_unref (GTK_OBJECT (attachment->editor_gui));
|
||||||
attachment->editor_gui = NULL;
|
attachment->editor_gui = NULL;
|
||||||
|
|
||||||
destroy_dialog_data (dialog_data);
|
destroy_dialog_data (dialog_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ok_cb (GtkWidget *widget,
|
ok_cb (GtkWidget *widget, gpointer data)
|
||||||
gpointer data)
|
|
||||||
{
|
{
|
||||||
DialogData *dialog_data;
|
DialogData *dialog_data;
|
||||||
EMsgComposerAttachment *attachment;
|
EMsgComposerAttachment *attachment;
|
||||||
gchar *str;
|
char *str;
|
||||||
|
|
||||||
dialog_data = (DialogData *) data;
|
dialog_data = (DialogData *) data;
|
||||||
attachment = dialog_data->attachment;
|
attachment = dialog_data->attachment;
|
||||||
|
|
||||||
str = e_utf8_gtk_entry_get_text (dialog_data->file_name_entry);
|
str = e_utf8_gtk_entry_get_text (dialog_data->file_name_entry);
|
||||||
camel_mime_part_set_filename (attachment->body, str);
|
camel_mime_part_set_filename (attachment->body, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
str = e_utf8_gtk_entry_get_text (dialog_data->description_entry);
|
str = e_utf8_gtk_entry_get_text (dialog_data->description_entry);
|
||||||
camel_mime_part_set_description (attachment->body, str);
|
camel_mime_part_set_description (attachment->body, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
str = e_utf8_gtk_entry_get_text (dialog_data->mime_type_entry);
|
str = e_utf8_gtk_entry_get_text (dialog_data->mime_type_entry);
|
||||||
camel_mime_part_set_content_type (attachment->body, str);
|
camel_mime_part_set_content_type (attachment->body, str);
|
||||||
|
|
||||||
camel_data_wrapper_set_mime_type (
|
camel_data_wrapper_set_mime_type (
|
||||||
camel_medium_get_content_object (CAMEL_MEDIUM (attachment->body)), str);
|
camel_medium_get_content_object (CAMEL_MEDIUM (attachment->body)), str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
switch (gtk_toggle_button_get_active (dialog_data->disposition_checkbox)) {
|
switch (gtk_toggle_button_get_active (dialog_data->disposition_checkbox)) {
|
||||||
case 0:
|
case 0:
|
||||||
camel_mime_part_set_disposition (attachment->body, "attachment");
|
camel_mime_part_set_disposition (attachment->body, "attachment");
|
||||||
@ -377,7 +376,7 @@ ok_cb (GtkWidget *widget,
|
|||||||
/* Hmmmm? */
|
/* Hmmmm? */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
changed (attachment);
|
changed (attachment);
|
||||||
close_cb (widget, data);
|
close_cb (widget, data);
|
||||||
}
|
}
|
||||||
@ -388,7 +387,7 @@ file_name_focus_out_cb (GtkWidget *widget,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
DialogData *dialog_data;
|
DialogData *dialog_data;
|
||||||
|
|
||||||
dialog_data = (DialogData *) data;
|
dialog_data = (DialogData *) data;
|
||||||
update_mime_type (dialog_data);
|
update_mime_type (dialog_data);
|
||||||
}
|
}
|
||||||
@ -400,32 +399,32 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
|
|||||||
{
|
{
|
||||||
DialogData *dialog_data;
|
DialogData *dialog_data;
|
||||||
GladeXML *editor_gui;
|
GladeXML *editor_gui;
|
||||||
|
|
||||||
g_return_if_fail (attachment != NULL);
|
g_return_if_fail (attachment != NULL);
|
||||||
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT (attachment));
|
g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT (attachment));
|
||||||
|
|
||||||
if (attachment->editor_gui != NULL) {
|
if (attachment->editor_gui != NULL) {
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
|
|
||||||
window = glade_xml_get_widget (attachment->editor_gui,
|
window = glade_xml_get_widget (attachment->editor_gui,
|
||||||
"dialog");
|
"dialog");
|
||||||
gdk_window_show (window->window);
|
gdk_window_show (window->window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
editor_gui = glade_xml_new (E_GLADEDIR "/e-msg-composer-attachment.glade",
|
editor_gui = glade_xml_new (E_GLADEDIR "/e-msg-composer-attachment.glade",
|
||||||
NULL);
|
NULL);
|
||||||
if (editor_gui == NULL) {
|
if (editor_gui == NULL) {
|
||||||
g_warning ("Cannot load `e-msg-composer-attachment.glade'");
|
g_warning ("Cannot load `e-msg-composer-attachment.glade'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
attachment->editor_gui = editor_gui;
|
attachment->editor_gui = editor_gui;
|
||||||
|
|
||||||
gtk_window_set_transient_for
|
gtk_window_set_transient_for
|
||||||
(GTK_WINDOW (glade_xml_get_widget (editor_gui, "dialog")),
|
(GTK_WINDOW (glade_xml_get_widget (editor_gui, "dialog")),
|
||||||
GTK_WINDOW (gtk_widget_get_toplevel (parent)));
|
GTK_WINDOW (gtk_widget_get_toplevel (parent)));
|
||||||
|
|
||||||
dialog_data = g_new (DialogData, 1);
|
dialog_data = g_new (DialogData, 1);
|
||||||
dialog_data->attachment = attachment;
|
dialog_data->attachment = attachment;
|
||||||
dialog_data->dialog = glade_xml_get_widget (editor_gui, "dialog");
|
dialog_data->dialog = glade_xml_get_widget (editor_gui, "dialog");
|
||||||
@ -437,12 +436,12 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
|
|||||||
glade_xml_get_widget (editor_gui, "mime_type_entry"));
|
glade_xml_get_widget (editor_gui, "mime_type_entry"));
|
||||||
dialog_data->disposition_checkbox = GTK_TOGGLE_BUTTON (
|
dialog_data->disposition_checkbox = GTK_TOGGLE_BUTTON (
|
||||||
glade_xml_get_widget (editor_gui, "disposition_checkbox"));
|
glade_xml_get_widget (editor_gui, "disposition_checkbox"));
|
||||||
|
|
||||||
if (attachment != NULL) {
|
if (attachment != NULL) {
|
||||||
CamelContentType *content_type;
|
CamelContentType *content_type;
|
||||||
char *type;
|
char *type;
|
||||||
const char *disposition;
|
const char *disposition;
|
||||||
|
|
||||||
set_entry (editor_gui, "file_name_entry",
|
set_entry (editor_gui, "file_name_entry",
|
||||||
camel_mime_part_get_filename (attachment->body));
|
camel_mime_part_get_filename (attachment->body));
|
||||||
set_entry (editor_gui, "description_entry",
|
set_entry (editor_gui, "description_entry",
|
||||||
@ -451,15 +450,19 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
|
|||||||
type = header_content_type_simple (content_type);
|
type = header_content_type_simple (content_type);
|
||||||
set_entry (editor_gui, "mime_type_entry", type);
|
set_entry (editor_gui, "mime_type_entry", type);
|
||||||
g_free (type);
|
g_free (type);
|
||||||
|
|
||||||
disposition = camel_mime_part_get_disposition (attachment->body);
|
disposition = camel_mime_part_get_disposition (attachment->body);
|
||||||
gtk_toggle_button_set_active (dialog_data->disposition_checkbox,
|
gtk_toggle_button_set_active (dialog_data->disposition_checkbox,
|
||||||
disposition && !g_strcasecmp (disposition, "inline"));
|
disposition && !g_strcasecmp (disposition, "inline"));
|
||||||
}
|
}
|
||||||
|
|
||||||
connect_widget (editor_gui, "ok_button", "clicked", ok_cb, dialog_data);
|
connect_widget (editor_gui, "ok_button", "clicked", ok_cb, dialog_data);
|
||||||
connect_widget (editor_gui, "close_button", "clicked", close_cb, dialog_data);
|
connect_widget (editor_gui, "close_button", "clicked", close_cb, dialog_data);
|
||||||
|
|
||||||
connect_widget (editor_gui, "file_name_entry", "focus_out_event",
|
connect_widget (editor_gui, "file_name_entry", "focus_out_event",
|
||||||
file_name_focus_out_cb, dialog_data);
|
file_name_focus_out_cb, dialog_data);
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (parent), "destroy", close_cb, dialog_data);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gtk_widget_get_toplevel (parent)), "hide",
|
||||||
|
close_cb, dialog_data);
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ build_message (EMsgComposer *composer)
|
|||||||
|
|
||||||
if (composer->send_html) {
|
if (composer->send_html) {
|
||||||
clear_current_images (composer);
|
clear_current_images (composer);
|
||||||
|
|
||||||
data = get_text (composer->persist_stream_interface, "text/html");
|
data = get_text (composer->persist_stream_interface, "text/html");
|
||||||
if (!data) {
|
if (!data) {
|
||||||
/* The component has probably died */
|
/* The component has probably died */
|
||||||
@ -401,7 +401,7 @@ build_message (EMsgComposer *composer)
|
|||||||
|
|
||||||
add_inlined_images (composer, html_with_images);
|
add_inlined_images (composer, html_with_images);
|
||||||
clear_current_images (composer);
|
clear_current_images (composer);
|
||||||
|
|
||||||
current = CAMEL_DATA_WRAPPER (html_with_images);
|
current = CAMEL_DATA_WRAPPER (html_with_images);
|
||||||
} else
|
} else
|
||||||
current = CAMEL_DATA_WRAPPER (body);
|
current = CAMEL_DATA_WRAPPER (body);
|
||||||
@ -415,7 +415,7 @@ build_message (EMsgComposer *composer)
|
|||||||
camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
|
camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
|
||||||
"multipart/alternative");
|
"multipart/alternative");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate a random boundary. */
|
/* Generate a random boundary. */
|
||||||
camel_multipart_set_boundary (multipart, NULL);
|
camel_multipart_set_boundary (multipart, NULL);
|
||||||
|
|
||||||
@ -431,16 +431,16 @@ build_message (EMsgComposer *composer)
|
|||||||
|
|
||||||
if (composer->is_alternative) {
|
if (composer->is_alternative) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = camel_multipart_get_number (multipart); i > 1; i--) {
|
for (i = camel_multipart_get_number (multipart); i > 1; i--) {
|
||||||
part = camel_multipart_get_part (multipart, i - 1);
|
part = camel_multipart_get_part (multipart, i - 1);
|
||||||
camel_medium_remove_header (CAMEL_MEDIUM (part), "Content-Disposition");
|
camel_medium_remove_header (CAMEL_MEDIUM (part), "Content-Disposition");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
current = CAMEL_DATA_WRAPPER (multipart);
|
current = CAMEL_DATA_WRAPPER (multipart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (composer->pgp_sign || composer->pgp_encrypt) {
|
if (composer->pgp_sign || composer->pgp_encrypt) {
|
||||||
part = camel_mime_part_new ();
|
part = camel_mime_part_new ();
|
||||||
camel_medium_set_content_object (CAMEL_MEDIUM (part), current);
|
camel_medium_set_content_object (CAMEL_MEDIUM (part), current);
|
||||||
@ -462,6 +462,8 @@ build_message (EMsgComposer *composer)
|
|||||||
camel_internet_address_get (from, 0, NULL, &pgpid);
|
camel_internet_address_get (from, 0, NULL, &pgpid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf ("build_message(): pgpid = '%s'\n", pgpid);
|
||||||
|
|
||||||
mail_crypto_pgp_mime_part_sign (&part, pgpid, CAMEL_CIPHER_HASH_SHA1, &ex);
|
mail_crypto_pgp_mime_part_sign (&part, pgpid, CAMEL_CIPHER_HASH_SHA1, &ex);
|
||||||
|
|
||||||
if (from)
|
if (from)
|
||||||
@ -1108,7 +1110,7 @@ autosave_save_draft (EMsgComposer *composer)
|
|||||||
CamelMimeMessage *message;
|
CamelMimeMessage *message;
|
||||||
CamelStream *stream;
|
CamelStream *stream;
|
||||||
char *file;
|
char *file;
|
||||||
gint fd;
|
int fd;
|
||||||
gboolean success = TRUE;
|
gboolean success = TRUE;
|
||||||
|
|
||||||
fd = composer->autosave_fd;
|
fd = composer->autosave_fd;
|
||||||
@ -2270,6 +2272,8 @@ init (EMsgComposer *composer)
|
|||||||
composer->has_changed = FALSE;
|
composer->has_changed = FALSE;
|
||||||
|
|
||||||
composer->charset = NULL;
|
composer->charset = NULL;
|
||||||
|
|
||||||
|
composer->enable_autosave = TRUE;
|
||||||
composer->autosave_file = NULL;
|
composer->autosave_file = NULL;
|
||||||
composer->autosave_fd = -1;
|
composer->autosave_fd = -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user