[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][TOP]
Re: gtk+$B$G$N%9%l%C%I=hM}(B
$B3A:j$G$9!#(B
(B
(B
$B$?$4$&$5$sM-Fq$&$4$6$$$^$9!#(B
(B
$B!!$?$4$&$5$s(B> $B$3$l$O$*;H$$$N(Bglib$B$,(B--enable-threads$B$G(Bbuild$B$5$l$F$$$l$P(B
$B!!$?$4$&$5$s(B> /usr/lib/glib/include/glibconfig.h$B$K=q$+$l$F$$$k$O$:$G$9!%(B
(B
(B/usr/lib/glib/include/glibconfig.h $B$KDj5A$5$l$F$$$^$7$?!#(B
$B$H$$$&$3$H$O!";d$N%3!<%G%#%s%0$,0-$$$N$+!&!&!&!&!#(B
(B
$B0J2<$K%=!<%9$r5-=R$7$^$9!#(B
(Bmain()$B$G%9%l%C%I$N=i4|2=!"%&%#%s%I%&I=<(!"(Bon_btnSend_clicked ()$B$G%9%l%C%I3+(B
$B;O!"(B
(BDisplay()$B$GI=<(=hM}$r9T$C$F$*$j$^$9!#(B
(B
$B%9%l%C%I=hM}!"I=<(=hM}$G$*$+$7$$$H$3$m$J$I!"(B
$B$4;XE&$$$?$@$1$l$P4r$7$$$G$9!#(B
(B
(B/* main.c */
(B#include <gnome.h>
(B
(B/* -------------------main()$B4X?t(B------------------- */
(Bint$B!!(Bmain (int argc, char *argv[])
(B{
(B
(B#ifdef ENABLE_NLS
(B bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
(B textdomain (PACKAGE);
(B#endif
(B /* gnome$B=i4|2=(B */
(B gnome_init ("test", VERSION, argc, argv);
(B
(B /* $B%9%l%C%I=i4|2=(B */
(B XInitThreads();
(B g_thread_init(NULL);
(B
(B /* Gtk $B=i4|2=(B */
(B gtk_set_locale();
(B gtk_init(&argc, &argv);
(B
(B /* $B%&%#%s%I%&:n@.(B-$BI=<((B */
(B window = create_window ();
(B gtk_widget_show (window);
(B
$B!!(Bgdk_threads_enter();
(B gtk_main ();
$B!!(Bgdk_threads_leave();
(B
(B return 0;
(B}
(B
(B/* callbacks.c */
(B#include <gnome.h>
(B#include <pthread.h>
(B
(B/* ------$BAw?.%\%?%s%/%j%C%/;~$N%3!<%k%P%C%/4X?t(B------- */
(Bvoid on_btnSend_clicked (GtkButton *button,
(B gpointer user_data)
(B{
(Bpthread_t thread_id;
(B
(B /* $B%9%l%C%I=hM}(B */
(B pthread_create(&thread_id,NULL,Display,NULL);
(B pthread_detach(&thread_id);
(B
(B}
(B
(B/* ------------------$BI=<(=hM}(B-------------- */
(Bvoid Display()
(B{
(Bgchar *buf;
(B
(B /* $BDd;_%\%?%s$,%/%j%C%/$5$l$k(B(StopFlag=TRUE)$B$^$G%k!<%W(B */
(B
(Be(!StopFlag){
(B $B!'(B
(B $B!JDL?.$J$I$N=hM}!K(B
(B $B!'(B
(B /* $BI=<(=hM}(B */
(B gtk_clist_freeze(GTK_CLIST (list)); // $B%j%9%H$N%U%j!<%:(B
(B $B!!(Bgdk_threads_enter();
(B gtk_clist_append(GTK_CLIST (list), buf); // $BDI2C(B
(B $B!!(Bgdk_threads_leave();
(B gtk_clist_thaw(GTK_CLIST (list)); // $B%j%9%H$N%"%s%U%j!<%:(B
(B
(B }
(B}