comparison src/layout.c @ 1313:1ffa5222dc61

enabled commandline again
author nadvornik
date Mon, 23 Feb 2009 21:21:15 +0000
parents 55ea4962887a
children 8cca18bce950
comparison
equal deleted inserted replaced
1312:fcf0e7a6143e 1313:1ffa5222dc61
2106 } 2106 }
2107 2107
2108 gtk_widget_show(lw->window); 2108 gtk_widget_show(lw->window);
2109 layout_tools_hide(lw, lw->options.tools_hidden); 2109 layout_tools_hide(lw, lw->options.tools_hidden);
2110 2110
2111 image_osd_set(lw->image, options->image_overlay.common.state | (options->image_overlay.common.show_at_startup ? OSD_SHOW_INFO : OSD_SHOW_NOTHING));
2112
2111 layout_window_list = g_list_append(layout_window_list, lw); 2113 layout_window_list = g_list_append(layout_window_list, lw);
2112 2114
2113 file_data_register_notify_func(layout_image_notify_cb, lw, NOTIFY_PRIORITY_LOW); 2115 file_data_register_notify_func(layout_image_notify_cb, lw, NOTIFY_PRIORITY_LOW);
2114 2116
2115 return lw; 2117 return lw;
2245 DEBUG_1("unknown attribute %s = %s", option, value); 2247 DEBUG_1("unknown attribute %s = %s", option, value);
2246 } 2248 }
2247 2249
2248 } 2250 }
2249 2251
2250 2252 static void layout_config_commandline(LayoutOptions *lop, gchar **path)
2251 LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values) 2253 {
2254 if (command_line->startup_blank)
2255 {
2256 *path = NULL;
2257 }
2258 else if (command_line->file)
2259 {
2260 *path = g_strdup(command_line->file);
2261 }
2262 else if (command_line->path)
2263 {
2264 *path = g_strdup(command_line->path);
2265 }
2266 else if (options->startup.restore_path && options->startup.path && isdir(options->startup.path))
2267 {
2268 *path = g_strdup(options->startup.path);
2269 }
2270 else
2271 {
2272 *path = get_current_dir();
2273 }
2274
2275 if (command_line->tools_show)
2276 {
2277 lop->tools_float = FALSE;
2278 lop->tools_hidden = FALSE;
2279 }
2280 else if (command_line->tools_hide)
2281 {
2282 lop->tools_hidden = TRUE;
2283 }
2284 }
2285
2286 LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values, gboolean use_commandline)
2252 { 2287 {
2253 LayoutOptions lop; 2288 LayoutOptions lop;
2254 LayoutWindow *lw; 2289 LayoutWindow *lw;
2290 gchar *path = NULL;
2291
2255 memset(&lop, 0, sizeof(LayoutOptions)); 2292 memset(&lop, 0, sizeof(LayoutOptions));
2256 copy_layout_options(&lop, &options->layout); 2293 copy_layout_options(&lop, &options->layout);
2257 2294
2258 layout_load_attributes(&lop, attribute_names, attribute_values); 2295 if (attribute_names) layout_load_attributes(&lop, attribute_names, attribute_values);
2259 lw = layout_new(NULL, &lop); 2296
2297 if (use_commandline)
2298 {
2299 layout_config_commandline(&lop, &path);
2300 }
2301 else if (options->startup.restore_path && options->startup.path && isdir(options->startup.path))
2302 {
2303 path = g_strdup(options->startup.path);
2304 }
2305 else
2306 {
2307 path = get_current_dir();
2308 }
2309
2310 lw = layout_new_with_geometry(NULL, &lop, use_commandline ? command_line->geometry : NULL);
2260 layout_sort_set(lw, options->file_sort.method, options->file_sort.ascending); 2311 layout_sort_set(lw, options->file_sort.method, options->file_sort.ascending);
2261 layout_set_path(lw, get_current_dir()); // FIXME: use options / cmdline 2312 layout_set_path(lw, path);
2262 2313
2314 if (use_commandline && command_line->startup_full_screen) layout_image_full_screen_start(lw);
2315 if (use_commandline && command_line->startup_in_slideshow) layout_image_slideshow_start(lw);
2316
2317
2318 g_free(path);
2263 free_layout_options_content(&lop); 2319 free_layout_options_content(&lop);
2264 return lw; 2320 return lw;
2265 } 2321 }
2266 2322
2267 2323