[PATCH] font setting
- From: Richard Hult <rhult hem2 passagen se>
- To: balsa-list gnome org
- Subject: [PATCH] font setting
- Date: Tue, 13 Apr 1999 15:44:11 +0200
I started playing around a bit with the sources and implemented a font setting in the preferences. This affects the font used to display messages. I needed this badly cause the default font was totally unreadable on my screen. The default is the old font.
I put the option on the "Misc" tab, so it should probably be moved somewhere else.
I also cleaned up the rest of the property tabs. They were a bit inconsistent wrt padding between frames etc. I also put a frame around the "Identity" tab, since all the other tabs had one and it looks a lot nicer IMHO.
Richard
? ChangeLog
Index: balsa-app.c
===================================================================
RCS file: /cvs/gnome/balsa/src/balsa-app.c,v
retrieving revision 1.106
diff -u -r1.106 balsa-app.c
--- balsa-app.c 1999/02/21 15:28:07 1.106
+++ balsa-app.c 1999/04/13 13:35:33
@@ -121,6 +121,9 @@
/* arp */
balsa_app.quote_str = NULL;
+
+ /* font */
+ balsa_app.message_font = NULL;
}
gint
Index: balsa-app.h
===================================================================
RCS file: /cvs/gnome/balsa/src/balsa-app.h,v
retrieving revision 1.53
diff -u -r1.53 balsa-app.h
--- balsa-app.h 1999/02/24 03:33:10 1.53
+++ balsa-app.h 1999/04/13 13:35:33
@@ -38,8 +38,8 @@
#define MESSAGEBOX_WIDTH 450
#define MESSAGEBOX_HEIGHT 150
+#define DEFAULT_MESSAGE_FONT "-adobe-helvetica-medium-r-normal--12-*-72-72-p-*-iso8859-1"
-
/* global balsa application structure */
extern struct BalsaApplication
{
@@ -88,6 +88,9 @@
/* arp --- string to prefix "replied to" messages. */
gchar *quote_str;
+
+ /* font used to display messages */
+ gchar *message_font;
}
balsa_app;
Index: balsa-message.c
===================================================================
RCS file: /cvs/gnome/balsa/src/balsa-message.c,v
retrieving revision 1.77
diff -u -r1.77 balsa-message.c
--- balsa-message.c 1999/04/09 04:00:47 1.77
+++ balsa-message.c 1999/04/13 13:35:34
@@ -424,7 +424,7 @@
"x", x,
"y", y,
"anchor", GTK_ANCHOR_NW,
- "font", "-adobe-helvetica-medium-r-normal--12-*-72-72-p-*-iso8859-1",
+ "font", balsa_app.message_font,
"text", text, NULL);
return new;
}
Index: pref-manager.c
===================================================================
RCS file: /cvs/gnome/balsa/src/pref-manager.c,v
retrieving revision 1.71
diff -u -r1.71 pref-manager.c
--- pref-manager.c 1999/03/03 00:59:47 1.71
+++ pref-manager.c 1999/04/13 13:35:34
@@ -46,6 +46,9 @@
#endif
/* arp */
GtkWidget *quote_str;
+
+ GtkWidget *message_font; /* font used to display messages */
+ GtkWidget *font_picker;
}
PropertyUI;
@@ -65,7 +68,7 @@
{
N_("Text"),
N_("Icons"),
- N_("Both"),
+ N_("Both")
};
/* notebook pages */
@@ -88,6 +91,7 @@
/* callbacks */
static void properties_modified_cb (GtkWidget *, GnomePropertyBox *);
+static void font_changed (GtkWidget *w, PropertyUI *prop);
static void pop3_add_cb (GtkWidget * widget, gpointer data);
static void pop3_edit_cb (GtkWidget * widget, gpointer data);
@@ -197,6 +201,16 @@
GTK_SIGNAL_FUNC (properties_modified_cb),
pui->pbox);
+ /* message font */
+ gtk_signal_connect (GTK_OBJECT (pui->message_font), "changed",
+ GTK_SIGNAL_FUNC (font_changed),
+ pui->pbox);
+
+ gtk_signal_connect (GTK_OBJECT (pui->font_picker), "font_set",
+ GTK_SIGNAL_FUNC (font_changed),
+ pui->pbox);
+
+
/* set data and show the whole thing */
gtk_widget_show_all (GTK_WIDGET (pui->pbox));
}
@@ -263,6 +277,9 @@
balsa_app.quote_str =
g_strdup (gtk_entry_get_text (GTK_ENTRY (pui->quote_str)));
+ g_free (balsa_app.message_font);
+ balsa_app.message_font =
+ g_strdup (gtk_entry_get_text (GTK_ENTRY (pui->message_font)));
refresh_main_window ();
@@ -305,6 +322,10 @@
#endif
/* arp */
gtk_entry_set_text (GTK_ENTRY (pui->quote_str), balsa_app.quote_str);
+
+ /* message font */
+ gtk_entry_set_text (GTK_ENTRY (pui->message_font), balsa_app.message_font);
+ gtk_entry_set_position (GTK_ENTRY (pui->message_font), 0);
}
void
@@ -353,6 +374,7 @@
create_identity_page (void)
{
GtkWidget *vbox;
+ GtkWidget *frame;
GtkWidget *table;
GtkWidget *label;
GtkWidget *signature;
@@ -360,8 +382,13 @@
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
+ /* identity frame */
+ frame = gtk_frame_new (_("Identity"));
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 5);
+
table = gtk_table_new (4, 2, FALSE);
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 5);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 5);
+ gtk_container_add (GTK_CONTAINER (frame), table);
/* your name */
label = gtk_label_new (_ ("Your name:"));
@@ -476,6 +503,7 @@
frame = gtk_frame_new (_("Local Mail"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 5);
hbox = gtk_hbox_new (TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_container_add (GTK_CONTAINER (frame), hbox);
label = gtk_label_new (_ ("Local mail directory:"));
@@ -489,6 +517,8 @@
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 5);
table1 = gtk_table_new (2, 2, FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (table1), 5);
+
gtk_container_add (GTK_CONTAINER (frame), table1);
gtk_widget_show (table1);
@@ -578,9 +608,8 @@
GtkWidget *vbox1;
GtkWidget *table;
GtkWidget *label;
-
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
/* Misc */
@@ -589,6 +618,7 @@
/* arp */
vbox1 = gtk_vbox_new (FALSE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5);
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (vbox1));
pui->debug = gtk_check_button_new_with_label (_("Debug"));
@@ -609,7 +639,35 @@
gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET (table), TRUE, TRUE, 2);
+ /* font picker */
+ table = gtk_table_new (1, 3, FALSE);
+ label = gtk_label_new (_("Font:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
+ GTK_FILL, GTK_FILL, 10, 10);
+
+ pui->message_font = gtk_entry_new ();
+ gtk_table_attach (GTK_TABLE (table), pui->message_font, 1, 2, 0, 1,
+ GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 10);
+
+ pui->font_picker = gnome_font_picker_new ();
+ gnome_font_picker_set_font_name (GNOME_FONT_PICKER (pui->font_picker),
+ gtk_entry_get_text (GTK_ENTRY (pui->message_font)));
+ gnome_font_picker_set_mode (GNOME_FONT_PICKER (pui->font_picker),
+ GNOME_FONT_PICKER_MODE_USER_WIDGET);
+
+ label = gtk_label_new (_("Browse..."));
+ gnome_font_picker_uw_set_widget (GNOME_FONT_PICKER (pui->font_picker), GTK_WIDGET (label));
+ gtk_object_set_user_data (GTK_OBJECT(pui->font_picker), GTK_OBJECT(pui->message_font));
+ gtk_object_set_user_data (GTK_OBJECT(pui->message_font), GTK_OBJECT(pui->font_picker));
+
+ gtk_table_attach (GTK_TABLE (table), pui->font_picker,
+ 2, 3, 0, 1, GTK_FILL, GTK_FILL, 5, 10);
+
+ gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET (table), TRUE, TRUE, 2);
+
+
return vbox;
}
@@ -620,6 +678,23 @@
properties_modified_cb (GtkWidget * widget, GnomePropertyBox * pbox)
{
gnome_property_box_changed (pbox);
+}
+
+static void
+font_changed (GtkWidget * w, PropertyUI * prop)
+{
+ gchar *font;
+ GtkWidget *peer;
+ if (GNOME_IS_FONT_PICKER (w)){
+ font = gnome_font_picker_get_font_name (GNOME_FONT_PICKER (w));
+ peer = gtk_object_get_user_data (GTK_OBJECT (w));
+ gtk_entry_set_text (GTK_ENTRY (peer), font);
+ } else {
+ font = gtk_entry_get_text (GTK_ENTRY (w));
+ peer = gtk_object_get_user_data (GTK_OBJECT (w));
+ gnome_font_picker_set_font_name (GNOME_FONT_PICKER (peer), font);
+ properties_modified_cb (w, prop->pbox);
+ }
}
static void
Index: save-restore.c
===================================================================
RCS file: /cvs/gnome/balsa/src/save-restore.c,v
retrieving revision 1.88
diff -u -r1.88 save-restore.c
--- save-restore.c 1999/02/24 03:33:17 1.88
+++ save-restore.c 1999/04/13 13:35:34
@@ -677,14 +677,18 @@
if (balsa_app.mblist_height < 100)
balsa_app.mblist_width = 200;
-
-
/* arp --- LeadinStr for "reply to" leadin. */
if ((field = pl_dict_get_str (globals, "LeadinStr")) == NULL)
balsa_app.quote_str = g_strdup ("> ");
else
balsa_app.quote_str = g_strdup (field);
+ /* font used to display messages */
+ if ((field = pl_dict_get_str (globals, "MessageFont")) == NULL)
+ balsa_app.message_font = g_strdup (DEFAULT_MESSAGE_FONT);
+ else
+ balsa_app.message_font = g_strdup (field);
+
return TRUE;
} /* config_global_load */
@@ -756,6 +760,12 @@
pl_dict_add_str_str (globals, "LeadinStr", balsa_app.quote_str);
else
pl_dict_add_str_str (globals, "LeadinStr", "> ");
+
+ /* message font */
+ if (balsa_app.message_font != NULL)
+ pl_dict_add_str_str (globals, "MessageFont", balsa_app.message_font);
+ else
+ pl_dict_add_str_str (globals, "MessageFont", DEFAULT_MESSAGE_FONT);
/* Add it to configuration file */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]