g_free(lw->options.id);
lw->options.id = NULL;
- if (!layout_find_by_layout_id("main"))
- {
- lw->options.id = g_strdup("main");
- return;
- }
-
i = 1;
while (TRUE)
{
gchar *path;
gchar *xml_name;
- if (!g_str_has_prefix(lw->options.id, "lw") && !g_str_equal(lw->options.id, "main"))
+ if (!g_str_has_prefix(lw->options.id, "lw"))
{
xml_name = g_strdup_printf("%s.xml", lw->options.id);
path = g_build_filename(get_window_layouts_dir(), xml_name, NULL);
if (layout_window_list && layout_window_list->next)
{
- if (g_strcmp0(lw->options.id, "main") == 0)
- {
- while (layout_window_list && layout_window_list->next)
- {
- list = layout_window_list;
- while (list)
- {
- tmp_lw = list->data;
- if (g_strcmp0(tmp_lw->options.id, "main") != 0)
- {
- save_layout(list->data);
- layout_free(list->data);
- break;
- }
- list = list->next;
- }
- }
- exit_program();
- }
- else
- {
- save_layout(lw);
- layout_free(lw);
- }
+ save_layout(lw);
+ layout_free(lw);
}
else
{
}
}
+static gboolean first_found = FALSE;
+
LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values, gboolean use_commandline)
{
LayoutOptions lop;
/* If multiple windows are specified in the config. file,
* use the command line options only in the main window.
*/
- if (use_commandline && (g_strcmp0(lop.id, "main") == 0))
+ if (use_commandline && !first_found)
{
+ first_found = TRUE;
layout_config_commandline(&lop, &path);
}
else
layout_image_set_buttons(lw);
image_set_drag_func(lw->image, layout_image_drag_cb, lw);
- image_attach_window(lw->image, lw->window, NULL, g_strcmp0(lw->options.id, "main") == 0 ? GQ_APPNAME : GQ_APPNAME_LC, FALSE);
+ image_attach_window(lw->image, lw->window, NULL, GQ_APPNAME, FALSE);
/* do not hilight selected image in SPLIT_NONE */
/* maybe the image should be selected always and hilight should be controled by
menu = gtk_ui_manager_get_widget(lw->ui_manager, "/MainMenu/WindowsMenu/");
sub_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menu));
- /* disable Rename and Delete for main window */
- if (g_strcmp0(lw->options.id, "main") == 0)
+ /* disable Delete for temporary windows */
+ if (g_str_has_prefix(lw->options.id, "lw"))
{
i = 0;
children = gtk_container_get_children(GTK_CONTAINER(sub_menu));
for (iter = children; iter != NULL; iter = g_list_next(iter), i++)
{
menu_label = g_strdup(gtk_menu_item_get_label(GTK_MENU_ITEM(iter->data)));
- if (g_strcmp0(menu_label, _("Delete window")) == 0 || g_strcmp0(menu_label, _("Rename window")) == 0)
+ if (g_strcmp0(menu_label, _("Delete window")) == 0)
{
gtk_widget_set_sensitive(GTK_WIDGET(iter->data), FALSE);
}
static void exit_program_final(void)
{
LayoutWindow *lw = NULL;
+ GList *list;
+ LayoutWindow *tmp_lw;
/* make sure that external editors are loaded, we would save incomplete configuration otherwise */
layout_editors_reload_finish();
collect_manager_flush();
+ /* Save the named windows */
+ if (layout_window_list && layout_window_list->next)
+ {
+ list = layout_window_list;
+ while (list)
+ {
+ tmp_lw = list->data;
+ if (!g_str_has_prefix(tmp_lw->options.id, "lw"))
+ {
+ save_layout(list->data);
+ }
+ list = list->next;
+ }
+ }
+
save_options(options);
keys_save();
accel_map_save();
{
LayoutWindow *lw = NULL;
- lw = layout_find_by_layout_id("main");
- if (!lw)
- {
- lw = g_list_first(layout_window_list)->data;
- }
+ layout_valid(&lw);
g_free(pwd);
pwd = g_strdup(text);