void ascii_open (void) { int do_unref = TRUE; int i, j, val; unsigned char name[2], num[4]; GtkWidget *wid, *but, *hbox, *vbox, *win; GtkStyle *style; style = gtk_style_new (); gdk_font_unref (style->font); if (menu_sess && menu_sess->type == SESS_DIALOG) { style->font = dialog_font_normal; gdk_font_ref (dialog_font_normal); } else { style->font = font_normal; gdk_font_ref (font_normal); } win = maingui_window ("asciichart", _("Ascii Chart"), TRUE, TRUE, NULL, NULL, 0, 0, NULL); vbox = wins_get_vbox (win); name[1] = 0; for (i = 0; i < 16; i++) { hbox = gtk_hbox_new (0, 0); sprintf (num, "%03d", i * 16); wid = gtk_label_new (num); gtk_widget_set_usize (wid, 36, 20); gtk_container_add (GTK_CONTAINER (hbox), wid); gtk_widget_show (wid); for (j = 0; j < 16; j++) { val = j + (i * 16); name[0] = val; but = gtk_button_new_with_label (name); gtk_widget_set_style (GTK_BIN (but)->child, style); if (do_unref) { do_unref = FALSE; gtk_style_unref (style); } gtk_signal_connect (GTK_OBJECT (but), "clicked", GTK_SIGNAL_FUNC (ascii_click), GINT_TO_POINTER (val)); gtk_widget_set_usize (but, 24, 20); gtk_container_add (GTK_CONTAINER (hbox), but); gtk_widget_show (but); } gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_widget_show (hbox); } gtk_widget_show (win); }
void fe_dcc_open_send_win (int passive) { GtkWidget *vbox, *bbox; gchar *titles[] = { _("Status"), _("File"), _("Size"), _("Position"), _("Ack"), "%", _("CPS"), _("ETA"), _("To") }; if (dccswin.window) { fe_dcc_update_send_win (); if (!passive) wins_bring_tofront (dccswin.window); return; } dccswin.window = maingui_window ("dccsend", _("X-Chat: File Send List"), FALSE, TRUE, close_dcc_send_window, NULL, 595, 0, &dccswin.window); vbox = wins_get_vbox (dccswin.window); dccswin.list = gtkutil_clist_new (9, titles, vbox, GTK_POLICY_ALWAYS, send_row_selected, 0, 0, 0, GTK_SELECTION_SINGLE); gtk_clist_set_column_width (GTK_CLIST (dccswin.list), 0, 65); gtk_clist_set_column_width (GTK_CLIST (dccswin.list), 1, 100); gtk_clist_set_column_width (GTK_CLIST (dccswin.list), 2, 50); gtk_clist_set_column_width (GTK_CLIST (dccswin.list), 3, 50); gtk_clist_set_column_width (GTK_CLIST (dccswin.list), 4, 50); gtk_clist_set_column_width (GTK_CLIST (dccswin.list), 5, 30); gtk_clist_set_column_width (GTK_CLIST (dccswin.list), 6, 50); gtk_clist_set_column_width (GTK_CLIST (dccswin.list), 7, 50); gtk_clist_set_column_justification (GTK_CLIST (dccswin.list), 5, GTK_JUSTIFY_CENTER); bbox = gtk_hbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 2); gtk_widget_show (bbox); gtkutil_button (dccswin.window, 0, _("Abort"), abort_send_clicked, 0, bbox); gtkutil_button (dccswin.window, 0, _("Info"), info_send_clicked, 0, bbox); gtk_widget_show (dccswin.window); fe_dcc_update_send_win (); }
void url_opengui () { GtkWidget *vbox, *hbox; GSList *list; if (urlgrabberwindow) { wins_bring_tofront (urlgrabberwindow); return; } urlgrabberwindow = maingui_window ("urlgrabber", _("X-Chat: URL Grabber"), FALSE, TRUE, url_closegui, NULL, 350, 100, &urlgrabberwindow); vbox = wins_get_vbox (urlgrabberwindow); urlgrabberlist = gtkutil_clist_new (1, 0, vbox, GTK_POLICY_AUTOMATIC, 0, 0, 0, 0, GTK_SELECTION_BROWSE); gtk_signal_connect (GTK_OBJECT (urlgrabberlist), "button_press_event", GTK_SIGNAL_FUNC (url_clicklist), 0); gtk_widget_set_usize (urlgrabberlist, 350, 0); gtk_clist_set_column_width (GTK_CLIST (urlgrabberlist), 0, 100); hbox = gtk_hbox_new (FALSE, 1); gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 2); gtk_widget_show (hbox); gtkutil_button (urlgrabberwindow, GNOME_STOCK_PIXMAP_CLEAR, _("Clear"), url_button_clear, 0, hbox); gtkutil_button (urlgrabberwindow, GNOME_STOCK_PIXMAP_SAVE, _("Save"), url_button_save, 0, hbox); gtk_widget_show (urlgrabberwindow); list = url_list; while (list) { url_addurlgui ((char *) list->data); list = list->next; } }
void notify_opengui (void) { GtkWidget *vbox, *bbox; gchar *titles[] = { _("User"), _("Status"), _("Server"), _("Last Seen") }; if (notify_window) { wins_bring_tofront (notify_window); return; } notify_window = maingui_window ("notify", _("X-Chat: Notify List"), FALSE, TRUE, notify_closegui, NULL, 400, 120, ¬ify_window); vbox = wins_get_vbox (notify_window); notify_guilist = gtkutil_clist_new (4, titles, vbox, GTK_POLICY_ALWAYS, 0, 0, 0, 0, GTK_SELECTION_BROWSE); gtk_clist_set_column_width (GTK_CLIST (notify_guilist), 0, 100); gtk_clist_set_column_width (GTK_CLIST (notify_guilist), 1, 60); gtk_clist_set_column_width (GTK_CLIST (notify_guilist), 2, 100); gtk_clist_set_auto_sort (GTK_CLIST (notify_guilist), FALSE); bbox = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (bbox), 4); gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0); gtk_widget_show (bbox); gtkutil_button (notify_window, GNOME_STOCK_PIXMAP_NEW, _("Add"), notify_add_clicked, 0, bbox); gtkutil_button (notify_window, GNOME_STOCK_PIXMAP_CLOSE, _("Remove"), notify_remove_clicked, 0, bbox); notify_gui_update (); gtk_widget_show (notify_window); }
void fe_dcc_open_chat_win (int passive) { GtkWidget *vbox, *bbox; gchar *titles[] = { _("Status"), _("To/From"), _("Recv"), _("Sent"), _("StartTime") }; if (dcccwin.window) { fe_dcc_update_chat_win (); if (!passive) wins_bring_tofront (dcccwin.window); return; } dcccwin.window = maingui_window ("dccchat", _("X-Chat: DCC Chat List"), FALSE, TRUE, close_dcc_chat_window, NULL, 550, 0, &dcccwin.window); vbox = wins_get_vbox (dcccwin.window); dcccwin.list = gtkutil_clist_new (5, titles, vbox, GTK_POLICY_ALWAYS, chat_row_selected, 0, 0, 0, GTK_SELECTION_BROWSE); gtk_clist_set_column_width (GTK_CLIST (dcccwin.list), 0, 65); gtk_clist_set_column_width (GTK_CLIST (dcccwin.list), 1, 100); gtk_clist_set_column_width (GTK_CLIST (dcccwin.list), 2, 65); gtk_clist_set_column_width (GTK_CLIST (dcccwin.list), 3, 65); bbox = gtk_hbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 2); gtk_widget_show (bbox); gtkutil_button (dcccwin.window, 0, _("Accept"), accept_chat_clicked, 0, bbox); gtkutil_button (dcccwin.window, 0, _("Abort"), abort_chat_clicked, 0, bbox); gtk_widget_show (dcccwin.window); fe_dcc_update_chat_win (); }
void fe_dcc_open_recv_win (int passive) { GtkWidget *vbox, *bbox; #ifdef USE_GNOME gchar *titles[] = { _("Status"), _("File"), _("Size"), _("Position"), "%", _("CPS"), _("ETA"), _("From"), _("MIME Type") }; #else gchar *titles[] = { _("Status"), _("File"), _("Size"), _("Position"), "%", _("CPS"), _("ETA"), _("From") }; #endif if (dccrwin.window) { fe_dcc_update_recv_win (); if (!passive) wins_bring_tofront (dccrwin.window); return; } dccrwin.window = maingui_window ("dccrecv", _("X-Chat: File Receive List"), FALSE, TRUE, close_dcc_recv_window, NULL, 601, 0, &dccrwin.window); vbox = wins_get_vbox (dccrwin.window); #ifdef USE_GNOME dccrwin.list = gtkutil_clist_new (9, titles, vbox, GTK_POLICY_ALWAYS, recv_row_selected, 0, 0, 0, GTK_SELECTION_SINGLE); #else dccrwin.list = gtkutil_clist_new (8, titles, vbox, GTK_POLICY_ALWAYS, recv_row_selected, 0, 0, 0, GTK_SELECTION_SINGLE); #endif gtk_clist_set_column_width (GTK_CLIST (dccrwin.list), 0, 65); gtk_clist_set_column_width (GTK_CLIST (dccrwin.list), 1, 100); gtk_clist_set_column_width (GTK_CLIST (dccrwin.list), 2, 50); gtk_clist_set_column_width (GTK_CLIST (dccrwin.list), 3, 50); gtk_clist_set_column_width (GTK_CLIST (dccrwin.list), 4, 30); gtk_clist_set_column_width (GTK_CLIST (dccrwin.list), 5, 50); gtk_clist_set_column_width (GTK_CLIST (dccrwin.list), 6, 60); gtk_clist_set_column_width (GTK_CLIST (dccrwin.list), 7, 60); gtk_clist_set_column_justification (GTK_CLIST (dccrwin.list), 4, GTK_JUSTIFY_CENTER); bbox = gtk_hbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 2); gtk_widget_show (bbox); gtkutil_button (dccrwin.window, 0, _("Accept"), accept_clicked, 0, bbox); gtkutil_button (dccrwin.window, 0, _("Resume"), resume_clicked, 0, bbox); gtkutil_button (dccrwin.window, 0, _("Abort"), abort_clicked, 0, bbox); gtkutil_button (dccrwin.window, 0, _("Info"), info_clicked, 0, bbox); #ifdef USE_GNOME gtkutil_button (dccrwin.window, 0, _("Open"), open_clicked, 0, bbox); #endif gtk_widget_show (dccrwin.window); fe_dcc_update_recv_win (); }
static void open_dialog_window (struct session *sess) { GtkWidget *hbox, *vbox, *bbox; int page = prefs.privmsgtab; struct User *user; if (!main_window) page = 0; if (!page) { sess->gui->window = wins_new (sess->channel, "", kill_session_callback, sess, link_cb, sess, FALSE, FALSE, NULL); gtk_widget_set_usize (sess->gui->window, prefs.dialog_width, prefs.dialog_height); gtk_signal_connect ((GtkObject *) sess->gui->window, "focus_in_event", GTK_SIGNAL_FUNC (focus_in), sess); sess->is_tab = FALSE; } else { sess->gui->window = wins_new (sess->channel, "", kill_session_callback, sess, link_cb, sess, TRUE, FALSE, NULL); sess->is_tab = TRUE; } sess->gui->vbox = vbox = wins_get_vbox (sess->gui->window); if (!page) sess->gui->changad = NULL; else sess->gui->changad = wins_get_notebooklabel (sess->gui->window); sess->gui->tbox = hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 2); if (prefs.topicbar) gtk_widget_show (hbox); /* create the X ^ < > buttons */ wins_create_linkbuttons (sess->gui->window, hbox); sess->gui->topicgad = gtk_entry_new (); gtk_entry_set_editable ((GtkEntry *) sess->gui->topicgad, FALSE); gtk_container_add (GTK_CONTAINER (hbox), sess->gui->topicgad); if (prefs.inputgad_superfocus) show_and_unfocus (sess->gui->topicgad); else gtk_widget_show (sess->gui->topicgad); /*if (prefs.dialogbuttons)*/ dialog_createbuttons (sess); /*else sess->gui->button_box = 0;*/ hbox = gtk_hbox_new (FALSE, 0); sess->gui->leftpane = hbox; gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_widget_show (hbox); sess->gui->textgad = gtk_xtext_new (prefs.dialog_indent_pixels * prefs.dialog_indent_nicks, prefs.dialog_show_separator); gtk_object_set_user_data (GTK_OBJECT (sess->gui->textgad), sess); ((GtkXText *) sess->gui->textgad)->wordwrap = prefs.dialog_wordwrap; ((GtkXText *) sess->gui->textgad)->max_auto_indent = prefs.max_auto_indent; ((GtkXText *) sess->gui->textgad)->auto_indent = prefs.auto_indent; ((GtkXText *) sess->gui->textgad)->thinline = prefs.thin_separator; ((GtkXText *) sess->gui->textgad)->max_lines = prefs.max_lines; ((GtkXText *) sess->gui->textgad)->error_function = gtkutil_simpledialog; ((GtkXText *) sess->gui->textgad)->urlcheck_function = maingui_word_check; ((GtkXText *) sess->gui->textgad)->tint_red = prefs.dialog_tint_red; ((GtkXText *) sess->gui->textgad)->tint_green = prefs.dialog_tint_green; ((GtkXText *) sess->gui->textgad)->tint_blue = prefs.dialog_tint_blue; if (prefs.timestamp && prefs.dialog_indent_nicks) ((GtkXText *) sess->gui->textgad)->time_stamp = TRUE; gtk_xtext_set_palette (GTK_XTEXT (sess->gui->textgad), colors); gtk_xtext_set_font (GTK_XTEXT (sess->gui->textgad), dialog_font_normal, 0); gtk_xtext_set_background (GTK_XTEXT (sess->gui->textgad), dialogwin_pix, prefs.dialog_transparent, prefs.dialog_tint); gtk_container_add (GTK_CONTAINER (hbox), sess->gui->textgad); show_and_unfocus (sess->gui->textgad); #ifdef USE_GNOME gtk_drag_dest_set (sess->gui->textgad, GTK_DEST_DEFAULT_ALL, dnd_targets, 1, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK); gtk_signal_connect (GTK_OBJECT (sess->gui->textgad), "drag_data_received", GTK_SIGNAL_FUNC (dialog_dnd_drop), sess); #endif sess->gui->vscrollbar = gtk_vscrollbar_new (GTK_XTEXT (sess->gui->textgad)->adj); gtk_box_pack_start (GTK_BOX (hbox), sess->gui->vscrollbar, FALSE, FALSE, 1); show_and_unfocus (sess->gui->vscrollbar); if (!sess->is_tab) gtk_signal_connect_object (GTK_OBJECT (sess->gui->window), "configure_event", GTK_SIGNAL_FUNC (maingui_configure), GTK_OBJECT (sess)); bbox = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (bbox), 0); gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, TRUE, 2); gtk_widget_show (bbox); gtk_signal_connect (GTK_OBJECT (sess->gui->textgad), "word_click", GTK_SIGNAL_FUNC (maingui_word_clicked), sess); sess->gui->inputgad = gtk_entry_new_with_max_length (2048); gtk_container_add (GTK_CONTAINER (bbox), sess->gui->inputgad); gtk_signal_connect (GTK_OBJECT (sess->gui->inputgad), "key_press_event", GTK_SIGNAL_FUNC (key_handle_key_press), sess); if (prefs.style_inputbox) gtk_widget_set_style (sess->gui->inputgad, inputgad_style); gtk_widget_show (sess->gui->inputgad); /* create the < ^ buttons on the bottom right (maingui.c) */ gui_create_toolbox (sess, bbox); gtk_widget_show (sess->gui->window); if (page && prefs.newtabstofront) wins_bring_tofront (sess->gui->window); fe_set_title (sess); user = find_name_global (sess->server, sess->channel); if (user) { if (user->hostname) gtk_entry_set_text (GTK_ENTRY (sess->gui->topicgad), user->hostname); } }