From e14f3f53af7d042f6b34205606ee8aaa3c61caa1 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Thu, 27 Sep 2012 03:21:04 +0000 Subject: [PATCH] Ajustando dialogo de configuracao de impressora --- src/pw3270/print.c | 14 ++++++++------ src/pw3270/uiparser/parsefile.c | 32 ++++++++++++++++++++++++++++---- src/pw3270/uiparser/private.h | 5 ++++- ui/00default.xml | 1 + ui/99debug.xml | 1 - 5 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/pw3270/print.c b/src/pw3270/print.c index be5cb77..f88c687 100644 --- a/src/pw3270/print.c +++ b/src/pw3270/print.c @@ -352,7 +352,6 @@ static gchar * enum_to_string(GType type, guint enum_value) GtkWidget * label[G_N_ELEMENTS(text)]; GtkWidget * widget; int f; - gchar * font; trace("%s starts",__FUNCTION__); @@ -364,8 +363,14 @@ static gchar * enum_to_string(GType type, guint enum_value) } // Font selection button - widget = gtk_font_button_new(); - gtk_label_set_mnemonic_widget(GTK_LABEL(label[0]),widget); + { + gchar * font = get_string_from_config("print","font","Courier New 10"); + widget = gtk_font_button_new_with_font(font); + gtk_font_button_set_show_size((GtkFontButton *) widget,FALSE); + gtk_font_button_set_use_font((GtkFontButton *) widget,TRUE); + gtk_label_set_mnemonic_widget(GTK_LABEL(label[0]),widget); + g_free(font); + } #if GTK_CHECK_VERSION(3,2,0) 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) load_settings(info); - font = get_string_from_config("print","font","Courier New 10"); - gtk_font_button_set_font_name((GtkFontButton *) widget, font); - g_free(font); g_signal_connect(G_OBJECT(widget),"font-set",G_CALLBACK(font_set),info); diff --git a/src/pw3270/uiparser/parsefile.c b/src/pw3270/uiparser/parsefile.c index 33f8d9a..7dccb4e 100644 --- a/src/pw3270/uiparser/parsefile.c +++ b/src/pw3270/uiparser/parsefile.c @@ -170,6 +170,33 @@ GtkWidget * widget = NULL; int f; + name = ui_get_attribute("platform",names,values); + if(name) + { +#if defined(WIN32) + static const gchar *platname = "windows"; +#elif defined(linux) + static const gchar *platname = "linux"; +#elif defined( __APPLE__ ) + static const gchar *platname = "apple"; +#else + static const gchar *platname = "none"; +#endif + gchar **plat = g_strsplit(name,",",-1); + info->disabled = 1; + + for(f=0;info->disabled && plat[f];f++) + { + if(!g_strcasecmp(plat[f],platname)) + info->disabled = 0; + } + + g_strfreev(plat); + + if(info->disabled) + return; + } + for(f=0;felement); int f; -/* if(info->disabled) { - info->disabled--; -// trace("%s: <%s> disabled=%d",__FUNCTION__,element_name,info->disabled); + info->disabled = 0; return; } -*/ for(f=0;f + diff --git a/ui/99debug.xml b/ui/99debug.xml index 0f753c2..2c41f08 100644 --- a/ui/99debug.xml +++ b/ui/99debug.xml @@ -48,7 +48,6 @@ - -- libgit2 0.21.2