From: Sean E. <sea...@us...> - 2002-08-30 03:04:15
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv29181/src Modified Files: conversation.c dialogs.c gaimrc.c prefs.c ui.h Log Message: Fixed font preferences, and removed the title from alert windows. Index: conversation.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/conversation.c,v retrieving revision 1.372 retrieving revision 1.373 diff -u -d -r1.372 -r1.373 --- conversation.c 29 Aug 2002 21:40:06 -0000 1.372 +++ conversation.c 30 Aug 2002 03:04:11 -0000 1.373 @@ -77,7 +77,7 @@ GtkWidget *convo_notebook = NULL; char fontface[128] = { 0 }; -char fontxfld[256] = { 0 }; + int fontsize = 3; extern GdkColor bgcolor; extern GdkColor fgcolor; @@ -627,18 +627,8 @@ void set_font_face(char *newfont, struct conversation *c) { char *pre_fontface; - int i, j = 0, k = 0; - - - sprintf(c->fontxfld, "%s", newfont && *newfont ? newfont : DEFAULT_FONT_XFLD); - for (i = 0; i < strlen(c->fontxfld); i++) { - if (c->fontxfld[i] == '-') { - if (++j > 2) - break; - } else if (j == 2) - c->fontface[k++] = c->fontxfld[i]; - } - c->fontface[k] = '\0'; + + sprintf(c->fontface, "%s", newfont && *newfont ? newfont : DEFAULT_FONT_FACE); c->hasfont = 1; pre_fontface = g_strconcat("<FONT FACE=\"", c->fontface, "\">", NULL); @@ -2761,7 +2751,6 @@ c->smiley_dialog = NULL; c->link_dialog = NULL; c->log_dialog = NULL; - sprintf(c->fontxfld, "%s", fontxfld); sprintf(c->fontface, "%s", fontface); c->hasfont = 0; c->bgcol = bgcolor; @@ -3333,7 +3322,6 @@ if (b->hasfont) continue; sprintf(b->fontface, "%s", fontface); - sprintf(b->fontxfld, "%s", fontxfld); } } Index: dialogs.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/dialogs.c,v retrieving revision 1.331 retrieving revision 1.332 diff -u -d -r1.331 -r1.332 --- dialogs.c 29 Aug 2002 21:40:07 -0000 1.331 +++ dialogs.c 30 Aug 2002 03:04:11 -0000 1.332 @@ -581,7 +581,7 @@ img = gtk_image_new_from_file(filename); gtk_misc_set_alignment(GTK_MISC(img), 0, 0); } - d = gtk_dialog_new_with_buttons(NULL, NULL, GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT); + d = gtk_dialog_new_with_buttons("", NULL, GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT); g_signal_connect(d, "response", G_CALLBACK(gtk_widget_destroy), NULL); gtk_container_set_border_width (GTK_CONTAINER(d), 6); @@ -3206,34 +3206,29 @@ { /* this could be expanded to include font size, weight, etc. but for now only works with font face */ - int i, j = 0, k = 0; + int i = 0; char *fontname; struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(fontsel)); if (c) { fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); - + while(fontname[i] && !isdigit(fontname[i])) { + i++; + } + fontname[i] = 0; set_font_face(fontname, c); } else { fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); - - for (i = 0; i < strlen(fontname); i++) { - if (fontname[i] == '-') { - if (++j > 2) - break; - } else if (j == 2) - fontface[k++] = fontname[i]; + while(fontface[i] && !isdigit(fontname[i]) && i < sizeof(fontface)) { + fontface[i] = fontname[i]; + i++; } - fontface[k] = '\0'; - - g_snprintf(fontxfld, sizeof(fontxfld), "%s", fontname); + fontface[i] = 0; } cancel_font(NULL, c); } -static GtkWidget *fontseld; - void destroy_fontsel(GtkWidget *w, gpointer d) { gtk_widget_destroy(fontseld); @@ -3242,17 +3237,18 @@ void show_font_dialog(struct conversation *c, GtkWidget *font) { - + char fonttif[128]; if (!font) { /* we came from the prefs dialog */ if (fontseld) return; fontseld = gtk_font_selection_dialog_new(_("Select Font")); - if (fontxfld[0]) { + if (fontface[0]) { + g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface); gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), - fontxfld); + fonttif); } else { gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), - DEFAULT_FONT_XFLD); + DEFAULT_FONT_FACE " 12"); } gtk_object_set_user_data(GTK_OBJECT(fontseld), NULL); @@ -3261,7 +3257,7 @@ gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->cancel_button), "clicked", GTK_SIGNAL_FUNC(destroy_fontsel), NULL); gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->ok_button), "clicked", - GTK_SIGNAL_FUNC(apply_font_dlg), NULL); + GTK_SIGNAL_FUNC(apply_font_dlg), fontseld); gtk_widget_realize(fontseld); aol_icon(fontseld->window); gtk_widget_show(fontseld); @@ -3277,12 +3273,13 @@ else gtk_object_set_user_data(GTK_OBJECT(c->font_dialog), NULL); - if (c->fontxfld[0]) { + if (c->fontface[0]) { + g_snprintf(fonttif, sizeof(fonttif), "%s 12", c->fontface); gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(c->font_dialog), - c->fontxfld); + fonttif); } else { gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(c->font_dialog), - DEFAULT_FONT_XFLD); + DEFAULT_FONT_FACE); } gtk_signal_connect(GTK_OBJECT(c->font_dialog), "delete_event", Index: gaimrc.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gaimrc.c,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- gaimrc.c 28 Aug 2002 05:55:48 -0000 1.104 +++ gaimrc.c 30 Aug 2002 03:04:11 -0000 1.105 @@ -748,8 +748,6 @@ } else if (!strcmp(p->option, "away_options")) { away_options = atoi(p->value[0]); away_resend = atoi(p->value[1]); - } else if (!strcmp(p->option, "font_xfld")) { - g_snprintf(fontxfld, sizeof(fontxfld), "%s", p->value[0]); } else if (!strcmp(p->option, "font_face")) { g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]); } else if (!strcmp(p->option, "font_size")) { @@ -851,7 +849,6 @@ fprintf(f, "\tsound_options { %u }\n", sound_options); fprintf(f, "\taway_options { %u } { %u }\n", away_options, away_resend); - fprintf(f, "\tfont_xfld { %s }\n", fontxfld); fprintf(f, "\tfont_face { %s }\n", fontface); fprintf(f, "\tfont_size { %d }\n", fontsize); fprintf(f, "\tforeground { %d } { %d } { %d }\n", fgcolor.red, fgcolor.green, fgcolor.blue); Index: prefs.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/prefs.c,v retrieving revision 1.244 retrieving revision 1.245 diff -u -d -r1.244 -r1.245 --- prefs.c 29 Aug 2002 21:40:07 -0000 1.244 +++ prefs.c 30 Aug 2002 03:04:11 -0000 1.245 @@ -1919,13 +1919,14 @@ int i = 0; char *fontname; - fontname = g_strdup(gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontseld))); + fontname = g_strdup(gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(f))); destroy_fontsel(0, 0); while(fontname[i] && !isdigit(fontname[i]) && i < sizeof(fontface_new)) { fontface_new[i] = fontname[i]; i++; } - + fontface_new[i] = 0; + debug_printf("fontface_new: %s\n", fontface_new); g_free(fontname); } Index: ui.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/ui.h,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- ui.h 29 Aug 2002 21:40:08 -0000 1.48 +++ ui.h 30 Aug 2002 03:04:12 -0000 1.49 @@ -36,8 +36,7 @@ #define gtk_accel_group_attach(x, y) _gtk_accel_group_attach(x, y) #define gtk_widget_lock_accelerators(x) -#define DEFAULT_FONT_XFLD "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1" -#define DEFAULT_FONT_FACE "helvetica" +#define DEFAULT_FONT_FACE "Helvetica" #define BROWSER_NETSCAPE 0 #define BROWSER_KONQ 1 @@ -125,7 +124,6 @@ GtkWidget *log_dialog; int makesound; char fontface[128]; - char fontxfld[256]; int hasfont; GdkColor bgcol; int hasbg; @@ -296,6 +294,7 @@ /* Globals in prefs.c */ extern struct debug_window *dw; +extern GtkWidget *fontseld; /* Globals in prpl.c */ extern GtkWidget *protomenu; |