annotate plugins/gtik.c @ 7665:0351ff7030d0

[gaim-migrate @ 8309] Felipe Contreras (aka revo aka shx) writes: " Basically that, currently gaim will not display international "subjects" or "from" fields from emails, like "a??a" or "Pa?l". This implements the propper RFC that specify the format for those fields." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 30 Nov 2003 04:17:17 +0000
parents 8f94cce8faa5
children
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 *
2142
4bd8e3b65402 [gaim-migrate @ 2152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2130
diff changeset
19 * Modified by EWarmenhoven to become a gaim plugin. There was little
426
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 {
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
138 gtk_signal_disconnect(G_OBJECT(applet), destroycb);
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4165
diff changeset
139 if (drawTimeID > 0) { g_source_remove(drawTimeID); }
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4165
diff changeset
140 if (updateTimeID >0) { g_source_remove(updateTimeID); }
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 gtk_widget_destroy(applet);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4168
diff changeset
142 gaim_plugin_unload_self(handle);
426
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 /*-----------------------------------------------------------------*/
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
596
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
597 struct gaim_plugin_description desc;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
598 struct gaim_plugin_description *gaim_plugin_desc() {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 4168
diff changeset
599 desc.api_version = GAIM_PLUGIN_API_VERSION;
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
600 desc.name = g_strdup("Stock Ticker");
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
601 desc.version = g_strdup(VERSION);
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
602 desc.description = g_strdup(
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
603 " This program uses ghttp to connect to "
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
604 "a popular stock quote site, then downloads "
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
605 "and parses the html returned from the "
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
606 "site to scroll delayed quotes"
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
607 "\n\n The Gnome Stock Ticker is a free, Internet based application. These quotes are not "
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
608 "guaranteed to be timely or accurate. "
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
609 "Do not use the Gnome Stock Ticker for making investment decisions; it is for "
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
610 "informational purposes only.");
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
611 desc.authors = g_strdup("Jayson Lorenzen, Jim Garrison, Rached Blili");
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
612 desc.url = g_strdup(GAIM_WEBSITE);
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
613 return &desc;
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
614 }
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
615
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 2536
diff changeset
616 char *description() {
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
617 return
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 " This program uses ghttp to connect to "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619 "a popular stock quote site, then downloads "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
620 "and parses the html returned from the "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
621 "site to scroll delayed quotes"
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
622 "\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
623 "guaranteed to be timely or accurate. "
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
624 "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
625 "informational purposes only."
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 "\n\n (C) 2000 Jayson Lorenzen, Jim Garrison, Rached Blili";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
627 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629 char *name() {
2536
0e0a54e5819a [gaim-migrate @ 2549]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2142
diff changeset
630 return "The Gnome Stock Ticker for Gaim";
426
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
635
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
636
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
637
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
638 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
639 void changed_cb(GtkWidget *pb, gpointer data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640 /* gnome_property_box_changed(GNOME_PROPERTY_BOX(pb)); */
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
644 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645 void toggle_output_cb(GtkWidget *widget, gpointer data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647 props.output = g_strdup("nochange");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648 else
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649 props.output = g_strdup("default");
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
654 void toggle_scroll_cb(GtkWidget *widget, gpointer data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
655 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656 props.scroll = g_strdup("left2right");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
657 else
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
658 props.scroll = g_strdup("right2left");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659
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 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663 void timeout_cb( GtkWidget *widget, GtkWidget *spin ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664 timeout=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665 /* gnome_property_box_changed(GNOME_PROPERTY_BOX(pb)); */
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 static void apply_cb( GtkWidget *widget, void *data ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 char *tmpText;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
674
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 tmpText = gtk_entry_get_text(GTK_ENTRY(tik_syms_entry));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
677 props.tik_syms = g_strdup(tmpText);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
678 if (props.timeout) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
679 props.timeout = timeout > 0 ? timeout : props.timeout;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
680 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
681
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
682 /* properties_save(APPLET_WIDGET(applet)->privcfgpath); */
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 setup_colors();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
685 updateOutput();
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
689
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 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
692 gint destroy_cb( GtkWidget *widget, void *data ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
693 pb = NULL;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
694 return FALSE;
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
697
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 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
700 void gaim_plugin_config() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
701 GtkWidget * vbox;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
702 GtkWidget *urlcheck, *launchcheck;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
703
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
704 GtkWidget *panela, *panel1 ,*panel2, *panel3, *panel4;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
705 GtkWidget *label1,*label2,*label3 ;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
706
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
707
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
708 GtkWidget *timeout_label,*timeout_c;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
709 GtkObject *timeout_a;
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 GtkWidget *upColor, *downColor, *upLabel, *downLabel;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
712 GtkWidget *check,*check2;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
713
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
714 int ur,ug,ub, dr,dg,db;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
715
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
716 if (pb) return;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
717 pb = gtk_window_new(GTK_WINDOW_TOPLEVEL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
718
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
719 gtk_window_set_title(GTK_WINDOW(pb), _("Gnome Stock Ticker Properties"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
720
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
721 vbox = gtk_vbox_new(FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
722
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
723 panela = gtk_hbox_new(FALSE, 5);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
724 panel1 = gtk_hbox_new(FALSE, 5);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
725 panel2 = gtk_hbox_new(FALSE, 5);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
726 panel3 = gtk_hbox_new(FALSE, 5);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
727 panel4 = gtk_hbox_new(FALSE, 5);
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 gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
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 timeout_label = gtk_label_new(_("Update Frequency in min"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
732 timeout_a = gtk_adjustment_new( timeout, 0.5, 128, 1, 8, 8 );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
733 timeout_c = gtk_spin_button_new( GTK_ADJUSTMENT(timeout_a), 1, 0 );
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 gtk_box_pack_start_defaults( GTK_BOX(panel2), timeout_label );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
736 gtk_box_pack_start_defaults( GTK_BOX(panel2), timeout_c );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
737
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
738 g_signal_connect_swapped(G_OBJECT(timeout_c), "changed",G_CALLBACK(changed_cb),G_OBJECT(pb));
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
739
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
740 g_signal_connect( G_OBJECT(timeout_a),"value_changed",
4165
07a3d1fae88f [gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents: 3551
diff changeset
741 G_CALLBACK(timeout_cb), timeout_c );
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
742 g_signal_connect( G_OBJECT(timeout_c),"changed",
4165
07a3d1fae88f [gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents: 3551
diff changeset
743 G_CALLBACK(timeout_cb), timeout_c );
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
744 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON(timeout_c),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
745 GTK_UPDATE_ALWAYS );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
746
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747 label1 = gtk_label_new(_("Enter symbols delimited with \"+\" in the box below."));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
748
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
749 tik_syms_entry = gtk_entry_new_with_max_length(60);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
751 /* tik_syms var is her if want a default value */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
752 gtk_entry_set_text(GTK_ENTRY(tik_syms_entry), props.tik_syms ? props.tik_syms : tik_syms);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
753 g_signal_connect_swapped(G_OBJECT(tik_syms_entry), "changed",G_CALLBACK(changed_cb),G_OBJECT(pb));
426
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 /* OUTPUT FORMAT and SCROLL DIRECTION */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
756
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
757 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
758 label3 = gtk_label_new(_("Check this box to scroll left to right:"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
759 check = gtk_check_button_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
760 check2 = gtk_check_button_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
761 gtk_box_pack_start_defaults(GTK_BOX(panel3),label2);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
762 gtk_box_pack_start_defaults(GTK_BOX(panel3),check);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
763 gtk_box_pack_start_defaults(GTK_BOX(panel4),label3);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
764 gtk_box_pack_start_defaults(GTK_BOX(panel4),check2);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
765
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
766 /* Set the checkbox according to current prefs */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
767 if (strcmp(props.output,"default")!=0)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
768 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
769 TRUE);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
770 g_signal_connect_swapped(G_OBJECT(check),"toggled",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
771 G_CALLBACK(changed_cb),G_OBJECT(pb));
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
772 g_signal_connect(G_OBJECT(check),"toggled",
4165
07a3d1fae88f [gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents: 3551
diff changeset
773 G_CALLBACK(toggle_output_cb),NULL);
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
774
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
775 /* Set the checkbox according to current prefs */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
776 if (strcmp(props.scroll,"right2left")!=0)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
777 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check2),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
778 TRUE);
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
779 g_signal_connect_swapped(G_OBJECT(check2),"toggled",
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
780 G_CALLBACK(changed_cb),G_OBJECT(pb));
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
781 g_signal_connect(G_OBJECT(check2),"toggled",
4165
07a3d1fae88f [gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents: 3551
diff changeset
782 G_CALLBACK(toggle_scroll_cb),NULL);
426
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 /* COLOR */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
785 /* upLabel = gtk_label_new(_("+ Color"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
786 upColor = gnome_color_picker_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
787
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
788 sscanf( props.ucolor, "#%02x%02x%02x", &ur,&ug,&ub );
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 gnome_color_picker_set_i8(GNOME_COLOR_PICKER (upColor),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
791 ur, ug, ub, 255);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
792
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
793 g_signal_connect(G_OBJECT(upColor), "color_set",
4165
07a3d1fae88f [gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents: 3551
diff changeset
794 G_CALLBACK(ucolor_set_cb), NULL);
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
795
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
796 gtk_box_pack_start_defaults( GTK_BOX(panela), upLabel );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
797 gtk_box_pack_start_defaults( GTK_BOX(panela), upColor );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
798
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
799 downLabel = gtk_label_new(_("- Color"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
800 downColor = gnome_color_picker_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
801
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
802 sscanf( props.dcolor, "#%02x%02x%02x", &dr,&dg,&db );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
803
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
804 gnome_color_picker_set_i8(GNOME_COLOR_PICKER (downColor),
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
805 dr, dg, db, 255);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
806
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
807 g_signal_connect(G_OBJECT(downColor), "color_set",
4165
07a3d1fae88f [gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents: 3551
diff changeset
808 G_CALLBACK(dcolor_set_cb), NULL);
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
809
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
810 gtk_box_pack_start_defaults( GTK_BOX(panela), downLabel );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
811 gtk_box_pack_start_defaults( GTK_BOX(panela), downColor );
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 */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
814 gtk_box_pack_start(GTK_BOX(panel1), label1, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
815 FALSE, 8);
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_box_pack_start(GTK_BOX(vbox), panel2, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
818 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
819 gtk_box_pack_start(GTK_BOX(vbox), panel3, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
820 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
821 gtk_box_pack_start(GTK_BOX(vbox), panel4, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
822 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
823 gtk_box_pack_start(GTK_BOX(vbox), panela, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
824 FALSE, 8);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
825 gtk_box_pack_start(GTK_BOX(vbox), panel1, FALSE,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
826 FALSE, 8);
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 gtk_box_pack_start(GTK_BOX(vbox), tik_syms_entry,
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
829 FALSE, FALSE, 8);
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 gtk_container_add(GTK_CONTAINER(pb), vbox);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
832
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
833 g_signal_connect_swapped(G_OBJECT(tik_syms_entry),
4165
07a3d1fae88f [gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents: 3551
diff changeset
834 "changed",G_CALLBACK(changed_cb),
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
835 G_OBJECT(pb));
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
836
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
837 g_signal_connect(G_OBJECT(pb), "apply",
4165
07a3d1fae88f [gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents: 3551
diff changeset
838 G_CALLBACK(apply_cb), NULL);
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
839
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
840 gtk_widget_show_all(pb);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
841 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
842
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
845
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 /*-----------------------------------------------------------------*/
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 426
diff changeset
848 char *gaim_plugin_init(GModule *handle) { /* used to be main() */
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
849 GtkWidget *label;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
850
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
851 GtkWidget * vbox;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
852
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
853 memset(configFileName,0,sizeof(configFileName));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
854 strcat(configFileName, getenv("HOME"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
855 strcat(configFileName, "/.gtik.conf");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
856
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
857 applet = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* or not */
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 vbox = gtk_hbox_new (FALSE,0);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
860
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
861 drawing_area = gtk_drawing_area_new();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
862 gtk_drawing_area_size(GTK_DRAWING_AREA (drawing_area),200,20);
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(drawing_area);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
865 gtk_box_pack_start(GTK_BOX (vbox), drawing_area,TRUE,TRUE,0);
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 gtk_widget_show(vbox);
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 /* applet_widget_add (APPLET_WIDGET (applet), vbox); */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
870 gtk_container_add(GTK_CONTAINER(applet), vbox);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
871
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
872 g_signal_connect(G_OBJECT(drawing_area),"expose_event",
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
873 (GtkSignalFunc) expose_event, NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
874
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
875 g_signal_connect(G_OBJECT(drawing_area),"configure_event",
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
876 (GtkSignalFunc) configure_event, NULL);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
877
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
878
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
879 destroycb = g_signal_connect(G_OBJECT(applet), "destroy",
4165
07a3d1fae88f [gaim-migrate @ 4394]
Christian Hammond <chipx86@chipx86.com>
parents: 3551
diff changeset
880 G_CALLBACK(remove_self), handle);
426
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 gtk_widget_show (applet);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
885 create_gc();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
886
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
887 /* load_properties(APPLET_WIDGET(applet)->privcfgpath); */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
888
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
889 setup_colors();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
890 load_fonts();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
891 updateOutput();
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 /* KEEPING TIMER ID FOR CLEANUP IN DESTROY */
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4165
diff changeset
895 drawTimeID = g_timeout_add(2,Repaint,drawing_area);
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4165
diff changeset
896 updateTimeID = g_timeout_add(props.timeout * 60000,
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4165
diff changeset
897 updateOutput,"NULL");
426
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
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 426
diff changeset
900 return NULL;
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
901 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
902
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
903
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 void updateOutput() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
907 if ( http_got() == -1 || !(configured()) ) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
908 reSetOutputArray();
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
909 printf("No data!\n");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
910 setOutputArray("No data available or properties not set");
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 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
913
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
916
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
917 /* JHACK */
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 void gaim_plugin_remove() {
5314
1f901484599d [gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
920 gtk_signal_disconnect(G_OBJECT(applet), destroycb);
4168
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4165
diff changeset
921 if (drawTimeID > 0) { g_source_remove(drawTimeID); }
ebfb80bbe1ed [gaim-migrate @ 4397]
Luke Schierer <lschiere@pidgin.im>
parents: 4165
diff changeset
922 if (updateTimeID >0) { g_source_remove(updateTimeID); }
426
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
923 gtk_widget_destroy(applet);
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
928
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
929
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
930 /*HERE*/
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 static void reSetOutputArray() {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
933 int i;
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 for (i=0;i<LEN;i++) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
936 /* CLEAR EACH SYMBOL'S SPACE */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
937 memset(outputArray[i],0,sizeof(outputArray[i]));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
938
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
939 /* CLEAR ASSOC COLOR ARRAY */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
940 colorArray[i] = 0;
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 /* CLEAR ADDITIONAL INFO */
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
943 memset(changeArray[i],0,sizeof(changeArray[i]));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
944
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
947 setCounter = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
948 getCounter = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
949 setColorCounter = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
950 getColorCounter = 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
951
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
952 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
953
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
954
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
955 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
956 char *splitPrice(char *data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
957 char buff[128]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
958 static char buff2[128]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
959 char *var1, *var2;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
960 int i;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
961
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
962 strcpy(buff,data);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
963 var1 = strtok(buff,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
964 var2 = strtok(NULL,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
965
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
966 sprintf(buff2," %s %s",var1,var2);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
967 return(buff2);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
968 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
969
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
970 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
971 char *splitChange(char *data) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
972 char buff[128]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
973 static char buff2[128]="";
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
974 char *var1, *var2, *var3, *var4;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
975 int i;
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 strcpy(buff,data);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
978 var1 = strtok(buff,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
979 var2 = strtok(NULL,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
980 var3 = strtok(NULL,":");
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
981 var4 = strtok(NULL,"");
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 if (var3[0] == '+') {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
984 if (symbolfont)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
985 var3[0] = 221;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
986 var4[0] = '(';
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
987 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
988 else if (var3[0] == '-') {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
989 if (symbolfont)
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
990 var3[0] = 223;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
991 var4[0] = '(';
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
992 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
993 else {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
994 var3 = strdup(_("(No"));
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
995 var4 = strdup(_("Change"));
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 sprintf(buff2,"%s %s)",var3,var4);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
999 return(buff2);
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
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1002 /*-----------------------------------------------------------------*/
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1003 static void setOutputArray(char *param1) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1004 char *price;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1005 char *change;
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 price = splitPrice(param1);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1008 change = splitChange(param1);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1009
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1010 if (setCounter < LEN) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1011
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1012 strcpy(outputArray[setCounter],price);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1013 strcpy(changeArray[setCounter],change);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1014 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1015 setCounter++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1016 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1017
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 static void setColorArray(int theColor) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1022 if (setColorCounter < LEN) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1023 colorArray[setColorCounter] = theColor;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1024 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1025 setColorCounter++;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1026 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1027
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1028 void setup_colors(void) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1029 GdkColormap *colormap;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1030
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1031 colormap = gtk_widget_get_colormap(drawing_area);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1032
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1033 gdk_color_parse(props.ucolor, &gdkUcolor);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1034 gdk_color_alloc(colormap, &gdkUcolor);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1035
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1036 gdk_color_parse(props.dcolor, &gdkDcolor);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1037 gdk_color_alloc(colormap, &gdkDcolor);
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1038 }
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1039
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1040
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1041 int create_gc(void) {
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1042 gc = gdk_gc_new( drawing_area->window );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1043 gdk_gc_copy( gc, drawing_area->style->white_gc );
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1044 return 0;
50489ea9f4ec [gaim-migrate @ 436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1045 }