summary refs log tree commit diff stats
path: root/win32/installer
AgeCommit message (Expand)Author
2013-09-25Update installer links to 2013 redistTingPing
2013-09-15Convert project files to vs2013Eustachy Kapusta
2013-08-04Remove VS Redistributable update version from installer linkEustachy Kapusta
2013-07-24Move optimization settings from all subsequent projects to hexchat.propsEustachy Kapusta
2013-05-03Add python3 pluginTingPing
2013-04-27Get rid of bundled beepBerke Viktor
2013-04-25win32: Moved PlatformToolset configuration to individual project files. It sh...Arnavion
2013-04-16Update installers as wellBerke Viktor
2013-04-14Add default beep sound, deploy on WindowsBerke Viktor
2013-04-14Really relocateBerke Viktor
2013-04-13Nuke WMPA, not supported by ExpressBerke Viktor
2013-04-13Get rid of multiple Perl versionsBerke Viktor
2013-04-11Don't call it package, it causes line breakBerke Viktor
2013-04-11It's official: VS2012.2 needs VS2012.1 redistBerke Viktor
2013-04-08I might regret this, but let's do the brave jumpBerke Viktor
2013-04-01Apparently XP won't work anymore, Uniscribe problem with the redistributableBerke Viktor
2013-04-01We all knew I'll forget something, right?Berke Viktor
2013-04-02Open the redist download page by default for the first MSVC releaseBerke Viktor
2013-04-02Don't open the same link twiceBerke Viktor
2013-04-02Open downloads for Perl and PythonBerke Viktor
2013-04-01Last cjstyles remnantsBerke Viktor
2013-04-01Remove old stuff, some preparation for soon-to-be-released Perl 5.18Berke Viktor
2013-04-01Remove another bunch of obsolete junkBerke Viktor
2013-04-01Nuke Lua and TclBerke Viktor
2013-04-01Get rid of installer skinningBerke Viktor
2013-03-23Revert "Migrator for servlist_ in the installers"Berke Viktor
2013-03-23Migrator for servlist_ in the installersBerke Viktor
2013-03-15Update changelog linksBerke Viktor
2013-03-15Add safe mode shortcutsBerke Viktor
2013-02-18Add HarfBuzz DLL to distBerke Viktor
2013-02-16Add vc redist to links, don't open links by default and cosmeticsBerke Viktor
2013-02-16Fix libwimp path in the installersBerke Viktor
2013-02-04Update installer to point to newsTingPing
2012-12-25add changelog to installerTingPing
2012-12-17remove hextray from installerTingPing
2012-11-12Get rid of the buggy, unmaintained and unused Lua and Tcl interfacesBerke Viktor
2012-11-12Prepare solution for Perl 5.16 VC buildBerke Viktor
2012-11-12Move HexChat L10n to share\locale where it should've been in the first placeBerke Viktor
2012-11-11Fix GTK-VS installersBerke Viktor
2012-11-03Installer migrator functions for xchat.conf -> hexchat.confBerke Viktor
2012-11-03Relocate hexchat.png and hexchat.ico and some more varname cleanupBerke Viktor
2012-10-29Make HexTray filename consistent with the restBerke Viktor
2012-10-25Get rid of the SASL pluginBerke Viktor
2012-10-22Add Windows version check to installer against overly frustrated Win2000 usersBerke Viktor
2012-10-22Change readme icon and add changelog icon as wellBerke Viktor
2012-10-22Add README for people who still can't use GoogleBerke Viktor
2012-10-21Keep the installer component lists sortedBerke Viktor
2012-10-21Rename WinSys on the code levelBerke Viktor
2012-10-21Move warning level to property sheetBerke Viktor
2012-10-13Accept license agreement by defaultBerke Viktor
a id='n216' href='#n216'>216 217
218
219
220
221
222
223
224
225


































                                                                            
                             














































































































                                                                               
                                                                                                                                        






                                
                       








                                                                                       








                                                                                              





















                                                    
                                                                                           



















                                                                                                                






                                                                                                       
 
