Commit c5042e5b02406e6b43ae07abfd92d8ef7c86c891

Authored by Perry Werneck
1 parent 6701eb6d
Exists in master and in 1 other branch develop

Adjustments in the font-family validator.

Showing 1 changed file with 15 additions and 17 deletions   Show diff stats
src/terminal/font/properties.c
... ... @@ -33,6 +33,13 @@
33 33  
34 34 /*--[ Globals ]--------------------------------------------------------------------------------------*/
35 35  
  36 +static const gchar * invalid_font_messages[] = {
  37 +
  38 + N_( "Font \"%s\" is valid" ),
  39 + N_( "Font \"%s\" is not monospace" ),
  40 + N_( "Can't find a valid font with the name \"%s\"")
  41 +
  42 +};
36 43  
37 44 /*--[ Implement ]------------------------------------------------------------------------------------*/
38 45  
... ... @@ -45,7 +52,7 @@ const gchar * v3270_get_default_font_name()
45 52 #endif // _WIN32
46 53 }
47 54  
48   -static guint validate_font_family(const gchar *family_name)
  55 +static guint check_font_family(const gchar *family_name)
49 56 {
50 57 int rc = 2;
51 58  
... ... @@ -64,11 +71,16 @@ static guint validate_font_family(const gchar *family_name)
64 71 break;
65 72 }
66 73  
67   -
68 74 }
  75 +
69 76 g_object_unref(G_OBJECT(context));
70 77 g_free(families);
71 78  
  79 + if(rc)
  80 + g_warning(invalid_font_messages[rc],family_name);
  81 + else
  82 + g_message(invalid_font_messages[rc],family_name);
  83 +
72 84 return rc;
73 85 }
74 86  
... ... @@ -85,21 +97,7 @@ LIB3270_EXPORT void v3270_set_font_family(GtkWidget *widget, const gchar *name)
85 97  
86 98 if(g_ascii_strcasecmp(terminal->font.family,name))
87 99 {
88   -
89   - switch(validate_font_family(name))
90   - {
91   - case 0:
92   - g_message("Change font to \"%s\"", name);
93   - break;
94   -
95   - case 1:
96   - g_warning("Font \"%s\" is not monospace", name);
97   - break;
98   -
99   - default:
100   - g_warning("Invalid or unexpected font family name: \"%s\"", name);
101   -
102   - }
  100 + check_font_family(name);
103 101  
104 102 // Font has changed, update it
105 103 g_free(terminal->font.family);
... ...