Re: [PATCH] Use monospace font in text view
- From: Alexander Larsson <alexl redhat com>
- To: Luca Ferretti <elle uca libero it>
- Cc: nautilus-list gnome org
- Subject: Re: [PATCH] Use monospace font in text view
- Date: Fri, 28 Feb 2003 06:23:17 -0500 (EST)
On 24 Feb 2003, Luca Ferretti wrote:
> Well, now we have a cool monospace font from Bitstream, isn't it?
>
> So using monospace font you can see (much) better all vertically aligned
> and/or indented text files.
>
> PS: patch add a 3px spacing on left and right, so window border don't
> 'clash' with external chars. This is useful for non-monospace font too.
>
> PPS: we should make the same for gnome-terminal and gedit :-)
I commited this with two changes, 1) you leaked the GConfClient, 2) for
safety i check that the monospace fontname is not NULL.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5704
diff -u -p -r1.5704 ChangeLog
--- ChangeLog 28 Feb 2003 10:26:43 -0000 1.5704
+++ ChangeLog 28 Feb 2003 11:17:30 -0000
@@ -1,5 +1,11 @@
2003-02-28 Alexander Larsson <alexl redhat com>
+ * components/text/nautilus-text-view.c (nautilus_text_view_instance_init):
+ Use monospaced font for text view.
+ Patch by Luca Ferretti <elle uca libero it>
+
+2003-02-28 Alexander Larsson <alexl redhat com>
+
* src/nautilus-file-management-properties.c:
* src/nautilus-file-management-properties.glade:
Add a 1 GB value for the thumbnailing limit.
Index: components/text/nautilus-text-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/text/nautilus-text-view.c,v
retrieving revision 1.54
diff -u -p -r1.54 nautilus-text-view.c
--- components/text/nautilus-text-view.c 12 Jun 2002 16:34:59 -0000 1.54
+++ components/text/nautilus-text-view.c 28 Feb 2003 11:17:30 -0000
@@ -31,6 +31,7 @@
#include <string.h>
#include <eel/eel-debug.h>
#include <eel/eel-vfs-extensions.h>
+#include <gconf/gconf-client.h>
#include <gtk/gtktextview.h>
#include <gtk/gtkscrolledwindow.h>
#include <libnautilus/nautilus-view.h>
@@ -183,11 +184,26 @@ nautilus_text_view_instance_init (Nautil
{
GtkWidget *text_view;
GtkWidget *scrolled_window;
+ PangoFontDescription *monospace_font_desc;
+ GConfClient *conf_client;
+ char *monospace_font;
text_view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
+ gtk_text_view_set_left_margin (GTK_TEXT_VIEW (text_view), 3);
+ gtk_text_view_set_right_margin (GTK_TEXT_VIEW (text_view), 3);
+ /* Pick up the monospace font from desktop preferences */
+ conf_client = gconf_client_get_default ();
+ monospace_font = gconf_client_get_string (conf_client, "/desktop/gnome/interface/monospace_font_name", NULL);
+ if (monospace_font) {
+ monospace_font_desc = pango_font_description_from_string (monospace_font);
+ gtk_widget_modify_font (text_view, monospace_font_desc);
+ pango_font_description_free (monospace_font_desc);
+ }
+ g_object_unref (conf_client);
+
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's an impetuous guerilla barbarian who hides his scarred face behind a mask.
She's a provocative streetsmart queen of the dead in the witness protection
program. They fight crime!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]