Re: GMC i18n fix



Robert Brady wrote:
> 
> Here's a small patch to fix a major GMC i18n problem.
> (yes, I know it's going to die, but this is urgent)
> 
> Any objections?
> 

This is another one.
(fontset is configureable by hand. )

fontset info saved at .gnome/gmc as following
--------------8X-----------
[Desktop Info]
fontset=-*-helvetica-bold-r-normal--10-*-*-*-p-*-*-*,-*-*-bold-r-normal-*-10-*-*
-*-*-*-*-*,*
--------------8X-----------
-- 
Won-kyu Park <wkpark@kldp.org>
diff -u mc-4.5.51/gnome/gdesktop-icon.c mc-4.5.51.modify/gnome/gdesktop-icon.c
--- mc-4.5.51/gnome/gdesktop-icon.c	Mon Jul  3 23:32:12 2000
+++ mc-4.5.51.modify/gnome/gdesktop-icon.c	Fri Sep  1 03:01:51 2000
@@ -20,6 +20,7 @@
 #define SPACING 2
 
 
+extern char *desktop_icon_font;
 /* The 50% gray stipple for selected icons */
 #define gray50_width 2
 #define gray50_height 2
@@ -205,6 +206,9 @@
 {
 	int text_height;
 	double x1, y1, x2, y2;
+
+	GdkFont *fn;
+	GtkStyle *style;
 	
 	gnome_canvas_item_get_bounds (dicon->text, &x1, &y1, &x2, &y2);
 	text_height = y2 = y1;
@@ -215,7 +219,7 @@
 	gnome_icon_text_item_configure (GNOME_ICON_TEXT_ITEM (dicon->text),
 					0, dicon->height - text_height,
 					DESKTOP_SNAP_X,
-					DESKTOP_ICON_FONT,
+					desktop_icon_font,
 					text,
 					TRUE,
 					FALSE);
diff -u mc-4.5.51/gnome/gdesktop.c mc-4.5.51.modify/gnome/gdesktop.c
--- mc-4.5.51/gnome/gdesktop.c	Mon Jul  3 23:32:12 2000
+++ mc-4.5.51.modify/gnome/gdesktop.c	Fri Sep  1 03:04:58 2000
@@ -33,6 +33,11 @@
 #include "main.h"
 #include "gmount.h"
 
+#define DESKTOP_ICON_FONT \
+     "-*-helvetica-bold-r-normal--10-*-*-*-p-*-*-*," \
+     "-*-*-bold-r-normal-*-10-*-*-*-*-*-*-*"
+
+char *desktop_icon_font;
 
 struct layout_slot {
 	int num_icons;		      /* Number of icons in this slot */
@@ -50,6 +55,7 @@
 int desktop_arr_b2t = FALSE;
 int desktop_arr_rows = FALSE;
 
+
 /*
  * Possible values for this one:
  *
@@ -3486,4 +3492,28 @@
 
 		gnome_metadata_set (filename, "icon-filename", strlen (icon) + 1, icon);
 	}
+}
+
+void
+desktop_info_load (void)
+{
+    GdkFont *fn;
+    gnome_config_push_prefix("/gmc/");
+    desktop_icon_font=gnome_config_get_string("Desktop Info/fontset="DESKTOP_ICON_FONT);
+    printf("icon font: %s\n",desktop_icon_font);
+    gnome_config_pop_prefix();
+
+    fn=gdk_fontset_load(desktop_icon_font);
+    if (!fn) desktop_icon_font=g_strdup(DESKTOP_ICON_FONT);
+    else gdk_font_unref(fn);
+}
+
+void
+desktop_info_save (void)
+{
+    gnome_config_push_prefix("/gmc/");
+    gnome_config_set_string("Desktop Info/fontset", desktop_icon_font);
+    gnome_config_sync();
+    gnome_config_drop_all();
+    gnome_config_pop_prefix();
 }
diff -u mc-4.5.51/gnome/gdesktop.h mc-4.5.51.modify/gnome/gdesktop.h
--- mc-4.5.51/gnome/gdesktop.h	Mon Jul  3 23:32:13 2000
+++ mc-4.5.51.modify/gnome/gdesktop.h	Fri Sep  1 02:35:57 2000
@@ -78,6 +78,8 @@
 void desktop_create_url (const char *filename, const char *title, const char *url, const char *icon);
 void desktop_tidy_icons (void);
 
+void desktop_info_load (void);
+void desktop_info_save (void);
 
 extern int desktop_wm_is_gnome_compliant;
 
diff -u mc-4.5.51/gnome/gmain.c mc-4.5.51.modify/gnome/gmain.c
--- mc-4.5.51/gnome/gmain.c	Fri Sep  1 03:10:37 2000
+++ mc-4.5.51.modify/gnome/gmain.c	Fri Sep  1 02:58:25 2000
@@ -493,6 +493,7 @@
 static void
 non_corba_create_panels (char *startup_dir)
 {
+	desktop_info_load();
 	desktop_init ();
 	gnome_init_panels ();
 
@@ -504,6 +505,7 @@
 	session_load ();
 	run_dlg (desktop_dlg);
 	desktop_destroy ();
+	desktop_info_save();
 }
 
 /* The GNOME version of create_panels() */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]