[gaim-migrate @ 3523]

Thu, 29 Aug 2002 21:40:08 +0000

author
Robert McQueen <robot101@debian.org>
date
Thu, 29 Aug 2002 21:40:08 +0000
changeset 3472
3939deb42c1e
parent 3471
6af267d20195
child 3473
83018f64a2b8

[gaim-migrate @ 3523]
Rob McQueen went and removed all the GTK version preprocessor statements.

Thanks!

committer: Sean Egan <seanegan@pidgin.im>

plugins/filectl.c file | annotate | diff | comparison | revisions
plugins/iconaway.c file | annotate | diff | comparison | revisions
src/about.c file | annotate | diff | comparison | revisions
src/aim.c file | annotate | diff | comparison | revisions
src/away.c file | annotate | diff | comparison | revisions
src/browser.c file | annotate | diff | comparison | revisions
src/buddy.c file | annotate | diff | comparison | revisions
src/conversation.c file | annotate | diff | comparison | revisions
src/dialogs.c file | annotate | diff | comparison | revisions
src/gaim.h file | annotate | diff | comparison | revisions
src/gtkimhtml.c file | annotate | diff | comparison | revisions
src/multi.c file | annotate | diff | comparison | revisions
src/plugins.c file | annotate | diff | comparison | revisions
src/prefs.c file | annotate | diff | comparison | revisions
src/server.c file | annotate | diff | comparison | revisions
src/ui.h file | annotate | diff | comparison | revisions
--- a/plugins/filectl.c	Thu Aug 29 21:12:00 2002 +0000
+++ b/plugins/filectl.c	Thu Aug 29 21:40:08 2002 +0000
@@ -1,6 +1,5 @@
 #include "config.h"
 #include "gaim.h"
-#include "applet.h"
 
 #include <gtk/gtk.h>
 #include <stdlib.h>
--- a/plugins/iconaway.c	Thu Aug 29 21:12:00 2002 +0000
+++ b/plugins/iconaway.c	Thu Aug 29 21:40:08 2002 +0000
@@ -1,8 +1,7 @@
 #include "../config.h"
 #include "gaim.h"
 
-#include <gdk/gdkx.h>
-#include <X11/Xlib.h>
+#include <gtk/gtk.h>
 
 void *handle;
 
@@ -18,18 +17,12 @@
 void iconify_windows(struct gaim_connection *gc, char *state, char *message, void *data) {
 	if (!imaway || !gc->away)
 		return;
-	XIconifyWindow(GDK_DISPLAY(),
-			GDK_WINDOW_XWINDOW(imaway->window),
-		       ((_XPrivDisplay)GDK_DISPLAY())->default_screen);
+	gtk_window_iconify(GTK_WINDOW(imaway));
 	hide_buddy_list();
 	if (all_convos)
-		XIconifyWindow(GDK_DISPLAY(),
-				GDK_WINDOW_XWINDOW(all_convos->window),
-				((_XPrivDisplay)GDK_DISPLAY())->default_screen);
+		gtk_window_iconify(GTK_WINDOW(all_convos));
 	if (all_chats)
-		XIconifyWindow(GDK_DISPLAY(),
-				GDK_WINDOW_XWINDOW(all_chats->window),
-				((_XPrivDisplay)GDK_DISPLAY())->default_screen);
+		gtk_window_iconify(GTK_WINDOW(all_chats));
 }
 
 char *gaim_plugin_init(GModule *h) {
--- a/src/about.c	Thu Aug 29 21:12:00 2002 +0000
+++ b/src/about.c	Thu Aug 29 21:40:08 2002 +0000
@@ -69,15 +69,6 @@
 	return VERSION;
 }
 
