TAILIEUCHUNG - apress foundations_of gtk plus development 2007 phần 5

Tham khảo tài liệu 'apress foundations_of gtk plus development 2007 phần 5', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 206 CHAPTER 6 USING GLIB case 0 gtk_init argc argv setup_app parent_to_child child_to_parent pid break default gtk_init argc argv setup_app child_to_parent parent_to_child pid gtk_main return 0 Set up the GUI aspects of each window and setup IO channel watches. static void setup_app gint input gint output gint pid GtkWidget window entry GIOChannel channel_read channel_write window gtk_window_new GTK_WINDOW_TOPLEVEL entry gtk_entry_new gtk_container_add GTK_CONTAINER window entry gtk_container_set_border_width GTK_CONTAINER window 10 gtk_widget_set_size_request window 200 -1 gtk_widget_show_all window Close the unnecessary pipes for the given process. close input 1 close output 0 Create read and write channels out of the remaining pipes. channel_read g_io_channel_unix_new input 0 channel_write g_io_channel_unix_new output 1 if channel_read NULL channel_write NULL g_error Error The GIOChannels could not be created n Watch the read channel for changes. This will send the appropriate data. if g_io_add_watch channel_read G_IO_IN G_IO_HUP iochannel_read gpointer entry g_error Error Read watch could not be added to the GIOChannel n CHAPTER 6 USING GLIB 207 signal_id g_signal_connect G_OBJECT entry changed G_CALLBACK entry_changed gpointer channel_write Set the window title depending on the process identifier. if pid 0 gtk_window_set_title GTK_WINDOW window Child Process else gtk_window_set_title GTK_WINDOW window Parent Process Read the message from the pipe and set the text to the GtkEntry. static gboolean iochannel_read GIOChannel channel GIOCondition condition GtkEntry entry GIOStatus ret_value gchar message gsize length The pipe has died unexpectedly so exit the application. if condition G_IO_HUP g_error Error The pipe has died n Read the data that has been sent through the pipe. ret_value g_io_channel_read_line channel message length NULL NULL if ret_value G_IO_STATUS_ERROR g_error Error The line could not be read n Synchronize the GtkEntry text blocking the changed

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.