xchat-gnome r2655 - in trunk: . plugins/notification plugins/notify-osd plugins/python plugins/url_scraper src/common src/fe-gnome



Author: cosimoc
Date: Sat Sep  6 00:38:11 2008
New Revision: 2655
URL: http://svn.gnome.org/viewvc/xchat-gnome?rev=2655&view=rev

Log:
2008-09-06  Cosimo Cecchi  <cosimoc gnome org>

	* plugins/notification/notification.c:
	* plugins/notify-osd/notify-osd.c:
	* plugins/python/Makefile.am:
	* plugins/python/python.c: (Util_Autoload):
	* plugins/url_scraper/urlscraper.c: (url_open):
	* src/common/*
	* src/fe-gnome/*
	General code cleanup. Fix many GCC warnings and drop libgnome usage
	in favour of more recent functions where possible (#551041).


Modified:
   trunk/ChangeLog
   trunk/plugins/notification/notification.c
   trunk/plugins/notify-osd/notify-osd.c
   trunk/plugins/python/Makefile.am
   trunk/plugins/python/python.c
   trunk/plugins/url_scraper/urlscraper.c
   trunk/src/common/ctcp.c
   trunk/src/common/dcc.c
   trunk/src/common/network.c
   trunk/src/common/outbound.c
   trunk/src/common/plugin-timer.c
   trunk/src/common/proto-irc.c
   trunk/src/common/server.c
   trunk/src/common/text.c
   trunk/src/common/url.c
   trunk/src/common/util.c
   trunk/src/fe-gnome/connect-dialog.c
   trunk/src/fe-gnome/conversation-panel.c
   trunk/src/fe-gnome/fe-gnome.c
   trunk/src/fe-gnome/gui.c
   trunk/src/fe-gnome/main-window.c
   trunk/src/fe-gnome/palette.c
   trunk/src/fe-gnome/preferences.c
   trunk/src/fe-gnome/text-entry.c
   trunk/src/fe-gnome/userlist-gui.c
   trunk/src/fe-gnome/xg-plugin.h
   trunk/src/fe-gnome/xtext.c

Modified: trunk/plugins/notification/notification.c
==============================================================================
--- trunk/plugins/notification/notification.c	(original)
+++ trunk/plugins/notification/notification.c	Sat Sep  6 00:38:11 2008
@@ -25,7 +25,6 @@
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #include <gconf/gconf-client.h>
-#include <libgnome/gnome-program.h>
 #include <dlfcn.h>
 
 #include "navigation-tree.h"

Modified: trunk/plugins/notify-osd/notify-osd.c
==============================================================================
--- trunk/plugins/notify-osd/notify-osd.c	(original)
+++ trunk/plugins/notify-osd/notify-osd.c	Sat Sep  6 00:38:11 2008
@@ -22,8 +22,8 @@
 
 #include <config.h>
 #include <libnotify/notify.h>
-#include <libgnome/gnome-i18n.h>
 #include <string.h>
+#include <glib/gi18n.h>
 #include "xchat-plugin.h"
 #include "xg-plugin.h"
 

Modified: trunk/plugins/python/Makefile.am
==============================================================================
--- trunk/plugins/python/Makefile.am	(original)
+++ trunk/plugins/python/Makefile.am	Sat Sep  6 00:38:11 2008
@@ -4,7 +4,8 @@
 python_la_SOURCES = python.c
 
 python_la_CPPFLAGS = \
-	-I$(srcdir)/..		\
+	-I$(srcdir)/..			\
+        -I$(top_srcdir)/src/fe-gnome	\
 	$(AM_CPPFLAGS)
 
 python_la_CFLAGS = \

Modified: trunk/plugins/python/python.c
==============================================================================
--- trunk/plugins/python/python.c	(original)
+++ trunk/plugins/python/python.c	Sat Sep  6 00:38:11 2008
@@ -53,6 +53,7 @@
 
 #include <config.h>
 #include <glib.h>
+#include <glib/gstdio.h>
 #include <glib/gi18n.h>
 #include <string.h>
 #include <unistd.h>
@@ -61,6 +62,7 @@
 #include <dirent.h>
 
 #include "xchat-plugin.h"
+#include "xg-plugin.h"
 #include "Python.h"
 #include "structmember.h"
 #include "pythread.h"
@@ -223,6 +225,11 @@
 /* ===================================================================== */
 /* Function declarations */
 
+
+void xchat_plugin_get_info   (char **plugin_name, char **plugin_desc, char **plugin_version, void **reserved);
+int  xchat_plugin_init       (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg);
+int  xchat_plugin_deinit     (void);
+
 static PyObject *Util_BuildList(char *word[]);
 static void Util_Autoload();
 static char *Util_Expand(char *filename);
