annotate plugins/gtik.c @ 673:ddc3fd0dcd51

[gaim-migrate @ 683] Made the necessary modifications to allow gaim to save buddy pounces. I just noticed that you cant _delete_ (remove) a buddy pounce. Woops. I'll take a look at that. I'll do saving of buddy chats when I get back from dinner. Adios. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Sun, 13 Aug 2000 03:15:06 +0000
parents 50489ea9f4ec
children ece2d1543b20
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * GNOME Stock Ticker
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 * (C) 2000 Jayson Lorenzen, Jim Garrison, Rached Blili
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 *
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 * based on:
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * desire, and the old great slash applet.
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 *
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 *
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * Authors: Jayson Lorenzen (jaysonl@pacbell.net)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 * Jim Garrison (garrison@users.sourceforge.net)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * Rached Blili (striker@Dread.net)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 *
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * The Gnome Stock Ticker is a free, Internet based application.
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * These quotes are not guaranteed to be timely or accurate.
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * Do not use the Gnome Stock Ticker for making investment decisions,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * it is for informational purposes only.
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 *
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 * Modified by EWarmenhoven to become a gaim plugin. There was little
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 * enough that needed to be changed that I can't really claim any credit.
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 * (you need to add -lghttp to the GTK_LIBS part of the Makefile)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 * TODO: config, saving info
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 *
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 #define GAIM_PLUGINS
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 #include "gaim.h"
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 #include <gtk/gtk.h>
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 #include <time.h>
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 #include <stdlib.h>
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #include <stdio.h>
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 #include <string.h>
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 #include "ghttp.h"
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 #include <sys/stat.h>
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 #include <unistd.h>
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 #include <dirent.h>
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 #include <gdk/gdkx.h>
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 GtkWidget *applet; /* this will become the main window */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 GtkWidget *label;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 static GdkPixmap *pixmap = NULL;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 GtkWidget * drawing_area;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 int location;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 int MOVE;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 char output[64];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 /**
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 * FOR COLOR
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 * LEN and the length of output, and colorNum must match
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 const int LEN = 20;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 char outputArray[20][64];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 char changeArray[20][64];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 int colorArray[20];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 const int RED = 1;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 const int GREEN = 2;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 static const int max_rgb_str_len = 7;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 static const int max_rgb_str_size = 8;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 int setCounter, getCounter, setColorCounter,getColorCounter;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 GdkGC *gc;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 GdkColor gdkUcolor,gdkDcolor;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 /* end of COLOR vars */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 char configFileName[256];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 /* properties vars */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 GtkWidget *tik_syms_entry;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 gchar tik_syms[256];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 GtkWidget * pb = NULL;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 typedef struct
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 char *tik_syms;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 char *output;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 char *scroll;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 gint timeout;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 gchar dcolor[8];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 gchar ucolor[8];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 } gtik_properties;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 gtik_properties props = {"cald+rhat+corl","default","right2left",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 5,"#ff0000","#00ff00"};
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 /* end prop vars */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 gint timeout = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 gint drawTimeID, updateTimeID;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 GdkFont * my_font;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 GdkFont * extra_font;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108 GdkFont * small_font;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 static gint symbolfont = 1;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 static gint destroycb;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 int configured();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 void timeout_cb( GtkWidget *widget, GtkWidget *spin );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115 static int http_get_to_file(gchar *a_host, gint a_port,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 gchar *a_resource, FILE *a_file);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 int http_got();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118 void properties_save( char *path) ;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119 void gaim_plugin_remove();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122 /* FOR COLOR */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
124 void updateOutput() ;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 static void reSetOutputArray() ;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 static void setOutputArray(char *param1) ;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127 static void setColorArray(int theColor) ;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 void setup_colors(void);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129 int create_gc(void) ;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131 /* end of color funcs */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 void remove_self(GtkWidget *w, void *handle)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 gtk_signal_disconnect(GTK_OBJECT(applet), destroycb);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 if (drawTimeID > 0) { gtk_timeout_remove(drawTimeID); }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 if (updateTimeID >0) { gtk_timeout_remove(updateTimeID); }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 gtk_widget_destroy(applet);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 gaim_plugin_unload(handle);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 void load_fonts()
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 my_font = gdk_font_load ("fixed");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150 extra_font = gdk_font_load ("-urw-symbol-medium-r-normal-*-*-100-*-*-p-*-adobe-fontspecific");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 small_font = gdk_font_load ("-schumacher-clean-medium-r-normal-*-*-100-*-*-c-*-iso8859-1");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 /* If fonts do not load */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 if (!my_font)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 g_error("Could not load fonts!");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156 if (!extra_font) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 extra_font = gdk_font_load("fixed");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 symbolfont = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 if (!small_font)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 small_font = gdk_font_load("fixed");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 /*void load_properties( char *path) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168 gnome_config_push_prefix (path);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169 if( gnome_config_get_string ("gtik/tik_syms") != NULL )
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 props.tik_syms = gnome_config_get_string("gtik/tik_syms");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
172
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
173 timeout = gnome_config_get_int("gtik/timeout") > 0 ? gnome_config_get_int ("gtik/timeout") : props.timeout;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176 if ( gnome_config_get_string ("gtik/output") != NULL )
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 props.output = gnome_config_get_string("gtik/output");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 if ( gnome_config_get_string ("gtik/scroll") != NULL )
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180 props.scroll = gnome_config_get_string("gtik/scroll");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 if ( gnome_config_get_string ("gtik/ucolor") != NULL )
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 strcpy(props.ucolor, gnome_config_get_string("gtik/ucolor"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 if ( gnome_config_get_string ("gtik/dcolor") != NULL )
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 strcpy(props.dcolor, gnome_config_get_string("gtik/dcolor"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 gnome_config_pop_prefix ();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 }*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 /*void properties_save( char *path) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 gnome_config_push_prefix (path);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197 gnome_config_set_string( "gtik/tik_syms", props.tik_syms );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 gnome_config_set_string( "gtik/output", props.output );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199 gnome_config_set_string( "gtik/scroll", props.scroll );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 gnome_config_set_string( "gtik/ucolor", props.ucolor );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 gnome_config_set_string( "gtik/dcolor", props.dcolor );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 gnome_config_set_int("gtik/timeout",props.timeout);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 gnome_config_pop_prefix ();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 gnome_config_sync();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 gnome_config_drop_all();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 }*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 char * extractText(const char *line) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 int i=0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 int j=0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 static char Text[256]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 while (i < (strlen(line) -1)) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 if (line[i] != '>')
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 i++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 i++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 while (line[i] != '<') {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 Text[j] = line[i];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 i++;j++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229 Text[j] = '\0';
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 i = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 while (i < (strlen(Text)) ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 if (Text[i] < 32)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
233 Text[i] = '\0';
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 i++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 return(Text);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 char * parseQuote(FILE *CONFIG, char line[512]) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243 char symbol[512];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 char buff[512];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245 char price[16];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246 char change[16];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247 char percent[16];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 static char result[512]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249 int linenum=0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 int AllOneLine=0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 int flag=0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 char *section;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253 char *ptr;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255 if (strlen(line) > 64) AllOneLine=1;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 if (AllOneLine) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 strcpy(buff,line);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 while (!flag) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 if ((ptr=strstr(buff,"</td>"))!=NULL) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 ptr[0] = '|';
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263 else flag=1;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265 section = strtok(buff,"|");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 /* Get the stock symbol */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 if (!AllOneLine) strcpy(symbol,extractText(line));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 else strcpy(symbol,extractText(section));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 linenum++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 /* Skip the time... */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 if (!AllOneLine) fgets(line,255,CONFIG);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 else section = strtok(NULL,"|");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275 linenum++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 while (linenum < 8 ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 if (!AllOneLine) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 fgets(line,255,CONFIG);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 if (strstr(line,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 "<td align=center nowrap colspan=2>")) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 strcpy(change,"");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 strcpy(percent,"");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 linenum=100;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 section = strtok(NULL,"|");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 if (strstr(section,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 "<td align=center nowrap colspan=2>")) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 strcpy(change,"");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 strcpy(percent,"");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 linenum=100;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 if (linenum == 2) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 if (!AllOneLine)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 strcpy(price,extractText(line));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 else
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302 strcpy(price,extractText(section));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 else if (linenum == 3) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 if (!AllOneLine)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 strcpy(change,extractText(line));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307 else
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308 strcpy(change,extractText(section));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310 if (strstr(change,"-")) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311 setColorArray(RED);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 else if (strstr(change,"+")) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 setColorArray(GREEN);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 setColorArray(0);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 else if (linenum == 4) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322 if (!AllOneLine)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323 strcpy(percent,extractText(line));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 else
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325 strcpy(percent,extractText(section));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327 linenum++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329 sprintf(result,"%s:%s:%s:%s",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 symbol,price,change,percent);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 return(result);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
334
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338 int configured() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 int retVar;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 char buffer[512];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342 static FILE *CONFIG;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 CONFIG = fopen((const char *)configFileName,"r");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 retVar = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348 /* clear the output variable */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349 reSetOutputArray();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351 if ( CONFIG ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352 while ( !feof(CONFIG) ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353 fgets(buffer,511,CONFIG);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 if (strstr(buffer,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 "<td nowrap align=left><a href=\"/q\?s=")) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358 setOutputArray(parseQuote(CONFIG,buffer));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 retVar = 1;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 retVar = (retVar > 0) ? retVar : 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 fclose(CONFIG);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 retVar = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372 return retVar;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 /* Shamelessly stolen from the Slashapp applet
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378 */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379 static int http_get_to_file(gchar *a_host, gint a_port,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 gchar *a_resource, FILE *a_file) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 int length = -1;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 ghttp_request *request = NULL;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 gchar s_port[8];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384 gchar *uri = NULL;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385 gchar *body;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 gchar *proxy = g_getenv("http_proxy");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388 g_snprintf(s_port, 8, "%d", a_port);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
389 uri = g_strconcat("http://", a_host, ":", s_port,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
390 a_resource, NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 fprintf(stderr,"Asking for %s\n", uri);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 request = ghttp_request_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 if (!request)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396 goto ec;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397 if (proxy && (ghttp_set_proxy(request,proxy) != 0))
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
398 goto ec;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 if (ghttp_set_uri(request, uri) != 0)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 goto ec;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402 ghttp_set_header(request, http_hdr_Connection, "close");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 if (ghttp_prepare(request) != 0)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404 goto ec;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
405 if (ghttp_process(request) != ghttp_done)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
406 goto ec;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407 length = ghttp_get_body_len(request);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
408 body = ghttp_get_body(request);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
409 if (body != NULL)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
410 fwrite(body, length, 1, a_file);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
411
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
412 ec:
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 if (request)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414 ghttp_request_destroy(request);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
415 if (uri)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417 g_free(uri);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418 return length;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
420
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
424 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425 int http_got() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427 int retVar;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 FILE *local_file;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 char tmpBuff[256];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431 memset(tmpBuff,0,sizeof(tmpBuff));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433 strcat(tmpBuff,"/q?s=");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 strcat(tmpBuff, props.tik_syms);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 strcat(tmpBuff,"&d=v2");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
436
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
437 retVar = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439 local_file = fopen(configFileName, "w");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440 retVar = http_get_to_file("finance.yahoo.com", 80,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
441 tmpBuff, local_file);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
442
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
443 fclose(local_file);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
444
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
445 return retVar;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
446 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
447
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
448
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
451
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
452 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
453 gint expose_event (GtkWidget *widget,GdkEventExpose *event) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
454
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
455 gdk_draw_pixmap(widget->window,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
456 widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
457 pixmap,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
458 event->area.x, event->area.y,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
459 event->area.x, event->area.y,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
460 event->area.width,event->area.height);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
461
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
462 return FALSE;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
463 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
464
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
466
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
467 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
468 static gint configure_event(GtkWidget *widget,GdkEventConfigure *event){
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470 if(pixmap) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
471 gdk_pixmap_unref (pixmap);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
472 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
473
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
474 pixmap = gdk_pixmap_new(widget->window,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 widget->allocation.width,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
476 widget->allocation.height,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
477 -1);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
478
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
479 return TRUE;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
480 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
483
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
484
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
485
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
486
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
487 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
488 gint Repaint (gpointer data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489 GtkWidget* drawing_area = (GtkWidget *) data;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
490 GdkRectangle update_rect;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
491 int comp;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
492
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
493 /* FOR COLOR */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
494 char *tmpSym;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
495 int totalLoc;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
496 int totalLen;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
497 int i;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
498
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
499
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
500 totalLoc = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
501 totalLen = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
502
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
503 /* clear the pixmap */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504 gdk_draw_rectangle (pixmap,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
505 drawing_area->style->black_gc,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506 TRUE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
507 0,0,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508 drawing_area->allocation.width,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
509 drawing_area->allocation.height);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
511
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
512 for(i=0;i<LEN;i++) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 totalLen += strlen(outputArray[i]);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
514 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515 if (!strcmp(props.output,"default")) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
516 for(i=0;i<LEN;i++) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
517 totalLen += strlen(changeArray[i]);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
518 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
519 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
520
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 comp = 1 - ( totalLen *8 );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
522
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
523 if (MOVE == 1) { MOVE = 0; } else { MOVE = 1; }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
524
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525 if (MOVE == 1) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
527
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528 if (!strcmp(props.scroll,"right2left")) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
529 if (location > comp) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
530 location--;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
533 location = drawing_area->allocation.width;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
535
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
536 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
537 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
538 if (location < drawing_area->allocation.width) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539 location ++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
540 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 location = comp;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
547
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
548 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
549
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
550 for (i=0;i<LEN;i++) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
551
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
552 /* COLOR */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
553 if (colorArray[i] == GREEN) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
554 gdk_gc_set_foreground( gc, &gdkUcolor );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
555 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 else if (colorArray[i] == RED) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557 gdk_gc_set_foreground( gc, &gdkDcolor );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
560 gdk_gc_copy( gc, drawing_area->style->white_gc );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
563 tmpSym = outputArray[i];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
564 gdk_draw_string (pixmap,my_font,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
565 gc,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566 location + (totalLoc * 6 ) ,12,outputArray[i]);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
567 totalLoc += (strlen(tmpSym) + 1);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
568
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
569
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
570 if (!strcmp(props.output,"default")) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
571 tmpSym = changeArray[i];
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
572 if (*(changeArray[i]))
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
573 gdk_draw_text (pixmap,extra_font,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
574 gc, location + (totalLoc * 6) ,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
575 12,changeArray[i],1);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
576 gdk_draw_string (pixmap,small_font,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
577 gc, location + ((totalLoc +2) * 6) ,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
578 12, &changeArray[i][1]);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
579 totalLoc += (strlen(tmpSym) + 1);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
580 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
582 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583 update_rect.x = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584 update_rect.y = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 update_rect.width = drawing_area->allocation.width;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
586 update_rect.height = drawing_area->allocation.height;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
587
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588 gtk_widget_draw(drawing_area,&update_rect);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
589 return 1;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
590 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
591
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
592
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
593
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
594
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
595 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
596 char *description() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 return
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
598 " This program uses ghttp to connect to "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
599 "a popular stock quote site, then downloads "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600 "and parses the html returned from the "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601 "site to scroll delayed quotes"
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
602 "\n\n The Gnome Stock Ticker is a free, Internet based application. These quotes are not "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
603 "guaranteed to be timely or accurate. "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
604 "Do not use the Gnome Stock Ticker for making investment decisions; it is for "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
605 "informational purposes only."
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
606 "\n\n (C) 2000 Jayson Lorenzen, Jim Garrison, Rached Blili";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
607 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
608
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
609 char *name() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
610 return "The Gnome Stock Ticker for GAIM";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
613
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
614
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
615
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
616
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
617
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619 void changed_cb(GtkWidget *pb, gpointer data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
620 /* gnome_property_box_changed(GNOME_PROPERTY_BOX(pb)); */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
621 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
622
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
623
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
624 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
625 void toggle_output_cb(GtkWidget *widget, gpointer data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
627 props.output = g_strdup("nochange");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628 else
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629 props.output = g_strdup("default");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
630
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
633 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
634 void toggle_scroll_cb(GtkWidget *widget, gpointer data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
635 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
636 props.scroll = g_strdup("left2right");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
637 else
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
638 props.scroll = g_strdup("right2left");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
639
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
641
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
642 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643 void timeout_cb( GtkWidget *widget, GtkWidget *spin ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 timeout=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645 /* gnome_property_box_changed(GNOME_PROPERTY_BOX(pb)); */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
651 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652 static void apply_cb( GtkWidget *widget, void *data ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653 char *tmpText;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
654
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
655
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656 tmpText = gtk_entry_get_text(GTK_ENTRY(tik_syms_entry));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
657 props.tik_syms = g_strdup(tmpText);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
658 if (props.timeout) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659 props.timeout = timeout > 0 ? timeout : props.timeout;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
660 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
662 /* properties_save(APPLET_WIDGET(applet)->privcfgpath); */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664 setup_colors();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665 updateOutput();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
666 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
667
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
668
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
670
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
671 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
672 gint destroy_cb( GtkWidget *widget, void *data ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 pb = NULL;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
674 return FALSE;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
675 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
676
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
677
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
678
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
679 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
680 void gaim_plugin_config() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
681 GtkWidget * vbox;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
682 GtkWidget *urlcheck, *launchcheck;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
683
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
684 GtkWidget *panela, *panel1 ,*panel2, *panel3, *panel4;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
685 GtkWidget *label1,*label2,*label3 ;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
686
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
687
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
688 GtkWidget *timeout_label,*timeout_c;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
689 GtkObject *timeout_a;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
690
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
691 GtkWidget *upColor, *downColor, *upLabel, *downLabel;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
692 GtkWidget *check,*check2;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
693
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
694 int ur,ug,ub, dr,dg,db;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
695
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
696 if (pb) return;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
697 pb = gtk_window_new(GTK_WINDOW_TOPLEVEL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
698
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
699 gtk_window_set_title(GTK_WINDOW(pb), _("Gnome Stock Ticker Properties"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
700
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
701 vbox = gtk_vbox_new(FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
702
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
703 panela = gtk_hbox_new(FALSE, 5);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
704 panel1 = gtk_hbox_new(FALSE, 5);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
705 panel2 = gtk_hbox_new(FALSE, 5);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
706 panel3 = gtk_hbox_new(FALSE, 5);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
707 panel4 = gtk_hbox_new(FALSE, 5);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
708
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
709 gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
710
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
711 timeout_label = gtk_label_new(_("Update Frequency in min"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
712 timeout_a = gtk_adjustment_new( timeout, 0.5, 128, 1, 8, 8 );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
713 timeout_c = gtk_spin_button_new( GTK_ADJUSTMENT(timeout_a), 1, 0 );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
714
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
715 gtk_box_pack_start_defaults( GTK_BOX(panel2), timeout_label );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
716 gtk_box_pack_start_defaults( GTK_BOX(panel2), timeout_c );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
717
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
718 gtk_signal_connect_object(GTK_OBJECT(timeout_c), "changed",GTK_SIGNAL_FUNC(changed_cb),GTK_OBJECT(pb));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
719
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
720 gtk_signal_connect( GTK_OBJECT(timeout_a),"value_changed",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
721 GTK_SIGNAL_FUNC(timeout_cb), timeout_c );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
722 gtk_signal_connect( GTK_OBJECT(timeout_c),"changed",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
723 GTK_SIGNAL_FUNC(timeout_cb), timeout_c );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
724 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON(timeout_c),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
725 GTK_UPDATE_ALWAYS );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
726
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
727 label1 = gtk_label_new(_("Enter symbols delimited with \"+\" in the box below."));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
728
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
729 tik_syms_entry = gtk_entry_new_with_max_length(60);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
730
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
731 /* tik_syms var is her if want a default value */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
732 gtk_entry_set_text(GTK_ENTRY(tik_syms_entry), props.tik_syms ? props.tik_syms : tik_syms);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
733 gtk_signal_connect_object(GTK_OBJECT(tik_syms_entry), "changed",GTK_SIGNAL_FUNC(changed_cb),GTK_OBJECT(pb));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
734
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
735 /* OUTPUT FORMAT and SCROLL DIRECTION */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
736
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
737 label2 = gtk_label_new(_("Check this box to display only symbols and price:"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
738 label3 = gtk_label_new(_("Check this box to scroll left to right:"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
739 check = gtk_check_button_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
740 check2 = gtk_check_button_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
741 gtk_box_pack_start_defaults(GTK_BOX(panel3),label2);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
742 gtk_box_pack_start_defaults(GTK_BOX(panel3),check);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
743 gtk_box_pack_start_defaults(GTK_BOX(panel4),label3);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
744 gtk_box_pack_start_defaults(GTK_BOX(panel4),check2);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
745
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
746 /* Set the checkbox according to current prefs */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747 if (strcmp(props.output,"default")!=0)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
748 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
749 TRUE);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750 gtk_signal_connect_object(GTK_OBJECT(check),"toggled",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
751 GTK_SIGNAL_FUNC(changed_cb),GTK_OBJECT(pb));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
752 gtk_signal_connect(GTK_OBJECT(check),"toggled",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
753 GTK_SIGNAL_FUNC(toggle_output_cb),NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
754
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
755 /* Set the checkbox according to current prefs */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
756 if (strcmp(props.scroll,"right2left")!=0)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
757 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check2),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
758 TRUE);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
759 gtk_signal_connect_object(GTK_OBJECT(check2),"toggled",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
760 GTK_SIGNAL_FUNC(changed_cb),GTK_OBJECT(pb));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
761 gtk_signal_connect(GTK_OBJECT(check2),"toggled",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
762 GTK_SIGNAL_FUNC(toggle_scroll_cb),NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
763
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
764 /* COLOR */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
765 /* upLabel = gtk_label_new(_("+ Color"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
766 upColor = gnome_color_picker_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
767
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
768 sscanf( props.ucolor, "#%02x%02x%02x", &ur,&ug,&ub );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
769
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
770 gnome_color_picker_set_i8(GNOME_COLOR_PICKER (upColor),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
771 ur, ug, ub, 255);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
772
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
773 gtk_signal_connect(GTK_OBJECT(upColor), "color_set",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
774 GTK_SIGNAL_FUNC(ucolor_set_cb), NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
775
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
776 gtk_box_pack_start_defaults( GTK_BOX(panela), upLabel );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
777 gtk_box_pack_start_defaults( GTK_BOX(panela), upColor );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
778
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
779 downLabel = gtk_label_new(_("- Color"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
780 downColor = gnome_color_picker_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
781
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
782 sscanf( props.dcolor, "#%02x%02x%02x", &dr,&dg,&db );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
783
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
784 gnome_color_picker_set_i8(GNOME_COLOR_PICKER (downColor),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
785 dr, dg, db, 255);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
786
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
787 gtk_signal_connect(GTK_OBJECT(downColor), "color_set",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
788 GTK_SIGNAL_FUNC(dcolor_set_cb), NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
789
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
790 gtk_box_pack_start_defaults( GTK_BOX(panela), downLabel );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
791 gtk_box_pack_start_defaults( GTK_BOX(panela), downColor );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
792
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
793 */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
794 gtk_box_pack_start(GTK_BOX(panel1), label1, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
795 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
796
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
797 gtk_box_pack_start(GTK_BOX(vbox), panel2, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
798 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
799 gtk_box_pack_start(GTK_BOX(vbox), panel3, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
800 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
801 gtk_box_pack_start(GTK_BOX(vbox), panel4, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
802 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
803 gtk_box_pack_start(GTK_BOX(vbox), panela, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
804 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
805 gtk_box_pack_start(GTK_BOX(vbox), panel1, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
806 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
807
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
808 gtk_box_pack_start(GTK_BOX(vbox), tik_syms_entry,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
809 FALSE, FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
810
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
811 gtk_container_add(GTK_CONTAINER(pb), vbox);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
812
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
813 gtk_signal_connect_object(GTK_OBJECT(tik_syms_entry),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
814 "changed",GTK_SIGNAL_FUNC(changed_cb),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
815 GTK_OBJECT(pb));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
816
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
817 gtk_signal_connect(GTK_OBJECT(pb), "apply",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
818 GTK_SIGNAL_FUNC(apply_cb), NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
819
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
820 gtk_widget_show_all(pb);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
821 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
822
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
823
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
824
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
825
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
826
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
827 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
828 int gaim_plugin_init(void *handle) { /* used to be main() */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
829 GtkWidget *label;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
830
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
831 GtkWidget * vbox;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
832
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
833 memset(configFileName,0,sizeof(configFileName));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
834 strcat(configFileName, getenv("HOME"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
835 strcat(configFileName, "/.gtik.conf");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
836
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
837 applet = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* or not */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
838
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
839 vbox = gtk_hbox_new (FALSE,0);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
840
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
841 drawing_area = gtk_drawing_area_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
842 gtk_drawing_area_size(GTK_DRAWING_AREA (drawing_area),200,20);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
843
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
844 gtk_widget_show(drawing_area);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
845 gtk_box_pack_start(GTK_BOX (vbox), drawing_area,TRUE,TRUE,0);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
846
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
847 gtk_widget_show(vbox);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
848
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
849 /* applet_widget_add (APPLET_WIDGET (applet), vbox); */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
850 gtk_container_add(GTK_CONTAINER(applet), vbox);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
851
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
852 gtk_signal_connect(GTK_OBJECT(drawing_area),"expose_event",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
853 (GtkSignalFunc) expose_event, NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
854
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
855 gtk_signal_connect(GTK_OBJECT(drawing_area),"configure_event",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
856 (GtkSignalFunc) configure_event, NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
857
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
858
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
859 destroycb = gtk_signal_connect(GTK_OBJECT(applet), "destroy",
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
860 GTK_SIGNAL_FUNC(remove_self), handle);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
861
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
862
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
863
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
864 gtk_widget_show (applet);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
865 create_gc();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
866
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
867 /* load_properties(APPLET_WIDGET(applet)->privcfgpath); */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
868
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
869 setup_colors();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
870 load_fonts();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
871 updateOutput();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
872
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
873
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
874 /* KEEPING TIMER ID FOR CLEANUP IN DESTROY */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
875 drawTimeID = gtk_timeout_add(2,Repaint,drawing_area);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
876 updateTimeID = gtk_timeout_add(props.timeout * 60000,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
877 (gpointer)updateOutput,"NULL");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
878
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
879
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
880 return 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
881 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
882
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
883
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
884
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
885 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
886 void updateOutput() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
887 if ( http_got() == -1 || !(configured()) ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
888 reSetOutputArray();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
889 printf("No data!\n");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
890 setOutputArray("No data available or properties not set");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
891 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
892 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
893
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
894
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
895
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
896
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
897 /* JHACK */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
898 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
899 void gaim_plugin_remove() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
900 gtk_signal_disconnect(GTK_OBJECT(applet), destroycb);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
901 if (drawTimeID > 0) { gtk_timeout_remove(drawTimeID); }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
902 if (updateTimeID >0) { gtk_timeout_remove(updateTimeID); }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
903 gtk_widget_destroy(applet);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
904 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
905
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
906
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
907
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
908
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
909
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
910 /*HERE*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
911 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
912 static void reSetOutputArray() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
913 int i;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
914
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
915 for (i=0;i<LEN;i++) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
916 /* CLEAR EACH SYMBOL'S SPACE */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
917 memset(outputArray[i],0,sizeof(outputArray[i]));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
918
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
919 /* CLEAR ASSOC COLOR ARRAY */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
920 colorArray[i] = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
921
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
922 /* CLEAR ADDITIONAL INFO */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
923 memset(changeArray[i],0,sizeof(changeArray[i]));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
924
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
925 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
926
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
927 setCounter = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
928 getCounter = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
929 setColorCounter = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
930 getColorCounter = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
931
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
932 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
933
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
934
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
935 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
936 char *splitPrice(char *data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
937 char buff[128]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
938 static char buff2[128]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
939 char *var1, *var2;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
940 int i;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
941
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
942 strcpy(buff,data);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
943 var1 = strtok(buff,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
944 var2 = strtok(NULL,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
945
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
946 sprintf(buff2," %s %s",var1,var2);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
947 return(buff2);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
948 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
949
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
950 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
951 char *splitChange(char *data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
952 char buff[128]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
953 static char buff2[128]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
954 char *var1, *var2, *var3, *var4;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
955 int i;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
956
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
957 strcpy(buff,data);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
958 var1 = strtok(buff,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
959 var2 = strtok(NULL,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
960 var3 = strtok(NULL,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
961 var4 = strtok(NULL,"");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
962
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
963 if (var3[0] == '+') {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
964 if (symbolfont)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
965 var3[0] = 221;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
966 var4[0] = '(';
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
967 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
968 else if (var3[0] == '-') {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
969 if (symbolfont)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
970 var3[0] = 223;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
971 var4[0] = '(';
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
972 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
973 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
974 var3 = strdup(_("(No"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
975 var4 = strdup(_("Change"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
976 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
977
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
978 sprintf(buff2,"%s %s)",var3,var4);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
979 return(buff2);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
980 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
981
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
982 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
983 static void setOutputArray(char *param1) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
984 char *price;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
985 char *change;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
986
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
987 price = splitPrice(param1);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
988 change = splitChange(param1);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
989
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
990 if (setCounter < LEN) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
991
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
992 strcpy(outputArray[setCounter],price);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
993 strcpy(changeArray[setCounter],change);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
994 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
995 setCounter++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
996 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
997
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
998
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
999
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1000 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1001 static void setColorArray(int theColor) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1002 if (setColorCounter < LEN) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1003 colorArray[setColorCounter] = theColor;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1004 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1005 setColorCounter++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1006 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1007
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1008 void setup_colors(void) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1009 GdkColormap *colormap;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1010
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1011 colormap = gtk_widget_get_colormap(drawing_area);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1012
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1013 gdk_color_parse(props.ucolor, &gdkUcolor);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1014 gdk_color_alloc(colormap, &gdkUcolor);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1015
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1016 gdk_color_parse(props.dcolor, &gdkDcolor);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1017 gdk_color_alloc(colormap, &gdkDcolor);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1018 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1019
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1020
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1021 int create_gc(void) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1022 gc = gdk_gc_new( drawing_area->window );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1023 gdk_gc_copy( gc, drawing_area->style->white_gc );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1024 return 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1025 }