comparison 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
comparison
equal deleted inserted replaced
80:a10fc0308c12 81:0ef72a64930b
904 } 904 }
905 parse_command_line_add_file(file_path, path, file, list, collection_list); 905 parse_command_line_add_file(file_path, path, file, list, collection_list);
906 } 906 }
907 907
908 static void parse_command_line(int argc, char *argv[], gchar **path, gchar **file, 908 static void parse_command_line(int argc, char *argv[], gchar **path, gchar **file,
909 GList **cmd_list, GList **collection_list) 909 GList **cmd_list, GList **collection_list,
910 gchar **geometry)
910 { 911 {
911 GList *list = NULL; 912 GList *list = NULL;
912 GList *remote_list = NULL; 913 GList *remote_list = NULL;
913 gint remote_do = FALSE; 914 gint remote_do = FALSE;
914 gchar *first_dir = NULL; 915 gchar *first_dir = NULL;
974 } 975 }
975 else if (strcmp(cmd_line, "-l") == 0 || 976 else if (strcmp(cmd_line, "-l") == 0 ||
976 strcmp(cmd_line, "--list") == 0) 977 strcmp(cmd_line, "--list") == 0)
977 { 978 {
978 startup_command_line_collection = TRUE; 979 startup_command_line_collection = TRUE;
980 }
981 else if (strncmp(cmd_line, "--geometry=", 11) == 0)
982 {
983 if (!*geometry) *geometry = g_strdup(cmd_line + 11);
979 } 984 }
980 else if (strcmp(cmd_line, "-r") == 0 || 985 else if (strcmp(cmd_line, "-r") == 0 ||
981 strcmp(cmd_line, "--remote") == 0) 986 strcmp(cmd_line, "--remote") == 0)
982 { 987 {
983 if (!remote_do) 988 if (!remote_do)
1017 print_term(_(" +t, --with-tools force show of tools\n")); 1022 print_term(_(" +t, --with-tools force show of tools\n"));
1018 print_term(_(" -t, --without-tools force hide of tools\n")); 1023 print_term(_(" -t, --without-tools force hide of tools\n"));
1019 print_term(_(" -f, --fullscreen start in full screen mode\n")); 1024 print_term(_(" -f, --fullscreen start in full screen mode\n"));
1020 print_term(_(" -s, --slideshow start in slideshow mode\n")); 1025 print_term(_(" -s, --slideshow start in slideshow mode\n"));
1021 print_term(_(" -l, --list open collection window for command line\n")); 1026 print_term(_(" -l, --list open collection window for command line\n"));
1027 print_term(_(" --geometry=GEOMETRY set main window location\n"));
1022 print_term(_(" -r, --remote send following commands to open window\n")); 1028 print_term(_(" -r, --remote send following commands to open window\n"));
1023 print_term(_(" -rh,--remote-help print remote command list\n")); 1029 print_term(_(" -rh,--remote-help print remote command list\n"));
1024 print_term(_(" --debug turn on debug output\n")); 1030 print_term(_(" --debug turn on debug output\n"));
1025 print_term(_(" -v, --version print version info\n")); 1031 print_term(_(" -v, --version print version info\n"));
1026 print_term(_(" -h, --help show this message\n\n")); 1032 print_term(_(" -h, --help show this message\n\n"));
1259 gchar *cmd_path = NULL; 1265 gchar *cmd_path = NULL;
1260 gchar *cmd_file = NULL; 1266 gchar *cmd_file = NULL;
1261 GList *cmd_list = NULL; 1267 GList *cmd_list = NULL;
1262 GList *collection_list = NULL; 1268 GList *collection_list = NULL;
1263 CollectionData *first_collection = NULL; 1269 CollectionData *first_collection = NULL;
1270 gchar *geometry = NULL;
1264 gchar *buf; 1271 gchar *buf;
1265 gchar *bufl; 1272 gchar *bufl;
1266 1273
1267 /* setup locale, i18n */ 1274 /* setup locale, i18n */
1268 gtk_set_locale(); 1275 gtk_set_locale();
1279 1286
1280 layout_order = g_strdup("123"); 1287 layout_order = g_strdup("123");
1281 setup_default_options(); 1288 setup_default_options();
1282 load_options(); 1289 load_options();
1283 1290
1284 parse_command_line(argc, argv, &cmd_path, &cmd_file, &cmd_list, &collection_list); 1291 parse_command_line(argc, argv, &cmd_path, &cmd_file, &cmd_list, &collection_list, &geometry);
1285 1292
1286 gtk_init (&argc, &argv); 1293 gtk_init (&argc, &argv);
1287 1294
1288 if (gtk_major_version < GTK_MAJOR_VERSION || 1295 if (gtk_major_version < GTK_MAJOR_VERSION ||
1289 (gtk_major_version == GTK_MAJOR_VERSION && gtk_minor_version < GTK_MINOR_VERSION) ) 1296 (gtk_major_version == GTK_MAJOR_VERSION && gtk_minor_version < GTK_MINOR_VERSION) )
1339 else 1346 else
1340 { 1347 {
1341 path = get_current_dir(); 1348 path = get_current_dir();
1342 } 1349 }
1343 1350
1344 lw = layout_new(NULL, tools_float, tools_hidden); 1351 lw = layout_new_with_geometry(NULL, tools_float, tools_hidden, geometry);
1345 layout_sort_set(lw, file_sort_method, file_sort_ascending); 1352 layout_sort_set(lw, file_sort_method, file_sort_ascending);
1346 1353
1347 if (collection_list && !startup_command_line_collection) 1354 if (collection_list && !startup_command_line_collection)
1348 { 1355 {
1349 GList *work; 1356 GList *work;
1426 layout_image_set_collection(lw, first_collection, 1433 layout_image_set_collection(lw, first_collection,
1427 collection_get_first(first_collection)); 1434 collection_get_first(first_collection));
1428 } 1435 }
1429 } 1436 }
1430 1437
1438 g_free(geometry);
1431 g_free(cmd_path); 1439 g_free(cmd_path);
1432 g_free(cmd_file); 1440 g_free(cmd_file);
1433 path_list_free(cmd_list); 1441 path_list_free(cmd_list);
1434 path_list_free(collection_list); 1442 path_list_free(collection_list);
1435 g_free(path); 1443 g_free(path);