@@ -368,7 +375,7 @@
 	/* fallback for pre-2.0.9 xchat */
 	if (!dir_name)
 		dir_name = xchat_get_info(ph, "xchatdir");
-	if (chdir(dir_name) != 0)
+	if (g_chdir(dir_name) != 0)
 		return;
 	dir = opendir(".");
 	if (dir == NULL)
@@ -379,7 +386,7 @@
 			Command_PyLoad(ent->d_name);
 	}
 	closedir(dir);
-	chdir(oldcwd);
+	g_chdir(oldcwd);
 }
 
 static char *

Modified: trunk/plugins/url_scraper/urlscraper.c
==============================================================================
--- trunk/plugins/url_scraper/urlscraper.c	(original)
+++ trunk/plugins/url_scraper/urlscraper.c	Sat Sep  6 00:38:11 2008
@@ -5,7 +5,6 @@
 #include <gtk/gtk.h>
 #include <stdlib.h>
 #include <string.h>
-#include <libgnome/gnome-url.h>
 #include <gconf/gconf-client.h>
 #include <time.h>
 
@@ -175,7 +174,12 @@
 	if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
 		gtk_tree_model_get (model, &iter, 3, &cur_url, 4, &isurl, -1);
 		if (isurl)
-			gnome_url_show (cur_url, &err);
+			gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (treeview)),
+				      cur_url, gtk_get_current_event_time (), &err);
+		if (err) {
+			g_warning ("Unable to open %s: %s", cur_url, err->message);
+			g_error_free (err);
+		}
 	}
 }
 

Modified: trunk/src/common/ctcp.c
==============================================================================
--- trunk/src/common/ctcp.c	(original)
+++ trunk/src/common/ctcp.c	Sat Sep  6 00:38:11 2008
@@ -44,7 +44,7 @@
 	conf = strdup (conf);
 	/* process %C %B etc */
 	check_special_chars (conf, TRUE);
-	auto_insert (tbuf, sizeof (tbuf), conf, word, word_eol, "", "", word_eol[5],
+	auto_insert (tbuf, sizeof (tbuf), (unsigned char *) conf, word, word_eol, "", "", word_eol[5],
 					 server_get_network (sess->server, TRUE), "", "", nick);
 	free (conf);
 	handle_command (sess, tbuf, FALSE);

Modified: trunk/src/common/dcc.c
==============================================================================
--- trunk/src/common/dcc.c	(original)
+++ trunk/src/common/dcc.c	Sat Sep  6 00:38:11 2008
@@ -1315,7 +1315,7 @@
 		{
 			fe_input_remove (dcc->iotag);
 			dcc->iotag = 0;
-			PrintText (dcc->serv->front_session, proxy->buffer);
+			PrintText (dcc->serv->front_session, (char *) proxy->buffer);
 			dcc->dccstat = STAT_FAILED;
 			fe_dcc_update (dcc);
 			return TRUE;
@@ -1337,7 +1337,7 @@
 					break;
 				}
 				if (proxy->bufferused > 1)
-					PrintText (dcc->serv->front_session, proxy->buffer);
+					PrintText (dcc->serv->front_session, (char *) proxy->buffer);
 				proxy->bufferused = 0;
 			}
 			else

Modified: trunk/src/common/network.c
==============================================================================
--- trunk/src/common/network.c	(original)
+++ trunk/src/common/network.c	Sat Sep  6 00:38:11 2008
@@ -375,7 +375,7 @@
 	struct sockaddr_in addr;
 	int len = sizeof (addr);
 
-	if (getsockname (sok4, (struct sockaddr *)&addr, &len) == -1)
+	if (getsockname (sok4, (struct sockaddr *)&addr, (unsigned int *) &len) == -1)
 		return -1;
 	return addr.sin_port;
 }

Modified: trunk/src/common/outbound.c
==============================================================================
--- trunk/src/common/outbound.c	(original)
+++ trunk/src/common/outbound.c	Sat Sep  6 00:38:11 2008
@@ -1259,7 +1259,7 @@
 	int idx = 2;
 	int len;
 	int pos = 0xffff;
-	int state;
+	int state = 0;
 	int toggle = FALSE;
 	int enable = TRUE;
 	int markup = FALSE;
