Commit e14f3f53af7d042f6b34205606ee8aaa3c61caa1
1 parent
ed3e5b27
Exists in
master
and in
5 other branches
Ajustando dialogo de configuracao de impressora
Showing
5 changed files
with
41 additions
and
12 deletions
Show diff stats
src/pw3270/print.c
| @@ -352,7 +352,6 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -352,7 +352,6 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
| 352 | GtkWidget * label[G_N_ELEMENTS(text)]; | 352 | GtkWidget * label[G_N_ELEMENTS(text)]; |
| 353 | GtkWidget * widget; | 353 | GtkWidget * widget; |
| 354 | int f; | 354 | int f; |
| 355 | - gchar * font; | ||
| 356 | 355 | ||
| 357 | trace("%s starts",__FUNCTION__); | 356 | trace("%s starts",__FUNCTION__); |
| 358 | 357 | ||
| @@ -364,8 +363,14 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -364,8 +363,14 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
| 364 | } | 363 | } |
| 365 | 364 | ||
| 366 | // Font selection button | 365 | // Font selection button |
| 367 | - widget = gtk_font_button_new(); | ||
| 368 | - gtk_label_set_mnemonic_widget(GTK_LABEL(label[0]),widget); | 366 | + { |
| 367 | + gchar * font = get_string_from_config("print","font","Courier New 10"); | ||
| 368 | + widget = gtk_font_button_new_with_font(font); | ||
| 369 | + gtk_font_button_set_show_size((GtkFontButton *) widget,FALSE); | ||
| 370 | + gtk_font_button_set_use_font((GtkFontButton *) widget,TRUE); | ||
| 371 | + gtk_label_set_mnemonic_widget(GTK_LABEL(label[0]),widget); | ||
| 372 | + g_free(font); | ||
| 373 | + } | ||
| 369 | 374 | ||
| 370 | #if GTK_CHECK_VERSION(3,2,0) | 375 | #if GTK_CHECK_VERSION(3,2,0) |
| 371 | gtk_font_chooser_set_filter_func((GtkFontChooser *) widget,filter_monospaced,NULL,NULL); | 376 | gtk_font_chooser_set_filter_func((GtkFontChooser *) widget,filter_monospaced,NULL,NULL); |
| @@ -374,9 +379,6 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -374,9 +379,6 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
| 374 | 379 | ||
| 375 | load_settings(info); | 380 | load_settings(info); |
| 376 | 381 | ||
| 377 | - font = get_string_from_config("print","font","Courier New 10"); | ||
| 378 | - gtk_font_button_set_font_name((GtkFontButton *) widget, font); | ||
| 379 | - g_free(font); | ||
| 380 | 382 | ||
| 381 | g_signal_connect(G_OBJECT(widget),"font-set",G_CALLBACK(font_set),info); | 383 | g_signal_connect(G_OBJECT(widget),"font-set",G_CALLBACK(font_set),info); |
| 382 | 384 |
src/pw3270/uiparser/parsefile.c
| @@ -170,6 +170,33 @@ | @@ -170,6 +170,33 @@ | ||
| 170 | GtkWidget * widget = NULL; | 170 | GtkWidget * widget = NULL; |
| 171 | int f; | 171 | int f; |
| 172 | 172 | ||
| 173 | + name = ui_get_attribute("platform",names,values); | ||
| 174 | + if(name) | ||
| 175 | + { | ||
| 176 | +#if defined(WIN32) | ||
| 177 | + static const gchar *platname = "windows"; | ||
| 178 | +#elif defined(linux) | ||
| 179 | + static const gchar *platname = "linux"; | ||
| 180 | +#elif defined( __APPLE__ ) | ||
| 181 | + static const gchar *platname = "apple"; | ||
| 182 | +#else | ||
| 183 | + static const gchar *platname = "none"; | ||
| 184 | +#endif | ||
| 185 | + gchar **plat = g_strsplit(name,",",-1); | ||
| 186 | + info->disabled = 1; | ||
| 187 | + | ||
| 188 | + for(f=0;info->disabled && plat[f];f++) | ||
| 189 | + { | ||
| 190 | + if(!g_strcasecmp(plat[f],platname)) | ||
| 191 | + info->disabled = 0; | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + g_strfreev(plat); | ||
| 195 | + | ||
| 196 | + if(info->disabled) | ||
| 197 | + return; | ||
| 198 | + } | ||
| 199 | + | ||
| 173 | for(f=0;f<G_N_ELEMENTS(element_builder);f++) | 200 | for(f=0;f<G_N_ELEMENTS(element_builder);f++) |
| 174 | { | 201 | { |
| 175 | if(!g_ascii_strcasecmp(element_name,element_builder[f].name)) | 202 | if(!g_ascii_strcasecmp(element_name,element_builder[f].name)) |
| @@ -242,14 +269,11 @@ | @@ -242,14 +269,11 @@ | ||
| 242 | GtkWidget *widget = GTK_WIDGET(info->element); | 269 | GtkWidget *widget = GTK_WIDGET(info->element); |
| 243 | int f; | 270 | int f; |
| 244 | 271 | ||
| 245 | -/* | ||
| 246 | if(info->disabled) | 272 | if(info->disabled) |
| 247 | { | 273 | { |
| 248 | - info->disabled--; | ||
| 249 | -// trace("%s: <%s> disabled=%d",__FUNCTION__,element_name,info->disabled); | 274 | + info->disabled = 0; |
| 250 | return; | 275 | return; |
| 251 | } | 276 | } |
| 252 | -*/ | ||
| 253 | 277 | ||
| 254 | for(f=0;f<G_N_ELEMENTS(element_builder);f++) | 278 | for(f=0;f<G_N_ELEMENTS(element_builder);f++) |
| 255 | { | 279 | { |
src/pw3270/uiparser/private.h
| @@ -82,8 +82,11 @@ | @@ -82,8 +82,11 @@ | ||
| 82 | GHashTable * actions; /**< List of actions */ | 82 | GHashTable * actions; /**< List of actions */ |
| 83 | GHashTable * element_list[UI_ELEMENT_COUNT]; | 83 | GHashTable * element_list[UI_ELEMENT_COUNT]; |
| 84 | const UI_WIDGET_SETUP * setup; | 84 | const UI_WIDGET_SETUP * setup; |
| 85 | + | ||
| 86 | + int disabled : 1; | ||
| 87 | + | ||
| 85 | #ifdef HAVE_GTKMAC | 88 | #ifdef HAVE_GTKMAC |
| 86 | - GtkWidget * sysmenu[SYSMENU_ITEM_COUNT]; | 89 | + GtkWidget * sysmenu[SYSMENU_ITEM_COUNT]; |
| 87 | #endif // HAVE_GTKMAC | 90 | #endif // HAVE_GTKMAC |
| 88 | void * block_data; | 91 | void * block_data; |
| 89 | }; | 92 | }; |
ui/00default.xml
| @@ -107,6 +107,7 @@ | @@ -107,6 +107,7 @@ | ||
| 107 | 107 | ||
| 108 | <menu name='SettingsMenu' label='Settings'> | 108 | <menu name='SettingsMenu' label='Settings'> |
| 109 | <menuitem action='editcolors' icon='select-color' label='Colors' /> | 109 | <menuitem action='editcolors' icon='select-color' label='Colors' /> |
| 110 | + <menuitem action='printsettings' platform='windows' label='Print settings' /> | ||
| 110 | 111 | ||
| 111 | <!--- Special action - The fontselect menu will be populated with all available monospaced fonts ---> | 112 | <!--- Special action - The fontselect menu will be populated with all available monospaced fonts ---> |
| 112 | <menuitem name='fontselect' icon='select-font' label='Select font' /> | 113 | <menuitem name='fontselect' icon='select-font' label='Select font' /> |
ui/99debug.xml
| @@ -48,7 +48,6 @@ | @@ -48,7 +48,6 @@ | ||
| 48 | <menuitem action='testpattern' group='offline' label='Show test pattern' /> | 48 | <menuitem action='testpattern' group='offline' label='Show test pattern' /> |
| 49 | <menuitem action='reload' label='Reload buffer contents' /> | 49 | <menuitem action='reload' label='Reload buffer contents' /> |
| 50 | <menuitem action='toggle' id='gdkdebug' label='Debug window updates' /> | 50 | <menuitem action='toggle' id='gdkdebug' label='Debug window updates' /> |
| 51 | - <menuitem action='printsettings' label='Print settings' /> | ||
| 52 | </menu> | 51 | </menu> |
| 53 | 52 | ||
| 54 | </menubar> | 53 | </menubar> |