Beispiel #1
0
gint send_message(const gchar *file, PrefsAccount *ac_prefs, GSList *to_list)
{
	FILE *fp;
	gint val;

	cm_return_val_if_fail(file != NULL, -1);
	cm_return_val_if_fail(ac_prefs != NULL, -1);
	cm_return_val_if_fail(to_list != NULL, -1);

	if ((fp = claws_fopen(file, "rb")) == NULL) {
		FILE_OP_ERROR(file, "claws_fopen");
		return -1;
	}

	inc_lock();
	if (ac_prefs->use_mail_command && ac_prefs->mail_command &&
	    (*ac_prefs->mail_command)) {
		val = send_message_local(ac_prefs->mail_command, fp);
		claws_fclose(fp);
		inc_unlock();
		return val;
	} else {
		val = send_message_smtp(ac_prefs, to_list, fp);
		
		claws_fclose(fp);
		inc_unlock();
		return val;
	}
}
static void alertpanel_show(void)
{
	gint x, y, w, h, sx, sy;
	value = G_ALERTWAIT;

	inc_lock();

	sx = gdk_screen_width();
	sy = gdk_screen_height();
	gdk_window_get_origin(dialog->window, &x, &y);
	w = dialog->allocation.width;
	h = dialog->allocation.height;
	if (x < 0 || y < 0 || x + w > sx || y + h > sy) {
		debug_print("sx, sy,  x, y,  w, h = %d, %d,  %d, %d,  %d, %d\n",
			    sx, sy, x, y, w, h);
		debug_print("alert dialog position out of range\n");
		gtk_window_set_position(GTK_WINDOW(dialog),
					GTK_WIN_POS_CENTER_ALWAYS);
	}

	while ((value & G_ALERT_VALUE_MASK) == G_ALERTWAIT)
		gtk_main_iteration();

	gtk_widget_destroy(dialog);
	GTK_EVENTS_FLUSH();

	alertpanel_is_open = FALSE;
	inc_unlock();
}
Beispiel #3
0
static void close_cb(GtkButton *button, PluginWindow *pluginwindow)
{
	if (pluginwindow->loading)
		return;
	gtk_widget_destroy(pluginwindow->window);
	g_free(pluginwindow);
	plugin_save_list();
	inc_unlock();
}
Beispiel #4
0
void inc_mail(MainWindow *mainwin, gboolean notify)
{
	gint new_msgs = 0;
	gint account_new_msgs = 0;

	if (inc_lock_count) return;

	if (prefs_common.work_offline && 
	    !inc_offline_should_override(TRUE,
		_("Claws Mail needs network access in order "
		  "to get mails.")))
		return;

	inc_lock();
	inc_autocheck_timer_remove();
	main_window_lock(mainwin);

	if (prefs_common.use_extinc && prefs_common.extinc_cmd) {
		/* external incorporating program */
		if (execute_command_line(prefs_common.extinc_cmd, FALSE) < 0) {
			main_window_unlock(mainwin);
			inc_autocheck_timer_set();
			inc_unlock();
			return;
		}
	} else {
		account_new_msgs = inc_account_mail_real(mainwin, cur_account);
		if (account_new_msgs > 0)
			new_msgs += account_new_msgs;
	}

	inc_update_stats(new_msgs);
	inc_finished(mainwin, new_msgs > 0, FALSE);
	main_window_unlock(mainwin);
 	inc_notify_cmd(new_msgs, notify);
	inc_autocheck_timer_set();
	inc_unlock();
}
Beispiel #5
0
static gchar *input_dialog_open(const gchar *title, const gchar *message,
				const gchar *default_string)
{
	gchar *str;

	gtkut_box_set_reverse_order(GTK_BOX(confirm_area),
				    !prefs_common.comply_gnome_hig);
	input_dialog_set(title, message, default_string);
	gtk_widget_show(dialog);

	ack = fin = FALSE;

	inc_lock();

	while (fin == FALSE)
		gtk_main_iteration();

	manage_window_focus_out(dialog, NULL, NULL);

	if (ack) {
		GtkEditable *editable;

		if (type == INPUT_DIALOG_COMBO)
			editable = GTK_EDITABLE(GTK_COMBO(combo)->entry);
		else
			editable = GTK_EDITABLE(entry);

		str = gtk_editable_get_chars(editable, 0, -1);
		if (str && *str == '\0') {
			g_free(str);
			str = NULL;
		}
	} else
		str = NULL;

	gtk_widget_destroy(dialog);
	dialog = msg_label = entry = combo = confirm_area = ok_button = NULL;

	GTK_EVENTS_FLUSH();

	inc_unlock();

	if (type != INPUT_DIALOG_INVISIBLE)
		debug_print("return string = %s\n", str ? str : "(none)");

	return str;
}
Beispiel #6
0
static void alertpanel_show(void)
{
	gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
	manage_window_set_transient(GTK_WINDOW(dialog));
	gtk_widget_show_all(dialog);
	value = G_ALERTWAIT;

	if (gdk_pointer_is_grabbed())
		gdk_pointer_ungrab(GDK_CURRENT_TIME);
	inc_lock();
	while ((value & G_ALERT_VALUE_MASK) == G_ALERTWAIT)
		gtk_main_iteration();

	gtk_widget_destroy(dialog);
	GTK_EVENTS_FLUSH();

	alertpanel_is_open = FALSE;
	hooks_invoke(ALERTPANEL_OPENED_HOOKLIST, &alertpanel_is_open);

	inc_unlock();
}
void prefs_summary_column_open(void)
{
	inc_lock();

	if (!summary_col.window)
		prefs_summary_column_create();

	manage_window_set_transient(GTK_WINDOW(summary_col.window));
	gtk_widget_grab_focus(summary_col.ok_btn);

	prefs_summary_column_set_dialog(NULL);

	gtk_widget_show(summary_col.window);

	summary_col.finished = FALSE;
	while (summary_col.finished == FALSE)
		gtk_main_iteration();

	gtk_widget_hide(summary_col.window);

	inc_unlock();
}