MimeView *mimeview_create(MainWindow *mainwin) { MimeView *mimeview; GtkWidget *paned; GtkWidget *scrolledwin; GtkWidget *ctree; GtkWidget *mime_notebook; GtkWidget *popupmenu; GtkWidget *ctree_mainbox; GtkWidget *vbox; GtkWidget *mime_toggle; GtkWidget *icon_mainbox; GtkWidget *icon_scroll; GtkWidget *icon_vbox; GtkWidget *arrow; GtkWidget *scrollbutton; GtkWidget *hbox; GtkTooltips *tooltips; GtkItemFactory *popupfactory; NoticeView *siginfoview; gchar *titles[N_MIMEVIEW_COLS]; gint n_entries; gint i; debug_print("Creating MIME view...\n"); mimeview = g_new0(MimeView, 1); titles[COL_MIMETYPE] = _("MIME Type"); titles[COL_SIZE] = _("Size"); titles[COL_NAME] = _("Name"); scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolledwin); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); ctree = gtk_sctree_new_with_titles(N_MIMEVIEW_COLS, 0, titles); gtk_widget_show(ctree); gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_BROWSE); gtk_ctree_set_line_style(GTK_CTREE(ctree), GTK_CTREE_LINES_NONE); gtk_clist_set_column_justification(GTK_CLIST(ctree), COL_SIZE, GTK_JUSTIFY_RIGHT); gtk_clist_set_column_width(GTK_CLIST(ctree), COL_MIMETYPE, 240); gtk_clist_set_column_width(GTK_CLIST(ctree), COL_SIZE, 90); for (i = 0; i < N_MIMEVIEW_COLS; i++) GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(ctree)->column[i].button, GTK_CAN_FOCUS); gtk_container_add(GTK_CONTAINER(scrolledwin), ctree); gtk_signal_connect(GTK_OBJECT(ctree), "tree_select_row", GTK_SIGNAL_FUNC(mimeview_selected), mimeview); gtk_signal_connect(GTK_OBJECT(ctree), "button_release_event", GTK_SIGNAL_FUNC(mimeview_button_pressed), mimeview); gtk_signal_connect(GTK_OBJECT(ctree), "key_press_event", GTK_SIGNAL_FUNC(mimeview_key_pressed), mimeview); gtk_signal_connect(GTK_OBJECT (ctree),"start_drag", GTK_SIGNAL_FUNC (mimeview_start_drag), mimeview); gtk_signal_connect(GTK_OBJECT(ctree), "drag_data_get", GTK_SIGNAL_FUNC(mimeview_drag_data_get), mimeview); mime_notebook = gtk_notebook_new(); gtk_widget_show(mime_notebook); GTK_WIDGET_UNSET_FLAGS(mime_notebook, GTK_CAN_FOCUS); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(mime_notebook), FALSE); gtk_notebook_set_show_border(GTK_NOTEBOOK(mime_notebook), FALSE); icon_vbox = gtk_vbox_new(FALSE, 2); gtk_widget_show(icon_vbox); icon_scroll = gtk_layout_new(NULL, NULL); gtk_widget_show(icon_scroll); gtk_layout_put(GTK_LAYOUT(icon_scroll), icon_vbox, 0, 0); scrollbutton = gtk_vscrollbutton_new(gtk_layout_get_vadjustment(GTK_LAYOUT(icon_scroll))); gtk_widget_show(scrollbutton); mime_toggle = gtk_toggle_button_new(); gtk_widget_show(mime_toggle); arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE); gtk_widget_show(arrow); gtk_container_add(GTK_CONTAINER(mime_toggle), arrow); gtk_signal_connect(GTK_OBJECT(mime_toggle), "toggled", GTK_SIGNAL_FUNC(mime_toggle_button_cb), mimeview); icon_mainbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(icon_mainbox); gtk_box_pack_start(GTK_BOX(icon_mainbox), mime_toggle, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(icon_mainbox), icon_scroll, TRUE, TRUE, 3); gtk_box_pack_end(GTK_BOX(icon_mainbox), scrollbutton, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(icon_mainbox), "size_allocate", GTK_SIGNAL_FUNC(icon_scroll_size_allocate_cb), mimeview); ctree_mainbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(ctree_mainbox), scrolledwin, TRUE, TRUE, 0); n_entries = sizeof(mimeview_popup_entries) / sizeof(mimeview_popup_entries[0]); popupmenu = menu_create_items(mimeview_popup_entries, n_entries, "<MimeView>", &popupfactory, mimeview); tooltips = gtk_tooltips_new(); gtk_tooltips_set_delay(tooltips, 0); vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox); siginfoview = noticeview_create(mainwin); noticeview_hide(siginfoview); gtk_box_pack_start(GTK_BOX(vbox), mime_notebook, TRUE, TRUE, 0); gtk_box_pack_end(GTK_BOX(vbox), GTK_WIDGET_PTR(siginfoview), FALSE, FALSE, 0); paned = gtk_vpaned_new(); gtk_widget_show(paned); gtk_paned_set_gutter_size(GTK_PANED(paned), 0); gtk_paned_pack1(GTK_PANED(paned), ctree_mainbox, FALSE, TRUE); gtk_paned_pack2(GTK_PANED(paned), vbox, TRUE, TRUE); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), paned, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), icon_mainbox, FALSE, FALSE, 0); gtk_widget_show(hbox); gtk_widget_hide(ctree_mainbox); mimeview->hbox = hbox; mimeview->paned = paned; mimeview->scrolledwin = scrolledwin; mimeview->ctree = ctree; mimeview->mime_notebook = mime_notebook; mimeview->popupmenu = popupmenu; mimeview->popupfactory = popupfactory; mimeview->type = -1; mimeview->ctree_mainbox = ctree_mainbox; mimeview->icon_scroll = icon_scroll; mimeview->icon_vbox = icon_vbox; mimeview->icon_mainbox = icon_mainbox; mimeview->icon_count = 0; mimeview->mainwin = mainwin; mimeview->tooltips = tooltips; mimeview->oldsize = 60; mimeview->mime_toggle = mime_toggle; mimeview->siginfoview = siginfoview; mimeview->target_list = gtk_target_list_new(mimeview_mime_types, 1); mimeviews = g_slist_prepend(mimeviews, mimeview); return mimeview; }
static void addressbook_foldersel_create( void ) { GtkWidget *window; GtkWidget *vbox; GtkWidget *tree_folder; GtkWidget *vlbox; GtkWidget *tree_win; GtkWidget *hbbox; GtkWidget *ok_btn; GtkWidget *cancel_btn; static GdkGeometry geometry; gchar *titles[1]; window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "addressbook_foldersel" ); gtk_container_set_border_width( GTK_CONTAINER(window), 0 ); gtk_window_set_title( GTK_WINDOW(window), _("Select Address Book Folder") ); gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_MOUSE ); g_signal_connect( G_OBJECT(window), "delete_event", G_CALLBACK(addressbook_foldersel_delete_event), NULL ); g_signal_connect( G_OBJECT(window), "key_press_event", G_CALLBACK(addressbook_foldersel_key_pressed), NULL ); g_signal_connect(G_OBJECT(window), "size_allocate", G_CALLBACK(addressbook_foldersel_size_allocate_cb), NULL); vbox = gtk_vbox_new(FALSE, 8); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_container_set_border_width( GTK_CONTAINER(vbox), 8 ); /* Address book/folder tree */ vlbox = gtk_vbox_new(FALSE, 8); gtk_box_pack_start(GTK_BOX(vbox), vlbox, TRUE, TRUE, 0); gtk_container_set_border_width( GTK_CONTAINER(vlbox), 8 ); tree_win = gtk_scrolled_window_new( NULL, NULL ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(tree_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_box_pack_start( GTK_BOX(vlbox), tree_win, TRUE, TRUE, 0 ); titles[0] = _( "Address Book") ; tree_folder = gtk_sctree_new_with_titles( 1, 0, titles ); gtk_container_add( GTK_CONTAINER(tree_win), tree_folder ); gtk_cmclist_column_titles_show( GTK_CMCLIST(tree_folder) ); gtk_cmctree_set_line_style(GTK_CMCTREE(tree_folder), GTK_CMCTREE_LINES_NONE); gtk_cmctree_set_expander_style(GTK_CMCTREE(tree_folder), GTK_CMCTREE_EXPANDER_TRIANGLE); gtk_sctree_set_stripes(GTK_SCTREE(tree_folder), prefs_common.use_stripes_everywhere); gtk_cmclist_set_selection_mode( GTK_CMCLIST(tree_folder), GTK_SELECTION_BROWSE ); gtk_cmctree_set_indent( GTK_CMCTREE(tree_folder), CTREE_INDENT ); gtk_cmclist_set_auto_sort( GTK_CMCLIST(tree_folder), TRUE ); /* Button panel */ gtkut_stock_button_set_create( &hbbox, &cancel_btn, GTK_STOCK_CANCEL, &ok_btn, GTK_STOCK_OK, NULL, NULL ); gtk_box_pack_end( GTK_BOX(vbox), hbbox, FALSE, FALSE, 0 ); gtk_container_set_border_width( GTK_CONTAINER(hbbox), 0 ); gtk_widget_grab_default( ok_btn ); g_signal_connect( G_OBJECT(ok_btn), "clicked", G_CALLBACK(addressbook_foldersel_ok), NULL ); g_signal_connect( G_OBJECT(cancel_btn), "clicked", G_CALLBACK(addressbook_foldersel_cancel), NULL ); g_signal_connect( G_OBJECT(tree_folder), "tree_select_row", G_CALLBACK(addressbook_foldersel_folder_select), NULL ); g_signal_connect( G_OBJECT(tree_folder), "button_press_event", G_CALLBACK(addressbook_foldersel_tree_button), NULL ); if ( !geometry.min_height ) { geometry.min_width = 300; geometry.min_height = 350; } gtk_window_set_geometry_hints( GTK_WINDOW(window), NULL, &geometry, GDK_HINT_MIN_SIZE ); gtk_widget_set_size_request( window, prefs_common.addressbook_folderselwin_width, prefs_common.addressbook_folderselwin_height ); gtk_widget_show_all( vbox ); addressbook_foldersel_dlg.window = window; addressbook_foldersel_dlg.tree_folder = tree_folder; addressbook_foldersel_dlg.ok_btn = ok_btn; addressbook_foldersel_dlg.cancel_btn = cancel_btn; gtk_widget_show_all( window ); stock_pixbuf_gdk(STOCK_PIXMAP_BOOK, &bookXpm); stock_pixbuf_gdk(STOCK_PIXMAP_DIR_OPEN, &folderXpm); }
void ssl_manager_create(void) { GtkWidget *window; GtkWidget *hbox1; GtkWidget *vbox1; GtkWidget *certlist; GtkWidget *view_btn; GtkWidget *delete_btn; GtkWidget *ok_btn; gchar *titles[2]; window = gtk_window_new (GTK_WINDOW_DIALOG); gtk_window_set_title (GTK_WINDOW(window), _("Saved SSL Certificates")); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE); gtk_signal_connect (GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(ssl_manager_ok_cb), NULL); MANAGE_WINDOW_SIGNALS_CONNECT (window); hbox1 = gtk_hbox_new(FALSE,2); vbox1 = gtk_vbox_new(FALSE,0); delete_btn = gtk_button_new_with_label(_("Delete")); gtk_signal_connect (GTK_OBJECT(delete_btn), "clicked", GTK_SIGNAL_FUNC(ssl_manager_delete_cb), NULL); view_btn = gtk_button_new_with_label(_("View")); gtk_signal_connect (GTK_OBJECT(view_btn), "clicked", GTK_SIGNAL_FUNC(ssl_manager_view_cb), NULL); ok_btn = gtk_button_new_with_label(_("OK")); gtk_signal_connect (GTK_OBJECT(ok_btn), "clicked", GTK_SIGNAL_FUNC(ssl_manager_ok_cb), NULL); gtk_widget_set_usize(ok_btn, 80, -1); gtk_widget_set_usize(delete_btn, 80, -1); gtk_widget_set_usize(view_btn, 80, -1); titles[0] = _("Server"); titles[1] = _("Port"); certlist = gtk_sctree_new_with_titles(2, 3, titles); gtk_clist_column_titles_show(GTK_CLIST(certlist)); gtk_clist_set_column_width(GTK_CLIST(certlist), 0, 220); gtk_clist_set_selection_mode(GTK_CLIST(certlist), GTK_SELECTION_SINGLE); gtk_widget_set_usize(certlist, 300, 200); gtk_signal_connect (GTK_OBJECT(certlist), "open_row", GTK_SIGNAL_FUNC(ssl_manager_view_cb), NULL); gtk_box_pack_start(GTK_BOX(hbox1), certlist, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox1), vbox1, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox1), view_btn, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), delete_btn, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(vbox1), ok_btn, FALSE, FALSE, 0); gtk_widget_show(certlist); gtk_widget_show(hbox1); gtk_widget_show(vbox1); gtk_widget_show(ok_btn); gtk_widget_show(delete_btn); gtk_widget_show(view_btn); gtk_container_add(GTK_CONTAINER (window), hbox1); manager.window = window; manager.hbox1 = hbox1; manager.vbox1 = vbox1; manager.certlist = certlist; manager.view_btn = view_btn; manager.delete_btn = delete_btn; manager.ok_btn = ok_btn; gtk_widget_show(window); }
static void grouplist_dialog_create(void) { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *msg_label; GtkWidget *search_button; GtkWidget *confirm_area; GtkWidget *cancel_button; GtkWidget *refresh_button; GtkWidget *scrolledwin; static GdkGeometry geometry; gchar *titles[3]; gint i; dialog = gtk_dialog_new(); gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE); gtk_container_set_border_width (GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), 5); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); gtk_window_set_title(GTK_WINDOW(dialog), _("Newsgroup subscription")); g_signal_connect(G_OBJECT(dialog), "delete_event", G_CALLBACK(window_deleted), NULL); g_signal_connect(G_OBJECT(dialog), "key_press_event", G_CALLBACK(key_pressed), NULL); g_signal_connect(G_OBJECT(dialog), "size_allocate", G_CALLBACK(grouplist_size_allocate), NULL); MANAGE_WINDOW_SIGNALS_CONNECT(dialog); vbox = gtk_vbox_new(FALSE, 8); gtk_container_add(GTK_CONTAINER( gtk_dialog_get_content_area(GTK_DIALOG(dialog))), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 8); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); msg_label = gtk_label_new(_("Select newsgroups for subscription:")); gtk_box_pack_start(GTK_BOX(hbox), msg_label, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 8); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); msg_label = gtk_label_new(_("Find groups:")); gtk_box_pack_start(GTK_BOX(hbox), msg_label, FALSE, FALSE, 0); entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(entry_activated), NULL); search_button = gtk_button_new_with_label(_(" Search ")); gtk_box_pack_start(GTK_BOX(hbox), search_button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(search_button), "clicked", G_CALLBACK(search_clicked), NULL); scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_box_pack_start(GTK_BOX (vbox), scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); titles[0] = _("Newsgroup name"); titles[1] = _("Messages"); titles[2] = _("Type"); ctree = gtk_sctree_new_with_titles(3, 0, titles); gtk_container_add(GTK_CONTAINER(scrolledwin), ctree); gtk_cmclist_set_column_width (GTK_CMCLIST(ctree), 0, GROUPLIST_COL_NAME_WIDTH); gtk_cmclist_set_column_auto_resize(GTK_CMCLIST(ctree), 0, TRUE); gtk_cmclist_set_selection_mode(GTK_CMCLIST(ctree), GTK_SELECTION_MULTIPLE); gtk_cmctree_set_expander_style(GTK_CMCTREE(ctree), GTK_CMCTREE_EXPANDER_TRIANGLE); for (i = 0; i < 3; i++) gtk_widget_set_can_focus(GTK_CMCLIST(ctree)->column[i].button, FALSE); g_signal_connect(G_OBJECT(ctree), "button-press-event", G_CALLBACK(button_press_cb), NULL); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); status_label = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(hbox), status_label, FALSE, FALSE, 0); gtkut_stock_button_set_create(&confirm_area, &refresh_button, GTK_STOCK_REFRESH, &cancel_button, GTK_STOCK_CANCEL, &ok_button, GTK_STOCK_OK); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), confirm_area); gtk_widget_grab_default(ok_button); g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(ok_clicked), NULL); g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(cancel_clicked), NULL); g_signal_connect(G_OBJECT(refresh_button), "clicked", G_CALLBACK(refresh_clicked), NULL); if (!geometry.min_width) { geometry.min_width = GROUPLIST_DIALOG_WIDTH; geometry.min_height = GROUPLIST_DIALOG_HEIGHT; } gtk_window_set_geometry_hints(GTK_WINDOW(dialog), NULL, &geometry, GDK_HINT_MIN_SIZE); gtk_window_set_default_size(GTK_WINDOW(dialog), prefs_common.news_subscribe_width, prefs_common.news_subscribe_height); gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); }