gaim/www

Initial import into CVS
chipx86
2002-09-26, Christian Hammond
564edb9ca620
Parents d2a0b4a42c8e
Children 7dfd0c0992a6
Initial import into CVS
Binary file htdocs/eric/gaim-0.12.0pre20010725.tar.gz has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/gaim.diff Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,12 @@
+--- ../../../icqlib/icqlib/socketmanager.h Mon Jun 4 20:36:31 2001
++++ socketmanager.h Sat Jun 9 07:37:26 2001
+@@ -32,6 +32,9 @@
+ #include <sys/types.h>
+
+ #ifndef _WIN32
++#ifdef NEED_SOCKLEN_T
++typedef unsigned int socklen_t;
++#endif
+ #include <sys/socket.h>
+ #else
+ #include <winsock.h>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/gendiff.sh Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,19 @@
+cd /usr/local/src/gaim/libfaim/src
+for i in *.c ; do
+ diff -Nu --ignore-matching-lines=\\\$Id$ $i ../../app/src/protocols/oscar/$i
+done
+
+cd /usr/local/src/gaim/libfaim/include
+for i in *.h ; do
+ diff -Nu --ignore-matching-lines=\\\$Id$ $i ../../app/src/protocols/oscar/$i
+done
+
+cd /usr/local/src/gaim/icqlib/icqlib
+for i in *.c ; do
+ diff -Nu --ignore-matching-lines=\\\$Id$ $i ../../app/src/protocols/icq/$i
+done
+
+cd /usr/local/src/gaim/icqlib/icqlib
+for i in *.h ; do
+ diff -Nu --ignore-matching-lines=\\\$Id$ $i ../../app/src/protocols/icq/$i
+done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/gtk2.shtml Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,70 @@
+<!--#include virtual="/header.shtml"-->
+
+<h1>Compiling Gaim with GTK 2</h1>
+<blockquote>
+
+GTK 2 is supposed to be released at the end of June or maybe in July sometime.
+So I figured I should probably get off my lazy ass and see how hard it was going
+to be to port Gaim to GTK 2.
+
+<P>If I take the easy way, it turns out to be rather easy. 700-line <a
+href="broken.diff">diff</a> easy, and 165 of those lines are just removing the
+GNOME stuff from ./configure so that GTK 2 gets used instead of it. So here's
+how to use that diff. (Please don't ask me questions about this, I'm not
+supporting any of it, and especially, this is the BROKEN way of porting gaim, so
+I'm not taking bug reports.)
+
+<P><B>Step 1. Make sure you're using GTK 1.2.9 or higher currently</B>
+<BR>You're going to have to install GTK 2 in order to use this patch, and if
+you don't want to completely fuck up your system, you're going to want to keep
+GTK 1.2 installed. GTK 1.2.9 has the nice properly that it can coexist with
+GTK 2; GTK 1.2.8 cannot. So make sure you're using 1.2.9 or higher (I'm actually
+using 1.2.10).
+
+<P><B>Step 2. Install pkg-config</B>
+<BR><a href="http://www.freedesktop.org/software/pkgconfig/">pkg-config</a> is the replacement
+for glib-config, gtk-config, et al. You'll need to install it before you can
+install GTK 2.
+
+<P><B>Step 3. Get glib, pango, and gtk+ out of GNOME's CVS</B>
+<BR>The patch isn't meant for GTK 1.3.5 (which is the last development release,
+AFAIK). There were changes to the GdkPixbuf API between 1.3.5 and what's
+currently in CVS, and this diff makes use of those changes. So get the glib,
+pango, and gtk+ modules out of GNOME's CVS. Do this by first logging in:
+
+<P><code>cvs -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome login</code>
+<BR><font size=-1>Hit Enter at the password prompt</font>
+
+<P>And then check out each module:
+
+<P><code>cvs -d :pserver:anonymous@anoncvs.gnome.org;/cvs/gnome co -r HEAD glib</code>
+<BR><code>cvs -d :pserver:anonymous@anoncvs.gnome.org;/cvs/gnome co -r HEAD pango</code>
+<BR><code>cvs -d :pserver:anonymous@anoncvs.gnome.org;/cvs/gnome co -r HEAD gtk+</code>
+
+<P><B>Step 4. Compile glib, pango, and gtk+</B>
+<BR>I'm not going to give real detailed directions for this, because you should
+be familiar with using software from CVS. But basically it's just the normal
+./autogen.sh ; make ; make install. You need to have at least libtool 1.4
+installed though, and automake 1.4-p1 as well.
+
+<P><B>Step 5. Get Gaim out of CVS</B>
+<BR>You should know how to do this by now. Directions are <a
+href="/cvs.shtml">here</a>.
+
+<P><B>Step 6. Apply the patch</B>
+<BR>OK, for those of you who have never applied a patch before, what you're
+going to do is this. Go to the top level of the Gaim CVS tree you just checked
+out. Then run
+
+<P><code>patch -p0 <../path/to/broken.diff</code>
+
+<P>Make sure to give the right path to the patch. The 'patch' program will then
+tell you which files it's patching, and how cleanly they applied.
+
+<p><B>Step 7. Compile Gaim and use it</B>
+<BR>Now you just need to do the normal ./autogen.sh ; make that you do for your
+regular CVS tree. Have fun with it.
+
+</blockquote>
+
+<!--#include virtual="/footer.shtml"--)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/gtkcount.sh Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,5 @@
+for i in icq irc jabber msn napster oscar toc yahoo zephyr
+do
+ echo -n $i:
+ grep g\[td\]k $i/*.c | wc -l
+done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/idle.c Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,152 @@
+/* a nifty little plugin to set your idle time to whatever you want it to be.
+ * useful for almost nothing. mostly just a demo plugin. but it's fun to have
+ * 40-day idle times.
+ */
+
+#define GAIM_PLUGINS
+#include "multi.h"
+#include "gaim.h"
+#include <sys/time.h>
+#include "pixmaps/ok.xpm"
+#include "pixmaps/cancel.xpm"
+
+static GtkWidget *idlewin = NULL;
+static struct gaim_connection *gc = NULL;
+
+char *name() {
+ return "I'dle Mak'er";
+}
+
+char *description() {
+ return "Allows you to hand-configure how long you've been idle for";
+}
+
+char *gaim_plugin_init(GModule *module) {
+ return NULL;
+}
+
+static void des_idle_win(GtkWidget *win, gpointer data) {
+ gtk_widget_destroy(idlewin);
+ idlewin = NULL;
+}
+
+static void set_idle(GtkWidget *button, GtkWidget *spinner) {
+ time_t t;
+ int tm = CLAMP(gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner)), 0, G_MAXINT);
+ if (!gc) {
+ des_idle_win(idlewin, NULL);
+ return;
+ }
+ debug_printf("setting idle time for %s to %d\n", gc->username, tm);
+ time(&t);
+ t -= 60 * tm;
+ gc->lastsent = t;
+ serv_set_idle(gc, 60 * tm);
+ gc->is_idle = 0;
+ des_idle_win(idlewin, NULL);
+}
+
+static void unset_idle(GtkWidget *button, GtkWidget *spinner) {
+ des_idle_win(idlewin, NULL);
+}
+
+static void sel_gc(GtkWidget *opt, struct gaim_connection *g) {
+ gc = g;
+}
+
+static void make_connect_menu(GtkWidget *box) {
+ GtkWidget *optmenu, *menu, *opt;
+ GSList *c = connections;
+ struct gaim_connection *g;
+
+ optmenu = gtk_option_menu_new();
+ gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 5);
+
+ menu = gtk_menu_new();
+
+ while (c) {
+ g = (struct gaim_connection *)c->data;
+ opt = gtk_menu_item_new_with_label(g->username);
+ gtk_signal_connect(GTK_OBJECT(opt), "activate",
+ GTK_SIGNAL_FUNC(sel_gc), g);
+ gtk_menu_append(GTK_MENU(menu), opt);
+ gtk_widget_show(opt);
+ c = g_slist_next(c);
+ }
+
+ gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu));
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
+
+ if (connections)
+ gc = connections->data;
+ else
+ gc = NULL;
+}
+
+char *gaim_plugin_config() {
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *label;
+ GtkAdjustment *adj;
+ GtkWidget *spinner;
+ GtkWidget *button;
+
+ if (idlewin) {
+ gtk_widget_show(idlewin);
+ return;
+ }
+
+ idlewin = gtk_window_new(GTK_WINDOW_DIALOG);
+ gtk_window_set_title(GTK_WINDOW(idlewin), "Idle Time");
+ gtk_window_set_policy(GTK_WINDOW(idlewin), 0, 0, 1);
+ gtk_window_set_wmclass(GTK_WINDOW(idlewin), "idle", "gaim");
+ gtk_widget_realize(idlewin);
+ aol_icon(idlewin->window);
+ gtk_signal_connect(GTK_OBJECT(idlewin), "destroy",
+ GTK_SIGNAL_FUNC(des_idle_win), NULL);
+
+ frame = gtk_frame_new("Idle Time");
+ gtk_container_add(GTK_CONTAINER(idlewin), frame);
+
+ vbox = gtk_vbox_new(FALSE, 5);
+ gtk_container_add(GTK_CONTAINER(frame), vbox);
+
+ hbox = gtk_hbox_new(FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+
+ label = gtk_label_new("Set");
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+
+ make_connect_menu(hbox);
+
+ label = gtk_label_new("idle for");
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+
+ adj = (GtkAdjustment *)gtk_adjustment_new(10, 0, G_MAXINT, 1, 0, 0);
+ spinner = gtk_spin_button_new(adj, 0, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), spinner, TRUE, TRUE, 0);
+
+ label = gtk_label_new("minutes.");
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+
+ hbox = gtk_hbox_new(TRUE, 5);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+
+ button = picture_button(idlewin, _("Set"), ok_xpm);
+ gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5);
+ gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_idle), spinner);
+
+ button = picture_button(idlewin, _("Cancel"), cancel_xpm);
+ gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5);
+ gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(unset_idle), spinner);
+
+ gtk_widget_show_all(idlewin);
+}
+
+void gaim_plugin_remove() {
+ if (idlewin)
+ gtk_widget_destroy(idlewin);
+ idlewin = NULL;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/index.shtml Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,65 @@
+<!--#include virtual="/header.shtml"-->
+
+<h1>Eric's Page of Cool Stuff</h1>
+<blockquote>
+
+So I've been hacking Gaim for a little over a year now, and I've come up
+with some things that I think are pretty neat. So here they are for all
+of you to have. Everything will be dated because I don't really intend
+to keep this very up-to-date. Don't send me bug reports about any of this,
+YAYOR, YMMV, etc., etc. Feel free to send patches for any of these things.
+
+<P><B>June 6, 2001: </b><a href="gtk2.shtml">Directions</a> for getting
+Gaim to compile using <a href="http://www.gtk.org/">GTK 2</a> (still in CVS)
+
+<P><B>June 6, 2001: </b><a href="idle.c">Plugin</a> to set the idle time
+for an account
+
+<P><B>June 6, 2001: </b><a href="base64.c">Base64</a> converter. Copied
+from Gaim code to bug test it.
+
+<P><B>June 6, 2001: </b><a href="pixbuf.shtml">GdkPixbuf</a> tests that
+I did (with sample animations too, thanks mid and elnscott).
+
+<P><B>June 9, 2001: </b><a href="gaim.diff">Diff</a> against icqlib from CVS and
+<a href="makediff.sh">script</a> I use to make the diff. Very me-specific. I
+don't know why I'm posting this.
+
+<P><B>June 9, 2001: </b><a href="mid.diff">Patch</a> I made for mid so that he
+could have the conversation tabs and chat tabs in the buddy list. Very buggy but
+mostly functional.
+
+<P><B>June 14, 2001: </b><a href="design.txt">Design ideas</a> for what Gaim
+might be like in the future.
+
+<P><B>July 26, 2001: </b><a href="gaim-0.12.0pre20010725.tar.gz">Gaim
+0.12.0pre20010725 tarball</a> for a quick look at some implementation ideas for
+a future gaim.
+
+<P><B>July 26, 2001: </b><a href="roadmap.txt">Roadmap</a> for where I'd like to
+see 0.11 and 0.12 go.
+
+<P><B>August 28, 2001: </b><a href="gendiff.sh">Script</a> to generate the diffs
+between icqlib and libfaim and gaim's copy of them. I don't know why I'm posting
+this.
+
+<P><B>August 28, 2001: </b><a href="gtkcount.sh">Script</a> to count the number
+of lines still containing either "gtk" or "gdk" (case-insensitive) left in the
+protocols.
+
+<P><B>August 29, 2001: </b><a href="broken2.diff">New diff</a> for getting gaim
+to work with GTK 2. --enable-gtk2, otherwise it'll use GTK 1.2. No guarantees
+about it compiling.
+
+<P><B>September 5, 2001: </b><a href="tricks.shtml">Tricks</a> that you can do
+by modifying gaim's source.
+
+<P><B>September 6, 2001: </b><a href="autoadd.c">Plugin</a> to automatically add
+people to your buddy list when they IM you.
+
+<P><B>September 6, 2001: </b><a href="maxconvo.c">Plugin</a> to limit the number
+of conversation windows.
+
+</blockquote>
+
+<!--#include virtual="/footer.shtml"-->
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/m.c Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,55 @@
+#include <gtk/gtk.h>
+#include "gtkimhtml.h"
+
+static void deswin(GtkObject *o, gpointer d)
+{
+ gtk_widget_destroy(GTK_WIDGET(o));
+}
+
+static void newwin(GtkObject *o, gpointer d)
+{
+ GtkWidget *window;
+ GtkWidget *sw;
+ GtkWidget *imhtml;
+
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_signal_connect(GTK_OBJECT(window), "delete_event", deswin, NULL);
+
+ sw = gtk_scrolled_window_new(NULL, NULL);
+ gtk_container_add(GTK_CONTAINER(window), sw);
+
+ imhtml = gtk_imhtml_new(NULL, NULL);
+ gtk_container_add(GTK_CONTAINER(sw), imhtml);
+
+ gtk_widget_show_all(window);
+}
+
+int main(int argc, char **argv)
+{
+ GtkWidget *window;
+ GtkWidget *hbox;
+ GtkWidget *button;
+
+ gtk_init(&argc, &argv);
+
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_signal_connect(GTK_OBJECT(window), "delete_event",
+ GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+
+ hbox = gtk_hbox_new(TRUE, 5);
+ gtk_container_add(GTK_CONTAINER(window), hbox);
+
+ button = gtk_button_new_with_label("Open");
+ gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5);
+ gtk_signal_connect(GTK_OBJECT(button), "clicked", newwin, NULL);
+
+ button = gtk_button_new_with_label("Quit");
+ gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5);
+ gtk_signal_connect(GTK_OBJECT(button), "clicked",
+ GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+
+ gtk_widget_show_all(window);
+
+ gtk_main();
+ return 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/makediff.sh Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,2 @@
+rm -f gaim.diff
+for i in *.[ch] ; do diff -u ../../../icqlib/icqlib/$i $i >>gaim.diff 2>/dev/null ; done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/maxconvo.c Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,107 @@
+#define GAIM_PLUGINS
+#include "multi.h"
+#include "gaim.h"
+#include "pixmaps/ok.xpm"
+#include "pixmaps/cancel.xpm"
+
+static GtkWidget *idlewin = NULL;
+static int maxnum = 10;
+
+char *name() {
+ return "Convo Limiter";
+}
+
+char *description() {
+ return "Allows you to limit max # of conversations";
+}
+
+static void im_handler(struct gaim_connection *gc, char *who, char **text, void *data) {
+ if (find_conversation(who))
+ return;
+ if (g_list_length(conversations) >= maxnum) {
+ serv_send_im(gc, who, "Already engaged in Maximum # of conversations, please try again later.", 1);
+ g_free(*text);
+ *text = NULL;
+ }
+}
+
+char *gaim_plugin_init(GModule *module) {
+ gaim_signal_connect(module, event_im_recv, im_handler, NULL);
+ return NULL;
+}
+
+static void des_idle_win(GtkWidget *win, gpointer data) {
+ gtk_widget_destroy(idlewin);
+ idlewin = NULL;
+}
+
+static void set_idle(GtkWidget *button, GtkWidget *spinner) {
+ maxnum = CLAMP(gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner)), 0, G_MAXINT);
+ des_idle_win(idlewin, NULL);
+}
+
+static void unset_idle(GtkWidget *button, GtkWidget *spinner) {
+ des_idle_win(idlewin, NULL);
+}
+
+char *gaim_plugin_config() {
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *label;
+ GtkAdjustment *adj;
+ GtkWidget *spinner;
+ GtkWidget *button;
+
+ if (idlewin) {
+ gtk_widget_show(idlewin);
+ return;
+ }
+
+ idlewin = gtk_window_new(GTK_WINDOW_DIALOG);
+ gtk_window_set_title(GTK_WINDOW(idlewin), "Idle Time");
+ gtk_window_set_policy(GTK_WINDOW(idlewin), 0, 0, 1);
+ gtk_window_set_wmclass(GTK_WINDOW(idlewin), "idle", "gaim");
+ gtk_widget_realize(idlewin);
+ aol_icon(idlewin->window);
+ gtk_signal_connect(GTK_OBJECT(idlewin), "destroy",
+ GTK_SIGNAL_FUNC(des_idle_win), NULL);
+
+ frame = gtk_frame_new("Idle Time");
+ gtk_container_add(GTK_CONTAINER(idlewin), frame);
+
+ vbox = gtk_vbox_new(FALSE, 5);
+ gtk_container_add(GTK_CONTAINER(frame), vbox);
+
+ hbox = gtk_hbox_new(FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+
+ label = gtk_label_new("idle for");
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+
+ adj = (GtkAdjustment *)gtk_adjustment_new(10, 0, G_MAXINT, 1, 0, 0);
+ spinner = gtk_spin_button_new(adj, 0, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), spinner, TRUE, TRUE, 0);
+
+ label = gtk_label_new("minutes.");
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+
+ hbox = gtk_hbox_new(TRUE, 5);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+
+ button = picture_button(idlewin, _("Set"), ok_xpm);
+ gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5);
+ gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_idle), spinner);
+
+ button = picture_button(idlewin, _("Cancel"), cancel_xpm);
+ gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5);
+ gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(unset_idle), spinner);
+
+ gtk_widget_show_all(idlewin);
+}
+
+void gaim_plugin_remove() {
+ if (idlewin)
+ gtk_widget_destroy(idlewin);
+ idlewin = NULL;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/mid.diff Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,463 @@
+Index: src/buddy.c
+===================================================================
+RCS file: /cvsroot/gaim/gaim/src/buddy.c,v
+retrieving revision 1.228
+diff -u -r1.228 buddy.c
+--- src/buddy.c 2001/06/08 23:17:16 1.228
++++ src/buddy.c 2001/06/09 14:40:55
+@@ -87,6 +87,7 @@
+ GtkWidget *blist = NULL;
+ GtkWidget *bpmenu;
+ GtkWidget *buddies;
++GtkWidget *buddy_notebook;
+
+ void BuddyTickerLogonTimeout( gpointer data );
+ void BuddyTickerLogoutTimeout( gpointer data );
+@@ -2529,6 +2530,7 @@
+
+
+
++extern void convo_switch(GtkNotebook *notebook, GtkWidget *page, gint page_num, gpointer data);
+ void show_buddy_list()
+ {
+
+@@ -2546,7 +2548,6 @@
+ GtkWidget *menubar;
+ GtkWidget *vbox;
+ GtkWidget *menuitem;
+- GtkWidget *notebook;
+ GtkWidget *label;
+ GtkWidget *bbox;
+ GtkWidget *tbox;
+@@ -2711,7 +2712,8 @@
+
+ vbox = gtk_vbox_new(FALSE, 0);
+
+- notebook = gtk_notebook_new();
++ buddy_notebook = gtk_notebook_new();
++ gtk_signal_connect(GTK_OBJECT(buddy_notebook), "switch-page", GTK_SIGNAL_FUNC(convo_switch), NULL);
+
+
+
+@@ -2806,17 +2808,17 @@
+
+
+ label = gtk_label_new(_("Online"));
+- gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buddypane, label);
++ gtk_notebook_append_page(GTK_NOTEBOOK(buddy_notebook), buddypane, label);
+ label = gtk_label_new(_("Edit Buddies"));
+- gtk_notebook_append_page(GTK_NOTEBOOK(notebook), editpane, label);
++ gtk_notebook_append_page(GTK_NOTEBOOK(buddy_notebook), editpane, label);
+
+- gtk_widget_show_all(notebook);
++ gtk_widget_show_all(buddy_notebook);
+
+ /* Pack things in the vbox */
+ gtk_widget_show(vbox);
+
+
+- gtk_widget_show(notebook);
++ gtk_widget_show(buddy_notebook);
+
+ /* Enable buttons */
+
+@@ -2824,7 +2826,7 @@
+ gtk_signal_connect(GTK_OBJECT(addbutton), "clicked", GTK_SIGNAL_FUNC(add_buddy_callback), NULL);
+ gtk_signal_connect(GTK_OBJECT(groupbutton), "clicked", GTK_SIGNAL_FUNC(add_group_callback), NULL);
+ gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
+- gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
++ gtk_box_pack_start(GTK_BOX(vbox), buddy_notebook, TRUE, TRUE, 0);
+
+ gtk_container_add(GTK_CONTAINER(blist), vbox);
+
+Index: src/buddy_chat.c
+===================================================================
+RCS file: /cvsroot/gaim/gaim/src/buddy_chat.c,v
+retrieving revision 1.97
+diff -u -r1.97 buddy_chat.c
+--- src/buddy_chat.c 2001/05/31 00:40:54 1.97
++++ src/buddy_chat.c 2001/06/09 14:40:56
+@@ -756,7 +756,7 @@
+ GtkWidget *label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(chat_notebook),
+ gtk_notebook_get_nth_page(GTK_NOTEBOOK(chat_notebook), page_num));
+ GtkStyle *style;
+- struct conversation *b = g_list_nth_data(chats, page_num);
++ struct conversation *b = g_list_nth_data(chats, page_num - 2 - g_list_length(conversations));
+ if (b && b->window && b->entry)
+ gtk_window_set_focus(GTK_WINDOW(b->window), b->entry);
+ if (!GTK_WIDGET_REALIZED(label))
+@@ -794,85 +794,12 @@
+
+ int dispstyle = set_dispstyle(1);
+
+- if (display_options & OPT_DISP_ONE_CHAT_WINDOW) {
+- if (!all_chats) {
+- win = all_chats = b->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+- gtk_window_set_wmclass(GTK_WINDOW(win), "buddy_chat", "Gaim");
+- gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
+- gtk_container_border_width(GTK_CONTAINER(win), 0);
+- gtk_widget_realize(win);
+- aol_icon(win->window);
+- gtk_window_set_title(GTK_WINDOW(win), _("Gaim - Group Chats"));
+- gtk_signal_connect(GTK_OBJECT(win), "delete_event",
+- GTK_SIGNAL_FUNC(delete_all_chats), NULL);
++ win = b->window = blist;
+
+- chat_notebook = gtk_notebook_new();
+- if (display_options & OPT_DISP_CHAT_SIDE_TAB) {
+- if (display_options & OPT_DISP_CHAT_BR_TAB) {
+- gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook),
+- GTK_POS_RIGHT);
+- } else {
+- gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook),
+- GTK_POS_LEFT);
+- }
+- } else {
+- if (display_options & OPT_DISP_CHAT_BR_TAB) {
+- gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook),
+- GTK_POS_BOTTOM);
+- } else {
+- gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook),
+- GTK_POS_TOP);
+- }
+- }
+- gtk_notebook_set_scrollable(GTK_NOTEBOOK(chat_notebook), TRUE);
+- gtk_notebook_popup_enable(GTK_NOTEBOOK(chat_notebook));
+- gtk_container_add(GTK_CONTAINER(win), chat_notebook);
+- gtk_signal_connect(GTK_OBJECT(chat_notebook), "switch-page",
+- GTK_SIGNAL_FUNC(chat_switch), NULL);
+- gtk_widget_show(chat_notebook);
+- } else
+- win = b->window = all_chats;
+-
+- cont = gtk_vbox_new(FALSE, 5);
+- gtk_container_set_border_width(GTK_CONTAINER(cont), 5);
+- gtk_notebook_append_page(GTK_NOTEBOOK(chat_notebook), cont, gtk_label_new(b->name));
+- gtk_widget_show(cont);
+- } else {
+- win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+- b->window = win;
+- gtk_object_set_user_data(GTK_OBJECT(win), b);
+- gtk_window_set_wmclass(GTK_WINDOW(win), "buddy_chat", "Gaim");
+- gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
+- gtk_container_border_width(GTK_CONTAINER(win), 10);
+- gtk_widget_realize(win);
+- aol_icon(win->window);
+- g_snprintf(buf, sizeof(buf), "Gaim - %s (chat)", b->name);
+- gtk_window_set_title(GTK_WINDOW(win), buf);
+- gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(close_callback), b);
+-
+- cont = gtk_vbox_new(FALSE,5);
+- gtk_container_add(GTK_CONTAINER(win), cont);
+- gtk_widget_show(cont);
+- }
+-
+- if (b->gc->prpl->options & OPT_PROTO_CHAT_TOPIC) {
+- GtkWidget *hbox;
+- GtkWidget *label;
+-
+- hbox = gtk_hbox_new(FALSE, 0);
+- gtk_box_pack_start(GTK_BOX(cont), hbox, FALSE, FALSE, 5);
+- gtk_widget_show(hbox);
+-
+- label = gtk_label_new(_("Topic:"));
+- gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+- gtk_widget_show(label);
+-
+- b->topic_text = gtk_entry_new();
+- gtk_signal_connect(GTK_OBJECT(b->topic_text), "activate",
+- GTK_SIGNAL_FUNC(topic_callback), b);
+- gtk_box_pack_start(GTK_BOX(hbox), b->topic_text, TRUE, TRUE, 5);
+- gtk_widget_show(b->topic_text);
+- }
++ cont = gtk_vbox_new(FALSE, 5);
++ gtk_container_set_border_width(GTK_CONTAINER(cont), 5);
++ gtk_notebook_append_page(GTK_NOTEBOOK(buddy_notebook), cont, gtk_label_new(b->name));
++ gtk_widget_show(cont);
+
+ vpaned = gtk_vpaned_new();
+ gtk_paned_set_gutter_size(GTK_PANED(vpaned), 15);
+Index: src/conversation.c
+===================================================================
+RCS file: /cvsroot/gaim/gaim/src/conversation.c,v
+retrieving revision 1.228
+diff -u -r1.228 conversation.c
+--- src/conversation.c 2001/06/07 03:12:45 1.228
++++ src/conversation.c 2001/06/09 14:40:56
+@@ -394,55 +394,17 @@
+
+ int close_callback(GtkWidget *widget, struct conversation *c)
+ {
+- if (c->is_chat && (widget == c->close) && !(display_options & OPT_DISP_ONE_CHAT_WINDOW)) {
+- GtkWidget *tmp = c->window;
+- debug_printf("chat clicked close button\n");
+- c->window = NULL;
+- gtk_widget_destroy(tmp);
+- return FALSE;
+- }
+-
+ debug_printf("conversation close callback\n");
+
+ if (general_options & OPT_GEN_CHECK_SPELLING)
+ gtkspell_detach(GTK_TEXT(c->entry));
+
+ if (!c->is_chat) {
+- if (c->gc && c->gc->prpl && c->gc->prpl->remove_convo)
+- (*c->gc->prpl->remove_convo)(c->gc, c);
+- if (display_options & OPT_DISP_ONE_WINDOW) {
+- if (g_list_length(conversations) > 1) {
+- gtk_notebook_remove_page(GTK_NOTEBOOK(convo_notebook),
+- g_list_index(conversations, c));
+- } else {
+- if (c->window)
+- gtk_widget_destroy(c->window);
+- c->window = NULL;
+- all_convos = NULL;
+- convo_notebook = NULL;
+- }
+- } else {
+- if (c->window)
+- gtk_widget_destroy(c->window);
+- c->window = NULL;
+- }
++ gtk_notebook_remove_page(GTK_NOTEBOOK(buddy_notebook),
++ g_list_index(conversations, c) + 2);
+ } else {
+- if (display_options & OPT_DISP_ONE_CHAT_WINDOW) {
+- if (g_list_length(chats) > 1) {
+- gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook),
+- g_list_index(chats, c));
+- } else {
+- if (c->window)
+- gtk_widget_destroy(c->window);
+- c->window = NULL;
+- all_chats = NULL;
+- chat_notebook = NULL;
+- }
+- } else {
+- if (c->window)
+- gtk_widget_destroy(c->window);
+- c->window = NULL;
+- }
++ gtk_notebook_remove_page(GTK_NOTEBOOK(buddy_notebook),
++ g_list_index(chats, c) + g_list_length(conversations) + 2);
+ }
+
+ if (c->fg_color_dialog)
+@@ -691,64 +653,6 @@
+ gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+ }
+ }
+- if ((!c->is_chat && (display_options & OPT_DISP_ONE_WINDOW)) ||
+- ( c->is_chat && (display_options & OPT_DISP_ONE_CHAT_WINDOW))) {
+- GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook);
+- if (event->keyval == '[') {
+- gtk_notebook_prev_page(GTK_NOTEBOOK(notebook));
+- gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+- } else if (event->keyval == ']') {
+- gtk_notebook_next_page(GTK_NOTEBOOK(notebook));
+- gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+- } else if (event->keyval == GDK_Tab) {
+- GList *ws = (c->is_chat ? chats : conversations);
+- GList *cnv = g_list_nth(ws,
+- gtk_notebook_get_current_page(
+- GTK_NOTEBOOK(notebook)));
+- struct conversation *d = NULL;
+- while (cnv) {
+- d = cnv->data;
+- if (d->unseen)
+- break;
+- cnv = cnv->next;
+- d = NULL;
+- }
+- if (d) {
+- gtk_notebook_set_page(GTK_NOTEBOOK(notebook),
+- g_list_index(ws, d));
+- } else {
+- cnv = ws;
+- while (cnv) {
+- d = cnv->data;
+- if (d->unseen)
+- break;
+- cnv = cnv->next;
+- d = NULL;
+- }
+- if (d) {
+- gtk_notebook_set_page(
+- GTK_NOTEBOOK(notebook),
+- g_list_index(ws, d));
+- } else {
+- cnv = g_list_last(ws);
+- if (c == cnv->data)
+- gtk_notebook_set_page(
+- GTK_NOTEBOOK(notebook), 0);
+- else
+- gtk_notebook_next_page(
+- GTK_NOTEBOOK(notebook));
+- }
+- }
+- gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+- }
+- }
+- } else if (((!c->is_chat && (display_options & OPT_DISP_ONE_WINDOW)) ||
+- ( c->is_chat && (display_options & OPT_DISP_ONE_CHAT_WINDOW))) &&
+- (event->state & GDK_MOD1_MASK) && isdigit(event->keyval) &&
+- (event->keyval > '0')) {
+- GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook);
+- gtk_notebook_set_page(GTK_NOTEBOOK(notebook), event->keyval - '1');
+- gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
+ }
+
+ return TRUE;
+@@ -1502,15 +1406,16 @@
+
+ if (((flags & WFLAG_RECV) || (flags & WFLAG_SYSTEM)) &&
+ ((!c->is_chat && (display_options & OPT_DISP_ONE_WINDOW) &&
+- (gtk_notebook_get_current_page(GTK_NOTEBOOK(convo_notebook))
+- != g_list_index(conversations, c))) ||
++ (gtk_notebook_get_current_page(GTK_NOTEBOOK(buddy_notebook))
++ != g_list_index(conversations, c) + 2)) ||
+ ( c->is_chat && (display_options & OPT_DISP_ONE_CHAT_WINDOW) &&
+- (gtk_notebook_get_current_page(GTK_NOTEBOOK(chat_notebook))
+- != g_list_index(chats, c))))) {
+- GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook);
++ (gtk_notebook_get_current_page(GTK_NOTEBOOK(buddy_notebook))
++ != g_list_index(chats, c) + g_list_length(conversations) + 2)))) {
+ GList *ws = (c->is_chat ? chats : conversations);
+- GtkWidget *label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook),
+- gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), g_list_index(ws, c)));
++ int add = (c->is_chat ? 2 + g_list_length(conversations) : 2);
++ GtkWidget *label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(buddy_notebook),
++ gtk_notebook_get_nth_page(GTK_NOTEBOOK(buddy_notebook),
++ g_list_index(ws, c) + add));
+ GtkStyle *style = gtk_style_new();
+ if (!GTK_WIDGET_REALIZED(label))
+ gtk_widget_realize(label);
+@@ -1946,12 +1851,16 @@
+ }
+ }
+
+-static void convo_switch(GtkNotebook *notebook, GtkWidget *page, gint page_num, gpointer data)
++void convo_switch(GtkNotebook *notebook, GtkWidget *page, gint page_num, gpointer data)
+ {
+- GtkWidget *label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(convo_notebook),
+- gtk_notebook_get_nth_page(GTK_NOTEBOOK(convo_notebook), page_num));
++ GtkWidget *label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(buddy_notebook),
++ gtk_notebook_get_nth_page(GTK_NOTEBOOK(buddy_notebook), page_num));
+ GtkStyle *style;
+- struct conversation *c = g_list_nth_data(conversations, page_num);
++ struct conversation *c = (page_num >= 2 + g_list_length(conversations)) ?
++ g_list_nth_data(chats, page_num - 2 - g_list_length(conversations)) :
++ page_num >= 2 ? g_list_nth_data(conversations, page_num - 2) : NULL;
++ if (!c)
++ return;
+ if (c && c->window && c->entry)
+ gtk_window_set_focus(GTK_WINDOW(c->window), c->entry);
+ if (!GTK_WIDGET_REALIZED(label))
+@@ -2004,66 +1913,13 @@
+ c->fgcol = fgcolor;
+ c->hasfg = 0;
+
+- if (display_options & OPT_DISP_ONE_WINDOW) {
+- if (!all_convos) {
+- win = all_convos = c->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+- gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim");
+- gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
+- gtk_container_border_width(GTK_CONTAINER(win), 0);
+- gtk_widget_realize(win);
+- aol_icon(win->window);
+- gtk_window_set_title(GTK_WINDOW(win), _("Gaim - Conversations"));
+- gtk_signal_connect(GTK_OBJECT(win), "delete_event",
+- GTK_SIGNAL_FUNC(delete_all_convo), NULL);
+-
+- convo_notebook = gtk_notebook_new();
+- if (display_options & OPT_DISP_CONV_SIDE_TAB) {
+- if (display_options & OPT_DISP_CONV_BR_TAB) {
+- gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook),
+- GTK_POS_RIGHT);
+- } else {
+- gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook),
+- GTK_POS_LEFT);
+- }
+- } else {
+- if (display_options & OPT_DISP_CONV_BR_TAB) {
+- gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook),
+- GTK_POS_BOTTOM);
+- } else {
+- gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook),
+- GTK_POS_TOP);
+- }
+- }
+- gtk_notebook_set_scrollable(GTK_NOTEBOOK(convo_notebook), TRUE);
+- gtk_notebook_popup_enable(GTK_NOTEBOOK(convo_notebook));
+- gtk_container_add(GTK_CONTAINER(win), convo_notebook);
+- gtk_signal_connect(GTK_OBJECT(convo_notebook), "switch-page",
+- GTK_SIGNAL_FUNC(convo_switch), NULL);
+- gtk_widget_show(convo_notebook);
+- } else
+- win = c->window = all_convos;
++ win = c->window = blist;
+
+- cont = gtk_vbox_new(FALSE, 5);
+- gtk_container_set_border_width(GTK_CONTAINER(cont), 5);
+- gtk_notebook_append_page(GTK_NOTEBOOK(convo_notebook), cont, gtk_label_new(c->name));
+- gtk_widget_show(cont);
+- } else {
+- cont = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+- c->window = win;
+- gtk_object_set_user_data(GTK_OBJECT(win), c);
+- gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim");
+- gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
+- gtk_container_border_width(GTK_CONTAINER(win), 10);
+- gtk_widget_realize(win);
+- aol_icon(win->window);
+- if ((find_log_info(c->name)) || ((logging_options & OPT_LOG_ALL)))
+- g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name);
+- else
+- g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name);
+- gtk_window_set_title(GTK_WINDOW(win), buf);
+- gtk_signal_connect(GTK_OBJECT(win), "delete_event",
+- GTK_SIGNAL_FUNC(delete_event_convo), c);
+- }
++ cont = gtk_vbox_new(FALSE, 5);
++ gtk_container_set_border_width(GTK_CONTAINER(cont), 5);
++ gtk_notebook_insert_page(GTK_NOTEBOOK(buddy_notebook), cont, gtk_label_new(c->name),
++ 1 + g_list_length(conversations));
++ gtk_widget_show(cont);
+
+ paned = gtk_vpaned_new();
+ gtk_paned_set_gutter_size(GTK_PANED(paned), 15);
+@@ -2340,14 +2196,14 @@
+
+ void set_convo_tab_label(struct conversation *c, char *text)
+ {
+- gtk_label_set_text(GTK_LABEL(gtk_notebook_get_tab_label(GTK_NOTEBOOK(convo_notebook),
+- gtk_notebook_get_nth_page(GTK_NOTEBOOK(convo_notebook),
+- g_list_index(conversations, c)))), text);
++ gtk_label_set_text(GTK_LABEL(gtk_notebook_get_tab_label(GTK_NOTEBOOK(buddy_notebook),
++ gtk_notebook_get_nth_page(GTK_NOTEBOOK(buddy_notebook),
++ g_list_index(conversations, c) + 2))), text);
+ }
+
+ void raise_convo_tab(struct conversation *c)
+ {
+- gtk_notebook_set_page(GTK_NOTEBOOK(convo_notebook), g_list_index(conversations, c));
++ gtk_notebook_set_page(GTK_NOTEBOOK(buddy_notebook), g_list_index(conversations, c) + 2);
+ gdk_window_show(c->window->window);
+ }
+
+Index: src/gaim.h
+===================================================================
+RCS file: /cvsroot/gaim/gaim/src/gaim.h,v
+retrieving revision 1.230
+diff -u -r1.230 gaim.h
+--- src/gaim.h 2001/06/01 23:56:52 1.230
++++ src/gaim.h 2001/06/09 14:40:57
+@@ -439,6 +439,7 @@
+ extern GList *chats;
+ extern GtkWidget *all_chats;
+ extern GtkWidget *chat_notebook;
++extern GtkWidget *buddy_notebook;
+
+ extern GtkWidget *joinchat;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/pixbuf.c Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,153 @@
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk-pixbuf/gdk-pixbuf-loader.h>
+#include <gtk/gtk.h>
+#include <stdio.h>
+
+char data[8192];
+int length;
+GdkPixbufAnimation *anim = NULL;
+GdkPixbuf *unanim = NULL;
+GtkWidget *pix;
+guint timer;
+gint curframe;
+
+static gboolean redraw_anim(gpointer data)
+{
+ int delay;
+ GList *frames;
+ GdkPixbufFrame *frame;
+ GdkPixbuf *buf;
+ GdkPixmap *pm; GdkBitmap *bm;
+ GdkPixmap *src;
+ GdkGC *gc;
+
+ frames = gdk_pixbuf_animation_get_frames(anim);
+ frame = g_list_nth_data(frames, curframe);
+ switch (gdk_pixbuf_frame_get_action(frame)) {
+ case GDK_PIXBUF_FRAME_RETAIN:
+ buf = gdk_pixbuf_frame_get_pixbuf(frame);
+ gdk_pixbuf_render_pixmap_and_mask(buf, &src, NULL, 0);
+ gtk_pixmap_get(GTK_PIXMAP(pix), &pm, &bm);
+ gc = gdk_gc_new(pm);
+ gdk_draw_pixmap(pm, gc, src, 0, 0,
+ gdk_pixbuf_frame_get_x_offset(frame),
+ gdk_pixbuf_frame_get_y_offset(frame),
+ -1, -1);
+ gtk_pixmap_set(GTK_PIXMAP(pix), pm, bm);
+ gtk_widget_queue_draw(pix);
+ gdk_gc_unref(gc);
+ break;
+ case GDK_PIXBUF_FRAME_DISPOSE:
+ buf = gdk_pixbuf_frame_get_pixbuf(frame);
+ gdk_pixbuf_render_pixmap_and_mask(buf, &pm, &bm, 0);
+ gtk_pixmap_set(GTK_PIXMAP(pix), pm, bm);
+ gdk_pixmap_unref(pm);
+ if (bm)
+ gdk_bitmap_unref(bm);
+ break;
+ case GDK_PIXBUF_FRAME_REVERT:
+ frame = frames->data;
+ buf = gdk_pixbuf_frame_get_pixbuf(frame);
+ gdk_pixbuf_render_pixmap_and_mask(buf, &pm, &bm, 0);
+ gtk_pixmap_set(GTK_PIXMAP(pix), pm, bm);
+ gdk_pixmap_unref(pm);
+ if (bm)
+ gdk_bitmap_unref(bm);
+ break;
+ }
+ curframe = (curframe + 1) % g_list_length(frames);
+ delay = MAX(gdk_pixbuf_frame_get_delay_time(frame), 13);
+ timer = gtk_timeout_add(delay * 10, redraw_anim, NULL);
+ return FALSE;
+}
+
+void des_evt(GtkObject *o, gpointer d)
+{
+ if (anim)
+ gdk_pixbuf_animation_unref(anim);
+ if (unanim)
+ gdk_pixbuf_unref(unanim);
+ if (timer)
+ gtk_timeout_remove(timer);
+ gtk_main_quit();
+}
+
+int main(int argc, char **argv)
+{
+ GdkPixbufLoader *load;
+ GList *frames;
+ GdkPixbuf *buf;
+ GdkPixmap *pm;
+ GdkBitmap *bm;
+ char data[8192];
+ int length;
+
+ FILE *f;
+ GtkWidget *win;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+
+ gtk_init(&argc, &argv);
+
+ if (argc == 2)
+ f = fopen(argv[1], "r");
+ else
+ f = fopen("picture.id", "r");
+ if (!f) return 1;
+
+ length = fread(data, 1, 8192, f);
+ fclose(f);
+
+ load = gdk_pixbuf_loader_new();
+ gdk_pixbuf_loader_write(load, data, length);
+ anim = gdk_pixbuf_loader_get_animation(load);
+
+ if (anim) {
+ frames = gdk_pixbuf_animation_get_frames(anim);
+ buf = gdk_pixbuf_frame_get_pixbuf(frames->data);
+ gdk_pixbuf_render_pixmap_and_mask(buf, &pm, &bm, 0);
+
+ if (gdk_pixbuf_animation_get_num_frames(anim) > 1) {
+ int delay = MAX(gdk_pixbuf_frame_get_delay_time(frames->data), 13);
+ curframe = 1;
+ timer = gtk_timeout_add(delay * 10, redraw_anim, NULL);
+ }
+ } else {
+ unanim = gdk_pixbuf_loader_get_pixbuf(load);
+ if (!unanim) {
+ gdk_pixbuf_loader_close(load);
+ return 1;
+ }
+ gdk_pixbuf_render_pixmap_and_mask(unanim, &pm, &bm, 0);
+ }
+
+ win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
+ gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(des_evt), NULL);
+
+ vbox = gtk_hbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(win), vbox);
+ gtk_widget_show(vbox);
+
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show(hbox);
+
+ pix = gtk_pixmap_new(pm, bm);
+ gtk_box_pack_start(GTK_BOX(hbox), pix, FALSE, FALSE, 0);
+ if (anim && (gdk_pixbuf_animation_get_num_frames(anim) > 1))
+ gtk_widget_set_usize(pix, gdk_pixbuf_animation_get_width(anim),
+ gdk_pixbuf_animation_get_height(anim));
+ gtk_widget_show(pix);
+ gdk_pixmap_unref(pm);
+ if (bm)
+ gdk_bitmap_unref(bm);
+
+ gdk_pixbuf_loader_close(load);
+
+ gtk_widget_show(win);
+
+ gtk_main();
+
+ return 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/pixbuf.shtml Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,30 @@
+<!--#include virtual="/header.shtml"-->
+
+<h1>GdkPixbuf Tests</h1>
+<blockquote>
+
+When I was adding buddy icons to Gaim I wrote a quick test program that
+used GdkPixbuf. You can get a copy of that program <a href="pixbuf.c">here</a>.
+To compile it, run:
+<P><code>gcc -o pixbuf pixbuf.c `gdk-pixbuf-config --cflags` `gdk-pixbuf-config
+--libs`</code>
+
+<P>Well, as it turns out, it doesn't display the following images very well:
+
+<P><img src="ABpenguinsAIM.gif" alt="animated penguins">
+<img src="bf.gif" alt="butterfly">
+<img src="ABcherrychopAIM.gif" alt="chopping down a tree">
+
+<P>So I wrote another quick test program to test GTK 2. You can get a copy
+of that program <a href="pixbuf2.c">here</a>. To compile it, run:
+<P><code>gcc -o pixbuf2 pixbuf2.c `pkg-config gtk+-x11-2.0 --cflags` `pkg-config
+gtk+-x11-2.0 --libs`</code>
+
+<P>Turns out I actually didn't need to write it because there's a testanimation
+program in the GTK 2 source that does exactly the same thing. Oh well. Anyway,
+if you compare the two you'll see that it's much easier to code and displays
+better. Such is the power of GTK 2.
+
+</blockquote>
+
+<!--#include virtual="/footer.shtml"-->
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/eric/pixbuf2.c Thu Sep 26 06:23:05 2002 -0400
@@ -0,0 +1,64 @@
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk-pixbuf/gdk-pixbuf-loader.h>
+#include <gtk/gtk.h>
+#include <stdio.h>
+
+char data[8192];
+int length;
+
+void des_evt(GtkObject *o, gpointer d)
+{
+ gtk_main_quit();
+}
+
+int main(int argc, char **argv)
+{
+ GdkPixbufLoader *load;
+ GdkPixbufAnimation *anim;
+ GdkPixbuf *unanim;
+ char data[8192];
+ int length;
+
+ FILE *f;
+ GtkWidget *win;
+ GtkWidget *pix;
+
+ gtk_init(&argc, &argv);
+
+ if (argc == 2)
+ f = fopen(argv[1], "r");
+ else
+ f = fopen("picture.id", "r");
+ if (!f) return 1;
+
+ length = fread(data, 1, 8192, f);
+ fclose(f);
+
+ load = gdk_pixbuf_loader_new();
+ gdk_pixbuf_loader_write(load, data, length, NULL);
+ anim = gdk_pixbuf_loader_get_animation(load);
+
+ if (anim) {
+ pix = gtk_image_new_from_animation(anim);
+ gdk_pixbuf_animation_unref(anim);
+ } else {
+ unanim = gdk_pixbuf_loader_get_pixbuf(load);
+ pix = gtk_image_new_from_pixbuf(unanim);
+ gdk_pixbuf_unref(unanim);
+ }
+
+ win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
+ gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(des_evt), NULL);
+
+ gtk_container_add(GTK_CONTAINER(win), pix);
+ gtk_widget_show(pix);
+
+ gdk_pixbuf_loader_close(load, NULL);
+
+ gtk_widget_show(win);
+
+ gtk_main();
+
+ return 0;
+}