-gboolean is_applet()
-{
-#ifdef USE_APPLET
-	return TRUE;
-#else
-	return FALSE;
-#endif
-}
-
 void show_about(GtkWidget *w, void *null)
 {
 	GtkWidget *vbox;
--- a/src/aim.c	Thu Aug 29 21:12:00 2002 +0000
+++ b/src/aim.c	Thu Aug 29 21:40:08 2002 +0000
@@ -22,14 +22,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#ifdef USE_APPLET
-#include "applet.h"
-#include <gnome.h>
-#else
-#ifdef USE_GNOME
-#include <gnome.h>
-#endif /* USE_GNOME */
-#endif /* USE_APPLET */
 #ifdef GAIM_PLUGINS
 #include <dlfcn.h>
 #endif /* GAIM_PLUGINS */
@@ -58,9 +50,7 @@
 #endif
 #include "locale.h"
 #include "gtkspell.h"
-#ifndef USE_APPLET
 #include <getopt.h>
-#endif
 
 static gchar *aspell_cmd[] = { "aspell", "--sug-mode=fast","-a", NULL };
 static gchar *ispell_cmd[] = { "ispell", "-a", NULL };
@@ -106,11 +96,6 @@
 
 void cancel_logon(void)
 {
-#ifdef USE_APPLET
-	applet_buddy_show = FALSE;
-	if (mainwindow)
-		gtk_widget_hide(mainwindow);
-#else
 #ifdef GAIM_PLUGINS
 	/* first we tell those who have requested it we're quitting */
 	plugin_event(event_quit, 0, 0, 0, 0);
@@ -123,7 +108,6 @@
 #endif
 
 	gtk_main_quit();
-#endif /* USE_APPLET */
 }
 
 static int snd_tmout;
@@ -143,12 +127,6 @@
 		logins_not_muted = 0;
 		snd_tmout = gtk_timeout_add(10000, (GtkFunction)sound_timeout, NULL);
 	}
-#ifdef USE_APPLET
-	set_user_state(online);
-	applet_widget_unregister_callback(APPLET_WIDGET(applet), "autologin");
-	applet_widget_register_callback(APPLET_WIDGET(applet),
-					"signoff", _("Signoff"), (AppletCallbackFunc)signoff_all, NULL);
-#endif /* USE_APPLET */
 }
 
 
@@ -311,11 +289,9 @@
 	gtk_box_pack_start(GTK_BOX(sbox), bbox, TRUE, TRUE, 0);
 	gtk_widget_show(bbox);
 
-#ifndef USE_APPLET
 	cancel = gtk_button_new_with_label(_("Quit"));
-#else
-	cancel = gtk_button_new_with_label(_("Close"));
-#endif
+/* fixme: docklet					*
+ *	cancel = gtk_button_new_with_label(_("Close"));	*/
 #ifndef NO_MULTI
 	accts = gtk_button_new_with_label(_("Accounts"));
 #endif
@@ -556,30 +532,9 @@
 	sigset_t sigset;
 	void (*prev_sig_disp)();
 #endif
-#ifndef USE_APPLET
 	int opt, opt_user = 0;
 	int i;
 
-#ifdef USE_GNOME
-	struct poptOption popt_options[] = {
-		{"acct", 'a', POPT_ARG_NONE, &opt_acct, 'a',
-		 "Display account editor window", NULL},
-		{"away", 'w', POPT_ARG_STRING, NULL, 'w',
-		 "Make away on signon (optional argument MESG specifies name of away message to use)",
-		 "[MESG]"},
-		{"login", 'l', POPT_ARG_STRING, NULL, 'l',
-		 "Automatically login (optional argument NAME specifies account(s) to use)", "[NAME]"},
-		{"loginwin", 'n', POPT_ARG_NONE, &opt_nologin, 'n',
-		 "Don't automatically login; show login window",  NULL},
-		{"user", 'u', POPT_ARG_STRING, &opt_user_arg, 'u',
-		 "Use account NAME", "NAME"},
-		{"file", 'f', POPT_ARG_STRING, &opt_rcfile_arg, 'f',
-		 "Use FILE as config", "FILE"},
-		{"debug", 'd', POPT_ARG_NONE, &opt_debug, 'd',
-		 "Print debugging messages to stdout", NULL},
-		{0, 0, 0, 0, 0, 0, 0}
-	};
-#endif /* USE_GNOME */
 	struct option long_options[] = {
 		{"acct", no_argument, NULL, 'a'},
 		/*{"away", optional_argument, NULL, 'w'}, */
@@ -592,7 +547,6 @@
 		{"version", no_argument, NULL, 'v'},
 		{0, 0, 0, 0}
 	};
