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 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 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 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); gtkutil_destroy_on_esc (plugin_window); 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")); gtkutil_button (hbox, GTK_STOCK_REFRESH, NULL, plugingui_reloadbutton_cb, view, _("_Reload")); fe_pluginlist_update (); gtk_widget_show_all (plugin_window); }
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); }
void chanlist_opengui (server *serv, bool 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, _(DISPLAY_NAME": Channel List (%s)"), serv->get_network (true).data()); 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) { if (prefs.hex_gui_chanlist_minusers < 1 || prefs.hex_gui_chanlist_minusers > 999999) { prefs.hex_gui_chanlist_minusers = 5; save_config(); } serv->gui->chanlist_minusers = prefs.hex_gui_chanlist_minusers; } if (!serv->gui->chanlist_maxusers) { if (prefs.hex_gui_chanlist_maxusers < 1 || prefs.hex_gui_chanlist_maxusers > 999999) { prefs.hex_gui_chanlist_maxusers = 9999; save_config(); } serv->gui->chanlist_maxusers = prefs.hex_gui_chanlist_maxusers; } serv->gui->chanlist_window = mg_create_generic_tab("ChanList", tbuf, FALSE, TRUE, G_CALLBACK(chanlist_closegui), serv, 640, 480, &vbox, serv); gtkutil_destroy_on_esc (serv->gui->chanlist_window); 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 (gtk_widget_get_parent (view)), 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, G_CALLBACK(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, G_CALLBACK(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, G_CALLBACK(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, G_CALLBACK(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); g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK(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); g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (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_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (wid), _("Simple Search")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (wid), _("Pattern Match (Wildcards)")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (wid), _("Regular Expression")); 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 (); gtk_entry_set_max_length (GTK_ENTRY(wid), 255); g_signal_connect (G_OBJECT (wid), "changed", G_CALLBACK (chanlist_find_cb), serv); g_signal_connect (G_OBJECT (wid), "activate", G_CALLBACK (chanlist_search_pressed), (gpointer) serv); gtk_table_attach (GTK_TABLE (table), wid, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GtkAttachOptions(), 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->gui); /* reset the counters. */ chanlist_reset_counters (*serv->gui); serv->gui->chanlist_tag = g_timeout_add (250, (GSourceFunc)chanlist_timeout, serv); if (do_refresh) chanlist_do_refresh (serv); chanlist_update_buttons (*serv->gui); gtk_widget_show (serv->gui->chanlist_window); gtk_widget_grab_focus (serv->gui->chanlist_refresh); }
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", _(DISPLAY_NAME": Uploads and Downloads"), FALSE, TRUE, close_dcc_file_window, NULL, win_width, win_height, &vbox, 0); gtkutil_destroy_on_esc (dccfwin.window); 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); gtk_tree_view_column_set_expand (gtk_tree_view_get_column (GTK_TREE_VIEW (view), COL_FILE), TRUE); gtk_tree_view_column_set_expand (gtk_tree_view_get_column (GTK_TREE_VIEW (view), COL_NICK), TRUE); 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.hex_gui_tab_utils) 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.clear_button = gtkutil_button (bbox, GTK_STOCK_CLEAR, 0, clear_completed, 0, _("Clear")); 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); }