@@ -2071,7 +2071,7 @@
 static int
 cmd_gui (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 {
-	switch (str_ihash (word[2]))
+	switch (str_ihash ((unsigned char *) word[2]))
 	{
 	case 0x058b836e: fe_ctrl_gui (sess, 8, 0); break; /* APPLY */
 	case 0xac1eee45: fe_ctrl_gui (sess, 7, 2); break; /* ATTACH */
@@ -4067,7 +4067,7 @@
 user_command (session * sess, char *tbuf, char *cmd, char *word[],
 				  char *word_eol[])
 {
-	if (!auto_insert (tbuf, 2048, cmd, word, word_eol, "", sess->channel, "",
+	if (!auto_insert (tbuf, 2048, (unsigned char *) cmd, word, word_eol, "", sess->channel, "",
 							server_get_network (sess->server, TRUE), "",
 							sess->server->nick, ""))
 	{

Modified: trunk/src/common/plugin-timer.c
==============================================================================
--- trunk/src/common/plugin-timer.c	(original)
+++ trunk/src/common/plugin-timer.c	Sat Sep  6 00:38:11 2008
@@ -2,6 +2,7 @@
 #include <string.h>
 #include <glib.h>
 #include "xchat-plugin.h"
+#include "plugin-timer.h"
 
 #ifdef WIN32
 #define strcasecmp stricmp

Modified: trunk/src/common/proto-irc.c
==============================================================================
--- trunk/src/common/proto-irc.c	(original)
+++ trunk/src/common/proto-irc.c	Sat Sep  6 00:38:11 2008
@@ -33,6 +33,7 @@
 #include "modes.h"
 #include "notify.h"
 #include "plugin.h"
+#include "proto-irc.h"
 #include "server.h"
 #include "text.h"
 #include "outbound.h"

Modified: trunk/src/common/server.c
==============================================================================
--- trunk/src/common/server.c	(original)
+++ trunk/src/common/server.c	Sat Sep  6 00:38:11 2008
@@ -911,7 +911,6 @@
 	char outbuf[512];
 	char host[100];
 	char ip[100];
-	char *p;
 
 	waitline2 (source, tbuf, sizeof tbuf);
 
@@ -1198,8 +1197,8 @@
 	if (buf[1] == 90)
 		return 0;
 
-	snprintf (buf, sizeof (buf), "SOCKS\tServer reported error %d,%d.\n", buf[0], buf[1]);
-	proxy_error (print_fd, buf);
+	snprintf ((char *) buf, sizeof ((char *) buf), "SOCKS\tServer reported error %d,%d.\n", buf[0], buf[1]);
+	proxy_error (print_fd, (char *) buf);
 	return 1;
 }
 
@@ -1299,10 +1298,10 @@
 	if (buf[0] != 5 || buf[1] != 0)
 	{
 		if (buf[1] == 2)
-			snprintf (buf, sizeof (buf), "SOCKS\tProxy refused to connect to host (not allowed).\n");
+			snprintf ((char *) buf, sizeof ((char *) buf), "SOCKS\tProxy refused to connect to host (not allowed).\n");
 		else
-			snprintf (buf, sizeof (buf), "SOCKS\tProxy failed to connect to host (error %d).\n", buf[1]);
-		proxy_error (print_fd, buf);
+			snprintf ((char *) buf, sizeof ((char *) buf), "SOCKS\tProxy failed to connect to host (error %d).\n", buf[1]);
+		proxy_error (print_fd, (char *) buf);
 		return 1;
 	}
 	if (buf[3] == 1)	/* IPV4 32bit address */

Modified: trunk/src/common/text.c
==============================================================================
--- trunk/src/common/text.c	(original)
+++ trunk/src/common/text.c	Sat Sep  6 00:38:11 2008
@@ -678,7 +678,7 @@
 	};
 
 	if (len == -1)
-		len = strlen (text);
+		len = strlen ((char *) text);
 
 	/* worst case scenario: every byte turns into 3 bytes */
 	res = output = g_malloc ((len * 3) + 1);
@@ -742,13 +742,13 @@
 	if (prefs.utf8_locale)
 #endif
 		/* fallback to iso-8859-1 */
-		utf = iso_8859_1_to_utf8 (*text, *len, &utf_len);
+		utf = iso_8859_1_to_utf8 ((char *) *text, *len, &utf_len);
 	else
 	{
 		/* fallback to locale */
 		utf = g_locale_to_utf8 (*text, *len, 0, &utf_len, NULL);
 		if (!utf)
-			utf = iso_8859_1_to_utf8 (*text, *len, &utf_len);
+			utf = iso_8859_1_to_utf8 ((char *) *text, *len, &utf_len);
 	}
 
 	if (!utf) 

Modified: trunk/src/common/url.c
==============================================================================
--- trunk/src/common/url.c	(original)
+++ trunk/src/common/url.c	Sat Sep  6 00:38:11 2008
@@ -217,7 +217,7 @@
 			l = suffix[i].len;
 			if (len > l)
 			{
-				const unsigned char *p = &word[len - l];
+				const unsigned char *p = (unsigned char *) &word[len - l];
 				int j;
 
 				/* This is pretty much strncasecmp(). */

Modified: trunk/src/common/util.c
==============================================================================
--- trunk/src/common/util.c	(original)
+++ trunk/src/common/util.c	Sat Sep  6 00:38:11 2008
@@ -1672,7 +1672,7 @@
 guint32
 str_ihash (const unsigned char *key)
 {
-	const char *p = key;
+	const unsigned char *p = key;
 	guint32 h = rfc_tolowertab [(guint)*p];
 
 	if (h)

Modified: trunk/src/fe-gnome/connect-dialog.c
==============================================================================
--- trunk/src/fe-gnome/connect-dialog.c	(original)
+++ trunk/src/fe-gnome/connect-dialog.c	Sat Sep  6 00:38:11 2008
@@ -108,7 +108,7 @@
 				                        GTK_MESSAGE_WARNING,
 				                        GTK_BUTTONS_CLOSE,
 				                        _("This network doesn't have a server defined."));
-			gtk_message_dialog_format_secondary_text (GTK_DIALOG (warning_dialog),
+			gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (warning_dialog),
 			                                          _("Please add at least one server to the %s network."),
 			                                          net->name);
 			gtk_dialog_run (GTK_DIALOG (warning_dialog));

Modified: trunk/src/fe-gnome/conversation-panel.c
==============================================================================
--- trunk/src/fe-gnome/conversation-panel.c	(original)
+++ trunk/src/fe-gnome/conversation-panel.c	Sat Sep  6 00:38:11 2008
@@ -23,7 +23,6 @@
 #include <gtk/gtk.h>
 #include <gconf/gconf.h>
 #include <gconf/gconf-client.h>
-#include <libgnomeui/gnome-stock-icons.h>
 
 #include "conversation-panel.h"
 #include "gui.h"
@@ -162,13 +161,15 @@
 	gboolean        redundant_nickstamps;
 };
 
+#define STOCK_MAIL_SEND "mail-send"
+
 static GtkActionEntry url_actions[] = {
 	{ "TextURLOpen", GTK_STOCK_OPEN, N_("_Open Link in Browser"), NULL, NULL, G_CALLBACK (open_url) },
 	{ "TextURLCopy", GTK_STOCK_COPY, N_("_Copy Link Location"),   NULL, NULL, G_CALLBACK (copy_text) },
 };
 
 static GtkActionEntry email_actions[] = {
-	{ "TextEmailSend", GNOME_STOCK_MAIL, N_("Se_nd Message To..."), NULL, NULL, G_CALLBACK (send_email) },
+	{ "TextEmailSend", STOCK_MAIL_SEND, N_("Se_nd Message To..."), NULL, NULL, G_CALLBACK (send_email) },
         { "TextEmailCopy", GTK_STOCK_COPY,   N_("_Copy Address"),       NULL, NULL, G_CALLBACK (copy_text) },
 };
 
@@ -862,7 +863,6 @@
 static void
 drop_paste (ConversationPanel *panel)
 {
-	GFile *file;
 	gboolean res;
 	char *contents;
 	const char *uri = panel->priv->dropped_files->data;
@@ -911,7 +911,6 @@
 static gboolean
 uri_is_text (gchar *uri)
 {
-	gchar *mime;
 	GFile *file;
 	GFileInfo *info;
 	gboolean is_text = FALSE;

Modified: trunk/src/fe-gnome/fe-gnome.c
==============================================================================
--- trunk/src/fe-gnome/fe-gnome.c	(original)
+++ trunk/src/fe-gnome/fe-gnome.c	Sat Sep  6 00:38:11 2008
@@ -23,7 +23,7 @@
 #include <glib/gi18n.h>
 #include <string.h>
 #include <glib.h>
-#include <gnome.h>
+#include <libgnomeui/libgnomeui.h>
 #include <gconf/gconf-client.h>
 #include "gui.h"
 #include "navigation-tree.h"
@@ -441,7 +441,7 @@
 	}
 
 	conversation_panel_print (CONVERSATION_PANEL (gui.conversation_panel),
-	                          sess, (guchar*) text, prefs.indent_nicks);
+	                          sess, text, prefs.indent_nicks);
 	sess->new_data = TRUE;
 	navigation_model_set_hilight (gui.tree_model, sess);
 	if (sess->nick_said) {
@@ -927,10 +927,10 @@
 	screen = gtk_widget_get_screen (gui.main_window);
 	if (strstr (url, "://") == NULL) {
 		gchar *newword = g_strdup_printf ("http://%s";, url);
-		gnome_url_show_on_screen (newword, screen, &err);
+		gtk_show_uri (screen, newword, gtk_get_current_event_time (), &err);
 		g_free (newword);
 	} else {
-		gnome_url_show_on_screen (url, screen, &err);
+		gtk_show_uri (screen, url, gtk_get_current_event_time (), &err);
 	}
 
 	if (err != NULL) {

Modified: trunk/src/fe-gnome/gui.c
==============================================================================
--- trunk/src/fe-gnome/gui.c	(original)
+++ trunk/src/fe-gnome/gui.c	Sat Sep  6 00:38:11 2008
@@ -58,8 +58,6 @@
 gboolean
 initialize_gui_2 (void)
 {
-	GtkWidget *widget;
-
 	gtk_window_set_default_icon_name ("xchat-gnome");
 
 	gui.current_session = NULL;

Modified: trunk/src/fe-gnome/main-window.c
==============================================================================
--- trunk/src/fe-gnome/main-window.c	(original)
+++ trunk/src/fe-gnome/main-window.c	Sat Sep  6 00:38:11 2008
@@ -22,7 +22,6 @@
 #include <config.h>
 #include <glib/gi18n.h>
 #include <string.h>
-#include <libgnome/libgnome.h>
 #include <gconf/gconf-client.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
@@ -502,7 +501,9 @@
 {
 	GError *error = NULL;
 
-	gnome_help_display_with_doc_id (NULL, "xchat-gnome", "xchat-gnome.xml", NULL, &error);
+	gtk_show_uri (gtk_widget_get_screen (gui.main_window),
+		      "ghelp:xchat-gnome",
+		      gtk_get_current_event_time (), &error);
 	if (error) {
 		error_dialog (_("Error showing help"), error->message);
 		g_error_free (error);

Modified: trunk/src/fe-gnome/palette.c
==============================================================================
--- trunk/src/fe-gnome/palette.c	(original)
+++ trunk/src/fe-gnome/palette.c	Sat Sep  6 00:38:11 2008
@@ -21,6 +21,7 @@
 
 #include <config.h>
 #include <glib/gi18n.h>
+#include <gtk/gtk.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -28,7 +29,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <gnome.h>
 #include <math.h>
 #include "palette.h"
 #include "preferences.h"

Modified: trunk/src/fe-gnome/preferences.c
==============================================================================
--- trunk/src/fe-gnome/preferences.c	(original)
+++ trunk/src/fe-gnome/preferences.c	Sat Sep  6 00:38:11 2008
@@ -69,6 +69,20 @@
 	}
 }
 
+/*
+ * This goes through the mechanics of hooking up a gconf notify for
+ * the given key, and also calls the callback once to populate the
+ * initial value.
+ */
+static void hook_preference (GConfClient *client, GConfEntry entry, gchar *path,
+			     GConfClientNotifyFunc callback, gpointer preference)
+{
+	entry.key = path;
+	callback (client, 0, &entry, preference);
+	gconf_client_notify_add (client, entry.key, callback,
+	                         preference, NULL, NULL);
+}
+
 void
 load_preferences (void)
 {
@@ -78,33 +92,19 @@
 	gconf_client_notify_add (client, "/apps/xchat/irc/nickname",
 	                         nickname_changed, NULL, NULL, NULL);
 
-	/*
-	 * This goes through the mechanics of hooking up a gconf notify for
-	 * the given key, and also calls the callback once to populate the
-	 * initial value.
-	 */
-	void hook_preference (gchar *path, GConfClientNotifyFunc callback,
-	                      gpointer preference)
-	{
-		entry.key = path;
-		callback (client, 0, &entry, preference);
-		gconf_client_notify_add (client, entry.key, callback,
-		                         preference, NULL, NULL);
-	}
-
-	hook_preference("/apps/xchat/irc/realname",
+	hook_preference(client, entry, "/apps/xchat/irc/realname",
 	                string_preference_changed, prefs.realname);
-	hook_preference("/apps/xchat/irc/awaymsg",
+	hook_preference(client, entry, "/apps/xchat/irc/awaymsg",
 	                string_preference_changed, prefs.awayreason);
-	hook_preference("/apps/xchat/irc/quitmsg",
+	hook_preference(client, entry, "/apps/xchat/irc/quitmsg",
 	                string_preference_changed, prefs.quitreason);
-	hook_preference("/apps/xchat/irc/partmsg",
+	hook_preference(client, entry, "/apps/xchat/irc/partmsg",
 	                string_preference_changed, prefs.partreason);
-	hook_preference("/apps/xchat/irc/showcolors",
+	hook_preference(client, entry, "/apps/xchat/irc/showcolors",
 	                showcolors_changed, NULL);
-	hook_preference("/apps/xchat/irc/colorize_nicknames",
+	hook_preference(client, entry, "/apps/xchat/irc/colorize_nicknames",
 			colorize_nicknames_changed, NULL);
-	hook_preference("/apps/xchat/irc/color_scheme",
+	hook_preference(client, entry, "/apps/xchat/irc/color_scheme",
 	                colors_changed, NULL);
 
 	g_object_unref (client);

Modified: trunk/src/fe-gnome/text-entry.c
==============================================================================
--- trunk/src/fe-gnome/text-entry.c	(original)
+++ trunk/src/fe-gnome/text-entry.c	Sat Sep  6 00:38:11 2008
@@ -91,6 +91,21 @@
 	widget_class->grab_focus = text_entry_grab_focus;
 }
 
+/* copied from eel-glib-extensions.c */
+
+static GList *
+g_list_from_g_slist (GSList *slist)
+{
+	GList *list;
+	GSList *node;
+
+	list = NULL;
+	for (node = slist; node != NULL; node = node->next) {
+		list = g_list_prepend (list, node->data);
+	}
+	return g_list_reverse (list);
+}
+
 static void
 text_entry_init (TextEntry *entry)
 {
@@ -100,6 +115,7 @@
 	gboolean enable_spellcheck;
 	GSList *languages;
 	GError *err  = NULL;
+	GList *real_command_list;
 
 	g_signal_connect_after (G_OBJECT (entry), "key_press_event",         G_CALLBACK (text_entry_key_press),         NULL);
 	g_signal_connect       (G_OBJECT (entry), "activate",                G_CALLBACK (text_entry_activate),          NULL);
@@ -112,7 +128,9 @@
 
 	/* Initialize & populate a GCompletion for commands */
 	entry->priv->command_completion = g_completion_new (NULL);
-	g_completion_add_items (entry->priv->command_completion, command_list);
+	real_command_list = g_list_from_g_slist (command_list);
+	g_completion_add_items (entry->priv->command_completion, real_command_list);
+	g_list_free (real_command_list);
 	for (i = 0; xc_cmds[i].name != NULL; i++) {
 		items = g_list_prepend (items, xc_cmds[i].name);
 	}
@@ -477,7 +495,7 @@
 			g_free (printtext);
 			printtext = npt;
 		}
-		conversation_panel_print (CONVERSATION_PANEL (gui.conversation_panel), text_entry->priv->current, (guchar *) printtext, TRUE);
+		conversation_panel_print (CONVERSATION_PANEL (gui.conversation_panel), text_entry->priv->current, printtext, TRUE);
 		g_free (printtext);
 
 		if (new_prefix && strcasecmp (prefix, new_prefix) != 0) {
@@ -580,7 +598,7 @@
 			g_free (printtext);
 			printtext = npt;
 		}
-		conversation_panel_print (CONVERSATION_PANEL (gui.conversation_panel), text_entry->priv->current, (guchar *) printtext, TRUE);
+		conversation_panel_print (CONVERSATION_PANEL (gui.conversation_panel), text_entry->priv->current, printtext, TRUE);
 		g_free (printtext);
 
 		if (strcasecmp (prefix, new_prefix) != 0) {

Modified: trunk/src/fe-gnome/userlist-gui.c
==============================================================================
--- trunk/src/fe-gnome/userlist-gui.c	(original)
+++ trunk/src/fe-gnome/userlist-gui.c	Sat Sep  6 00:38:11 2008
@@ -21,8 +21,8 @@
 
 #include <config.h>
 #include <glib/gi18n.h>
-#include <gnome.h>
 #include <string.h>
+#include <gdk/gdkkeysyms.h>
 #include "userlist-gui.h"
 #include "pixmaps.h"
 #include "palette.h"
@@ -473,7 +473,6 @@
 	GtkTreePath *path = NULL;
 	GtkTreeIter iter;
 	struct User *user = NULL;
-	char *markup;
 
 	if (!gtk_tree_view_get_tooltip_context (tree_view, &x, &y,
 						keyboard_tip,

Modified: trunk/src/fe-gnome/xg-plugin.h
==============================================================================
--- trunk/src/fe-gnome/xg-plugin.h	(original)
+++ trunk/src/fe-gnome/xg-plugin.h	Sat Sep  6 00:38:11 2008
@@ -19,6 +19,7 @@
  *
  */
 
+#include <gtk/gtk.h>
 #include "navigation-tree.h"
 #include "../common/xchat.h"
 

Modified: trunk/src/fe-gnome/xtext.c
==============================================================================
--- trunk/src/fe-gnome/xtext.c	(original)
+++ trunk/src/fe-gnome/xtext.c	Sat Sep  6 00:38:11 2008
@@ -145,7 +145,6 @@
 static void gtk_xtext_recalc_widths (xtext_buffer *buf, int);
 static void gtk_xtext_fix_indent (xtext_buffer *buf);
 static int gtk_xtext_find_subline (GtkXText *xtext, textentry *ent, int line);
-static char *gtk_xtext_conv_color (unsigned char *text, int len, int *newlen);
 static unsigned char *
 gtk_xtext_strip_color (unsigned char *text, int len, unsigned char *outbuf,
 							  int *newlen, int *mb_ret, int strip_hidden);
@@ -534,7 +533,7 @@
 	if (*str == 0)
 		return 0;
 
-	pango_layout_set_text (xtext->layout, str, len);
+	pango_layout_set_text (xtext->layout, (char *) str, len);
 	pango_layout_get_pixel_size (xtext->layout, &width, NULL);
 
 	return width;
@@ -552,7 +551,7 @@
 	}
 
 	*mbl_ret = charlen (str);
-	pango_layout_set_text (xtext->layout, str, *mbl_ret);
+	pango_layout_set_text (xtext->layout, (char *) str, *mbl_ret);
 	pango_layout_get_pixel_size (xtext->layout, &width, NULL);
 
 	return width;
@@ -1859,7 +1858,7 @@
 	if (ret_len)
 		*ret_len = str - word;
 
-	return gtk_xtext_strip_color (word, len, xtext->scratch_buffer, NULL, NULL, FALSE);
+	return (char *) gtk_xtext_strip_color (word, len, xtext->scratch_buffer, NULL, NULL, FALSE);
 }
 
 #ifdef MOTION_MONITOR
@@ -1941,7 +1940,7 @@
 	GtkXText *xtext = GTK_XTEXT (widget);
 	GdkModifierType mask;
 	int redraw, tmp, x, y, offset, len, line_x;
-	unsigned char *word;
+	char *word;
 	textentry *word_ent;
 
 	gdk_window_get_pointer (widget->window, &x, &y, &mask);
@@ -2137,7 +2136,7 @@
 gtk_xtext_button_release (GtkWidget * widget, GdkEventButton * event)
 {
 	GtkXText *xtext = GTK_XTEXT (widget);
-	unsigned char *word;
+	char *word;
 	int old;
 
 	if (xtext->moving_separator)
@@ -2202,7 +2201,7 @@
 	GtkXText *xtext = GTK_XTEXT (widget);
 	GdkModifierType mask;
 	textentry *ent;
-	unsigned char *word;
+	char *word;
 	int line_x, x, y, offset, len;
 
 	gdk_window_get_pointer (widget->window, &x, &y, &mask);
@@ -2377,7 +2376,7 @@
 		len = strlen (txt);
 	} else
 	{
-		stripped = gtk_xtext_strip_color (txt, strlen (txt), NULL, &len, 0, FALSE);
+		stripped = (char *) gtk_xtext_strip_color ((unsigned char *) txt, strlen (txt), NULL, &len, 0, FALSE);
 		free (txt);
 	}
 
@@ -2429,7 +2428,7 @@
 		}
 		break;
 	default:
-		new_text = g_locale_from_utf8 (stripped, len, NULL, &glen, NULL);
+		new_text = (guchar *) g_locale_from_utf8 (stripped, len, NULL, &glen, NULL);
 		gtk_selection_data_set (selection_data_ptr, GDK_SELECTION_TYPE_STRING,
 										8, new_text, glen);
 		g_free (new_text);
@@ -2473,7 +2472,7 @@
 	widget_class = (GtkWidgetClass *) class;
 	xtext_class = (GtkXTextClass *) class;
 
-	parent_class = gtk_type_class (gtk_widget_get_type ());
+	parent_class = g_type_class_peek (gtk_widget_get_type ());
 
 	xtext_signals[WORD_CLICK] =
 		g_signal_new ("word_click",
@@ -2619,99 +2618,6 @@
 	return new_str;
 }
 
-/* GeEkMaN: converts mIRC control codes to literal control codes */
-
-static char *
-gtk_xtext_conv_color (unsigned char *text, int len, int *newlen)
-{
-	int i, j = 2;
-	char cchar = 0;
-	char *new_str;
-	int mbl;
-
-	for (i = 0; i < len;)
-	{
-		switch (text[i])
-		{
-		case ATTR_COLOR:
-		case ATTR_RESET:
-		case ATTR_REVERSE:
-		case ATTR_BOLD:
-		case ATTR_UNDERLINE:
-		case ATTR_ITALICS:
-		case ATTR_HIDDEN:
-			j += 3;
-			i++;
-			break;
-		default:
-			mbl = charlen (text + i);
-			j += mbl;
-			i += mbl;
-		}
-	}
-
-	new_str = malloc (j);
-	j = 0;
-
-	for (i = 0; i < len;)
-	{
-		switch (text[i])
-		{
-		case ATTR_COLOR:
-			cchar = 'C';
-			break;
-		case ATTR_RESET:
-			cchar = 'O';
-			break;
-		case ATTR_REVERSE:
-			cchar = 'R';
-			break;
-		case ATTR_BOLD:
-			cchar = 'B';
-			break;
-		case ATTR_UNDERLINE:
-			cchar = 'U';
-			break;
-		case ATTR_ITALICS:
-			cchar = 'I';
-			break;
-		case ATTR_HIDDEN:
-			cchar = 'H';
-			break;
-		case ATTR_BEEP:
-			break;
-		default:
-			mbl = charlen (text + i);
-			if (mbl == 1)
-			{
-				new_str[j] = text[i];
-				j++;
-				i++;
-			} else
-			{
-				/* invalid utf8 safe guard */
-				if (i + mbl > len)
-					mbl = len - i;
-				memcpy (new_str + j, text + i, mbl);
-				j += mbl;
-				i += mbl;
-			}
-		}
-		if (cchar != 0)
-		{
-			new_str[j++] = '%';
-			new_str[j++] = cchar;
-			cchar = 0;
-			i++;
-		}
-	}
-
-	new_str[j] = 0;
-	*newlen = j;
-
-	return new_str;
-}
-
 /* gives width of a string, excluding the mIRC codes */
 
 static int
@@ -2740,6 +2646,8 @@
 	GdkDrawable *pix = NULL;
 	int dest_x, dest_y;
 
+	dest_x = dest_y = 0;
+
 	if (xtext->dont_render || len < 1 || xtext->hidden)
 		return 0;
 
@@ -2798,7 +2706,7 @@
 		dofill = FALSE;	/* already drawn the background */
 	}
 
-	backend_draw_text (xtext, dofill, gc, x, y, str, len, str_width, is_mb);
+	backend_draw_text (xtext, dofill, gc, x, y, (char *) str, len, str_width, is_mb);
 
 #ifdef USE_DB
 	if (pix)
@@ -3578,7 +3486,8 @@
 static GdkPixmap *
 shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
 {
-	unsigned int dummy, width, height, depth;
+	unsigned int udummy, width, height, depth;
+	int dummy;
 	GdkPixmap *shaded_pix;
 	Window root;
 	Pixmap tmp;
@@ -3588,7 +3497,7 @@
 	Display *xdisplay = GDK_WINDOW_XDISPLAY (xtext->draw_buf);
 
 	XGetGeometry (xdisplay, p, &root, &dummy, &dummy, &width, &height,
-					  &dummy, &depth);
+					  &udummy, &depth);
 
 	if (width < x + w || height < y + h || x < 0 || y < 0)
 	{
@@ -4078,11 +3987,11 @@
 			ent->mark_start = -1;
 			ent->mark_end = -1;
 		}
-		ent->str = text;
+		ent->str = (guchar *) text;
 	}
 
 	y = (xtext->fontsize * line) + xtext->font->ascent - xtext->pixel_offset;
-	gtk_xtext_render_str (xtext, y, ent, text, len,
+	gtk_xtext_render_str (xtext, y, ent, (guchar *) text, len,
 								 win_width, 2, line, TRUE, &xsize);
 
 	/* restore everything back to how it was */
@@ -4300,7 +4209,7 @@
 		char *time_str;
 		int stamp_size = xtext_get_stamp_str (time(0), &time_str);
 		xtext->stamp_width =
-			gtk_xtext_text_width (xtext, time_str, stamp_size, NULL) + MARGIN;
+			gtk_xtext_text_width (xtext, (guchar *) time_str, stamp_size, NULL) + MARGIN;
 		g_free (time_str);
 	}
 #endif
@@ -4379,7 +4288,7 @@
 {
 	textentry *ent;
 	int newlen;
-	char *buf;
+	unsigned char *buf;
 
 	ent = xtext->buffer->text_first;
 	while (ent)
@@ -4887,9 +4796,9 @@
 	{
 		/* If Case Ignore, fold before & free after calling strstr */
 		if (case_match)
-			hay = g_strdup (ent->str);
+			hay = g_strdup ((char *) ent->str);
 		else
-			hay = g_utf8_casefold (ent->str, strlen (ent->str));
+			hay = g_utf8_casefold ((char *) ent->str, strlen ((char *) ent->str));
 		/* Try to find the needle in this haystack */
 		str = g_strstr_len (hay, strlen (hay), nee);
 		g_free (hay);
@@ -4971,7 +4880,7 @@
 static void
 gtk_xtext_append_entry (xtext_buffer *buf, textentry * ent, time_t stamp)
 {
-	unsigned int mb;
+	int mb;
 	int i;
 
 	/* we don't like tabs */
@@ -5071,10 +4980,10 @@
 	int left_width;
 
 	if (left_len == -1)
-		left_len = strlen (left_text);
+		left_len = strlen ((char *) left_text);
 
 	if (right_len == -1)
-		right_len = strlen (right_text);
+		right_len = strlen ((char *) right_text);
 
 	if (right_len >= sizeof (buf->xtext->scratch_buffer))
 		right_len = sizeof (buf->xtext->scratch_buffer) - 1;
@@ -5129,7 +5038,7 @@
 	textentry *ent;
 
 	if (len == -1)
-		len = strlen (text);
+		len = strlen ((char *) text);
 
 	if (text[len-1] == '\n')
 		len--;
@@ -5164,7 +5073,7 @@
 
 	while (ent)
 	{
-		if (cmp_func (ent->str, userdata))
+		if (cmp_func ((char *) ent->str, userdata))
 		{
 			matches++;
 			/* copy the text over */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]