comparison src/dialogs.c @ 5545:7a64114641c3

[gaim-migrate @ 5946] I've been rewriting the prefs to move from gaimrc to prefs.xml. This will NOT compile! I don't want to see complaints about this, as it's CVS, and you should only be using it if you can put up with things like this. Also, don't ask how long it'll take until it compiles again. It may be several days. This is a big migration. Even when it works, it may not run right. However, it's made a lot of progress, and I plan to actively work on it today and tomorrow. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 29 May 2003 19:10:24 +0000
parents cce2d7868c78
children 51699de873af
comparison
equal deleted inserted replaced
5544:0028381fa874 5545:7a64114641c3
48 #include "gaim.h" 48 #include "gaim.h"
49 #include "gtkimhtml.h" 49 #include "gtkimhtml.h"
50 #include "prpl.h" 50 #include "prpl.h"
51 #include "gtkblist.h" 51 #include "gtkblist.h"
52 #include "notify.h" 52 #include "notify.h"
53 #include "prefs.h"
53 54
54 #ifdef _WIN32 55 #ifdef _WIN32
55 #include "win32dep.h" 56 #include "win32dep.h"
56 #endif 57 #endif
57 58
58 #define PATHSIZE 1024 59 #define PATHSIZE 1024
59
60 GdkColor bgcolor;
61 GdkColor fgcolor;
62 60
63 static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */ 61 static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */
64 static GList *dialogwindows = NULL; 62 static GList *dialogwindows = NULL;
65 static GtkWidget *importdialog; 63 static GtkWidget *importdialog;
66 static struct gaim_connection *importgc; 64 static struct gaim_connection *importgc;
2341 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); 2339 gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0);
2342 2340
2343 gtk_widget_show_all(b->window); 2341 gtk_widget_show_all(b->window);
2344 } 2342 }
2345 2343
2346 if (convo_options & OPT_CONVO_IGNORE_COLOUR) 2344 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors"))
2347 options ^= GTK_IMHTML_NO_COLOURS; 2345 options ^= GTK_IMHTML_NO_COLOURS;
2348 if (convo_options & OPT_CONVO_IGNORE_FONTS) 2346
2347 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts"))
2349 options ^= GTK_IMHTML_NO_FONTS; 2348 options ^= GTK_IMHTML_NO_FONTS;
2350 if (convo_options & OPT_CONVO_IGNORE_SIZES) 2349
2350 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes"))
2351 options ^= GTK_IMHTML_NO_SIZES; 2351 options ^= GTK_IMHTML_NO_SIZES;
2352
2352 options ^= GTK_IMHTML_NO_COMMENTS; 2353 options ^= GTK_IMHTML_NO_COMMENTS;
2353 options ^= GTK_IMHTML_NO_TITLE; 2354 options ^= GTK_IMHTML_NO_TITLE;
2354 options ^= GTK_IMHTML_NO_NEWLINE; 2355 options ^= GTK_IMHTML_NO_NEWLINE;
2355 options ^= GTK_IMHTML_NO_SCROLL; 2356 options ^= GTK_IMHTML_NO_SCROLL;
2356 2357
3020 3021
3021 void show_fgcolor_dialog(struct gaim_conversation *c, GtkWidget *color) 3022 void show_fgcolor_dialog(struct gaim_conversation *c, GtkWidget *color)
3022 { 3023 {
3023 struct gaim_gtk_conversation *gtkconv; 3024 struct gaim_gtk_conversation *gtkconv;
3024 GtkWidget *colorsel; 3025 GtkWidget *colorsel;
3026 GdkColor fgcolor;
3025 3027
3026 gtkconv = GAIM_GTK_CONVERSATION(c); 3028 gtkconv = GAIM_GTK_CONVERSATION(c);
3029
3030 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
3031 &fgcolor);
3027 3032
3028 if (color == NULL) { /* we came from the prefs */ 3033 if (color == NULL) { /* we came from the prefs */
3029 if (fgcseld) 3034 if (fgcseld)
3030 return; 3035 return;
3031 3036
3068 3073
3069 void show_bgcolor_dialog(struct gaim_conversation *c, GtkWidget *color) 3074 void show_bgcolor_dialog(struct gaim_conversation *c, GtkWidget *color)
3070 { 3075 {
3071 struct gaim_gtk_conversation *gtkconv; 3076 struct gaim_gtk_conversation *gtkconv;
3072 GtkWidget *colorsel; 3077 GtkWidget *colorsel;
3078 GdkColor bgcolor;
3073 3079
3074 gtkconv = GAIM_GTK_CONVERSATION(c); 3080 gtkconv = GAIM_GTK_CONVERSATION(c);
3081
3082 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
3083 &bgcolor);
3075 3084
3076 if (color == NULL) { /* we came from the prefs */ 3085 if (color == NULL) { /* we came from the prefs */
3077 if (bgcseld) 3086 if (bgcseld)
3078 return; 3087 return;
3079 3088
3141 int i = 0; 3150 int i = 0;
3142 char *fontname; 3151 char *fontname;
3143 struct gaim_conversation *c = g_object_get_data(G_OBJECT(fontsel), 3152 struct gaim_conversation *c = g_object_get_data(G_OBJECT(fontsel),
3144 "gaim_conversation"); 3153 "gaim_conversation");
3145 3154
3155 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
3156
3146 if (c) { 3157 if (c) {
3147 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
3148 while(fontname[i] && !isdigit(fontname[i])) { 3158 while(fontname[i] && !isdigit(fontname[i])) {
3149 i++; 3159 i++;
3150 } 3160 }
3151 fontname[i] = 0; 3161 fontname[i] = 0;
3152 gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname); 3162 gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname);
3153 } else { 3163 } else {
3164 char *c;
3165
3154 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); 3166 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
3155 while(fontface[i] && !isdigit(fontname[i]) && i < sizeof(fontface)) { 3167
3156 fontface[i] = fontname[i]; 3168 for (c = fontname; *c != '\0'; c++) {
3157 i++; 3169 if (isdigit(*c)) {
3170 *(--c) = '\0';
3171 break;
3172 }
3158 } 3173 }
3159 fontface[i] = 0; 3174
3160 } 3175 /* Try this. */
3176 gaim_prefs_set_string("/gaim/gtk/conversations/font_face", fontname);
3177 }
3178
3179 g_free(fontname);
3161 3180
3162 cancel_font(NULL, c); 3181 cancel_font(NULL, c);
3163 } 3182 }
3164 3183
3165 void destroy_fontsel(GtkWidget *w, gpointer d) 3184 void destroy_fontsel(GtkWidget *w, gpointer d)
3170 3189
3171 void show_font_dialog(struct gaim_conversation *c, GtkWidget *font) 3190 void show_font_dialog(struct gaim_conversation *c, GtkWidget *font)
3172 { 3191 {
3173 struct gaim_gtk_conversation *gtkconv; 3192 struct gaim_gtk_conversation *gtkconv;
3174 char fonttif[128]; 3193 char fonttif[128];
3194 const char *fontface;
3175 3195
3176 gtkconv = GAIM_GTK_CONVERSATION(c); 3196 gtkconv = GAIM_GTK_CONVERSATION(c);
3177 3197
3178 if (!font) { /* we came from the prefs dialog */ 3198 if (!font) { /* we came from the prefs dialog */
3179 if (fontseld) 3199 if (fontseld)
3180 return; 3200 return;
3201
3181 fontseld = gtk_font_selection_dialog_new(_("Select Font")); 3202 fontseld = gtk_font_selection_dialog_new(_("Select Font"));
3182 if (fontface[0]) { 3203
3204 fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
3205
3206 if (fontface != NULL && *fontface != '\0') {
3183 g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface); 3207 g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface);
3184 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), 3208 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld),
3185 fonttif); 3209 fonttif);
3186 } else { 3210 } else {
3187 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), 3211 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld),
4061 guint block; 4085 guint block;
4062 char convo_start[32]; 4086 char convo_start[32];
4063 long offset = 0; 4087 long offset = 0;
4064 4088
4065 options = GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL; 4089 options = GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL;
4066 if (convo_options & OPT_CONVO_IGNORE_COLOUR) 4090
4091 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors"))
4067 options ^= GTK_IMHTML_NO_COLOURS; 4092 options ^= GTK_IMHTML_NO_COLOURS;
4068 if (convo_options & OPT_CONVO_IGNORE_FONTS) 4093
4094 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts"))
4069 options ^= GTK_IMHTML_NO_FONTS; 4095 options ^= GTK_IMHTML_NO_FONTS;
4070 if (convo_options & OPT_CONVO_IGNORE_SIZES) 4096
4097 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes"))
4071 options ^= GTK_IMHTML_NO_SIZES; 4098 options ^= GTK_IMHTML_NO_SIZES;
4072 4099
4073 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 4100 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
4074 g_object_set_data(G_OBJECT(window), "name", name); 4101 g_object_set_data(G_OBJECT(window), "name", name);
4075 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(des_log_win), NULL); 4102 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(des_log_win), NULL);
4413 return button; 4440 return button;
4414 } 4441 }
4415 4442
4416 GtkWidget * 4443 GtkWidget *
4417 gaim_pixbuf_button_from_stock(const char *text, const char *icon, 4444 gaim_pixbuf_button_from_stock(const char *text, const char *icon,
4418 GaimButtonStyle style) 4445 GaimButtonOrientation style)
4419 { 4446 {
4420 GtkWidget *button, *image, *label, *bbox, *ibox, *lbox; 4447 GtkWidget *button, *image, *label, *bbox, *ibox, *lbox;
4421 button = gtk_button_new(); 4448 button = gtk_button_new();
4422 4449
4423 if (style == GAIM_BUTTON_HORIZONTAL) { 4450 if (style == GAIM_BUTTON_HORIZONTAL) {
4449 4476
4450 gtk_widget_show_all(bbox); 4477 gtk_widget_show_all(bbox);
4451 return button; 4478 return button;
4452 } 4479 }
4453 4480
4454 GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonStyle style) 4481 GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonOrientation style)
4455 { 4482 {
4456 GtkWidget *button, *image, *label, *bbox, *ibox, *lbox; 4483 GtkWidget *button, *image, *label, *bbox, *ibox, *lbox;
4457 button = gtk_button_new(); 4484 button = gtk_button_new();
4458 4485
4459 if (style == GAIM_BUTTON_HORIZONTAL) { 4486 if (style == GAIM_BUTTON_HORIZONTAL) {