Commit a5a9276f64b9faf3a8944b840a5146084b9ab73c
1 parent
3cf573e7
Exists in
master
and in
5 other branches
Allowing customization of the session name from ./configure.
Showing
3 changed files
with
31 additions
and
16 deletions
Show diff stats
configure.ac
@@ -190,6 +190,7 @@ AC_SUBST(PACKAGE_MAJOR_VERSION,$app_vrs_major) | @@ -190,6 +190,7 @@ AC_SUBST(PACKAGE_MAJOR_VERSION,$app_vrs_major) | ||
190 | AC_SUBST(PACKAGE_MINOR_VERSION,$app_vrs_minor) | 190 | AC_SUBST(PACKAGE_MINOR_VERSION,$app_vrs_minor) |
191 | 191 | ||
192 | AC_ARG_WITH([release], [AS_HELP_STRING([--with-release], [Set release])], [ app_cv_release="$withval" ],[ app_cv_release="`date +%y`.`date +%m`.`date +%d`" ]) | 192 | AC_ARG_WITH([release], [AS_HELP_STRING([--with-release], [Set release])], [ app_cv_release="$withval" ],[ app_cv_release="`date +%y`.`date +%m`.`date +%d`" ]) |
193 | +AC_ARG_WITH([session-name], [AS_HELP_STRING([--with-session-name], [Set default session name])], [ AC_DEFINE_UNQUOTED(DEFAULT_SESSION_NAME, $withval) ],[ AC_MSG_NOTICE([No default session name.]) ]) | ||
193 | 194 | ||
194 | app_rls_major=$(echo $app_cv_release.0.0 | cut -d. -f1) | 195 | app_rls_major=$(echo $app_cv_release.0.0 | cut -d. -f1) |
195 | app_rls_minor=$(echo $app_cv_release.0.0 | cut -d. -f2) | 196 | app_rls_minor=$(echo $app_cv_release.0.0 | cut -d. -f2) |
src/include/config.h.in
@@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
36 | #undef PACKAGE_NAME | 36 | #undef PACKAGE_NAME |
37 | #undef PACKAGE_VERSION | 37 | #undef PACKAGE_VERSION |
38 | #undef PACKAGE_RELEASE | 38 | #undef PACKAGE_RELEASE |
39 | + #undef DEFAULT_SESSION_NAME | ||
39 | 40 | ||
40 | #undef HAVE_GNUC_VISIBILITY | 41 | #undef HAVE_GNUC_VISIBILITY |
41 | #undef HAVE_LIBM | 42 | #undef HAVE_LIBM |
src/pw3270/main.c
@@ -232,7 +232,12 @@ static gboolean startup(GtkWidget *toplevel) | @@ -232,7 +232,12 @@ static gboolean startup(GtkWidget *toplevel) | ||
232 | int main(int argc, char *argv[]) | 232 | int main(int argc, char *argv[]) |
233 | { | 233 | { |
234 | const gchar * pluginpath = NULL; | 234 | const gchar * pluginpath = NULL; |
235 | +#ifdef DEFAULT_SESSION_NAME | ||
236 | + const gchar * session_name = G_STRINGIFY(DEFAULT_SESSION_NAME); | ||
237 | +#else | ||
235 | const gchar * session_name = NULL; | 238 | const gchar * session_name = NULL; |
239 | +#endif // DEFAULT_SESSION_NAME | ||
240 | + | ||
236 | const gchar * host = lib3270_get_default_host(NULL); | 241 | const gchar * host = lib3270_get_default_host(NULL); |
237 | int rc = 0; | 242 | int rc = 0; |
238 | 243 | ||
@@ -254,17 +259,22 @@ int main(int argc, char *argv[]) | @@ -254,17 +259,22 @@ int main(int argc, char *argv[]) | ||
254 | { | 259 | { |
255 | const GOptionEntry app_options[] = | 260 | const GOptionEntry app_options[] = |
256 | { | 261 | { |
257 | - { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), PACKAGE_NAME }, | ||
258 | - { "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), host }, | ||
259 | - { "colors", 'c', 0, G_OPTION_ARG_CALLBACK, optcolors, N_( "Set reported colors (8/16)" ), "16" }, | ||
260 | - { "systype", 't', 0, G_OPTION_ARG_STRING, &systype, N_( "Host system type" ), "S390" }, | ||
261 | - { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL }, | ||
262 | - { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL }, | ||
263 | - { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL }, | ||
264 | - { "remap", 'm', 0, G_OPTION_ARG_FILENAME, &remap, N_( "Remap charset from xml file" ), NULL }, | ||
265 | - { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL }, | ||
266 | - { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 }, | ||
267 | - { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL }, | 262 | +#ifdef DEFAULT_SESSION_NAME |
263 | + { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), G_STRINGIFY(DEFAULT_SESSION_NAME) }, | ||
264 | +#else | ||
265 | + { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), PACKAGE_NAME }, | ||
266 | +#endif // DEFAULT_SESSION_NAME | ||
267 | + | ||
268 | + { "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), host }, | ||
269 | + { "colors", 'c', 0, G_OPTION_ARG_CALLBACK, optcolors, N_( "Set reported colors (8/16)" ), "16" }, | ||
270 | + { "systype", 't', 0, G_OPTION_ARG_STRING, &systype, N_( "Host system type" ), "S390" }, | ||
271 | + { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL }, | ||
272 | + { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL }, | ||
273 | + { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL }, | ||
274 | + { "remap", 'm', 0, G_OPTION_ARG_FILENAME, &remap, N_( "Remap charset from xml file" ), NULL }, | ||
275 | + { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL }, | ||
276 | + { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 }, | ||
277 | + { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL }, | ||
268 | 278 | ||
269 | #if defined( HAVE_SYSLOG ) | 279 | #if defined( HAVE_SYSLOG ) |
270 | { "syslog", 'l', 0, G_OPTION_ARG_NONE, &log_to_syslog, N_( "Send messages to syslog" ), NULL }, | 280 | { "syslog", 'l', 0, G_OPTION_ARG_NONE, &log_to_syslog, N_( "Send messages to syslog" ), NULL }, |
@@ -401,6 +411,14 @@ int main(int argc, char *argv[]) | @@ -401,6 +411,14 @@ int main(int argc, char *argv[]) | ||
401 | // Just in case! | 411 | // Just in case! |
402 | g_mkdir_with_parents(g_get_tmp_dir(),0777); | 412 | g_mkdir_with_parents(g_get_tmp_dir(),0777); |
403 | 413 | ||
414 | + | ||
415 | + if(!session_name) | ||
416 | + session_name = PACKAGE_NAME; | ||
417 | + | ||
418 | +#ifdef _WIN32 | ||
419 | + g_set_application_name(session_name); | ||
420 | +#endif // _WIN32 | ||
421 | + | ||
404 | rc = initialize(); | 422 | rc = initialize(); |
405 | if(!rc) | 423 | if(!rc) |
406 | { | 424 | { |
@@ -414,11 +432,6 @@ int main(int argc, char *argv[]) | @@ -414,11 +432,6 @@ int main(int argc, char *argv[]) | ||
414 | 432 | ||
415 | pw3270_load_plugins(pluginpath); | 433 | pw3270_load_plugins(pluginpath); |
416 | toplevel = pw3270_new(host,systype,syscolors); | 434 | toplevel = pw3270_new(host,systype,syscolors); |
417 | - | ||
418 | - | ||
419 | - if(!session_name) | ||
420 | - session_name = g_get_application_name(); | ||
421 | - | ||
422 | pw3270_set_session_name(toplevel,session_name); | 435 | pw3270_set_session_name(toplevel,session_name); |
423 | 436 | ||
424 | #if defined(_WIN32) && defined(ENABLE_WINDOWS_REGISTRY) | 437 | #if defined(_WIN32) && defined(ENABLE_WINDOWS_REGISTRY) |