diff --git a/src/include/pw3270.h b/src/include/pw3270.h
index 2360976..bdd21d8 100644
--- a/src/include/pw3270.h
+++ b/src/include/pw3270.h
@@ -56,6 +56,7 @@
LIB3270_EXPORT const gchar * pw3270_get_host(GtkWidget *widget);
LIB3270_EXPORT gboolean pw3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix);
+ LIB3270_EXPORT gboolean pw3270_set_toggle_by_name(GtkWidget *widget, const gchar *name, gboolean flag);
LIB3270_EXPORT H3270 * pw3270_get_session(GtkWidget *widget);
LIB3270_EXPORT GtkWidget * pw3270_get_terminal_widget(GtkWidget *widget);
diff --git a/src/pw3270/main.c b/src/pw3270/main.c
index 93c7e01..c54b738 100644
--- a/src/pw3270/main.c
+++ b/src/pw3270/main.c
@@ -53,6 +53,8 @@
static GtkWidget * toplevel = NULL;
static unsigned int syscolors = 16;
static const gchar * systype = NULL;
+ static const gchar * toggleset = NULL;
+ static const gchar * togglereset = NULL;
#ifdef HAVE_GTKMAC
GtkOSXApplication * osxapp = NULL;
@@ -308,6 +310,9 @@ int main(int argc, char *argv[])
{ "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), NULL },
{ "colors", 'c', 0, G_OPTION_ARG_CALLBACK, optcolors, N_( "Set reported colors (8/16)" ), "16" },
{ "systype", 't', 0, G_OPTION_ARG_STRING, &system, N_( "Host system type" ), "S390" },
+ { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL },
+ { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL },
+
#if defined( HAVE_SYSLOG )
{ "syslog", 'l', 0, G_OPTION_ARG_NONE, &log_to_syslog, N_( "Send messages to syslog" ), NULL },
#endif
@@ -408,7 +413,31 @@ int main(int argc, char *argv[])
toplevel = pw3270_new(host,systype,syscolors);
pw3270_set_session_name(toplevel,session_name);
- // pw3270_set_session_options(toplevel,cmdline_opt.host);
+
+ if(toggleset)
+ {
+ gchar **str = g_strsplit(toggleset,",",-1);
+ int f;
+
+ for(f=0;str[f];f++)
+ pw3270_set_toggle_by_name(toplevel,str[f],TRUE);
+
+
+ g_strfreev(str);
+ }
+
+ if(togglereset)
+ {
+ gchar **str = g_strsplit(togglereset,",",-1);
+ int f;
+
+ for(f=0;str[f];f++)
+ pw3270_set_toggle_by_name(toplevel,str[f],FALSE);
+
+ g_strfreev(str);
+ }
+
+
toplevel_setup(GTK_WINDOW(toplevel));
diff --git a/src/pw3270/tools.c b/src/pw3270/tools.c
index 3064cca..eb83d23 100644
--- a/src/pw3270/tools.c
+++ b/src/pw3270/tools.c
@@ -119,3 +119,15 @@ LIB3270_EXPORT void pw3270_set_boolean(GtkWidget *widget, const gchar *group, co
{
set_boolean_to_config(group, key, val);
}
+
+LIB3270_EXPORT gboolean pw3270_set_toggle_by_name(GtkWidget *widget, const gchar *name, gboolean flag)
+{
+ H3270 * hSession = pw3270_get_session(widget);
+ LIB3270_TOGGLE id = lib3270_get_toggle_id(name);
+
+ if(!hSession || id == (LIB3270_TOGGLE) -1)
+ return FALSE;
+
+ lib3270_set_toggle(hSession,id,(int) flag);
+ return TRUE;
+}
diff --git a/ui/00default.xml b/ui/00default.xml
index 2d47fed..b21406c 100644
--- a/ui/00default.xml
+++ b/ui/00default.xml
@@ -46,7 +46,7 @@
-
+
--
libgit2 0.21.2