Пример #1
0
static void summaries_html_init(Logbook *logbook)
{
  logbook->summaries_html_view = html_view_new();
  logbook->summaries_html_document = html_document_new();
  html_view_set_document(HTML_VIEW(logbook->summaries_html_view), logbook->summaries_html_document);
  gtk_container_add(GTK_CONTAINER(logbook->summaries_sw), logbook->summaries_html_view);
  gtk_widget_show(logbook->summaries_html_view);
}
Пример #2
0
/******************************************************************
 Opens a read window
*******************************************************************/
int read_window_open(char *folder, struct mail *mail, int window)
{
	int num;
	struct Read_Data *data;

	for (num=0; num < MAX_READ_OPEN; num++)
		if (!read_open[num]) break;

	if (num == MAX_READ_OPEN) return -1;

	if ((data = (struct Read_Data*)malloc(sizeof(struct Read_Data))))
	{
		GtkWidget *vbox;

		memset(data,0,sizeof(struct Read_Data));
		data->folder_path = mystrdup(folder);

		data->num = num;
		read_open[num] = data;

		data->wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
		gtk_window_set_title(GTK_WINDOW(data->wnd), "SimpleMail - Read mail");
		gtk_window_set_default_size(GTK_WINDOW(data->wnd),640,400);
		gtk_window_set_position(GTK_WINDOW(data->wnd),GTK_WIN_POS_CENTER);
		gtk_signal_connect(GTK_OBJECT(data->wnd), "destroy",GTK_SIGNAL_FUNC (read_window_dispose), data);

		vbox = gtk_vbox_new(0,4);
		gtk_container_add(GTK_CONTAINER(data->wnd), vbox);

		data->toolbar = gtk_toolbar_new();
		gtk_box_pack_start(GTK_BOX(vbox), data->toolbar, FALSE, FALSE, 0 /* Padding */); /* only use minimal height */
		gtk_toolbar_append_item(GTK_TOOLBAR(data->toolbar), "Prev", "", NULL /* private TT */, create_pixmap(data->wnd,"MailPrev.xpm"), NULL /* CALLBACK */, NULL /* UDATA */);
		gtk_toolbar_append_item(GTK_TOOLBAR(data->toolbar), "Next", "", NULL /* private TT */, create_pixmap(data->wnd,"MailNext.xpm"), NULL/* CALLBACK */, NULL /* UDATA */);
		gtk_toolbar_append_space(GTK_TOOLBAR(data->toolbar));
        	gtk_toolbar_append_item(GTK_TOOLBAR(data->toolbar), "Save", "", NULL /* private TT */, create_pixmap(data->wnd,"MailSave.xpm"), NULL /* CALLBACK */, NULL /* UDATA */);
        	gtk_toolbar_append_item(GTK_TOOLBAR(data->toolbar), "Print", "", NULL /* private TT */, create_pixmap(data->wnd,"Print.xpm"), NULL /* CALLBACK */, NULL /* UDATA */);
		gtk_toolbar_append_space(GTK_TOOLBAR(data->toolbar));
        	gtk_toolbar_append_item(GTK_TOOLBAR(data->toolbar), "Delete", "", NULL /* private TT */, create_pixmap(data->wnd,"MailDelete.xpm"), NULL /* CALLBACK */, NULL /* UDATA */);
        	gtk_toolbar_append_item(GTK_TOOLBAR(data->toolbar), "Reply", "", NULL /* private TT */, create_pixmap(data->wnd,"MailReply.xpm"), NULL /* CALLBACK */, NULL /* UDATA */);
        	gtk_toolbar_append_item(GTK_TOOLBAR(data->toolbar), "Forward", "", NULL /* private TT */, create_pixmap(data->wnd,"MailForward.xpm"), NULL /* CALLBACK */, NULL /* UDATA */);

		data->text_scrolled_window = gtk_scrolled_window_new(NULL,NULL);
		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(data->text_scrolled_window),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);

		/* create the html document */
		data->html_document = html_document_new();
		data->html_view = html_view_new();
		gtk_container_add (GTK_CONTAINER (data->text_scrolled_window), data->html_view);
		gtk_box_pack_start(GTK_BOX(vbox), data->text_scrolled_window, TRUE, TRUE, 0 /* Padding */); /* only use minimal height */
		/* FIXME: ugly ugly! sba: ??? */
		html_view_set_document (HTML_VIEW (data->html_view), data->html_document);


#if 0
		data->text_view = gtk_text_view_new();
		g_object_set(data->text_view, "editable", FALSE, NULL);
		gtk_container_add(GTK_CONTAINER(data->text_scrolled_window), data->text_view);
		gtk_box_pack_start(GTK_BOX(vbox), data->text_scrolled_window, TRUE, TRUE, 0 /* Padding */); /* only use minimal height */
#endif

		read_window_display_mail(data,mail);

		gtk_widget_show_all(data->wnd);
	}
	return num;
}