-#endif
 
 #ifdef DEBUG
 	opt_debug = 1;
@@ -644,10 +598,6 @@
 	}		
 #endif
 
-
-#ifdef USE_APPLET
-	init_applet_mgr(argc, argv);
-#else
 	for (i = 0; i < argc; i++) {
 		/* --login option */
 		if (strstr(argv[i], "--l") == argv[i]) {
@@ -721,18 +671,10 @@
 	 */
 
 	gtk_set_locale();
-#ifdef USE_GNOME
-	gnome_init_with_popt_table(PACKAGE, VERSION, argc, argv, popt_options, 0, NULL);
-#else
 	gtk_init(&argc, &argv);
-#endif
 
 	/* scan command-line options */
-#ifdef USE_GNOME
-	opterr = 0;
-#else
 	opterr = 1;
-#endif
 	while ((opt = getopt_long(argc, argv, "adhu:f:vn", long_options, NULL)) != -1) {
 		switch (opt) {
 		case 'u':	/* set user */
@@ -757,18 +699,14 @@
 		case 'n':       /* don't autologin */
 			opt_nologin = 1;
 			break;
-#ifndef USE_GNOME
 		case '?':
 		default:
 			show_usage(1, argv[0]);
 			return 0;
 			break;
-#endif
 		}
 	}
 
-#endif /* USE_APPLET */
-
 	/* show help message */
 	if (opt_help) {
 		show_usage(0, argv[0]);
@@ -783,7 +721,6 @@
 		return 0;
 	}
 
-
 	load_prefs();
 
 	core_main();
@@ -792,10 +729,8 @@
 	/* set the default username */
 	if (opt_user_arg != NULL) {
 		set_first_user(opt_user_arg);
-#ifndef USE_GNOME
 		g_free(opt_user_arg);
 		opt_user_arg = NULL;
-#endif /* USE_GNOME */
 	}
 
 	if (misc_options & OPT_MISC_DEBUG)
@@ -826,25 +761,6 @@
 			opt_login_arg = NULL;
 		}
 	}
-#ifdef USE_APPLET
-	applet_widget_register_callback(APPLET_WIDGET(applet),
-					"prefs", _("Preferences"), show_prefs, NULL);
-	applet_widget_register_callback(APPLET_WIDGET(applet),
-					"accounts",
-					_("Accounts"), (AppletCallbackFunc)account_editor, (void *)1);
-#ifdef GAIM_PLUGINS
-	applet_widget_register_callback(APPLET_WIDGET(applet),
-					"plugins", _("Plugins"), GTK_SIGNAL_FUNC(show_plugins), NULL);
-#endif /* GAIM_PLUGINS */
-
-	applet_widget_register_callback(APPLET_WIDGET(applet),
-					"autologin", _("Auto-login"), (AppletCallbackFunc)auto_login, NULL);
- 
-	if (!opt_acct)
-		auto_login();
-
-	applet_widget_gtk_main();
-#else
 
 	if (!opt_acct && !opt_nologin)
 		auto_login();
@@ -856,8 +772,6 @@
 
 	gtk_main();
 
-#endif /* USE_APPLET */
-
 	if (convo_options & OPT_CONVO_CHECK_SPELLING)
 		gtkspell_stop();
 	core_quit();
--- a/src/away.c	Thu Aug 29 21:12:00 2002 +0000
+++ b/src/away.c	Thu Aug 29 21:40:08 2002 +0000
@@ -22,11 +22,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#ifdef USE_APPLET
-#include <gnome.h>
-#include <applet-widget.h>
-#include "applet.h"
-#endif /* USE_APPLET */
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -123,10 +118,6 @@
 	g_free(name);
 	gtk_clist_remove(GTK_CLIST(clist), row);
 
