Look for logo in engine dir first (GTK)
[xboard.git] / gtk / xoptions.c
index 0caa125..5df840b 100644 (file)
@@ -138,16 +138,6 @@ static Arg formArgs[] = {
 };
 #endif
 
-void
-MarkMenuItem (char *menuRef, int state)
-{
-    MenuItem *item = MenuNameToItem(menuRef);
-
-    if(item && item->handle) {
-        ((GtkCheckMenuItem *) (item->handle))->active = state;
-    }
-}
-
 void GetWidgetTextGTK(GtkWidget *w, char **buf)
 {
     GtkTextIter start;
@@ -259,6 +249,17 @@ SetDialogTitle (DialogClass dlg, char *title)
     gtk_window_set_title(GTK_WINDOW(shells[dlg]), title);
 }
 
+int
+SetWidgetFont (GtkWidget *w, char *s)
+{
+    PangoFontDescription *pfd;
+    if (!s || *s == '#') return 0; // no spec, or spec of color: fail
+    if(!*(char**)s) return 1;      // empty spec: do nothing, but succeed
+    pfd = pango_font_description_from_string(*(char**)s);
+    gtk_widget_modify_font(w, pfd);
+    return 1;
+}
+
 void
 SetListBoxItem (GtkListStore *store, int n, char *msg)
 {
@@ -558,7 +559,7 @@ AppendColorized (Option *opt, char *s, int count)
     static GtkTextTag *fgTags[8], *bgTags[8], *font, *bold, *normal, *attr = NULL;
 
     if(!font) {
-       font = gtk_text_buffer_create_tag(opt->handle, NULL, "font", "Monospace normal", NULL);
+       font = gtk_text_buffer_create_tag(opt->handle, NULL, "font", appData.icsFont, NULL);
        gtk_widget_modify_base(GTK_WIDGET(opt->textValue), GTK_STATE_NORMAL, &backgroundColor);
     }
 
@@ -703,6 +704,8 @@ AddHandler (Option *opt, DialogClass dlg, int nr)
        g_signal_connect(opt->handle, "key-press-event", G_CALLBACK (TypeInProc), (gpointer) (dlg<<16 | (opt - dialogOptions[dlg])));
        break;
       case 5: // game list
+printf("use %s\n", appData.gameListFont);
+        SetWidgetFont(opt->handle, (char*) &appData.gameListFont);
        g_signal_connect(opt->handle, "button-press-event", G_CALLBACK (GameListEvent), (gpointer) 0 );
       case 4: // game-list filter
        g_signal_connect(opt->handle, "key-press-event", G_CALLBACK (GameListEvent), (gpointer) (intptr_t) nr );
@@ -1349,6 +1352,7 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width);
                     /* no label so let textview occupy all columns */
                     Pack(hbox, table, sw, left, left+r, top, GTK_EXPAND);
                 }
+                SetWidgetFont(textview, option[i].textValue);
                 if ( *(char**)option[i].target != NULL )
                     gtk_text_buffer_set_text (textbuffer, *(char**)option[i].target, -1);
                 else
@@ -1415,6 +1419,7 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width);
             option[i].handle = (void *) (label = gtk_label_new(option[i].name));
             /* Left Justify */
             gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+            SetWidgetFont(label, option[i].textValue);
            if(option[i].min & BORDER) {
                GtkWidget *frame = gtk_frame_new(NULL);
                 gtk_container_add(GTK_CONTAINER(frame), label);
@@ -1442,6 +1447,7 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width);
            }
 
             /* set button color on new variant dialog */
+            if(!SetWidgetFont(gtk_bin_get_child(GTK_BIN(button)), option[i].textValue))
             if(option[i].textValue) {
                 gdk_color_parse( option[i].textValue, &color );
                 gtk_widget_modify_bg ( GTK_WIDGET(button), GTK_STATE_NORMAL, &color );