for (curr = attach_files ; curr != NULL ; curr = curr->next) {
ainfo = (AttachInfo *) curr->data;
- compose_attach_append(compose, ainfo->file, ainfo->name,
+ compose_attach_append(compose, ainfo->file, ainfo->file,
ainfo->content_type, ainfo->charset);
}
}
*(strstr(left_from, "@")) = '\0';
}
- if (left_ml && left_from && right_ml && right_from
+ if (right_ml && right_from
&& !strncmp(left_from, left_ml, strlen(left_ml))
&& !strcmp(right_from, right_ml)) {
result = TRUE;
gint len;
FILE *fp;
gboolean prev_autowrap;
- gboolean badtxt = FALSE;
struct stat file_stat;
int ret;
GString *file_contents = NULL;
fclose(fp);
- if (badtxt)
- return COMPOSE_INSERT_INVALID_CHARACTER;
- else
- return COMPOSE_INSERT_SUCCESS;
+ return COMPOSE_INSERT_SUCCESS;
}
static gboolean compose_attach_append(Compose *compose, const gchar *file,
(tmp, CS_INTERNAL, conv_get_locale_charset_str());
g_free(tmp);
- if (!chars) return -1;
-
+ if (!chars) {
+ fclose(fp);
+ claws_unlink(file);
+ return -1;
+ }
/* write body */
len = strlen(chars);
if (fwrite(chars, sizeof(gchar), len, fp) != len) {
}
continue;
}
+ if (g_stat(ainfo->file, &statbuf) < 0)
+ return -1;
+
mimepart = procmime_mimeinfo_new();
mimepart->content = MIMECONTENT_FILE;
mimepart->data.filename = g_strdup(ainfo->file);
mimepart->tmp = FALSE; /* or we destroy our attachment */
mimepart->offset = 0;
-
- g_stat(ainfo->file, &statbuf);
mimepart->length = statbuf.st_size;
type = g_strdup(ainfo->content_type);
gboolean standard_header = FALSE;
GtkListStore *model;
GtkTreeIter iter;
-#if !(GTK_CHECK_VERSION(2,12,0))
- GtkTooltips *tips = compose->tooltips;
-#endif
headerentry = g_new0(ComposeHeaderEntry, 1);
{
Compose *compose = (Compose *) data;
- if(compose->gtkaspell &&
- compose->gtkaspell->recheck_when_changing_dict == FALSE)
+ if(!compose->gtkaspell)
+ return;
+ if(compose->gtkaspell->recheck_when_changing_dict == FALSE)
return;
gtkaspell_highlight_all(compose->gtkaspell);
compose->mutex = cm_mutex_new();
compose->set_cursor_pos = -1;
-#if !(GTK_CHECK_VERSION(2,12,0))
- compose->tooltips = tips;
-#endif
-
window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "compose");
gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
GtkListStore *menu;
GtkTreeIter iter;
GtkWidget *from_name = NULL;
-#if !(GTK_CHECK_VERSION(2,12,0))
- GtkTooltips *tips = compose->tooltips;
-#endif
gint num = 0, def_menu = 0;
gtk_box_pack_start(GTK_BOX(hbox), optmenubox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), from_name, TRUE, TRUE, 0);
+
+ GList *l = NULL;
+ l = g_list_prepend(l, from_name);
+ gtk_container_set_focus_chain(GTK_CONTAINER(hbox), l);
+ g_list_free(l);
CLAWS_SET_TIP(optmenubox,
_("Account to use for this email"));
compose->deferred_destroy = TRUE;
return;
}
+
/* NOTE: address_completion_end() does nothing with the window
* however this may change. */
address_completion_end(compose->window);
gtk_widget_hide(attach_prop.window);
gtk_window_set_modal(GTK_WINDOW(attach_prop.window), FALSE);
- if (cancelled)
+ if (cancelled)
break;
entry_text = gtk_entry_get_text(GTK_ENTRY(attach_prop.mimetype_entry));
/* Get ID of active account in the combo box */
menu = gtk_combo_box_get_model(optmenu);
- gtk_combo_box_get_active_iter(optmenu, &iter);
+ cm_return_if_fail(gtk_combo_box_get_active_iter(optmenu, &iter));
gtk_tree_model_get(menu, &iter, 1, &account_id, -1);
ac = account_find_from_id(account_id);
debug_print("couldn't lock mutex, probably sending\n");
return FALSE;
}
-
+
lock = TRUE;
tmp = g_strdup_printf("%s%cdraft.%p", get_tmp_dir(),
GdkEventKey *event,
Compose *compose)
{
- GtkTextBuffer *buffer;
- GtkTextMark *mark;
- GtkTextIter iter;
-
cm_return_val_if_fail(compose != NULL, FALSE);
/* make backtab move to subject field */
gtk_widget_grab_focus(compose->subject_entry);
return TRUE;
}
-
- // Up key should also move the focus to subject field, if the cursor
- // is on the first line.
- if ((event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up)
- && (event->state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK)) == 0) {
- buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
- g_return_val_if_fail(buffer != NULL, FALSE);
-
- mark = gtk_text_buffer_get_mark(buffer, "insert");
- g_return_val_if_fail(mark != NULL, FALSE);
-
- gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
-
- if (gtk_text_iter_get_line(&iter) == 0) {
- gtk_widget_grab_focus(compose->subject_entry);
- return TRUE;
- }
- }
-
return FALSE;
}
g_list_free(list);
gtk_drag_finish(drag_context, TRUE, FALSE, time);
return;
- } else {
- return;
}
- gtk_drag_finish(drag_context, TRUE, FALSE, time);
}
static void compose_header_drag_received_cb (GtkWidget *widget,
g_timeout_add (500, (GSourceFunc) compose_close,
compose);
}
- return FALSE;
+ return TRUE;
}
-
- if (compose->close_timeout_tag) {
- /* let the close be done by the deferred callback */
- g_mutex_unlock(compose->mutex);
- return FALSE;
+
+ if (compose->draft_timeout_tag >= 0) {
+ g_source_remove(compose->draft_timeout_tag);
+ compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_FORBIDDEN;
}
gtkut_widget_get_uposition(compose->window, &x, &y);