diff src/main.c @ 81:0ef72a64930b

Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net> * layout.[ch] (layout_new_with_geometry): New function to create a layout sized to an X geometry string. * main.c: Add support for --geometry on the command line.
author gqview
date Thu, 19 Oct 2006 13:38:52 +0000
parents 528e3432e0c0
children d063f97503b7
line wrap: on
line diff
--- a/src/main.c	Thu Oct 19 11:45:14 2006 +0000
+++ b/src/main.c	Thu Oct 19 13:38:52 2006 +0000
@@ -906,7 +906,8 @@
 }
 
 static void parse_command_line(int argc, char *argv[], gchar **path, gchar **file,
-			       GList **cmd_list, GList **collection_list)
+			       GList **cmd_list, GList **collection_list,
+			       gchar **geometry)
 {
 	GList *list = NULL;
 	GList *remote_list = NULL;
@@ -977,6 +978,10 @@
 				{
 				startup_command_line_collection = TRUE;
 				}
+			else if (strncmp(cmd_line, "--geometry=", 11) == 0)
+				{
+				if (!*geometry) *geometry = g_strdup(cmd_line + 11);
+				}
 			else if (strcmp(cmd_line, "-r") == 0 ||
 				 strcmp(cmd_line, "--remote") == 0)
 				{
@@ -1019,6 +1024,7 @@
 				print_term(_("  -f, --fullscreen           start in full screen mode\n"));
 				print_term(_("  -s, --slideshow            start in slideshow mode\n"));
 				print_term(_("  -l, --list                 open collection window for command line\n"));
+				print_term(_("      --geometry=GEOMETRY    set main window location\n"));
 				print_term(_("  -r, --remote               send following commands to open window\n"));
 				print_term(_("  -rh,--remote-help          print remote command list\n"));
 				print_term(_("  --debug                    turn on debug output\n"));
@@ -1261,6 +1267,7 @@
 	GList *cmd_list = NULL;
 	GList *collection_list = NULL;
 	CollectionData *first_collection = NULL;
+	gchar *geometry = NULL;
 	gchar *buf;
 	gchar *bufl;
 
@@ -1281,7 +1288,7 @@
 	setup_default_options();
 	load_options();
 
-	parse_command_line(argc, argv, &cmd_path, &cmd_file, &cmd_list, &collection_list);
+	parse_command_line(argc, argv, &cmd_path, &cmd_file, &cmd_list, &collection_list, &geometry);
 
 	gtk_init (&argc, &argv);
 
@@ -1341,7 +1348,7 @@
 		path = get_current_dir();
 		}
 
-	lw = layout_new(NULL, tools_float, tools_hidden);
+	lw = layout_new_with_geometry(NULL, tools_float, tools_hidden, geometry);
 	layout_sort_set(lw, file_sort_method, file_sort_ascending);
 
 	if (collection_list && !startup_command_line_collection)
@@ -1428,6 +1435,7 @@
 			}
 		}
 
+	g_free(geometry);
 	g_free(cmd_path);
 	g_free(cmd_file);
 	path_list_free(cmd_list);