talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit d1c40b332d9bb908df7694d19a60b2319a2a00fc
parent bb974610e7ce07776f00c3eaa6743a6d458ee94d
Author: Ricardo Mones <ricardo@mones.org>
Date:   Fri, 19 Feb 2016 19:15:12 +0100

Fix bug #2604: Add support for -geometry

And document it too :-)

Diffstat:
Mdoc/man/claws-mail.1 | 6++++++
Msrc/main.c | 22++++++++++++++++++++--
2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/doc/man/claws-mail.1 b/doc/man/claws-mail.1 @@ -142,6 +142,8 @@ This list is not complete. \fB \-\-config\-dir\fR .br \fB \-\-alternate\-config\-dir [dir]\fR +.br +\fB \-\-geometry WxH+X+Y\fR .SH "FILES" .LP @@ -355,6 +357,8 @@ display the CONFIG\-DIR and exit .TP \fB\-\-alternate\-config\-dir [dir]\fR start Claws Mail with the configuration stored in [dir] directory +\fB\-\-geometry WxH+X+Y\fR +set initial X geometry of main window .SH "ENVIRONMENT" .LP @@ -544,4 +548,6 @@ Claws Mail online manual .TP Claws Mail plugins <http://www.claws\-mail.org/plugins.php> +.TP +\fIX\fR(7), \fIxwininfo\fR(1). diff --git a/src/main.c b/src/main.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team + * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,7 +14,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * */ #ifdef HAVE_CONFIG_H @@ -202,6 +201,7 @@ static struct RemoteCmd { const gchar *subscribe_uri; const gchar *target; gboolean debug; + const gchar *geometry; } cmd; SessionStats session_stats; @@ -1466,6 +1466,19 @@ int main(int argc, char *argv[]) main_window_popup(mainwin); } + if (cmd.geometry != NULL) { + if (!gtk_window_parse_geometry(GTK_WINDOW(mainwin->window), cmd.geometry)) + g_warning("failed to parse geometry '%s'", cmd.geometry); + else { + int width, height; + + if (sscanf(cmd.geometry, "%ux%u+", &width, &height) == 2) + gtk_window_resize(GTK_WINDOW(mainwin->window), width, height); + else + g_warning("failed to parse geometry's width/height"); + } + } + if (!folder_have_mailbox()) { prefs_destroy_cache(); main_window_cursor_normal(mainwin); @@ -1947,6 +1960,8 @@ static void parse_cmd_opt(int argc, char *argv[]) g_print("%s\n", _(" --config-dir output configuration directory")); g_print("%s\n", _(" --alternate-config-dir [dir]\n" " use specified configuration directory")); + g_print("%s\n", _(" --geometry -geometry WxH+X+Y\n" + " set geometry for main window")); g_free(base); exit(1); @@ -1959,6 +1974,9 @@ static void parse_cmd_opt(int argc, char *argv[]) exit(0); } else if (!strncmp(argv[i], "--alternate-config-dir", sizeof "--alternate-config-dir" - 1) && i+1 < argc) { set_rc_dir(argv[i+1]); + } else if (!strncmp(argv[i], "--geometry", sizeof "--geometry" - 1) + || !strncmp(argv[i], "-geometry", sizeof "-geometry" - 1)) { + cmd.geometry = (i+1 < argc)? argv[i+1]: NULL; } else if (!strncmp(argv[i], "--exit", 6) || !strncmp(argv[i], "--quit", 6) || !strncmp(argv[i], "-q", 2)) {