Mon, 20 Jan 2003 09:10:23 +0000
[gaim-migrate @ 4625]
Wow, okay, where to begin with this one ;)
I rewrote the whole conversation backend. It is now core/UI split. Here's
how it works..
Every conversation is represented by a gaim_conversation structure. This
branches out into gaim_im and gaim_chat structures. Every conversation
lives in (well, normally, but it doesn't have to) a gaim_window structure.
This is a _CORE_ representation of a window. There can be multiple
gaim_window structures around.
The gaim_window and gaim_conversation structures have UI-specific operation
structures associated with them. At the moment, the only UI is GTK+, and
this will be for some time. Don't start thinking you can write a QT UI now.
It's just not going to happen.
Everything that is done on a conversation is done through the core API.
This API does core processing and then calls the UI operations for the
rendering and anything else.
Now, what does this give the user?
- Multiple windows.
- Multiple tabs per window.
- Draggable tabs.
- Send As menu is moved to the menubar.
- Menubar for chats.
- Some very cool stuff in the future, like replacing, say, IRC chat windows
with an X-Chat interface, or whatever.
- Later on, customizable window/conversation positioning.
For developers:
- Fully documented API
- Core/UI split
- Variable checking and mostly sane handling of incorrect variables.
- Logical structure to conversations, both core and UI.
- Some very cool stuff in the future, like replacing, say, IRC chat windows
with an X-Chat interface, or whatever.
- Later on, customizable window/conversation positioning.
- Oh yeah, and the beginning of a stock icon system.
Now, there are things that aren't there yet. You will see tabs even if you
have them turned off. This will be fixed in time. Also, the preferences
will change to work with the new structure. I'm starting school in 2 days,
so it may not be done immediately, but hopefully in the next week.
Enjoy!
| 1 | 1 | /* |
| 2 | * gaim | |
| 3 | * | |
| 4 | * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 3424 | 7 | * it under the terms of the GNU General Public License as published by |
| 1 | 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | * | |
| 20 | */ | |
| 21 | ||
|
349
6f7d28b0f98d
[gaim-migrate @ 359]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
338
diff
changeset
|
22 | #ifdef HAVE_CONFIG_H |
|
2090
bab8b7e309db
[gaim-migrate @ 2100]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2072
diff
changeset
|
23 | #include <config.h> |
|
349
6f7d28b0f98d
[gaim-migrate @ 359]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
338
diff
changeset
|
24 | #endif |
| 1 | 25 | #include <string.h> |
| 26 | #include <stdio.h> | |
| 27 | #include <stdlib.h> | |
| 28 | #include <time.h> | |
| 29 | ||
| 30 | #include <gtk/gtk.h> | |
| 31 | #include "gaim.h" | |
| 4006 | 32 | #include "gtkimhtml.h" |
| 1 | 33 | |
|
1250
46ac03911ab0
[gaim-migrate @ 1260]
Decklin Foster <decklin@red-bean.com>
parents:
1233
diff
changeset
|
34 | static GtkWidget *about = NULL; |
| 1 | 35 | |
| 36 | static void destroy_about() | |
| 37 | { | |
| 38 | if (about) | |
| 39 | gtk_widget_destroy(about); | |
| 40 | about = NULL; | |
| 41 | } | |
| 42 | ||
|
1710
4793276c2510
[gaim-migrate @ 1720]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1670
diff
changeset
|
43 | char *name() |
|
4793276c2510
[gaim-migrate @ 1720]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1670
diff
changeset
|
44 | { |
|
4793276c2510
[gaim-migrate @ 1720]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1670
diff
changeset
|
45 | return PACKAGE; |
|
4793276c2510
[gaim-migrate @ 1720]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1670
diff
changeset
|
46 | } |
|
4793276c2510
[gaim-migrate @ 1720]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1670
diff
changeset
|
47 | |
|
4793276c2510
[gaim-migrate @ 1720]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1670
diff
changeset
|
48 | char *description() |
|
4793276c2510
[gaim-migrate @ 1720]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1670
diff
changeset
|
49 | { |
|
4793276c2510
[gaim-migrate @ 1720]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1670
diff
changeset
|
50 | return WEBSITE; |
|
523
da3c269711b7
[gaim-migrate @ 533]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
356
diff
changeset
|
51 | } |
|
da3c269711b7
[gaim-migrate @ 533]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
356
diff
changeset
|
52 | |
|
2276
16753d87b819
[gaim-migrate @ 2286]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2251
diff
changeset
|
53 | char *version() |
|
16753d87b819
[gaim-migrate @ 2286]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2251
diff
changeset
|
54 | { |
|
16753d87b819
[gaim-migrate @ 2286]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2251
diff
changeset
|
55 | return VERSION; |
|
16753d87b819
[gaim-migrate @ 2286]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2251
diff
changeset
|
56 | } |
|
16753d87b819
[gaim-migrate @ 2286]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2251
diff
changeset
|
57 | |
|
4082
0cb2b86d19b4
[gaim-migrate @ 4297]
Robert McQueen <robot101@debian.org>
parents:
4074
diff
changeset
|
58 | void show_about(GtkWidget *w, void *data) |
| 1 | 59 | { |
| 60 | GtkWidget *vbox; | |
| 1210 | 61 | GtkWidget *frame; |
| 62 | GtkWidget *fbox; | |
| 1205 | 63 | GtkWidget *hbox; |
| 64 | GtkWidget *button; | |
| 4006 | 65 | GtkWidget *text; |
| 2950 | 66 | GtkWidget *sw; |
| 3721 | 67 | GtkWidget *logo; |
| 1 | 68 | |
| 1205 | 69 | char abouttitle[45]; |
|
1250
46ac03911ab0
[gaim-migrate @ 1260]
Decklin Foster <decklin@red-bean.com>
parents:
1233
diff
changeset
|
70 | |
| 1 | 71 | if (!about) { |
|
1250
46ac03911ab0
[gaim-migrate @ 1260]
Decklin Foster <decklin@red-bean.com>
parents:
1233
diff
changeset
|
72 | |
|
2725
a844d0964552
[gaim-migrate @ 2738]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2562
diff
changeset
|
73 | GAIM_DIALOG(about); |
|
2904
43a12c48c7c3
[gaim-migrate @ 2917]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2902
diff
changeset
|
74 | gtk_window_set_default_size(GTK_WINDOW(about), 450, -1); |
| 2535 | 75 | g_snprintf(abouttitle, sizeof(abouttitle), _("About Gaim v%s"), VERSION); |
| 1 | 76 | gtk_window_set_title(GTK_WINDOW(about), abouttitle); |
|
4074
c69100a0ede9
[gaim-migrate @ 4289]
Robert McQueen <robot101@debian.org>
parents:
4054
diff
changeset
|
77 | gtk_window_set_role(GTK_WINDOW(about), "about"); |
| 1210 | 78 | gtk_window_set_policy(GTK_WINDOW(about), FALSE, TRUE, TRUE); |
| 79 | gtk_widget_realize(about); | |
| 1 | 80 | |
| 1210 | 81 | vbox = gtk_vbox_new(FALSE, 5); |
| 82 | gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | |
| 83 | gtk_container_add(GTK_CONTAINER(about), vbox); | |
| 2450 | 84 | gtk_widget_show(vbox); |
| 1205 | 85 | |
| 2562 | 86 | frame = gtk_frame_new("Gaim v" VERSION); |
|
1250
46ac03911ab0
[gaim-migrate @ 1260]
Decklin Foster <decklin@red-bean.com>
parents:
1233
diff
changeset
|
87 | gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
| 2450 | 88 | gtk_widget_show(frame); |
| 1210 | 89 | |
| 2072 | 90 | fbox = gtk_vbox_new(FALSE, 5); |
|
1250
46ac03911ab0
[gaim-migrate @ 1260]
Decklin Foster <decklin@red-bean.com>
parents:
1233
diff
changeset
|
91 | gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); |
| 1210 | 92 | gtk_container_add(GTK_CONTAINER(frame), fbox); |
| 2450 | 93 | gtk_widget_show(fbox); |
| 1205 | 94 | |
| 3721 | 95 | logo = gaim_pixmap(NULL, "logo.png"); |
| 96 | gtk_box_pack_start(GTK_BOX(fbox), logo, FALSE, FALSE, 0); | |
| 97 | gtk_widget_show(logo); | |
| 1205 | 98 | |
| 4006 | 99 | sw = gtk_scrolled_window_new(NULL, NULL); |
| 100 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
| 101 | GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
| 4197 | 102 | gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
| 4006 | 103 | gtk_box_pack_start(GTK_BOX(fbox), sw, TRUE, TRUE, 0); |
| 3709 | 104 | |
| 4006 | 105 | text = gtk_imhtml_new(NULL, NULL); |
| 106 | gtk_container_add(GTK_CONTAINER(sw), text); | |
| 4197 | 107 | gtk_widget_set_size_request(sw, -1, 350); |
| 4006 | 108 | gaim_setup_imhtml(text); |
| 2950 | 109 | |
| 3709 | 110 | |
| 4006 | 111 | gtk_imhtml_append_text(GTK_IMHTML(text), |
| 112 | _("Gaim is a modular Instant Messaging client capable of " | |
| 113 | "using AIM, ICQ, Yahoo!, MSN, IRC, Jabber, Napster, " | |
| 114 | "Zephyr, and Gadu-Gadu all at once. It is written using " | |
| 4054 | 115 | "Gtk+ and is licensed under the GPL.<BR><BR>"), -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 116 | |
| 117 | gtk_imhtml_append_text(GTK_IMHTML(text), | |
| 118 | "<FONT SIZE=\"3\">URL:</FONT> <A HREF=\"" WEBSITE "\">" | |
| 4054 | 119 | WEBSITE "</A><BR><BR>", -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 120 | |
| 121 | gtk_imhtml_append_text(GTK_IMHTML(text), | |
|
4160
280892d3f57a
[gaim-migrate @ 4389]
Nicolás Lichtmaier <nico@lichtmaier.com.ar>
parents:
4157
diff
changeset
|
122 | _("<FONT SIZE=\"3\">IRC:</FONT> #gaim on irc.freenode.net" |
|
280892d3f57a
[gaim-migrate @ 4389]
Nicolás Lichtmaier <nico@lichtmaier.com.ar>
parents:
4157
diff
changeset
|
123 | "<BR><BR>"), -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 124 | |
| 125 | gtk_imhtml_append_text(GTK_IMHTML(text), | |
| 4054 | 126 | _("<FONT SIZE=\"3\">Active Developers:</FONT><BR>"), -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 127 | gtk_imhtml_append_text(GTK_IMHTML(text), |
|
4160
280892d3f57a
[gaim-migrate @ 4389]
Nicolás Lichtmaier <nico@lichtmaier.com.ar>
parents:
4157
diff
changeset
|
128 | _(" Rob Flynn (maintainer) " |
| 4006 | 129 | "<<A HREF=\"mailto:rob@marko.net\">rob@marko.net</A>><BR>" |
| 130 | " Sean Egan (coder) " | |
| 131 | "<<A HREF=\"mailto:bj91704@binghamton.edu\">" | |
| 132 | "bj91704@binghamton.edu</A>>" | |
|
4160
280892d3f57a
[gaim-migrate @ 4389]
Nicolás Lichtmaier <nico@lichtmaier.com.ar>
parents:
4157
diff
changeset
|
133 | "<BR><BR>"), -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 134 | |
| 135 | gtk_imhtml_append_text(GTK_IMHTML(text), | |
| 4054 | 136 | _("<FONT SIZE=\"3\">Crazy Patch Writers:</FONT><BR>"), -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 137 | gtk_imhtml_append_text(GTK_IMHTML(text), |
| 138 | " Benjamin Miller<BR>" | |
| 139 | " Decklin Foster<BR>" | |
| 140 | " Nathan Walp<BR>" | |
| 4054 | 141 | " Mark Doliner<BR><BR>", -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 142 | |
| 143 | gtk_imhtml_append_text(GTK_IMHTML(text), | |
| 4054 | 144 | _("<FONT SIZE=\"3\">Win32 Port:</FONT><BR>"), -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 145 | gtk_imhtml_append_text(GTK_IMHTML(text), |
| 146 | " Herman Bloggs " | |
| 147 | "<<A HREF=\"mailto:hermanator12002@yahoo.com\">" | |
| 4054 | 148 | "hermanator12002@yahoo.com</A>><BR><BR>", -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 149 | |
| 150 | gtk_imhtml_append_text(GTK_IMHTML(text), | |
| 4054 | 151 | _("<FONT SIZE=\"3\">Retired Developers:</FONT><BR>"), -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 152 | gtk_imhtml_append_text(GTK_IMHTML(text), |
|
4160
280892d3f57a
[gaim-migrate @ 4389]
Nicolás Lichtmaier <nico@lichtmaier.com.ar>
parents:
4157
diff
changeset
|
153 | _(" Jim Duchek<BR>" |
| 4006 | 154 | " Eric Warmenhoven " |
| 155 | "<<A HREF=\"mailto:warmenhoven@yahoo.com\">" | |
| 156 | "warmenhoven@yahoo.com</A>><BR>" | |
| 157 | " Mark Spencer (original author) " | |
| 158 | "<<A HREF=\"mailto:markster@marko.net\">" | |
| 159 | "markster@marko.net</A>>" | |
|
4160
280892d3f57a
[gaim-migrate @ 4389]
Nicolás Lichtmaier <nico@lichtmaier.com.ar>
parents:
4157
diff
changeset
|
160 | "<BR><BR>"), -1, GTK_IMHTML_NO_SCROLL); |
| 4006 | 161 | |
| 162 | gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)), 0); | |
| 163 | ||
| 164 | gtk_widget_show(text); | |
| 2950 | 165 | gtk_widget_show(sw); |
| 3709 | 166 | |
|
1250
46ac03911ab0
[gaim-migrate @ 1260]
Decklin Foster <decklin@red-bean.com>
parents:
1233
diff
changeset
|
167 | |
| 1205 | 168 | /* Close Button */ |
| 169 | ||
| 170 | hbox = gtk_hbox_new(FALSE, 5); | |
| 1210 | 171 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 2450 | 172 | gtk_widget_show(hbox); |
| 1205 | 173 | |
| 3709 | 174 | button = gaim_pixbuf_button_from_stock(_("Close"), GTK_STOCK_CLOSE, GAIM_BUTTON_HORIZONTAL); |
| 1210 | 175 | gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
| 622 | 176 | |
|
4162
7aca7e45e675
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4160
diff
changeset
|
177 | g_signal_connect_swapped(G_OBJECT(button), "clicked", |
|
7aca7e45e675
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4160
diff
changeset
|
178 | G_CALLBACK(destroy_about), G_OBJECT(about)); |
|
7aca7e45e675
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4160
diff
changeset
|
179 | g_signal_connect(G_OBJECT(about), "destroy", |
|
7aca7e45e675
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4160
diff
changeset
|
180 | G_CALLBACK(destroy_about), G_OBJECT(about)); |
| 3709 | 181 | gtk_widget_show(button); |
| 1210 | 182 | |
|
1250
46ac03911ab0
[gaim-migrate @ 1260]
Decklin Foster <decklin@red-bean.com>
parents:
1233
diff
changeset
|
183 | /* this makes the sizes not work. */ |
| 1976 | 184 | /* GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); */ |
| 185 | /* gtk_widget_grab_default(button); */ | |
| 1205 | 186 | |
| 3709 | 187 | gtk_widget_show(button); |
| 1205 | 188 | } |
| 1210 | 189 | |
| 190 | /* Let's give'em something to talk about -- woah woah woah */ | |
|
4157
5d3d2f6517ae
[gaim-migrate @ 4385]
Robert McQueen <robot101@debian.org>
parents:
4082
diff
changeset
|
191 | gtk_window_present(GTK_WINDOW(about)); |
| 1205 | 192 | } |