/* X-Chat
 * Copyright (C) 1998 Peter Zelezny.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "fe-gtk.h"

#include <gtk/gtkhbox.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkhbbox.h>
#include <gtk/gtkscrolledwindow.h>

#include <gtk/gtkliststore.h>
#include <gtk/gtktreeview.h>
#include <gtk/gtktreeselection.h>
#include <gtk/gtkcellrenderertext.h>

#include "../common/xchat.h"
#include "../common/xchatc.h"
#include "../common/cfgfiles.h"
#include "../common/fe.h"
#include "../common/url.h"
#include "../common/tree.h"
#include "gtkutil.h"
#include "menu.h"
#include "maingui.h"
#include "urlgrab.h"

/* model for the URL treeview */
enum
{
	URL_COLUMN,
	N_COLUMNS
};

static GtkWidget *urlgrabberwindow = 0;


static gboolean
url_treeview_url_clicked_cb (GtkWidget *view, GdkEventButton *event,
                             gpointer data)
{
	GtkTreeIter iter;
	gchar *url;

	if (!event ||
	    !gtkutil_treeview_get_selected (GTK_TREE_VIEW (view), &iter,
	                                    URL_COLUMN, &url, -1))
	{
		return FALSE;
	}
	
	switch (event->button)
	{
		case 1:
			if (event->type == GDK_2BUTTON_PRESS)
				fe_open_url (url);
			break;
		case 3:
			menu_urlmenu (event, url);
			break;
		default:
			break;
	}
	g_free (url);

	return FALSE;
}

static GtkWidget *
url_treeview_new (GtkWidget *box)
{
	GtkListStore *store;
	GtkWidget *view;

	store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
	g_return_val_if_fail (store != NULL, NULL);

	view = gtkutil_treeview_new (box, GTK_TREE_MODEL (store), NULL,
	                             URL_COLUMN, _("URL"), -1);
	g_signal_connect (G_OBJECT (view), "button_press_event",
	                  G_CALLBACK (url_treeview_url_clicked_cb), NULL);
	/* don't want column headers */
	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
	gtk_widget_show (view);
	return view;
}

static void
url_closegui (GtkWidget *wid, gpointer userdata)
{
	urlgrabberwindow = 0;
}

static void
url_button_clear (void)
{
	GtkListStore *store;
	
	url_clear ();
	store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (urlgrabberwindow),
	                                           "model"));
	gtk_list_store_clear (store);
}

static void
url_button_copy (GtkWidget *widget, gpointer data)
{
	GtkTreeView *view = GTK_TREE_VIEW (data);
	GtkTreeIter iter;
	gchar *url = NULL;

	if (gtkutil_treeview_get_selected (view, &iter, URL_COLUMN, &url, -1))
	{
		gtkutil_copy_to_clipboard (GTK_WIDGET (view), NULL, url);
		g_free (url);
	}
}

static void
url_save_callback (void *arg1, char *file)
{
	if (file)
		url_save (file, "w", TRUE);
}

static void
url_button_save (void)
{
	gtkutil_file_req (_("Select an output filename"),
							url_save_callback, NULL, get_xdir_utf8 (), NULL, FRF_WRITE|FRF_FILTERISINITIAL);
}

void
fe_url_add (const char *urltext)
{
	GtkListStore *store;
	GtkTreeIter iter;
	gboolean valid;
	
	if (urlgrabberwindow)
	{
		store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (urlgrabberwindow),
		                                           "model"));
		gtk_list_store_prepend (store, &iter);
		gtk_list_store_set (store, &iter,
		                    URL_COLUMN, urltext,
		                    -1);

		/* remove any overflow */
		if (prefs.url_grabber_limit > 0)
		{
			valid = gtk_tree_model_iter_nth_child (
				GTK_TREE_MODEL (store), &iter, NULL, prefs.url_grabber_limit);
			while (valid)
				valid = gtk_list_store_remove (store, &iter);
		}
	}
}

static int
populate_cb (char *urltext, gpointer userdata)
{
	fe_url_add (urltext);
	return TRUE;
}

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);
	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_STOCK_CLEAR,
						 _("Clear list"), url_button_clear, 0, _("Clear"));
	gtkutil_button (hbox, GTK_STOCK_COPY,
						 _("Copy selected URL"), url_button_copy, view, _("Copy"));
	gtkutil_button (hbox, GTK_STOCK_SAVE_AS,
						 _("Save list to a file"), url_button_save, 0, _("Save As..."));

	gtk_widget_show (urlgrabberwindow);

	if (prefs.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.");
	}
}