Added --geometry option
This commit is contained in:
parent
dbdd2dbc6f
commit
b46174ae52
@ -71,6 +71,10 @@ execute python code in //STRING// in an existing instance.
|
||||
: **--exec-file** //FILE//
|
||||
execute python file //FILE// in an existing instance.
|
||||
|
||||
: **--geometry** //WIDTHxHEIGHT//
|
||||
: **--geometry** //WIDTHxHEIGHT+X+Y//
|
||||
default window size and position.
|
||||
|
||||
: **-h**, **--help**
|
||||
show summary of options.
|
||||
|
||||
|
@ -71,6 +71,10 @@ execute python code in //STRING// in an existing instance.
|
||||
: **--exec-file** //FILE//
|
||||
execute python file //FILE// in an existing instance.
|
||||
|
||||
: **--geometry** //WIDTHxHEIGHT//
|
||||
: **--geometry** //WIDTHxHEIGHT+X+Y//
|
||||
default window size and position.
|
||||
|
||||
: **-h**, **--help**
|
||||
show summary of options.
|
||||
|
||||
|
@ -77,6 +77,12 @@ execute python code in \fISTRING\fR in an existing instance.
|
||||
\fB\-\-exec\-file\fR \fIFILE\fR
|
||||
execute python file \fIFILE\fR in an existing instance.
|
||||
|
||||
.TP
|
||||
\fB\-\-geometry\fR \fIWIDTHxHEIGHT\fR
|
||||
.TP
|
||||
\fB\-\-geometry\fR \fIWIDTHxHEIGHT+X+Y\fR
|
||||
default window size and position.
|
||||
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
show summary of options.
|
||||
|
@ -53,6 +53,7 @@ static struct MeditOpts {
|
||||
const char *exec_string;
|
||||
const char *exec_file;
|
||||
char **files;
|
||||
const char *geometry;
|
||||
gboolean show_version;
|
||||
const char *debug;
|
||||
} medit_opts = { -1, -1 };
|
||||
@ -156,6 +157,9 @@ static GOptionEntry medit_options[] = {
|
||||
{ "exec-file", 0, 0, G_OPTION_ARG_FILENAME, (gpointer) &medit_opts.exec_file,
|
||||
/* help message for command line option --exec-file FILE */ N_("Execute python file in an existing instance"),
|
||||
/* "FILE" part in --exec-file FILE */ N_("FILE") },
|
||||
{ "geometry", 0, 0, G_OPTION_ARG_STRING, (gpointer) &medit_opts.geometry,
|
||||
/* help message for command line option --geometry=WIDTHxHEIGHT[+X+Y] */ N_("Default window size and position"),
|
||||
/* "WIDTHxHEIGHT[+X+Y]" part in --geometry=WIDTHxHEIGHT[+X+Y] */ N_("WIDTHxHEIGHT[+X+Y]") },
|
||||
{ "version", 0, 0, G_OPTION_ARG_NONE, &medit_opts.show_version,
|
||||
/* help message for command line option --version */ N_("Show version information and exit"), NULL },
|
||||
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &medit_opts.files,
|
||||
@ -617,6 +621,9 @@ medit_main (int argc, char *argv[])
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (medit_opts.geometry && *medit_opts.geometry)
|
||||
moo_window_set_default_geometry (medit_opts.geometry);
|
||||
|
||||
if (medit_opts.project_mode)
|
||||
#ifdef MOO_ENABLE_PROJECT
|
||||
project_mode (medit_opts.project);
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
#define TOOLBAR_STYLE_ACTION_ID "ToolbarStyle"
|
||||
|
||||
static char *default_geometry = NULL;
|
||||
|
||||
static GSList *window_instances = NULL;
|
||||
|
||||
@ -454,7 +455,12 @@ moo_window_constructor (GType type,
|
||||
g_signal_connect (window, "notify::ui-xml",
|
||||
G_CALLBACK (moo_window_update_ui), NULL);
|
||||
|
||||
if (moo_prefs_get_bool (setting (window, PREFS_REMEMBER_SIZE)))
|
||||
if (default_geometry && *default_geometry)
|
||||
{
|
||||
if (!gtk_window_parse_geometry (GTK_WINDOW (window), default_geometry))
|
||||
g_printerr (_("Could not parse geometry string '%s'\n"), default_geometry);
|
||||
}
|
||||
else if (moo_prefs_get_bool (setting (window, PREFS_REMEMBER_SIZE)))
|
||||
{
|
||||
int width = moo_prefs_get_int (setting (window, PREFS_WIDTH));
|
||||
int height = moo_prefs_get_int (setting (window, PREFS_HEIGHT));
|
||||
@ -492,6 +498,15 @@ moo_window_constructor (GType type,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_window_set_default_geometry (const char *geometry)
|
||||
{
|
||||
char *tmp = default_geometry;
|
||||
default_geometry = g_strdup (geometry);
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
parse_shadow_style (void)
|
||||
{
|
||||
|
@ -126,6 +126,8 @@ GtkAction *moo_window_get_action (MooWindow *window,
|
||||
void moo_window_set_global_accels (MooWindow *window,
|
||||
gboolean global);
|
||||
|
||||
void moo_window_set_default_geometry (const char *geometry);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user