diff 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
line wrap: on
line diff
--- a/src/dialogs.c	Thu May 29 17:35:28 2003 +0000
+++ b/src/dialogs.c	Thu May 29 19:10:24 2003 +0000
@@ -50,6 +50,7 @@
 #include "prpl.h"
 #include "gtkblist.h"
 #include "notify.h"
+#include "prefs.h"
 
 #ifdef _WIN32
 #include "win32dep.h"
@@ -57,9 +58,6 @@
 
 #define PATHSIZE 1024
 
-GdkColor bgcolor;
-GdkColor fgcolor;
-
 static GtkWidget *imdialog = NULL;	/*I only want ONE of these :) */
 static GList *dialogwindows = NULL;
 static GtkWidget *importdialog;
@@ -2343,12 +2341,15 @@
 		gtk_widget_show_all(b->window);
 	}
 
-	if (convo_options & OPT_CONVO_IGNORE_COLOUR)
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors"))
 		options ^= GTK_IMHTML_NO_COLOURS;
-	if (convo_options & OPT_CONVO_IGNORE_FONTS)
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts"))
 		options ^= GTK_IMHTML_NO_FONTS;
-	if (convo_options & OPT_CONVO_IGNORE_SIZES)
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes"))
 		options ^= GTK_IMHTML_NO_SIZES;
+
 	options ^= GTK_IMHTML_NO_COMMENTS;
 	options ^= GTK_IMHTML_NO_TITLE;
 	options ^= GTK_IMHTML_NO_NEWLINE;
@@ -3022,9 +3023,13 @@
 {
 	struct gaim_gtk_conversation *gtkconv;
 	GtkWidget *colorsel;
+	GdkColor fgcolor;
 
 	gtkconv = GAIM_GTK_CONVERSATION(c);
 
+	gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
+					&fgcolor);
+
 	if (color == NULL) {	/* we came from the prefs */
 		if (fgcseld)
 			return;
@@ -3070,9 +3075,13 @@
 {
 	struct gaim_gtk_conversation *gtkconv;
 	GtkWidget *colorsel;
+	GdkColor bgcolor;
 
 	gtkconv = GAIM_GTK_CONVERSATION(c);
 
+	gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
+					&bgcolor);
+
 	if (color == NULL) {	/* we came from the prefs */
 		if (bgcseld)
 			return;
@@ -3143,22 +3152,32 @@
 	struct gaim_conversation *c = g_object_get_data(G_OBJECT(fontsel),
 			"gaim_conversation");
 
+	fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(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;
 		gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname);
 	} else {
+		char *c;
+
 		fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel));
-		while(fontface[i] && !isdigit(fontname[i]) && i < sizeof(fontface)) { 
-			fontface[i] = fontname[i];
-			i++;
+
+		for (c = fontname; *c != '\0'; c++) {
+			if (isdigit(*c)) {
+				*(--c) = '\0';
+				break;
+			}
 		}
-		fontface[i] = 0;
+
+		/* Try this. */
+		gaim_prefs_set_string("/gaim/gtk/conversations/font_face", fontname);
 	}
 
+	g_free(fontname);
+
 	cancel_font(NULL, c);
 }
 
@@ -3172,14 +3191,19 @@
 {
 	struct gaim_gtk_conversation *gtkconv;
 	char fonttif[128];
+	const char *fontface;
 
 	gtkconv = GAIM_GTK_CONVERSATION(c);
 
 	if (!font) {		/* we came from the prefs dialog */
 		if (fontseld)
 			return;
+
 		fontseld = gtk_font_selection_dialog_new(_("Select Font"));
-		if (fontface[0]) {
+
+		fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
+
+		if (fontface != NULL && *fontface != '\0') {
 			g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface);
 			gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld),
 								fonttif);
@@ -4063,11 +4087,14 @@
 	long offset = 0;
 
 	options = GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL;
-	if (convo_options & OPT_CONVO_IGNORE_COLOUR)
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors"))
 		options ^= GTK_IMHTML_NO_COLOURS;
-	if (convo_options & OPT_CONVO_IGNORE_FONTS)
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts"))
 		options ^= GTK_IMHTML_NO_FONTS;
-	if (convo_options & OPT_CONVO_IGNORE_SIZES)
+
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes"))
 		options ^= GTK_IMHTML_NO_SIZES;
 
 	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -4415,7 +4442,7 @@
 
 GtkWidget *
 gaim_pixbuf_button_from_stock(const char *text, const char *icon,
-							  GaimButtonStyle style)
+							  GaimButtonOrientation style)
 {
 	GtkWidget *button, *image, *label, *bbox, *ibox, *lbox;
 	button = gtk_button_new();
@@ -4451,7 +4478,7 @@
 	return button;
 }
 
-GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonStyle style)
+GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonOrientation style)
 {
 	GtkWidget *button, *image, *label, *bbox, *ibox, *lbox;
 	button = gtk_button_new();