mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
b4f52020f0
2005-07-28 Federico Mena Quintero <federico@ximian.com> * perf/README: Update for the new API of the profiler. * perf/gtkwidgetprofiler.[ch]: New files with a widget profiler object. This is the old content of timers.[ch] turned into a nice object, with signals for creation and reporting. The profiler needs to maintain some state when reusing the widget, so it's useful to turn it into a real object. Break down timing show_all into GTK_WIDGET_PROFILER_REPORT_MAP and GTK_WIDGET_PROFILER_REPORT_EXPOSE. * perf/main.c: Refactor to use GtkWidgetProfiler. * perf/appwindow.c (content_area_new): Make this just create a notebook, instead of a complex arrangement of panes. * perf/widgets.h: New header file for all the "create a widget" utility functions. * perf/treeview.c: New file. Moved the tree view part from appwindow.c over to here; GtkTreeView really needs its own tests. (tree_view_new): Set the shadow type to IN. * perf/textview.c: Likewise moved over from appwindow.c, but for GtkTextView. (text_view_new): Set the shadow type to IN. * perf/Makefile.am (testperf_SOURCES): Add the new source files; remove appwindow.h and timers.[ch]. * perf/timers.[ch]: Removed. * perf/appwindow.h: Removed.
61 lines
2.1 KiB
C
61 lines
2.1 KiB
C
#include <gtk/gtk.h>
|
|
#include "widgets.h"
|
|
|
|
GtkWidget *
|
|
text_view_new (void)
|
|
{
|
|
GtkWidget *sw;
|
|
GtkWidget *text_view;
|
|
GtkTextBuffer *buffer;
|
|
|
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
|
|
|
|
text_view = gtk_text_view_new ();
|
|
gtk_widget_set_size_request (text_view, 400, 300);
|
|
gtk_container_add (GTK_CONTAINER (sw), text_view);
|
|
|
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
|
|
|
gtk_text_buffer_set_text (buffer,
|
|
"In felaweshipe, and pilgrimes were they alle,\n"
|
|
"That toward Caunterbury wolden ryde.\n"
|
|
"The chambres and the stables weren wyde,\n"
|
|
"And wel we weren esed atte beste;\n"
|
|
"And shortly, whan the sonne was to reste,\n"
|
|
"\n"
|
|
"So hadde I spoken with hem everychon \n"
|
|
"That I was of hir felaweshipe anon, \n"
|
|
"And made forward erly for to ryse \n"
|
|
"To take our wey, ther as I yow devyse. \n"
|
|
" But nathelees, whil I have tyme and space, \n"
|
|
" \n"
|
|
"Er that I ferther in this tale pace, \n"
|
|
"Me thynketh it acordaunt to resoun \n"
|
|
"To telle yow al the condicioun \n"
|
|
"Of ech of hem, so as it semed me, \n"
|
|
"And whiche they weren, and of what degree, \n"
|
|
" \n"
|
|
"And eek in what array that they were inne; \n"
|
|
"And at a knyght than wol I first bigynne. \n"
|
|
" A knyght ther was, and that a worthy man, \n"
|
|
"That fro the tyme that he first bigan \n"
|
|
"To riden out, he loved chivalrie, \n"
|
|
" \n"
|
|
"Trouthe and honour, fredom and curteisie. \n"
|
|
"Ful worthy was he in his lordes werre, \n"
|
|
" \n"
|
|
"And therto hadde he riden, no man ferre, \n"
|
|
"As wel in Cristendom as in Hethenesse, \n"
|
|
"And evere honoured for his worthynesse. \n"
|
|
" \n"
|
|
" At Alisaundre he was, whan it was wonne; \n"
|
|
"Ful ofte tyme he hadde the bord bigonne \n"
|
|
"Aboven alle nacions in Pruce; \n"
|
|
"In Lettow hadde he reysed, and in Ruce, \n"
|
|
"No cristen man so ofte of his degree. \n",
|
|
-1);
|
|
|
|
return sw;
|
|
}
|