Esempio n. 1
0
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);
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
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);
}
Esempio n. 4
0
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);
}
Esempio n. 5
0
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);
}
Esempio n. 6
0
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);
}
Esempio n. 7
0
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);
}
Esempio n. 8
0
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 ();
}
Esempio n. 9
0
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);
}
Esempio n. 10
0
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);
}
Esempio n. 11
0
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);
}
Esempio n. 12
0
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.");
	}
}
Esempio n. 13
0
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;
	}
}
Esempio n. 14
0
void
plugingui_open (void)
{
    GtkWidget *view;
    GtkWidget *vbox, *action_area;

    if (plugin_window)
    {
        gtk_window_present (GTK_WINDOW (plugin_window));
        return;
    }

    plugin_window = gtk_dialog_new ();
    g_signal_connect (G_OBJECT (plugin_window), "destroy",
                      G_CALLBACK (plugingui_close), 0);
    gtk_window_set_default_size (GTK_WINDOW (plugin_window), 500, 250);
    vbox = GTK_DIALOG (plugin_window)->vbox;
    action_area = GTK_DIALOG (plugin_window)->action_area;
    gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
    gtk_window_set_position (GTK_WINDOW (plugin_window), GTK_WIN_POS_CENTER);
    gtk_window_set_title (GTK_WINDOW (plugin_window),
                          _("GChat: Plugins and Scripts"));

    view = plugingui_treeview_new (vbox);
    g_object_set_data (G_OBJECT (plugin_window), "view", view);

    gtkutil_button (action_area, GTK_STOCK_REVERT_TO_SAVED, NULL,
                    plugingui_loadbutton_cb, NULL, _("_Load..."));

    gtkutil_button (action_area, GTK_STOCK_DELETE, NULL,
                    plugingui_unload, NULL, _("_Unload"));

    gtkutil_button (action_area,
                    GTK_STOCK_CLOSE, NULL, plugingui_close_button,
                    NULL, _("_Close"));

    fe_pluginlist_update ();

    gtk_widget_show (plugin_window);
}
Esempio n. 15
0
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, &notify_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);
}
Esempio n. 16
0
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 ();
}
Esempio n. 17
0
void
wins_create_linkbuttons (GtkWidget *win, GtkWidget *box)
{
	GtkWidget *hbox;
	xchatwin *xw;

	xw = gtk_object_get_user_data (GTK_OBJECT (win));

	hbox = gtk_hbox_new (0, 0);
	gtk_box_pack_start (GTK_BOX (box), hbox, 0, 0, 0);
	gtk_widget_show (hbox);

	gtk_box_reorder_child (GTK_BOX (box), hbox, 0);

	xw->button_box = hbox;
	xw->button_box_box = box;

	wins_create_button (hbox, GNOME_STOCK_BUTTON_CANCEL, "X",
								_("Close this tab/window"), wins_X_cb, xw);

	wins_create_button (hbox, GNOME_STOCK_PIXMAP_REMOVE, "^",
								_("Link/DeLink this tab"), wins_link_cb, xw);

#ifdef USE_PANEL
	if (!nopanel)
	{
		GtkWidget *wid = gtkutil_button (win, GNOME_STOCK_PIXMAP_BOTTOM,
									 0, wins_panelize_cb, xw, 0);
		gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
		add_tip (wid, _("Panelize"));
	}
#endif

	if (!xw->is_toplevel)
	{
		wins_create_button (hbox, GNOME_STOCK_PIXMAP_BACK, "<",
								_("Move tab left"), wins_moveleft_cb, xw);

		wins_create_button (hbox, GNOME_STOCK_PIXMAP_FORWARD, ">",
								_("Move tab right"), wins_moveright_cb, xw);
	}
}
Esempio n. 18
0
static GtkWidget *
wins_create_button (GtkWidget *box, char *stock, char *label, char *tip,
							void *callback, void *userdata)
{
	GtkWidget *wid;

#ifdef USE_GNOME
	wid = gtkutil_button (box, stock, 0, callback, userdata, 0);
	gtk_box_pack_start (GTK_BOX (box), wid, 0, 0, 0);
#else
	wid = gtk_button_new_with_label (label);
	gtk_box_pack_start (GTK_BOX (box), wid, 0, 0, 0);
	gtk_signal_connect (GTK_OBJECT (wid), "clicked",
							  GTK_SIGNAL_FUNC (callback), userdata);
#endif
	show_and_unfocus (wid);
	add_tip (wid, tip);

	return wid;
}
Esempio n. 19
0
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);
}
Esempio n. 20
0
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);
}
Esempio n. 21
0
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);
}
Esempio n. 22
0
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;
}
Esempio n. 23
0
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 ();
}
Esempio n. 24
0
static void
cv_tabs_init (chanview *cv)
{
    GtkWidget *box, *hbox = NULL;
    GtkWidget *viewport;
    GtkWidget *outer;
    GtkWidget *button;

    if (cv->vertical)
        outer = gtk_vbox_new (0, 0);
    else
        outer = gtk_hbox_new (0, 0);
    ((tabview *)cv)->outer = outer;
    g_signal_connect (G_OBJECT (outer), "size_allocate",
                      G_CALLBACK (cv_tabs_sizealloc), cv);
/*      gtk_container_set_border_width (GTK_CONTAINER (outer), 2);*/
    gtk_widget_show (outer);

    viewport = gtk_viewport_new (0, 0);
    gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
    g_signal_connect (G_OBJECT (viewport), "size_request",
                      G_CALLBACK (cv_tabs_sizerequest), cv);
    g_signal_connect (G_OBJECT (viewport), "scroll_event",
                      G_CALLBACK (tab_scroll_cb), cv);
    gtk_box_pack_start (GTK_BOX (outer), viewport, 1, 1, 0);
    gtk_widget_show (viewport);

    if (cv->vertical)
        box = gtk_vbox_new (FALSE, 0);
    else
        box = gtk_hbox_new (FALSE, 0);
    ((tabview *)cv)->inner = box;
    gtk_container_add (GTK_CONTAINER (viewport), box);
    gtk_widget_show (box);

    /* if vertical, the buttons can be side by side */
    if (cv->vertical)
    {
        hbox = gtk_hbox_new (FALSE, 0);
        gtk_box_pack_start (GTK_BOX (outer), hbox, 0, 0, 0);
        gtk_widget_show (hbox);
    }

    /* make the Scroll buttons */
    ((tabview *)cv)->b2 = make_sbutton (cv->vertical ?
                                        GTK_ARROW_UP : GTK_ARROW_LEFT,
                                        tab_scroll_left_up_clicked,
                                        cv);

    ((tabview *)cv)->b1 = make_sbutton (cv->vertical ?
                                        GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
                                        tab_scroll_right_down_clicked,
                                        cv);

    if (hbox)
    {
        gtk_container_add (GTK_CONTAINER (hbox), ((tabview *)cv)->b2);
        gtk_container_add (GTK_CONTAINER (hbox), ((tabview *)cv)->b1);
    } else
    {
        gtk_box_pack_start (GTK_BOX (outer), ((tabview *)cv)->b2, 0, 0, 0);
        gtk_box_pack_start (GTK_BOX (outer), ((tabview *)cv)->b1, 0, 0, 0);
    }

    button = gtkutil_button (outer, GTK_STOCK_CLOSE, NULL, cv_tabs_xclick_cb,
                             cv, 0);
    gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
    gtk_widget_set_can_focus (button, FALSE);

    gtk_container_add (GTK_CONTAINER (cv->box), outer);
}
Esempio n. 25
0
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);
}
Esempio n. 26
0
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);
}
Esempio n. 27
0
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);
}
Esempio n. 28
0
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;
}