void plugingui_open (void) { GtkWidget *view; GtkWidget *vbox, *hbox; if (plugin_window) { mg_bring_tofront (plugin_window); return; } plugin_window = mg_create_generic_tab ("Addons", _(DISPLAY_NAME": Plugins and Scripts"), FALSE, TRUE, plugingui_close, NULL, 500, 250, &vbox, 0); view = plugingui_treeview_new (vbox); g_object_set_data (G_OBJECT (plugin_window), "view", view); hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtkutil_button (hbox, GTK_STOCK_REVERT_TO_SAVED, NULL, plugingui_loadbutton_cb, NULL, _("_Load...")); gtkutil_button (hbox, GTK_STOCK_DELETE, NULL, plugingui_unload, NULL, _("_UnLoad")); fe_pluginlist_update (); gtk_widget_show_all (plugin_window); }
int fe_dcc_open_chat_win (int passive) { GtkWidget *view, *vbox, *bbox; GtkListStore *store; if (dcccwin.window) { if (!passive) mg_bring_tofront (dcccwin.window); return TRUE; } dcccwin.window = mg_create_generic_tab ("DCCChat", _(DISPLAY_NAME": DCC Chat List"), FALSE, TRUE, dcc_chat_close_cb, NULL, 550, 180, &vbox, 0); gtkutil_destroy_on_esc (dcccwin.window); gtk_container_set_border_width (GTK_CONTAINER (dcccwin.window), 3); gtk_box_set_spacing (GTK_BOX (vbox), 3); store = gtk_list_store_new (CN_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, GDK_TYPE_COLOR); view = gtkutil_treeview_new (vbox, GTK_TREE_MODEL (store), NULL, -1); dcc_add_column (view, CCOL_STATUS, CCOL_COLOR, _("Status"), FALSE); dcc_add_column (view, CCOL_NICK, CCOL_COLOR, _("Nick"), FALSE); dcc_add_column (view, CCOL_RECV, CCOL_COLOR, _("Recv"), TRUE); dcc_add_column (view, CCOL_SENT, CCOL_COLOR, _("Sent"), TRUE); dcc_add_column (view, CCOL_START, CCOL_COLOR, _("Start Time"), FALSE); gtk_tree_view_column_set_expand (gtk_tree_view_get_column (GTK_TREE_VIEW (view), 1), TRUE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); dcccwin.list = view; dcccwin.store = store; dcccwin.sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); gtk_tree_selection_set_mode (dcccwin.sel, GTK_SELECTION_MULTIPLE); g_signal_connect (G_OBJECT (dcccwin.sel), "changed", G_CALLBACK (dcc_chat_row_cb), NULL); /* double click */ g_signal_connect (G_OBJECT (view), "row-activated", G_CALLBACK (dcc_chat_dclick_cb), NULL); bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 2); dcccwin.abort_button = gtkutil_button (bbox, GTK_STOCK_CANCEL, 0, abort_chat_clicked, 0, _("Abort")); dcccwin.accept_button = gtkutil_button (bbox, GTK_STOCK_APPLY, 0, accept_chat_clicked, 0, _("Accept")); gtk_widget_set_sensitive (dcccwin.accept_button, FALSE); gtk_widget_set_sensitive (dcccwin.abort_button, FALSE); dcc_chat_fill_win (); gtk_widget_show_all (dcccwin.window); return FALSE; }
void open_rawlog (struct server *serv) { GtkWidget *hbox, *vscrollbar, *vbox; char tbuf[256]; if (serv->gui->rawlog_window) { mg_bring_tofront (serv->gui->rawlog_window); return; } snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Raw Log (%s)"), serv->servername); serv->gui->rawlog_window = mg_create_generic_tab ("RawLog", tbuf, FALSE, TRUE, close_rawlog, serv, 640, 320, &vbox, serv); gtkutil_destroy_on_esc (serv->gui->rawlog_window); hbox = gtk_hbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_widget_show (hbox); serv->gui->rawlog_textlist = gtk_xtext_new (colors, 0); gtk_xtext_set_tint (GTK_XTEXT (serv->gui->rawlog_textlist), prefs.hex_text_tint_red, prefs.hex_text_tint_green, prefs.hex_text_tint_blue); gtk_xtext_set_background (GTK_XTEXT (serv->gui->rawlog_textlist), channelwin_pix, prefs.hex_text_transparent); gtk_container_add (GTK_CONTAINER (hbox), serv->gui->rawlog_textlist); gtk_xtext_set_font (GTK_XTEXT (serv->gui->rawlog_textlist), prefs.hex_text_font); GTK_XTEXT (serv->gui->rawlog_textlist)->ignore_hidden = 1; gtk_widget_show (serv->gui->rawlog_textlist); vscrollbar = gtk_vscrollbar_new (GTK_XTEXT (serv->gui->rawlog_textlist)->adj); gtk_box_pack_start (GTK_BOX (hbox), vscrollbar, FALSE, FALSE, 0); show_and_unfocus (vscrollbar); hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtk_widget_show (hbox); gtkutil_button (hbox, GTK_STOCK_CLEAR, NULL, rawlog_clearbutton, serv, _("Clear Raw Log")); gtkutil_button (hbox, GTK_STOCK_SAVE_AS, NULL, rawlog_savebutton, serv, _("Save As...")); /* Copy selection to clipboard when Ctrl+Shift+C is pressed AND text auto-copy is disabled */ g_signal_connect (G_OBJECT (serv->gui->rawlog_window), "key_press_event", G_CALLBACK (rawlog_key_cb), serv->gui->rawlog_textlist); gtk_widget_show (serv->gui->rawlog_window); }
void ascii_open (void) { int i, len; const unsigned char *table_pos; char name[8]; GtkWidget *frame, *label, *but, *hbox = NULL, *vbox, *win; win = mg_create_generic_tab ("charmap", _("Character Chart"), TRUE, TRUE, NULL, NULL, 0, 0, &vbox, NULL); gtk_container_set_border_width (GTK_CONTAINER (win), 5); label = gtk_label_new (NULL); table_pos = table; i = 0; while (table_pos[0] != 0) { if (table_pos[0] == '\n' || i == 0) { table_pos++; hbox = gtk_hbox_new (0, 0); gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_widget_show (hbox); i++; continue; } i++; len = g_utf8_skip[table_pos[0]]; memcpy (name, table_pos, len); name[len] = 0; but = gtk_button_new_with_label (name); gtk_widget_set_size_request (but, 28, -1); g_signal_connect (G_OBJECT (but), "clicked", G_CALLBACK (ascii_click), NULL); g_signal_connect (G_OBJECT (but), "enter_notify_event", G_CALLBACK (ascii_enter), label); gtk_box_pack_start (GTK_BOX (hbox), but, 0, 0, 0); gtk_widget_show (but); table_pos += len; } frame = gtk_frame_new (""); gtk_container_add (GTK_CONTAINER (hbox), frame); gtk_container_add (GTK_CONTAINER (frame), label); gtk_widget_show (label); gtk_widget_show (frame); gtk_widget_show (win); }
void search_open (session * sess) { GtkWidget *win, *hbox, *vbox, *entry, *wid; last = NULL; win = mg_create_generic_tab ("search", _("XChat: Search"), TRUE, FALSE, NULL, NULL, 0, 0, &vbox, 0); gtk_container_set_border_width (GTK_CONTAINER (win), 12); gtk_box_set_spacing (GTK_BOX (vbox), 4); hbox = gtk_hbox_new (0, 10); gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_widget_show (hbox); gtkutil_label_new (_("Find:"), hbox); entry = gtk_entry_new (); g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (search_entry_cb), sess); gtk_container_add (GTK_CONTAINER (hbox), entry); gtk_widget_show (entry); gtk_widget_grab_focus (entry); wid = gtk_check_button_new_with_mnemonic (_("_Match case")); GTK_TOGGLE_BUTTON (wid)->active = case_match; g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_caseign_cb), sess); gtk_container_add (GTK_CONTAINER (vbox), wid); gtk_widget_show (wid); wid = gtk_check_button_new_with_mnemonic (_("Search _backwards")); GTK_TOGGLE_BUTTON (wid)->active = search_backward; g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_dirbwd_cb), sess); gtk_container_add (GTK_CONTAINER (vbox), wid); gtk_widget_show (wid); hbox = gtk_hbutton_box_new (); gtk_box_pack_start (GTK_BOX (vbox), hbox, 0, 0, 4); gtk_widget_show (hbox); gtkutil_button (hbox, GTK_STOCK_CLOSE, 0, search_close_cb, win, _("_Close")); wid = gtkutil_button (hbox, GTK_STOCK_FIND, 0, search_find_cb, sess, _("_Find")); g_object_set_data (G_OBJECT (wid), "e", entry); g_signal_connect (G_OBJECT (win), "key-press-event", G_CALLBACK (search_key_cb), win); gtk_widget_show (win); }
void open_rawlog (struct server *serv) { GtkWidget *hbox, *vscrollbar, *vbox; char tbuf[256]; if (serv->gui->rawlog_window) { mg_bring_tofront (serv->gui->rawlog_window); return; } snprintf (tbuf, sizeof tbuf, _("XChat: Rawlog (%s)"), serv->servername); serv->gui->rawlog_window = mg_create_generic_tab ("RawLog", tbuf, FALSE, TRUE, close_rawlog, serv, 640, 320, &vbox, serv); hbox = gtk_hbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); gtk_widget_show (hbox); serv->gui->rawlog_textlist = gtk_xtext_new (colors, 0); gtk_xtext_set_tint (GTK_XTEXT (serv->gui->rawlog_textlist), prefs.tint_red, prefs.tint_green, prefs.tint_blue); gtk_xtext_set_background (GTK_XTEXT (serv->gui->rawlog_textlist), channelwin_pix, prefs.transparent); gtk_container_add (GTK_CONTAINER (hbox), serv->gui->rawlog_textlist); gtk_xtext_set_font (GTK_XTEXT (serv->gui->rawlog_textlist), prefs.font_normal); GTK_XTEXT (serv->gui->rawlog_textlist)->ignore_hidden = 1; gtk_widget_show (serv->gui->rawlog_textlist); vscrollbar = gtk_vscrollbar_new (GTK_XTEXT (serv->gui->rawlog_textlist)->adj); gtk_box_pack_start (GTK_BOX (hbox), vscrollbar, FALSE, FALSE, 0); show_and_unfocus (vscrollbar); hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtk_widget_show (hbox); gtkutil_button (hbox, GTK_STOCK_CLEAR, NULL, rawlog_clearbutton, serv, _("Clear rawlog")); gtkutil_button (hbox, GTK_STOCK_SAVE_AS, NULL, rawlog_savebutton, serv, _("Save As...")); gtk_widget_show (serv->gui->rawlog_window); }
void banlist_opengui (struct session *sess) { GtkWidget *vbox1; GtkWidget *bbox; char tbuf[256]; if (sess->res->banlist_window) { mg_bring_tofront (sess->res->banlist_window); return; } if (sess->type != SESS_CHANNEL) { fe_message (_("You can only open the Ban List window while in a channel tab."), FE_MSG_ERROR); return; } snprintf (tbuf, sizeof tbuf, _("XChat: Ban List (%s)"), sess->server->servername); sess->res->banlist_window = mg_create_generic_tab ("BanList", tbuf, FALSE, TRUE, banlist_closegui, sess, 550, 200, &vbox1, sess->server); /* create banlist view */ sess->res->banlist_treeview = banlist_treeview_new (vbox1); bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_box_pack_end (GTK_BOX (vbox1), bbox, 0, 0, 0); gtk_widget_show (bbox); gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_unban, sess, _("Remove")); gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_crop, sess, _("Crop")); gtkutil_button (bbox, GTK_STOCK_CLEAR, 0, banlist_clear, sess, _("Clear")); sess->res->banlist_butRefresh = gtkutil_button (bbox, GTK_STOCK_REFRESH, 0, banlist_refresh, sess, _("Refresh")); banlist_do_refresh (sess); gtk_widget_show (sess->res->banlist_window); }
void editlist_gui_open (char *title1, char *title2, GSList *list, char *title, char *wmclass, char *file, char *help) { GtkWidget *vbox, *box; GtkWidget *view; GtkListStore *store; if (editlist_win) { mg_bring_tofront (editlist_win); return; } editlist_win = mg_create_generic_tab (wmclass, title, TRUE, FALSE, editlist_close, NULL, 450, 250, &vbox, 0); editlist_list = list; view = editlist_treeview_new (vbox, title1, title2); g_object_set_data (G_OBJECT (editlist_win), "view", view); if (help) gtk_widget_set_tooltip_text (view, help); box = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_SPREAD); gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (box), 5); gtk_widget_show (box); gtkutil_button (box, GTK_STOCK_NEW, 0, editlist_add, NULL, _("Add")); gtkutil_button (box, GTK_STOCK_DELETE, 0, editlist_delete, NULL, _("Delete")); gtkutil_button (box, GTK_STOCK_CANCEL, 0, editlist_close, NULL, _("Cancel")); gtkutil_button (box, GTK_STOCK_SAVE, 0, editlist_save, file, _("Save")); store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (view))); editlist_load (store, list); gtk_widget_show (editlist_win); }
void notify_opengui (void) { GtkWidget *vbox, *bbox; GtkWidget *view; if (notify_window) { mg_bring_tofront (notify_window); return; } notify_window = mg_create_generic_tab ("Notify", _(DISPLAY_NAME": Friends List"), FALSE, TRUE, notify_closegui, NULL, 400, 250, &vbox, 0); gtkutil_destroy_on_esc (notify_window); view = notify_treeview_new (vbox); g_object_set_data (G_OBJECT (notify_window), "view", view); bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_box_pack_end (GTK_BOX (vbox), bbox, 0, 0, 0); gtk_widget_show (bbox); gtkutil_button(bbox, GTK_STOCK_NEW, 0, G_CALLBACK(notify_add_clicked), 0, _("Add...")); notify_button_remove = gtkutil_button(bbox, GTK_STOCK_DELETE, 0, G_CALLBACK(notify_remove_clicked), 0, _("Remove")); notify_button_opendialog = gtkutil_button(bbox, NULL, 0, G_CALLBACK(notify_opendialog_clicked), 0, _("Open Dialog")); gtk_widget_set_sensitive (notify_button_opendialog, FALSE); gtk_widget_set_sensitive (notify_button_remove, FALSE); notify_gui_update (); gtk_widget_show (notify_window); }
void open_rawlog (struct server *serv) { GtkWidget *bbox, *scrolledwindow, *vbox; char tbuf[256]; if (serv->gui->rawlog_window) { mg_bring_tofront (serv->gui->rawlog_window); return; } g_snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Raw Log (%s)"), serv->servername); serv->gui->rawlog_window = mg_create_generic_tab ("RawLog", tbuf, FALSE, TRUE, close_rawlog, serv, 640, 320, &vbox, serv); gtkutil_destroy_on_esc (serv->gui->rawlog_window); scrolledwindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (vbox), scrolledwindow); serv->gui->rawlog_textlist = gtk_xtext_new (colors, 0); gtk_container_add (GTK_CONTAINER (scrolledwindow), serv->gui->rawlog_textlist); gtk_xtext_set_font (GTK_XTEXT (serv->gui->rawlog_textlist), prefs.hex_text_font); GTK_XTEXT (serv->gui->rawlog_textlist)->ignore_hidden = 1; bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_end (GTK_BOX (vbox), bbox, 0, 0, 4); gtkutil_button (bbox, GTK_STOCK_CLEAR, NULL, rawlog_clearbutton, serv, _("Clear Raw Log")); gtkutil_button (bbox, GTK_STOCK_SAVE_AS, NULL, rawlog_savebutton, serv, _("Save As...")); /* Copy selection to clipboard when Ctrl+Shift+C is pressed AND text auto-copy is disabled */ g_signal_connect (G_OBJECT (serv->gui->rawlog_window), "key_press_event", G_CALLBACK (rawlog_key_cb), serv->gui->rawlog_textlist); gtk_widget_show_all (serv->gui->rawlog_window); }
void key_dialog_show () { GtkWidget *vbox, *box; GtkWidget *view, *xtext; GtkListStore *store; if (key_dialog) { mg_bring_tofront (key_dialog); return; } key_dialog = mg_create_generic_tab ("editkeys", _(DISPLAY_NAME": Keyboard Shortcuts"), TRUE, FALSE, key_dialog_close, NULL, 600, 360, &vbox, 0); view = key_dialog_treeview_new (vbox); xtext = gtk_xtext_new (colors, 0); gtk_box_pack_start (GTK_BOX (vbox), xtext, FALSE, TRUE, 2); gtk_xtext_set_font (GTK_XTEXT (xtext), prefs.hex_text_font); g_object_set_data (G_OBJECT (key_dialog), "view", view); g_object_set_data (G_OBJECT (key_dialog), "xtext", xtext); box = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_SPREAD); gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (box), 5); gtkutil_button (box, GTK_STOCK_NEW, NULL, key_dialog_add, NULL, _("Add")); gtkutil_button (box, GTK_STOCK_DELETE, NULL, key_dialog_delete, NULL, _("Delete")); gtkutil_button (box, GTK_STOCK_CANCEL, NULL, key_dialog_close, NULL, _("Cancel")); gtkutil_button (box, GTK_STOCK_SAVE, NULL, key_dialog_save, NULL, _("Save")); store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (view))); key_dialog_load (store); gtk_widget_show_all (key_dialog); }
void url_opengui () { GtkWidget *vbox, *hbox, *view; if (urlgrabberwindow) { mg_bring_tofront (urlgrabberwindow); return; } urlgrabberwindow = mg_create_generic_tab ("UrlGrabber", _(DISPLAY_NAME": URL Grabber"), FALSE, TRUE, url_closegui, NULL, 400, 256, &vbox, 0); gtkutil_destroy_on_esc (urlgrabberwindow); view = url_treeview_new (vbox); g_object_set_data (G_OBJECT (urlgrabberwindow), "model", gtk_tree_view_get_model (GTK_TREE_VIEW (view))); hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtk_widget_show (hbox); gtkutil_button (hbox, gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU), _("Clear list"), url_button_clear, 0, _("Clear")); gtkutil_button (hbox, gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU), _("Copy selected URL"), url_button_copy, view, _("Copy")); gtkutil_button (hbox, gtk_image_new_from_stock(GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU), _("Save list to a file"), url_button_save, 0, _("Save As...")); gtk_widget_show (urlgrabberwindow); if (prefs.pchat_url_grabber) tree_foreach (url_tree, (tree_traverse_func *)populate_cb, NULL); else { gtk_list_store_clear (GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (view)))); fe_url_add ("URL Grabber is disabled."); } }
void banlist_opengui (struct session *sess) { banlist_info *banl; int i; GtkWidget *table, *vbox, *bbox; char tbuf[256]; if (sess->type != SESS_CHANNEL || sess->channel[0] == 0) { fe_message (_("You can only open the Ban List window while in a channel tab."), FE_MSG_ERROR); return; } if (!sess->res->banlist) { sess->res->banlist = g_malloc0 (sizeof (banlist_info)); if (!sess->res->banlist) { fe_message (_("Banlist initialization failed."), FE_MSG_ERROR); return; } } banl = sess->res->banlist; if (banl->window) { mg_bring_tofront (banl->window); return; } /* New banlist for this session -- Initialize it */ banl->sess = sess; /* For each mode set its bit in capable/readable/writeable */ for (i = 0; i < MODE_CT; i++) modes[i].tester (banl, i); /* Force on the checkmark in the "Bans" box */ banl->checked = 1<<MODE_BAN; g_snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Ban List (%s)"), sess->server->servername); banl->window = mg_create_generic_tab ("BanList", tbuf, FALSE, TRUE, banlist_closegui, banl, 550, 200, &vbox, sess->server); gtkutil_destroy_on_esc (banl->window); gtk_container_set_border_width (GTK_CONTAINER (banl->window), 3); gtk_box_set_spacing (GTK_BOX (vbox), 3); /* create banlist view */ banl->treeview = banlist_treeview_new (vbox, banl); table = gtk_table_new (1, MODE_CT, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 16); gtk_box_pack_start (GTK_BOX (vbox), table, 0, 0, 0); for (i = 0; i < MODE_CT; i++) { if (!(banl->capable & 1<<i)) continue; banl->checkboxes[i] = gtk_check_button_new_with_label (_(modes[i].name)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (banl->checkboxes[i]), (banl->checked & 1<<i? TRUE: FALSE)); g_signal_connect (G_OBJECT (banl->checkboxes[i]), "toggled", G_CALLBACK (banlist_toggle), banl); gtk_table_attach (GTK_TABLE (table), banl->checkboxes[i], i+1, i+2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); } bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); gtk_box_pack_end (GTK_BOX (vbox), bbox, 0, 0, 0); gtk_widget_show (bbox); banl->but_remove = gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_unban, banl, _("Remove")); banl->but_crop = gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_crop, banl, _("Crop")); banl->but_clear = gtkutil_button (bbox, GTK_STOCK_CLEAR, 0, banlist_clear, banl, _("Clear")); banl->but_refresh = gtkutil_button (bbox, GTK_STOCK_REFRESH, 0, banlist_refresh, banl, _("Refresh")); banlist_do_refresh (banl); gtk_widget_show_all (banl->window); }
static GtkWidget * servlist_open_edit (GtkWidget *parent, ircnet *net) { GtkWidget *editwindow; GtkWidget *vbox5; GtkWidget *table3; GtkWidget *label17; GtkWidget *label16; GtkWidget *label21; GtkWidget *label22; GtkWidget *label34; GtkWidget *comboboxentry_charset; GtkWidget *hbox1; GtkWidget *scrolledwindow2; GtkWidget *treeview_servers; GtkWidget *vbuttonbox1; GtkWidget *buttonadd; GtkWidget *buttonremove; GtkWidget *buttonedit; GtkWidget *check; GtkTreeModel *model; GtkListStore *store; GtkCellRenderer *renderer; char buf[128]; char buf2[128 + 8]; char tbuf[256]; snprintf (tbuf, sizeof tbuf, _("conspire: Network Editor (%s)"), net->name); editwindow = mg_create_generic_tab(_("Network Editor"), tbuf, FALSE, TRUE, servlist_closegui, NULL, 550, 200, &vbox5, NULL); table3 = gtk_table_new (17, 3, FALSE); gtk_widget_show (table3); gtk_box_pack_start (GTK_BOX (vbox5), table3, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table3), 2); gtk_table_set_col_spacings (GTK_TABLE (table3), 8); snprintf (buf, sizeof (buf), _("Servers for %s"), net->name); snprintf (buf2, sizeof (buf2), "<b>%s</b>", buf); label16 = gtk_label_new (buf2); gtk_widget_show (label16); gtk_table_attach (GTK_TABLE (table3), label16, 0, 3, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 3); gtk_label_set_use_markup (GTK_LABEL (label16), TRUE); gtk_misc_set_alignment (GTK_MISC (label16), 0, 0.5); check = servlist_create_check (0, !(net->flags & FLAG_CYCLE), table3, 2, 1, _("Connect to selected server only")); add_tip (check, _("Don't cycle through all the servers when the connection fails.")); label17 = bold_label (_("Your Details")); gtk_table_attach (GTK_TABLE (table3), label17, 0, 3, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 3); servlist_create_check (1, net->flags & FLAG_USE_GLOBAL, table3, 4, 1, _("Use global user information")); edit_entry_nick = servlist_create_entry (table3, _("_Nick name:"), 5, net->nick, &edit_label_nick, 0); edit_entry_nick2 = servlist_create_entry (table3, _("Second choice:"), 6, net->nick2, &edit_label_nick2, 0); edit_entry_user = servlist_create_entry (table3, _("_User name:"), 7, net->user, &edit_label_user, 0); edit_entry_real = servlist_create_entry (table3, _("Rea_l name:"), 8, net->real, &edit_label_real, 0); label21 = bold_label (_("Connecting")); gtk_table_attach (GTK_TABLE (table3), label21, 0, 3, 9, 10, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 3); servlist_create_check (3, net->flags & FLAG_AUTO_CONNECT, table3, 11, 1, _("Auto connect to this network at startup")); servlist_create_check (4, net->flags & FLAG_USE_PROXY, table3, 12, 1, _("Use a proxy server")); edit_entry_join = servlist_create_entry (table3, _("C_hannels to join:"), 15, net->autojoin, 0, _("Channels to join, separated by commas, but not spaces!")); edit_entry_nickserv = servlist_create_entry (table3, _("Nickserv password:"******"If your nickname requires a password, enter it here. Not all IRC networks support this.")); gtk_entry_set_visibility (GTK_ENTRY (edit_entry_nickserv), FALSE); edit_entry_pass = servlist_create_entry (table3, _("Server password:"******"Password for the server, if in doubt, leave blank.")); gtk_entry_set_visibility (GTK_ENTRY (edit_entry_pass), FALSE); edit_entry_sasl_user = servlist_create_entry (table3, _("SASL username:"******"If your network uses SASL, put your username here.")); edit_entry_sasl_pass = servlist_create_entry (table3, _("SASL password:"******"If your network uses SASL, put your password here.")); gtk_entry_set_visibility (GTK_ENTRY (edit_entry_sasl_pass), FALSE); label34 = gtk_label_new (_("Character set:")); gtk_widget_show (label34); gtk_table_attach (GTK_TABLE (table3), label34, 1, 2, 21, 22, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label34), 0, 0.5); comboboxentry_charset = servlist_create_charsetcombo (); ignore_changed = TRUE; gtk_entry_set_text (GTK_ENTRY (GTK_BIN (comboboxentry_charset)->child), net->encoding ? net->encoding : "System default"); ignore_changed = FALSE; gtk_widget_show (comboboxentry_charset); gtk_table_attach (GTK_TABLE (table3), comboboxentry_charset, 2, 3, 21, 22, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); label22 = bold_label (_("Perform")); gtk_table_attach (GTK_TABLE (table3), label22, 0, 3, 22, 23, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 3); edit_entry_cmd = servlist_create_textview (table3, _("Connect commands:"), 24, net->command, 0, _("Extra commands to execute after connecting. Alternatively, to run a large series of commands on connect, use LOAD -e <filename>, where <filename> is a text-file full of commands to execute.")); /*********** FINITO *************/ hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); gtk_table_attach (GTK_TABLE (table3), hbox1, 1, 3, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow2); gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow2, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN); store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN); model = GTK_TREE_MODEL (store); edit_tree = treeview_servers = gtk_tree_view_new_with_model (model); g_object_unref (model); gtk_widget_show (treeview_servers); gtk_container_add (GTK_CONTAINER (scrolledwindow2), treeview_servers); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview_servers), FALSE); renderer = gtk_cell_renderer_text_new (); g_signal_connect (G_OBJECT (renderer), "edited", G_CALLBACK (servlist_editserver_cb), model); gtk_tree_view_insert_column_with_attributes ( GTK_TREE_VIEW (treeview_servers), -1, 0, renderer, "text", 0, "editable", 1, NULL); vbuttonbox1 = gtk_vbutton_box_new (); gtk_box_set_spacing (GTK_BOX (vbuttonbox1), 3); gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox1), GTK_BUTTONBOX_START); gtk_widget_show (vbuttonbox1); gtk_box_pack_start (GTK_BOX (hbox1), vbuttonbox1, FALSE, FALSE, 3); buttonadd = gtk_button_new_from_stock ("gtk-add"); g_signal_connect (G_OBJECT (buttonadd), "clicked", G_CALLBACK (servlist_addserver_cb), edit_tree); gtk_widget_show (buttonadd); gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonadd); GTK_WIDGET_SET_FLAGS (buttonadd, GTK_CAN_DEFAULT); buttonremove = gtk_button_new_from_stock ("gtk-remove"); g_signal_connect (G_OBJECT (buttonremove), "clicked", G_CALLBACK (servlist_deleteserver_cb), NULL); gtk_widget_show (buttonremove); gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonremove); GTK_WIDGET_SET_FLAGS (buttonremove, GTK_CAN_DEFAULT); buttonedit = gtk_button_new_with_mnemonic (_("_Edit")); g_signal_connect (G_OBJECT (buttonedit), "clicked", G_CALLBACK (servlist_editserverbutton_cb), NULL); gtk_widget_show (buttonedit); gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonedit); GTK_WIDGET_SET_FLAGS (buttonedit, GTK_CAN_DEFAULT); if (net->flags & FLAG_USE_GLOBAL) { gtk_widget_hide (edit_label_nick); gtk_widget_hide (edit_entry_nick); gtk_widget_hide (edit_label_nick2); gtk_widget_hide (edit_entry_nick2); gtk_widget_hide (edit_label_user); gtk_widget_hide (edit_entry_user); gtk_widget_hide (edit_label_real); gtk_widget_hide (edit_entry_real); } return editwindow; }
void editlist_gui_open (char *title1, char *title2, GSList * list, char *title, char *wmclass, char *file, char *help) { gchar *titles[2]; GtkWidget *vbox, *hbox, *button; if (title1) { titles[0] = title1; titles[1] = title2; } else { titles[0] = _("Name"); titles[1] = _("Command"); } if (editlist_gui_window) { mg_bring_tofront (editlist_gui_window); return; } editlist_list = list; editlist_file = file; editlist_help = help; editlist_gui_window = mg_create_generic_tab (wmclass, title, TRUE, FALSE, editlist_gui_close, NULL, 450, 250, &vbox, 0); editlist_gui_list = gtkutil_clist_new (2, titles, vbox, GTK_POLICY_ALWAYS, editlist_gui_row_selected, 0, editlist_gui_row_unselected, 0, GTK_SELECTION_BROWSE); gtk_clist_set_column_width (GTK_CLIST (editlist_gui_list), 0, 90); hbox = gtk_hbox_new (0, 2); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtk_widget_show (hbox); button = gtkutil_button (hbox, GTK_STOCK_GO_UP, 0, editlist_gui_moveup, 0, _("Move Up")); gtk_widget_set_usize (button, 100, 0); button = gtkutil_button (hbox, GTK_STOCK_GO_DOWN, 0, editlist_gui_movedown, 0, _("Move Dn")); gtk_widget_set_usize (button, 100, 0); button = gtk_vseparator_new (); gtk_container_add (GTK_CONTAINER (hbox), button); gtk_widget_show (button); button = gtkutil_button (hbox, GTK_STOCK_CANCEL, 0, gtkutil_destroy, editlist_gui_window, _("Cancel")); gtk_widget_set_usize (button, 100, 0); button = gtkutil_button (hbox, GTK_STOCK_SAVE, 0, editlist_gui_save, 0, _("Save")); gtk_widget_set_usize (button, 100, 0); hbox = gtk_hbox_new (0, 2); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtk_widget_show (hbox); button = gtkutil_button (hbox, GTK_STOCK_ADD, 0, editlist_gui_addnew, 0, _("Add New")); gtk_widget_set_usize (button, 100, 0); button = gtkutil_button (hbox, GTK_STOCK_REMOVE, 0, editlist_gui_delete, 0, _("Delete")); gtk_widget_set_usize (button, 100, 0); button = gtk_vseparator_new (); gtk_container_add (GTK_CONTAINER (hbox), button); gtk_widget_show (button); button = gtkutil_button (hbox, GTK_STOCK_SORT_ASCENDING, 0, editlist_gui_sort, 0, _("Sort")); gtk_widget_set_usize (button, 100, 0); button = gtkutil_button (hbox, GTK_STOCK_HELP, 0, editlist_gui_help, 0, _("Help")); gtk_widget_set_usize (button, 100, 0); if (!help) gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); hbox = gtk_hbox_new (0, 2); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtk_widget_show (hbox); editlist_gui_entry_name = gtk_entry_new_with_max_length (82); gtk_widget_set_usize (editlist_gui_entry_name, 96, 0); gtk_signal_connect (GTK_OBJECT (editlist_gui_entry_name), "changed", GTK_SIGNAL_FUNC (editlist_gui_handle_name), 0); gtk_box_pack_start (GTK_BOX (hbox), editlist_gui_entry_name, 0, 0, 0); gtk_widget_show (editlist_gui_entry_name); editlist_gui_entry_cmd = gtk_entry_new_with_max_length (255); gtk_signal_connect (GTK_OBJECT (editlist_gui_entry_cmd), "changed", GTK_SIGNAL_FUNC (editlist_gui_handle_cmd), 0); gtk_container_add (GTK_CONTAINER (hbox), editlist_gui_entry_cmd); gtk_widget_show (editlist_gui_entry_cmd); hbox = gtk_hbox_new (0, 2); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtk_widget_show (hbox); editlist_gui_load (editlist_gui_list); gtk_widget_show (editlist_gui_window); }
void chanlist_opengui (server *serv, int do_refresh) { GtkWidget *vbox, *hbox, *table, *wid, *view; char tbuf[256]; GtkListStore *store; if (serv->gui->chanlist_window) { mg_bring_tofront (serv->gui->chanlist_window); return; } snprintf (tbuf, sizeof tbuf, _("XChat: Channel List (%s)"), server_get_network (serv, TRUE)); serv->gui->chanlist_pending_rows = NULL; serv->gui->chanlist_tag = 0; serv->gui->chanlist_flash_tag = 0; serv->gui->chanlist_data_stored_rows = NULL; if (!serv->gui->chanlist_minusers) serv->gui->chanlist_minusers = 5; if (!serv->gui->chanlist_maxusers) serv->gui->chanlist_maxusers = 9999; serv->gui->chanlist_window = mg_create_generic_tab ("ChanList", tbuf, FALSE, TRUE, chanlist_closegui, serv, 640, 480, &vbox, serv); gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_box_set_spacing (GTK_BOX (vbox), 12); /* make a label to store the user/channel info */ wid = gtk_label_new (NULL); gtk_box_pack_start (GTK_BOX (vbox), wid, 0, 0, 0); gtk_widget_show (wid); serv->gui->chanlist_label = wid; /* ============================================================= */ store = (GtkListStore *) custom_list_new(); view = gtkutil_treeview_new (vbox, GTK_TREE_MODEL (store), NULL, -1); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->parent), GTK_SHADOW_IN); serv->gui->chanlist_list = view; g_signal_connect (G_OBJECT (view), "row_activated", G_CALLBACK (chanlist_dclick_cb), serv); g_signal_connect (G_OBJECT (view), "button-press-event", G_CALLBACK (chanlist_button_cb), serv); chanlist_add_column (view, COL_CHANNEL, 96, _("Channel"), FALSE); chanlist_add_column (view, COL_USERS, 50, _("Users"), TRUE); chanlist_add_column (view, COL_TOPIC, 50, _("Topic"), FALSE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); /* this is a speed up, but no horizontal scrollbar :( */ /*gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (view), TRUE);*/ gtk_widget_show (view); /* ============================================================= */ table = gtk_table_new (4, 4, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 12); gtk_table_set_row_spacings (GTK_TABLE (table), 3); gtk_box_pack_start (GTK_BOX (vbox), table, 0, 1, 0); gtk_widget_show (table); wid = gtkutil_button (NULL, GTK_STOCK_FIND, 0, chanlist_search_pressed, serv, _("_Search")); serv->gui->chanlist_search = wid; gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); wid = gtkutil_button (NULL, GTK_STOCK_REFRESH, 0, chanlist_refresh, serv, _("_Download List")); serv->gui->chanlist_refresh = wid; gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); wid = gtkutil_button (NULL, GTK_STOCK_SAVE_AS, 0, chanlist_save, serv, _("Save _List...")); serv->gui->chanlist_savelist = wid; gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); wid = gtkutil_button (NULL, GTK_STOCK_JUMP_TO, 0, chanlist_join, serv, _("_Join Channel")); serv->gui->chanlist_join = wid; gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); /* ============================================================= */ wid = gtk_label_new (_("Show only:")); gtk_misc_set_alignment (GTK_MISC (wid), 0, 0.5); gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 3, 4, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show (wid); hbox = gtk_hbox_new (0, 0); gtk_box_set_spacing (GTK_BOX (hbox), 9); gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); wid = gtk_label_new (_("channels with")); gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0); gtk_widget_show (wid); wid = gtk_spin_button_new_with_range (1, 999999, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid), serv->gui->chanlist_minusers); g_signal_connect (G_OBJECT (wid), "value_changed", G_CALLBACK (chanlist_minusers), serv); gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0); gtk_widget_show (wid); serv->gui->chanlist_min_spin = wid; wid = gtk_label_new (_("to")); gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0); gtk_widget_show (wid); wid = gtk_spin_button_new_with_range (1, 999999, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid), serv->gui->chanlist_maxusers); g_signal_connect (G_OBJECT (wid), "value_changed", G_CALLBACK (chanlist_maxusers), serv); gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0); gtk_widget_show (wid); wid = gtk_label_new (_("users.")); gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0); gtk_widget_show (wid); /* ============================================================= */ wid = gtk_label_new (_("Look in:")); gtk_misc_set_alignment (GTK_MISC (wid), 0, 0.5); gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 2, 3, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show (wid); hbox = gtk_hbox_new (0, 0); gtk_box_set_spacing (GTK_BOX (hbox), 12); gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (hbox); wid = gtk_check_button_new_with_label (_("Channel name")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wid), TRUE); gtk_signal_connect (GTK_OBJECT (wid), "toggled", GTK_SIGNAL_FUNC (chanlist_match_channel_button_toggled), serv); gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0); gtk_widget_show (wid); wid = gtk_check_button_new_with_label (_("Topic")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wid), TRUE); gtk_signal_connect (GTK_OBJECT (wid), "toggled", GTK_SIGNAL_FUNC (chanlist_match_topic_button_toggled), serv); gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0); gtk_widget_show (wid); serv->gui->chanlist_match_wants_channel = 1; serv->gui->chanlist_match_wants_topic = 1; /* ============================================================= */ wid = gtk_label_new (_("Search type:")); gtk_misc_set_alignment (GTK_MISC (wid), 0, 0.5); gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show (wid); wid = gtk_combo_box_new_text (); gtk_combo_box_append_text (GTK_COMBO_BOX (wid), _("Simple Search")); gtk_combo_box_append_text (GTK_COMBO_BOX (wid), _("Pattern Match (Wildcards)")); #ifndef WIN32 gtk_combo_box_append_text (GTK_COMBO_BOX (wid), _("Regular Expression")); #endif gtk_combo_box_set_active (GTK_COMBO_BOX (wid), serv->gui->chanlist_search_type); gtk_table_attach (GTK_TABLE (table), wid, 1, 2, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); g_signal_connect (G_OBJECT (wid), "changed", G_CALLBACK (chanlist_combo_cb), serv); gtk_widget_show (wid); /* ============================================================= */ wid = gtk_label_new (_("Find:")); gtk_misc_set_alignment (GTK_MISC (wid), 0, 0.5); gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show (wid); wid = gtk_entry_new_with_max_length (255); gtk_signal_connect (GTK_OBJECT (wid), "changed", GTK_SIGNAL_FUNC (chanlist_find_cb), serv); gtk_signal_connect (GTK_OBJECT (wid), "activate", GTK_SIGNAL_FUNC (chanlist_search_pressed), (gpointer) serv); gtk_table_attach (GTK_TABLE (table), wid, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); gtk_widget_show (wid); serv->gui->chanlist_wild = wid; chanlist_find_cb (wid, serv); /* ============================================================= */ wid = gtk_vseparator_new (); gtk_table_attach (GTK_TABLE (table), wid, 2, 3, 0, 5, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show (wid); g_signal_connect (G_OBJECT (serv->gui->chanlist_window), "destroy", G_CALLBACK (chanlist_destroy_widget), serv); /* reset the counters. */ chanlist_reset_counters (serv); serv->gui->chanlist_tag = g_timeout_add (250, (GSourceFunc)chanlist_timeout, serv); if (do_refresh) chanlist_do_refresh (serv); chanlist_update_buttons (serv); gtk_widget_show (serv->gui->chanlist_window); gtk_widget_grab_focus (serv->gui->chanlist_refresh); }
static GtkWidget * servlist_open_networks (void) { GtkWidget *servlist; GtkWidget *vbox1; GtkWidget *label2; GtkWidget *table1; GtkWidget *label3; GtkWidget *label4; GtkWidget *label5; GtkWidget *label6; GtkWidget *label7; GtkWidget *entry1; GtkWidget *entry2; GtkWidget *entry3; GtkWidget *entry4; GtkWidget *entry5; GtkWidget *vbox2; GtkWidget *label1; GtkWidget *table4; GtkWidget *scrolledwindow3; GtkWidget *treeview_networks; GtkWidget *checkbutton_skip; GtkWidget *vbuttonbox2; GtkWidget *button_add; GtkWidget *button_remove; GtkWidget *button_edit; GtkWidget *button_sort; GtkWidget *button_connect; GtkTreeModel *model; GtkListStore *store; GtkCellRenderer *renderer; servlist = mg_create_generic_tab(_("Network List"), _("conspire: Networks"), FALSE, TRUE, servlist_close_cb, NULL, 640, 480, &vbox1, NULL); label2 = bold_label (_("User Information")); gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 0); table1 = gtk_table_new (5, 2, FALSE); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (table1), 8); gtk_table_set_row_spacings (GTK_TABLE (table1), 2); gtk_table_set_col_spacings (GTK_TABLE (table1), 4); label3 = gtk_label_new_with_mnemonic (_("_Nick name:")); gtk_widget_show (label3); gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5); label4 = gtk_label_new (_("Second choice:")); gtk_widget_show (label4); gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5); label5 = gtk_label_new (_("Third choice:")); gtk_widget_show (label5); gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5); label6 = gtk_label_new_with_mnemonic (_("_User name:")); gtk_widget_show (label6); gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); label7 = gtk_label_new_with_mnemonic (_("Rea_l name:")); gtk_widget_show (label7); gtk_table_attach (GTK_TABLE (table1), label7, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); entry_nick1 = entry1 = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (entry1), prefs.nick1); gtk_widget_show (entry1); gtk_table_attach (GTK_TABLE (table1), entry1, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); entry_nick2 = entry2 = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (entry2), prefs.nick2); gtk_widget_show (entry2); gtk_table_attach (GTK_TABLE (table1), entry2, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); entry_nick3 = entry3 = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (entry3), prefs.nick3); gtk_widget_show (entry3); gtk_table_attach (GTK_TABLE (table1), entry3, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); entry_guser = entry4 = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (entry4), prefs.username); gtk_widget_show (entry4); gtk_table_attach (GTK_TABLE (table1), entry4, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); entry_greal = entry5 = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (entry5), prefs.realname); gtk_widget_show (entry5); gtk_table_attach (GTK_TABLE (table1), entry5, 1, 2, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox2); gtk_box_pack_start (GTK_BOX (vbox1), vbox2, TRUE, TRUE, 0); label1 = bold_label (_("Networks")); gtk_box_pack_start (GTK_BOX (vbox2), label1, FALSE, FALSE, 0); table4 = gtk_table_new (2, 2, FALSE); gtk_widget_show (table4); gtk_box_pack_start (GTK_BOX (vbox2), table4, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (table4), 8); gtk_table_set_row_spacings (GTK_TABLE (table4), 2); gtk_table_set_col_spacings (GTK_TABLE (table4), 3); scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow3); gtk_table_attach (GTK_TABLE (table4), scrolledwindow3, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_SHADOW_IN); store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN); model = GTK_TREE_MODEL (store); networks_tree = treeview_networks = gtk_tree_view_new_with_model (model); g_object_unref (model); gtk_widget_show (treeview_networks); gtk_container_add (GTK_CONTAINER (scrolledwindow3), treeview_networks); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview_networks), FALSE); renderer = gtk_cell_renderer_text_new (); g_signal_connect (G_OBJECT (renderer), "edited", G_CALLBACK (servlist_celledit_cb), model); gtk_tree_view_insert_column_with_attributes ( GTK_TREE_VIEW (treeview_networks), -1, 0, renderer, "text", 0, "editable", 1, NULL); checkbutton_skip = gtk_check_button_new_with_mnemonic (_("Skip network list on startup")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton_skip), prefs.skip_serverlist); g_signal_connect (G_OBJECT (checkbutton_skip), "toggled", G_CALLBACK (no_servlist), 0); gtk_widget_show (checkbutton_skip); gtk_table_attach (GTK_TABLE (table4), checkbutton_skip, 0, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); vbuttonbox2 = gtk_vbutton_box_new (); gtk_box_set_spacing (GTK_BOX (vbuttonbox2), 3); gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox2), GTK_BUTTONBOX_START); gtk_widget_show (vbuttonbox2); gtk_table_attach (GTK_TABLE (table4), vbuttonbox2, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); button_add = gtk_button_new_from_stock ("gtk-add"); g_signal_connect (G_OBJECT (button_add), "clicked", G_CALLBACK (servlist_addnet_cb), networks_tree); gtk_widget_show (button_add); gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_add); GTK_WIDGET_SET_FLAGS (button_add, GTK_CAN_DEFAULT); button_remove = gtk_button_new_from_stock ("gtk-remove"); g_signal_connect (G_OBJECT (button_remove), "clicked", G_CALLBACK (servlist_deletenet_cb), 0); gtk_widget_show (button_remove); gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_remove); GTK_WIDGET_SET_FLAGS (button_remove, GTK_CAN_DEFAULT); button_edit = gtk_button_new_with_mnemonic (_("_Edit...")); g_signal_connect (G_OBJECT (button_edit), "clicked", G_CALLBACK (servlist_edit_cb), 0); gtk_widget_show (button_edit); gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_edit); GTK_WIDGET_SET_FLAGS (button_edit, GTK_CAN_DEFAULT); button_sort = gtk_button_new_with_mnemonic (_("_Sort")); add_tip (button_sort, _("Sorts the network list in alphabetical order. " "Use SHIFT-UP and SHIFT-DOWN keys to move a row.")); g_signal_connect (G_OBJECT (button_sort), "clicked", G_CALLBACK (servlist_sort), 0); gtk_widget_show (button_sort); gtk_container_add (GTK_CONTAINER (vbuttonbox2), button_sort); GTK_WIDGET_SET_FLAGS (button_sort, GTK_CAN_DEFAULT); button_connect = gtkutil_button (vbuttonbox2, GTK_STOCK_CONNECT, NULL, servlist_connect_cb, NULL, _("C_onnect")); GTK_WIDGET_SET_FLAGS (button_connect, GTK_CAN_DEFAULT); gtk_label_set_mnemonic_widget (GTK_LABEL (label3), entry1); gtk_label_set_mnemonic_widget (GTK_LABEL (label6), entry4); gtk_label_set_mnemonic_widget (GTK_LABEL (label7), entry5); gtk_widget_grab_focus (networks_tree); return servlist; }
void search_open (session * sess) { GtkWidget *win, *hbox, *vbox, *entry, *wid; if (searchwin) { gtk_widget_destroy (searchwin); searchwin = NULL; } win = mg_create_generic_tab ("search", _(DISPLAY_NAME": Search"), TRUE, FALSE, search_cleanup_cb, NULL, 0, 0, &vbox, 0); gtk_container_set_border_width (GTK_CONTAINER (win), 12); gtk_box_set_spacing (GTK_BOX (vbox), 4); /* First line: _____________________ _Find */ hbox = gtk_hbox_new (0, 10); gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_widget_show (hbox); entry = gtk_entry_new (); g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (search_entry_cb), sess); gtk_container_add (GTK_CONTAINER (hbox), entry); gtk_widget_show (entry); gtk_widget_grab_focus (entry); wid = gtk_hbutton_box_new (); gtk_container_add (GTK_CONTAINER (hbox), wid); gtk_widget_show (wid); wid = gtkutil_button (wid, GTK_STOCK_FIND, 0, search_find_cb, sess, _("_Find")); g_object_set_data (G_OBJECT (wid), "e", entry); /* Second line: X Match case */ wid = gtk_check_button_new_with_mnemonic (_("_Match case")); GTK_TOGGLE_BUTTON (wid)->active = prefs.text_search_case_match; g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_caseign_cb), sess); gtk_container_add (GTK_CONTAINER (vbox), wid); add_tip (wid, "Perform a case-sensitive search."); gtk_widget_show (wid); /* Third line: X Search backwards */ wid = gtk_check_button_new_with_mnemonic (_("Search _backwards")); GTK_TOGGLE_BUTTON (wid)->active = prefs.text_search_backward; g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_dirbwd_cb), sess); gtk_container_add (GTK_CONTAINER (vbox), wid); add_tip (wid, "Search from the newest text line to the oldest."); gtk_widget_show (wid); /* Fourth line: X Highlight all */ wid = gtk_check_button_new_with_mnemonic (_("_Highlight all")); GTK_TOGGLE_BUTTON (wid)->active = prefs.text_search_highlight_all; g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_highlight_cb), sess); gtk_container_add (GTK_CONTAINER (vbox), wid); add_tip (wid, "Highlight all occurrences, and underline the current occurrence."); gtk_widget_show (wid); /* Fifth line: X Regular expression */ wid = gtk_check_button_new_with_mnemonic (_("R_egular expression")); GTK_TOGGLE_BUTTON (wid)->active = prefs.text_search_regexp; g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_regexp_cb), sess); gtk_container_add (GTK_CONTAINER (vbox), wid); add_tip (wid, "Regard search string as a regular expression."); gtk_widget_show (wid); /* Sixth line: _Close Close and _Reset */ hbox = gtk_hbutton_box_new (); gtk_box_pack_start (GTK_BOX (vbox), hbox, 0, 0, 4); gtk_widget_show (hbox); wid = gtkutil_button (hbox, GTK_STOCK_CLOSE, 0, search_close_cb, win, _("_Close")); add_tip (wid, "Close this box, but continue searching new lines."); wid = gtkutil_button (hbox, "gtk-reset", 0, search_reset_cb, sess, _("Close and _Reset")); add_tip (wid, "Close this box, reset highlighted search items, and stop searching new lines."); /* Add recognition of the ESC key to close the box */ g_signal_connect (G_OBJECT (win), "key_press_event", G_CALLBACK (search_key_cb), win); /* That's all, folks */ searchwin = win; gtk_widget_show (win); }
void pevent_dialog_show () { GtkWidget *vbox, *hbox, *tbox, *wid, *bh, *th; GtkListStore *store, *hstore; GtkTreeSelection *sel; if (pevent_dialog) { mg_bring_tofront (pevent_dialog); return; } pevent_dialog = mg_create_generic_tab ("edit events", _("Edit Events"), TRUE, FALSE, pevent_dialog_close, NULL, 600, 455, &vbox, 0); wid = gtk_vpaned_new (); th = gtk_vbox_new (0, 2); bh = gtk_vbox_new (0, 2); gtk_widget_show (th); gtk_widget_show (bh); gtk_paned_pack1 (GTK_PANED (wid), th, 1, 1); gtk_paned_pack2 (GTK_PANED (wid), bh, 0, 1); gtk_box_pack_start (GTK_BOX (vbox), wid, 1, 1, 0); gtk_widget_show (wid); store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT); pevent_dialog_list = gtkutil_treeview_new (th, GTK_TREE_MODEL (store), NULL, COL_EVENT_NAME, _("Event"), COL_EVENT_TEXT, _("Text"), -1); sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (pevent_dialog_list)); g_signal_connect (G_OBJECT (sel), "changed", G_CALLBACK (pevent_dialog_select), store); pevent_dialog_twid = gtk_xtext_new (colors, 0); gtk_xtext_set_tint (GTK_XTEXT (pevent_dialog_twid), prefs.tint_red, prefs.tint_green, prefs.tint_blue); gtk_xtext_set_background (GTK_XTEXT (pevent_dialog_twid), channelwin_pix, prefs.transparent); pevent_dialog_entry = gtk_entry_new_with_max_length (255); g_signal_connect (G_OBJECT (pevent_dialog_entry), "activate", G_CALLBACK (pevent_dialog_update), pevent_dialog_twid); gtk_box_pack_start (GTK_BOX (bh), pevent_dialog_entry, 0, 0, 0); gtk_widget_show (pevent_dialog_entry); tbox = gtk_hbox_new (0, 0); gtk_container_add (GTK_CONTAINER (bh), tbox); gtk_widget_show (tbox); gtk_widget_set_usize (pevent_dialog_twid, 150, 20); gtk_container_add (GTK_CONTAINER (tbox), pevent_dialog_twid); gtk_xtext_set_font (GTK_XTEXT (pevent_dialog_twid), prefs.font_normal); wid = gtk_vscrollbar_new (GTK_XTEXT (pevent_dialog_twid)->adj); gtk_box_pack_start (GTK_BOX (tbox), wid, FALSE, FALSE, 0); show_and_unfocus (wid); gtk_widget_show (pevent_dialog_twid); hstore = gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING); pevent_dialog_hlist = gtkutil_treeview_new (bh, GTK_TREE_MODEL (hstore), NULL, 0, _("$ Number"), 1, _("Description"), -1); gtk_widget_show (pevent_dialog_hlist); pevent_dialog_fill (pevent_dialog_list); gtk_widget_show (pevent_dialog_list); hbox = gtk_hbutton_box_new (); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 2); /*wid = gtk_button_new_with_label (_("Save")); gtk_box_pack_end (GTK_BOX (hbox), wid, 0, 0, 0); gtk_signal_connect (GTK_OBJECT (wid), "clicked", GTK_SIGNAL_FUNC (pevent_save_cb), NULL); gtk_widget_show (wid);*/ gtkutil_button (hbox, GTK_STOCK_SAVE_AS, NULL, pevent_save_cb, (void *) 1, _("Save As...")); gtkutil_button (hbox, GTK_STOCK_OPEN, NULL, pevent_load_cb, (void *) 0, _("Load From...")); wid = gtk_button_new_with_label (_("Test All")); gtk_box_pack_end (GTK_BOX (hbox), wid, 0, 0, 0); g_signal_connect (G_OBJECT (wid), "clicked", G_CALLBACK (pevent_test_cb), pevent_dialog_twid); gtk_widget_show (wid); wid = gtk_button_new_from_stock (GTK_STOCK_OK); gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0); g_signal_connect (G_OBJECT (wid), "clicked", G_CALLBACK (pevent_ok_cb), NULL); gtk_widget_show (wid); gtk_widget_show (hbox); gtk_widget_show (pevent_dialog); }
void key_dialog_show () { GtkWidget *vbox, *hbox, *list, *vbox2, *wid, *wid2, *wid3, *hbox2; struct key_binding *kb; gchar *titles[] = { NULL, NULL, NULL, "1", "2" }; char temp[32]; int i; titles[0] = _("Mod"); titles[1] = _("Key"); titles[2] = _("Action"); if (key_dialog) { mg_bring_tofront (key_dialog); return; } key_dialog = mg_create_generic_tab ("editkeys", _("ZChat: Keyboard Shortcuts"), TRUE, FALSE, key_dialog_close, NULL, 560, 330, &vbox, 0); hbox = gtk_hbox_new (0, 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, 1, 1, 0); list = gtkutil_clist_new (5, titles, hbox, 0, key_dialog_sel_row, 0, NULL, 0, GTK_SELECTION_SINGLE); gtk_widget_set_usize (list, 400, 0); key_dialog_kb_clist = list; gtk_widget_show (hbox); kb = keys_root; gtk_clist_set_column_width (GTK_CLIST (list), 1, 50); gtk_clist_set_column_width (GTK_CLIST (list), 2, 120); gtk_clist_set_column_width (GTK_CLIST (list), 3, 50); gtk_clist_set_column_width (GTK_CLIST (list), 4, 50); while (kb) { titles[0] = key_make_mod_str (kb->mod, temp); titles[1] = kb->keyname; if (kb->action < 0 || kb->action > KEY_MAX_ACTIONS) titles[2] = _("<none>"); else titles[2] = key_actions[kb->action].name; if (kb->data1) titles[3] = kb->data1; else titles[3] = _("<none>"); if (kb->data2) titles[4] = kb->data2; else titles[4] = _("<none>"); gtk_clist_set_row_data (GTK_CLIST (list), gtk_clist_append (GTK_CLIST (list), titles), kb); kb = kb->next; } vbox2 = gtk_vbox_new (0, 2); gtk_box_pack_end (GTK_BOX (hbox), vbox2, 1, 1, 0); wid = gtk_button_new_with_label (_("Add New")); gtk_box_pack_start (GTK_BOX (vbox2), wid, 0, 0, 0); gtk_signal_connect (GTK_OBJECT (wid), "clicked", GTK_SIGNAL_FUNC (key_dialog_add_new), list); gtk_widget_show (wid); wid = gtk_button_new_with_label (_("Delete")); gtk_box_pack_start (GTK_BOX (vbox2), wid, 0, 0, 0); gtk_signal_connect (GTK_OBJECT (wid), "clicked", GTK_SIGNAL_FUNC (key_dialog_delete), list); gtk_widget_show (wid); gtk_widget_show (vbox2); wid = gtk_option_menu_new (); wid2 = gtk_menu_new (); for (i = 0; i <= KEY_MAX_ACTIONS; i++) { wid3 = gtk_menu_item_new_with_label (_(key_actions[i].name)); gtk_widget_show (wid3); gtk_menu_shell_append (GTK_MENU_SHELL (wid2), wid3); gtk_signal_connect (GTK_OBJECT (wid3), "activate", GTK_SIGNAL_FUNC (key_dialog_sel_act), GINT_TO_POINTER (i)); } gtk_option_menu_set_menu (GTK_OPTION_MENU (wid), wid2); gtk_option_menu_set_history (GTK_OPTION_MENU (wid), 0); gtk_box_pack_end (GTK_BOX (vbox2), wid, 0, 0, 0); gtk_widget_show (wid); key_dialog_act_menu = wid; key_dialog_tog_s = key_dialog_make_toggle (_("Shift"), key_dialog_tog_key, (void *) STATE_SHIFT, vbox2); key_dialog_tog_a = key_dialog_make_toggle (_("Alt"), key_dialog_tog_key, (void *) STATE_ALT, vbox2); key_dialog_tog_c = key_dialog_make_toggle (_("Ctrl"), key_dialog_tog_key, (void *) STATE_CTRL, vbox2); key_dialog_ent_key = key_dialog_make_entry (_("Key"), "key_press_event", key_dialog_set_key, NULL, vbox2); key_dialog_ent_d1 = key_dialog_make_entry (_("Data 1"), "activate", key_dialog_set_data, NULL, vbox2); key_dialog_ent_d2 = key_dialog_make_entry (_("Data 2"), "activate", key_dialog_set_data, (void *) 1, vbox2); hbox2 = gtk_hbox_new (0, 2); gtk_box_pack_end (GTK_BOX (vbox), hbox2, 0, 0, 1); wid = gtk_xtext_new (colors, 0); gtk_xtext_set_tint (GTK_XTEXT (wid), prefs.tint_red, prefs.tint_green, prefs.tint_blue); gtk_xtext_set_background (GTK_XTEXT (wid), channelwin_pix, prefs.transparent); gtk_widget_set_usize (wid, 0, 75); gtk_box_pack_start (GTK_BOX (hbox2), wid, 1, 1, 1); gtk_xtext_set_font (GTK_XTEXT (wid), prefs.font_normal); gtk_widget_show (wid); wid2 = gtk_vscrollbar_new (GTK_XTEXT (wid)->adj); gtk_box_pack_start (GTK_BOX (hbox2), wid2, 0, 0, 0); gtk_widget_show (wid2); gtk_widget_show (hbox2); key_dialog_text = wid; gtk_widget_show_all (key_dialog); }
int fe_dcc_open_recv_win (int passive) { GtkWidget *radio, *table, *vbox, *bbox, *view, *exp, *detailbox; GtkListStore *store; GSList *group; if (dccfwin.window) { if (!passive) mg_bring_tofront (dccfwin.window); return TRUE; } dccfwin.window = mg_create_generic_tab ("Transfers", _("conspire: Uploads and Downloads"), FALSE, TRUE, close_dcc_file_window, NULL, win_width, win_height, &vbox, 0); gtk_container_set_border_width (GTK_CONTAINER (dccfwin.window), 3); gtk_box_set_spacing (GTK_BOX (vbox), 3); store = gtk_list_store_new (N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, GDK_TYPE_COLOR); view = gtkutil_treeview_new (vbox, GTK_TREE_MODEL (store), NULL, -1); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); /* Up/Down Icon column */ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), -1, NULL, gtk_cell_renderer_pixbuf_new (), "pixbuf", COL_TYPE, NULL); dcc_add_column (view, COL_STATUS, COL_COLOR, _("Status"), FALSE); dcc_add_column (view, COL_FILE, COL_COLOR, _("File"), FALSE); dcc_add_column (view, COL_SIZE, COL_COLOR, _("Size"), TRUE); dcc_add_column (view, COL_POS, COL_COLOR, _("Position"), TRUE); dcc_add_column (view, COL_PERC, COL_COLOR, "%", TRUE); dcc_add_column (view, COL_SPEED, COL_COLOR, "KB/s", TRUE); dcc_add_column (view, COL_ETA, COL_COLOR, _("ETA"), FALSE); dcc_add_column (view, COL_NICK, COL_COLOR, _("Nick"), FALSE); dccfwin.list = view; dccfwin.store = store; dccfwin.sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); view_mode = VIEW_BOTH; gtk_tree_selection_set_mode (dccfwin.sel, GTK_SELECTION_MULTIPLE); if (!prefs.windows_as_tabs) g_signal_connect (G_OBJECT (dccfwin.window), "configure_event", G_CALLBACK (dcc_configure_cb), 0); g_signal_connect (G_OBJECT (dccfwin.sel), "changed", G_CALLBACK (dcc_row_cb), NULL); /* double click */ g_signal_connect (G_OBJECT (view), "row-activated", G_CALLBACK (dcc_dclick_cb), NULL); table = gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 16); gtk_box_pack_start (GTK_BOX (vbox), table, 0, 0, 0); radio = gtk_radio_button_new_with_mnemonic (NULL, _("Both")); g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_BOTH)); gtk_table_attach (GTK_TABLE (table), radio, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)); radio = gtk_radio_button_new_with_mnemonic (group, _("Uploads")); g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_UPLOAD)); gtk_table_attach (GTK_TABLE (table), radio, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)); radio = gtk_radio_button_new_with_mnemonic (group, _("Downloads")); g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_DOWNLOAD)); gtk_table_attach (GTK_TABLE (table), radio, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0); exp = gtk_expander_new (_("Details")); gtk_table_attach (GTK_TABLE (table), exp, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); detailbox = gtk_table_new (3, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (detailbox), 6); gtk_table_set_row_spacings (GTK_TABLE (detailbox), 2); gtk_container_set_border_width (GTK_CONTAINER (detailbox), 6); g_signal_connect (G_OBJECT (exp), "activate", G_CALLBACK (dcc_exp_cb), detailbox); gtk_table_attach (GTK_TABLE (table), detailbox, 0, 4, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); dccfwin.file_label = dcc_detail_label (_("File:"), detailbox, 0); dccfwin.address_label = dcc_detail_label (_("Address:"), detailbox, 1); bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 2); dccfwin.abort_button = gtkutil_button (bbox, GTK_STOCK_CANCEL, 0, abort_clicked, 0, _("Abort")); dccfwin.accept_button = gtkutil_button (bbox, GTK_STOCK_APPLY, 0, accept_clicked, 0, _("Accept")); dccfwin.resume_button = gtkutil_button (bbox, GTK_STOCK_REFRESH, 0, resume_clicked, 0, _("Resume")); dccfwin.open_button = gtkutil_button (bbox, 0, 0, browse_dcc_folder, 0, _("Open Folder...")); gtk_widget_set_sensitive (dccfwin.accept_button, FALSE); gtk_widget_set_sensitive (dccfwin.resume_button, FALSE); gtk_widget_set_sensitive (dccfwin.abort_button, FALSE); dcc_fill_window (3); gtk_widget_show_all (dccfwin.window); gtk_widget_hide (detailbox); return FALSE; }
void ignore_gui_open () { GtkWidget *vbox, *box, *stat_box, *frame; GtkWidget *view; GtkListStore *store; GtkTreeIter iter; const char *mask; gboolean priv, chan, notice, ctcp, dcc, invite, unignore; if (ignorewin) { mg_bring_tofront (ignorewin); return; } ignorewin = mg_create_generic_tab ("IgnoreList", _(DISPLAY_NAME": Ignore list"), FALSE, TRUE, close_ignore_gui_callback, NULL, 600, 256, &vbox, 0); gtkutil_destroy_on_esc (ignorewin); view = ignore_treeview_new (vbox); g_object_set_data (G_OBJECT (ignorewin), "view", view); frame = gtk_frame_new (_("Ignore Stats:")); gtk_widget_show (frame); stat_box = gtk_hbox_new (0, 2); gtk_container_set_border_width (GTK_CONTAINER (stat_box), 6); gtk_container_add (GTK_CONTAINER (frame), stat_box); gtk_widget_show (stat_box); num_chan = ignore_stats_entry (stat_box, _("Channel:"), ignored_chan); num_priv = ignore_stats_entry (stat_box, _("Private:"), ignored_priv); num_noti = ignore_stats_entry (stat_box, _("Notice:"), ignored_noti); num_ctcp = ignore_stats_entry (stat_box, _("CTCP:"), ignored_ctcp); num_invi = ignore_stats_entry (stat_box, _("Invite:"), ignored_invi); gtk_box_pack_start (GTK_BOX (vbox), frame, 0, 0, 5); box = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_SPREAD); gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (box), 5); gtk_widget_show (box); gtkutil_button(box, GTK_STOCK_NEW, 0, G_CALLBACK(ignore_new_entry_clicked), 0, _("Add...")); gtkutil_button(box, GTK_STOCK_DELETE, 0, G_CALLBACK(ignore_delete_entry_clicked), 0, _("Delete")); gtkutil_button(box, GTK_STOCK_CLEAR, 0, G_CALLBACK(ignore_clear_entry_clicked), 0, _("Clear")); store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (view))); auto ignores = get_ignore_list(); for(const auto & ig : ignores) { mask = ig.mask.c_str(); chan = (ig.type & ignore::IG_CHAN); priv = (ig.type & ignore::IG_PRIV); notice = (ig.type & ignore::IG_NOTI); ctcp = (ig.type & ignore::IG_CTCP); dcc = (ig.type & ignore::IG_DCC); invite = (ig.type & ignore::IG_INVI); unignore = (ig.type & ignore::IG_UNIG); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, MASK_COLUMN, mask, CHAN_COLUMN, chan, PRIV_COLUMN, priv, NOTICE_COLUMN, notice, CTCP_COLUMN, ctcp, DCC_COLUMN, dcc, INVITE_COLUMN, invite, UNIGNORE_COLUMN, unignore, -1); } gtk_widget_show (ignorewin); }