gedit r6100 - in branches/printing: . data gedit
- From: pborelli svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6100 - in branches/printing: . data gedit
- Date: Sat, 19 Jan 2008 11:28:17 +0000 (GMT)
Author: pborelli
Date: Sat Jan 19 11:28:17 2008
New Revision: 6100
URL: http://svn.gnome.org/viewvc/gedit?rev=6100&view=rev
Log:
remove support for legacy gnomefont options and get rid of the gnomeprint dependency for good.
Modified:
branches/printing/configure.ac
branches/printing/data/gedit.schemas.in
branches/printing/gedit/gedit-prefs-manager.c
branches/printing/gedit/gedit-prefs-manager.h
Modified: branches/printing/configure.ac
==============================================================================
--- branches/printing/configure.ac (original)
+++ branches/printing/configure.ac Sat Jan 19 11:28:17 2008
@@ -170,7 +170,6 @@
gtksourceview-2.0 >= 2.0.0
libgnomeui-2.0 >= 2.16.0
libglade-2.0 >= 2.5.1
- libgnomeprintui-2.2 >= 2.12.1
gnome-vfs-2.0 >= 2.16.0
])
GEDIT_LIBS="${GEDIT_LIBS}"
Modified: branches/printing/data/gedit.schemas.in
==============================================================================
--- branches/printing/data/gedit.schemas.in (original)
+++ branches/printing/data/gedit.schemas.in Sat Jan 19 11:28:17 2008
@@ -388,22 +388,6 @@
</schema>
<schema>
- <key>/schemas/apps/gedit-2/preferences/print/fonts/print_font_body</key>
- <applyto>/apps/gedit-2/preferences/print/fonts/print_font_body</applyto>
- <owner>gedit</owner>
- <type>string</type>
- <locale name="C">
- <default><!-- Translators: This is the Body font for printing.
- This is a gnome-print font name and is replaced by
- print_font_body_pango.-->Monospace Regular 9</default>
- <short>Body Font for Printing</short>
- <long>Specifies the font to use for a document's body when
- printing documents. This is a gnome-print font name and replaced by
- print_font_body_pango.</long>
- </locale>
- </schema>
-
- <schema>
<key>/schemas/apps/gedit-2/preferences/print/fonts/print_font_body_pango</key>
<applyto>/apps/gedit-2/preferences/print/fonts/print_font_body_pango</applyto>
<owner>gedit</owner>
@@ -418,23 +402,6 @@
</schema>
<schema>
- <key>/schemas/apps/gedit-2/preferences/print/fonts/print_font_header</key>
- <applyto>/apps/gedit-2/preferences/print/fonts/print_font_header</applyto>
- <owner>gedit</owner>
- <type>string</type>
- <locale name="C">
- <default><!-- Translators: This is the Header font for printing.
- This is a gnome-print font name and replaced by
- print_font_header_pango.-->Sans Regular 11</default>
- <short>Header Font for Printing</short>
- <long>Specifies the font to use for page headers when printing
- a document. This will only take effect if the "Print Header"
- option is turned on. This is a gnome-print font name and replaced by
- print_font_header_pango.</long>
- </locale>
- </schema>
-
- <schema>
<key>/schemas/apps/gedit-2/preferences/print/fonts/print_font_header_pango</key>
<applyto>/apps/gedit-2/preferences/print/fonts/print_font_header_pango</applyto>
<owner>gedit</owner>
@@ -450,23 +417,6 @@
</schema>
<schema>
- <key>/schemas/apps/gedit-2/preferences/print/fonts/print_font_numbers</key>
- <applyto>/apps/gedit-2/preferences/print/fonts/print_font_numbers</applyto>
- <owner>gedit</owner>
- <type>string</type>
- <locale name="C">
- <default><!-- Translators: This is the Line Number font for printing.
- This is a gnome-print font name and replaced by
- print_font_numbers_pango.-->Sans Regular 8</default>
- <short>Line Number Font for Printing</short>
- <long>Specifies the font to use for line numbers when
- printing. This will only take effect if the "Print Line
- Numbers" option is non-zero. This is a gnome-print font name
- and replaced by print_font_numbers_pango.</long>
- </locale>
- </schema>
-
- <schema>
<key>/schemas/apps/gedit-2/preferences/print/fonts/print_font_numbers_pango</key>
<applyto>/apps/gedit-2/preferences/print/fonts/print_font_numbers_pango</applyto>
<owner>gedit</owner>
Modified: branches/printing/gedit/gedit-prefs-manager.c
==============================================================================
--- branches/printing/gedit/gedit-prefs-manager.c (original)
+++ branches/printing/gedit/gedit-prefs-manager.c Sat Jan 19 11:28:17 2008
@@ -35,7 +35,6 @@
#include <glib/gi18n.h>
#include <gconf/gconf-value.h>
-#include <libgnomeprint/gnome-font.h>
#include "gedit-prefs-manager.h"
#include "gedit-prefs-manager-private.h"
@@ -603,214 +602,19 @@
DEFINE_INT_PREF (print_line_numbers,
GPM_PRINT_LINE_NUMBERS,
GPM_DEFAULT_PRINT_LINE_NUMBERS)
-
-/* The printing font entries are done in custom code because we
- * need to implement transitioning between old gnome-print font
- * names and new Pango fontnames
- */
-
-/*
- * The following routines are duplicated in gtksourceview/gtksourceview/gtksourceprintjob.c
- */
-
-/* Do this ourselves since gnome_font_find_closest() doesn't call
- * gnome_font_face_find_closest() (probably a gnome-print bug)
- */
-static void
-face_and_size_from_full_name (const gchar *name,
- GnomeFontFace **face,
- gdouble *size)
-{
- char *copy;
- char *str_size;
-
- copy = g_strdup (name);
- str_size = strrchr (copy, ' ');
- if (str_size) {
- *str_size = 0;
- str_size ++;
- *size = atof (str_size);
- } else {
- *size = 12;
- }
-
- *face = gnome_font_face_find_closest ((guchar *)copy);
- g_free (copy);
-}
-
-static PangoFontDescription *
-font_description_from_gnome_font_name (const char *font_name)
-{
- GnomeFontFace *face;
- PangoFontDescription *desc;
- PangoStyle style;
- PangoWeight weight;
- const gchar *family_name;
- gdouble size;
-
- face_and_size_from_full_name (font_name, &face, &size);
-
- /* Pango and GnomePrint have basically the same numeric weight values */
- weight = (PangoWeight) gnome_font_face_get_weight_code (face);
- style = gnome_font_face_is_italic (face) ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL;
- family_name = (const gchar *) gnome_font_face_get_family_name (face);
-
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, family_name);
- pango_font_description_set_weight (desc, weight);
- pango_font_description_set_style (desc, style);
- pango_font_description_set_size (desc, size * PANGO_SCALE);
-
- g_object_unref (face);
-
- return desc;
-}
-
-static char *
-font_name_from_gnome_font_name (const char *gnome_name)
-{
- PangoFontDescription *desc;
- gchar *pango_name;
-
- desc = font_description_from_gnome_font_name (gnome_name);
- pango_name = pango_font_description_to_string (desc);
- pango_font_description_free (desc);
-
- return pango_name;
-}
-
-static gchar *
-get_string_without_default (GConfClient *gconf_client,
- const char *key,
- GError **error)
-{
- GConfValue *value;
- gchar *result = NULL;
-
- value = gconf_client_get_without_default (gconf_client, key, error);
- if (value && value->type == GCONF_VALUE_STRING)
- {
- result = g_strdup (gconf_value_get_string (value));
- gconf_value_free (value);
- }
-
- return result;
-}
-
-static gchar *
-gedit_prefs_manager_get_font (const gchar *pango_key,
- const gchar *gnome_print_key,
- const gchar *def)
-{
- gchar *pango_value;
- gchar *gnome_print_value;
-
- /* if the new pango key isn't writable, we don't want an old value to
- * overwrite it. Otherwise, we first look whether the pango key has
- * been set explicitely. If the pango key hasn't been set, but the
- * gnome-print key has, we use that and convert it into a pango font name.
- */
- if (gedit_prefs_manager_key_is_writable (pango_key))
- {
- pango_value = get_string_without_default (gedit_prefs_manager->gconf_client,
- pango_key,
- NULL);
- if (pango_value)
- return pango_value;
-
- gnome_print_value = get_string_without_default (gedit_prefs_manager->gconf_client,
- gnome_print_key,
- NULL);
-
- if (gnome_print_value) {
- pango_value = font_name_from_gnome_font_name (gnome_print_value);
- g_free (gnome_print_value);
-
- return pango_value;
- }
- }
-
- return gedit_prefs_manager_get_string (pango_key, def);
-}
-
-gchar *
-gedit_prefs_manager_get_print_font_body (void)
-{
- return gedit_prefs_manager_get_font (GPM_PRINT_FONT_BODY_PANGO,
- GPM_PRINT_FONT_BODY,
- GPM_DEFAULT_PRINT_FONT_BODY_PANGO);
-}
-
-void
-gedit_prefs_manager_set_print_font_body (const gchar* v)
-{
- gedit_prefs_manager_set_string (GPM_PRINT_FONT_BODY_PANGO, v);
-}
-
-gboolean
-gedit_prefs_manager_print_font_body_can_set (void)
-{
- return gedit_prefs_manager_key_is_writable (GPM_PRINT_FONT_BODY_PANGO);
-}
-
-const gchar *
-gedit_prefs_manager_get_default_print_font_body (void)
-{
- return GPM_DEFAULT_PRINT_FONT_BODY_PANGO;
-}
-
-gchar *
-gedit_prefs_manager_get_print_font_header (void)
-{
- return gedit_prefs_manager_get_font (GPM_PRINT_FONT_HEADER_PANGO,
- GPM_PRINT_FONT_HEADER,
- GPM_DEFAULT_PRINT_FONT_HEADER_PANGO);
-}
-
-void
-gedit_prefs_manager_set_print_font_header (const gchar* v)
-{
- gedit_prefs_manager_set_string (GPM_PRINT_FONT_HEADER_PANGO, v);
-}
-
-gboolean
-gedit_prefs_manager_print_font_header_can_set (void)
-{
- return gedit_prefs_manager_key_is_writable (GPM_PRINT_FONT_HEADER_PANGO);
-}
-
-const gchar *
-gedit_prefs_manager_get_default_print_font_header (void)
-{
- return GPM_DEFAULT_PRINT_FONT_HEADER_PANGO;
-}
-
-gchar *
-gedit_prefs_manager_get_print_font_numbers (void)
-{
- return gedit_prefs_manager_get_font (GPM_PRINT_FONT_NUMBERS_PANGO,
- GPM_PRINT_FONT_NUMBERS,
- GPM_DEFAULT_PRINT_FONT_NUMBERS_PANGO);
-}
-
-void
-gedit_prefs_manager_set_print_font_numbers (const gchar* v)
-{
- gedit_prefs_manager_set_string (GPM_PRINT_FONT_NUMBERS_PANGO, v);
-}
-
-gboolean
-gedit_prefs_manager_print_font_numbers_can_set (void)
-{
- return gedit_prefs_manager_key_is_writable (GPM_PRINT_FONT_NUMBERS_PANGO);
-}
-
-const gchar *
-gedit_prefs_manager_get_default_print_font_numbers (void)
-{
- return GPM_DEFAULT_PRINT_FONT_NUMBERS_PANGO;
-}
+/* Printing fonts */
+DEFINE_STRING_PREF (print_font_body,
+ GPM_PRINT_FONT_BODY,
+ GPM_DEFAULT_PRINT_FONT_BODY)
+
+DEFINE_STRING_PREF (print_font_header,
+ GPM_PRINT_FONT_HEADER,
+ GPM_DEFAULT_PRINT_FONT_HEADER)
+
+DEFINE_STRING_PREF (print_font_numbers,
+ GPM_PRINT_FONT_NUMBERS,
+ GPM_DEFAULT_PRINT_FONT_NUMBERS)
/* Max number of files in "Recent Files" menu.
* This is configurable only using gconftool or gconf-editor
Modified: branches/printing/gedit/gedit-prefs-manager.h
==============================================================================
--- branches/printing/gedit/gedit-prefs-manager.h (original)
+++ branches/printing/gedit/gedit-prefs-manager.h Sat Jan 19 11:28:17 2008
@@ -115,12 +115,9 @@
#define GPM_PRINT_LINE_NUMBERS GPM_PRINT_PAGE_DIR "/print_line_numbers"
#define GPM_PRINT_FONT_DIR GPM_PREFS_DIR "/print/fonts"
-#define GPM_PRINT_FONT_BODY GPM_PRINT_FONT_DIR "/print_font_body"
-#define GPM_PRINT_FONT_BODY_PANGO GPM_PRINT_FONT_DIR "/print_font_body_pango"
-#define GPM_PRINT_FONT_HEADER GPM_PRINT_FONT_DIR "/print_font_header"
-#define GPM_PRINT_FONT_HEADER_PANGO GPM_PRINT_FONT_DIR "/print_font_header_pango"
-#define GPM_PRINT_FONT_NUMBERS GPM_PRINT_FONT_DIR "/print_font_numbers"
-#define GPM_PRINT_FONT_NUMBERS_PANGO GPM_PRINT_FONT_DIR "/print_font_numbers_pango"
+#define GPM_PRINT_FONT_BODY GPM_PRINT_FONT_DIR "/print_font_body_pango"
+#define GPM_PRINT_FONT_HEADER GPM_PRINT_FONT_DIR "/print_font_header_pango"
+#define GPM_PRINT_FONT_NUMBERS GPM_PRINT_FONT_DIR "/print_font_numbers_pango"
/* Encodings */
#define GPM_ENCODINGS_DIR GPM_PREFS_DIR "/encodings"
@@ -179,9 +176,9 @@
#define GPM_DEFAULT_PRINT_WRAP_MODE "GTK_WRAP_WORD"
#define GPM_DEFAULT_PRINT_LINE_NUMBERS 0 /* No numbers */
-#define GPM_DEFAULT_PRINT_FONT_BODY_PANGO (const gchar*) "Monospace 9"
-#define GPM_DEFAULT_PRINT_FONT_HEADER_PANGO (const gchar*) "Sans 11"
-#define GPM_DEFAULT_PRINT_FONT_NUMBERS_PANGO (const gchar*) "Sans 8"
+#define GPM_DEFAULT_PRINT_FONT_BODY (const gchar*) "Monospace 9"
+#define GPM_DEFAULT_PRINT_FONT_HEADER (const gchar*) "Sans 11"
+#define GPM_DEFAULT_PRINT_FONT_NUMBERS (const gchar*) "Sans 8"
#define GPM_DEFAULT_MAX_RECENTS 5
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]