-#ifdef USE_APPLET
-	set_user_state(away);
-#endif
-	
 }
 	
 	
@@ -170,11 +161,6 @@
 	awaymessage = NULL;
 	clistqueue = NULL;
 	clistqueuesw = NULL;
-#ifdef USE_APPLET
-	applet_widget_unregister_callback(APPLET_WIDGET(applet), "away");
-	set_user_state(online);
-	insert_applet_away();
-#endif /* USE_APPLET */
 }
 
 
@@ -260,13 +246,6 @@
 		return;
 	}
 
-#ifdef USE_APPLET
-	remove_applet_away();
-	applet_widget_register_callback(APPLET_WIDGET(applet),
-					"away", _("Back"), (AppletCallbackFunc)do_im_back, NULL);
-	set_user_state(away);
-#endif
-
 	/* New away message... Clear out the old sent_aways */
 	while (away_time_queue) {
 		struct queued_away_response *qar = away_time_queue->data;
@@ -284,15 +263,6 @@
 void rem_away_mess(GtkWidget *w, struct away_message *a)
 {
 	int default_index;
-#ifdef USE_APPLET
-	char *awayname;
-	awayname = g_malloc(sizeof(*awayname) * (6 + strlen(a->name)));
-	awayname[0] = '\0';
-	strcat(awayname, "away/");
-	strcat(awayname, a->name);
-	applet_widget_unregister_callback(APPLET_WIDGET(applet), awayname);
-	g_free(awayname);
-#endif
 	default_index = g_slist_index(away_messages, default_away);
 	if (default_index == -1) {
 		if (away_messages != NULL)
@@ -339,15 +309,6 @@
 	struct gaim_connection *gc = NULL;
 	int count = 0;
 
-#ifdef USE_APPLET
-	remove_applet_away();
-	if (imaway && applet)
-		applet_widget_register_callback(APPLET_WIDGET(applet),
-						"away", _("Back"), (AppletCallbackFunc)do_im_back, NULL);
-	else if (applet && !imaway)
-		insert_applet_away();
-#endif
-
 	if (prefs_away_list != NULL) {
 		GtkWidget *hbox;
 		gtk_list_clear_items(GTK_LIST(prefs_away_list), 0, -1);
--- a/src/browser.c	Thu Aug 29 21:12:00 2002 +0000
+++ b/src/browser.c	Thu Aug 29 21:40:08 2002 +0000
@@ -576,10 +576,9 @@
 
 		netscape_command(command);
 		g_free(command);
-#ifdef USE_GNOME
-	} else if (web_browser == BROWSER_GNOME) {
-		gnome_url_show(url);
-#endif /* USE_GNOME */
+/* fixme: GNOME helper					*
+ *	} else if (web_browser == BROWSER_GNOME) {	*
+ *		gnome_url_show(url);			*/
 	} else {
 		pid_t pid;
 
--- a/src/buddy.c	Thu Aug 29 21:12:00 2002 +0000
+++ b/src/buddy.c	Thu Aug 29 21:40:08 2002 +0000
@@ -22,11 +22,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#ifdef USE_APPLET
-#include <gnome.h>
-#include <applet-widget.h>
-#include "applet.h"
-#endif /* USE_APPLET */
 #ifdef GAIM_PLUGINS
 #include <dlfcn.h>
 #endif /* GAIM_PLUGINS */
@@ -41,7 +36,6 @@
 
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
-#include <gdk/gdkx.h>
 #include "prpl.h"
 #include "gaim.h"
 #include "pixmaps/login_icon.xpm"
@@ -61,11 +55,8 @@
 #endif
 #include "pixmaps/prefs_small.xpm"
 #include "pixmaps/search_small.xpm"
-#ifdef USE_APPLET
 #include "pixmaps/close_small.xpm"
-#else
 #include "pixmaps/exit_small.xpm"
-#endif
 #include "pixmaps/pounce_small.xpm"
 #include "pixmaps/about_small.xpm"
 
@@ -96,7 +87,6 @@
 
 typedef struct _GtkTreePixmaps GtkTreePixmaps;
 
-
 struct buddy_show {
 	GtkWidget *item;
 	GtkWidget *pix;
@@ -120,6 +110,9 @@
 };
 static GSList *shows = NULL;
 
+static gboolean blist_hidden;
+static int docklet_refcount = 0;
+
 /* Predefine some functions */
 static void new_bp_callback(GtkWidget *w, struct buddy *bs);
 static struct group_show *find_group_show(char *group);
@@ -521,16 +514,6 @@
 }
 
 
-#ifdef USE_APPLET
-gint applet_destroy_buddy(GtkWidget *widget, GdkEvent *event, gpointer *data)
-{
-	applet_buddy_show = FALSE;
-	gtk_widget_hide(blist);
-	return (TRUE);
-}
-
-#endif
-
 static int handle_click_group(GtkWidget *widget, GdkEventButton *event, struct group *g)
 {
 	if (event->type == GDK_2BUTTON_PRESS) {
@@ -1418,10 +1401,6 @@
 
 void do_quit()
 {
-#ifdef USE_APPLET
-	applet = NULL;
-#endif
-
 	/* first we tell those who have requested it we're quitting */
 	plugin_event(event_quit, 0, 0, 0, 0);
 
@@ -2016,16 +1995,71 @@
 	return g;
 }
 
+/* used by this file, and by iconaway.so */
 void hide_buddy_list() {
-	if (blist)
-		XIconifyWindow(GDK_DISPLAY(),
-			       GDK_WINDOW_XWINDOW(blist->window),
-			       ((_XPrivDisplay)GDK_DISPLAY())->default_screen);
+	if (!blist) return;
+	if (!connections || docklet_refcount) {
+		gtk_widget_hide(blist);
+	} else {
+		gtk_window_iconify(GTK_WINDOW(blist));
+	}
+	blist_hidden = TRUE;
+}
+
+/* shared code... not in lschiere/faceprint tree though. oh well */
+static void move_buddy_list() {
+	if (blist_options & OPT_BLIST_SAVED_WINDOWS) {
+		if (blist_pos.width != 0) {	/* Sanity check! */
+			gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff,
+						 blist_pos.y - blist_pos.yoff);
+			gtk_widget_set_usize(blist, blist_pos.width, blist_pos.height);
+		}
+	}
+}
+
+/* mostly used by code in this file */
+void unhide_buddy_list() {
+	if (!blist) return;
+	gtk_window_present(GTK_WINDOW(blist));
+	move_buddy_list();
+	blist_hidden = FALSE;
 }
 
-void unhide_buddy_list() {
-	if (blist)
-		gdk_window_show(blist->window);
+/* used by the docklet */
+void toggle_buddy_list() {
+	if (blist_hidden) {
+		unhide_buddy_list();
+	} else {
+		hide_buddy_list();
+	}
+}
+
+/* for the delete_event handler */
+static void close_buddy_list() {
+	if (docklet_refcount) {
+		hide_buddy_list();
+	} else {
+		do_quit();
+	}
+}
+
+void docklet_add() {
+	docklet_refcount++;
+	printf("docklet_refcount: %d\n",docklet_refcount);
+}
+
+void docklet_remove() {
+	if (docklet_refcount) {
+		docklet_refcount--;
+	}
+	printf("docklet_refcount: %d\n",docklet_refcount);
+	if (!docklet_refcount) {
+		if (connections) {
+			unhide_buddy_list();
+		} else {
+			gtk_window_present(GTK_WINDOW(mainwindow));
+		}
+	}
 }
 
 static gint log_timeout(struct buddy_show *b)
@@ -2205,9 +2239,6 @@
 		gtk_widget_show(bs->idle);
 
 	style = gtk_style_new();
-#if !GTK_CHECK_VERSION(1,3,0)
-	gdk_font_unref(gtk_style_get_font(style));
-#endif
 	gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(bs->label->style)));
 	for (i = 0; i < 5; i++)
 		style->fg[i] = bs->idle->style->fg[i];
@@ -2413,9 +2444,8 @@
 	gdk_window_get_position(blist->window, &x, &y);
 	gdk_window_get_size(blist->window, &width, &height);
 
-#ifdef USE_APPLET
-	if (applet_buddy_show){
-#endif
+/* fixme: docklet		*
+ *	if (applet_buddy_show){	*/
 
 	if (e->send_event) {	/* Is a position event */
 		if (blist_pos.x != x || blist_pos.y != y)
@@ -2435,10 +2465,6 @@
 	if (save)
 		save_prefs();
 
-#ifdef USE_APPLET
-	}
-#endif
-	
 }
 
 
@@ -2626,15 +2652,11 @@
 	GtkWidget *tbox;
 
 	if (blist) {
-		gtk_widget_show(blist);
+		unhide_buddy_list;
 		return;
 	}
 
-#ifdef USE_APPLET
-	GAIM_DIALOG(blist);
-#else
 	blist = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-#endif
 
 	gtk_window_set_wmclass(GTK_WINDOW(blist), "buddy_list", "Gaim");
 
@@ -2675,13 +2697,11 @@
 	gaim_new_item_with_pixmap(menu, _("Signoff"), logout_menu_xpm,
 				  GTK_SIGNAL_FUNC(signoff_all), (void*)1, 'd', GDK_CONTROL_MASK, "Ctl+D");
 
-#ifndef USE_APPLET
+	gaim_new_item_with_pixmap(menu, _("Hide"), close_small_xpm,
+				  GTK_SIGNAL_FUNC(hide_buddy_list), NULL, 'h', GDK_CONTROL_MASK, "Ctl+H");
+
 	gaim_new_item_with_pixmap(menu, _("Quit"), exit_small_xpm,
 				  GTK_SIGNAL_FUNC(do_quit), NULL, 'q', GDK_CONTROL_MASK, "Ctl+Q");
-#else
-	gaim_new_item_with_pixmap(menu, _("Close"), close_small_xpm,
-				  GTK_SIGNAL_FUNC(applet_destroy_buddy), NULL, 'x', GDK_CONTROL_MASK, "Ctl+X");
-#endif
 
 	menu = gtk_menu_new();
 
@@ -2878,12 +2898,8 @@
 
 	gtk_container_add(GTK_CONTAINER(blist), vbox);
 
-#ifndef USE_APPLET
-	gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(do_quit), blist);
-#else
-	gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(applet_destroy_buddy),
+	gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(close_buddy_list),
 			   NULL);
-#endif
 
 	gtk_signal_connect(GTK_OBJECT(blist), "configure_event", GTK_SIGNAL_FUNC(move_blist_window),
 			   NULL);
@@ -2897,14 +2913,8 @@
 
 
 	gtk_window_set_title(GTK_WINDOW(blist), _("Gaim - Buddy List"));
-
-	if (blist_options & OPT_BLIST_SAVED_WINDOWS) {
-		if (blist_pos.width != 0) {	/* Sanity check! */
-			gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff,
-						 blist_pos.y - blist_pos.yoff);
-			gtk_widget_set_usize(blist, blist_pos.width, blist_pos.height);
-		}
-	}
+	move_buddy_list();
+	blist_hidden = FALSE;
 }
 
 void refresh_buddy_window()
--- a/src/conversation.c	Thu Aug 29 21:12:00 2002 +0000
+++ b/src/conversation.c	Thu Aug 29 21:40:08 2002 +0000
@@ -272,10 +272,8 @@
 		gtk_widget_destroy(c->link_dialog);
 	if (c->log_dialog)
 		gtk_widget_destroy(c->log_dialog);