comparison src/layout.c @ 1470:38925ff71a46

do not re-create ui_manager at layout change
author nadvornik
date Fri, 20 Mar 2009 22:48:01 +0000
parents 6e020d3ab168
children 01693e68707b
comparison
equal deleted inserted replaced
1469:607c60506863 1470:38925ff71a46
256 256
257 menu_bar = layout_actions_menu_bar(lw); 257 menu_bar = layout_actions_menu_bar(lw);
258 gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, FALSE, 0); 258 gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, FALSE, 0);
259 gtk_widget_show(menu_bar); 259 gtk_widget_show(menu_bar);
260 260
261 lw->toolbar = layout_actions_toolbar(lw); 261 layout_actions_toolbar(lw);
262 gtk_box_pack_start(GTK_BOX(box), lw->toolbar, FALSE, FALSE, 0); 262 gtk_box_pack_start(GTK_BOX(box), lw->toolbar, FALSE, FALSE, 0);
263 if (!lw->options.toolbar_hidden) gtk_widget_show(lw->toolbar); 263 if (!lw->options.toolbar_hidden) gtk_widget_show(lw->toolbar);
264 264
265 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1, 265 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1,
266 layout_path_entry_cb, lw); 266 layout_path_entry_cb, lw);
1636 GtkWidget *image_sb; /* image together with sidebars in utility box */ 1636 GtkWidget *image_sb; /* image together with sidebars in utility box */
1637 GtkWidget *tools; 1637 GtkWidget *tools;
1638 GtkWidget *files; 1638 GtkWidget *files;
1639 1639
1640 layout_actions_setup(lw); 1640 layout_actions_setup(lw);
1641 layout_actions_add_window(lw, lw->window);
1642 1641
1643 lw->group_box = gtk_vbox_new(FALSE, 0); 1642 lw->group_box = gtk_vbox_new(FALSE, 0);
1644 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0); 1643 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0);
1645 gtk_widget_show(lw->group_box); 1644 gtk_widget_show(lw->group_box);
1646 1645
1768 if (dir_fd) file_data_unregister_real_time_monitor(dir_fd); 1767 if (dir_fd) file_data_unregister_real_time_monitor(dir_fd);
1769 lw->dir_fd = NULL; 1768 lw->dir_fd = NULL;
1770 1769
1771 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos); 1770 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos);
1772 1771
1772 /* preserve utility_box (image + sidebars), menu_bar and toolbar to be reused later in layout_grid_setup */
1773 /* lw->image is preserved together with lw->utility_box */ 1773 /* lw->image is preserved together with lw->utility_box */
1774 if (lw->utility_box) 1774 if (lw->utility_box) gtk_container_remove(GTK_CONTAINER(lw->utility_box->parent), lw->utility_box);
1775 { 1775 if (lw->menu_bar) gtk_container_remove(GTK_CONTAINER(lw->menu_bar->parent), lw->menu_bar);
1776 /* preserve utility_box (image + sidebars) to be reused later in layout_grid_setup */ 1776 if (lw->toolbar) gtk_container_remove(GTK_CONTAINER(lw->toolbar->parent), lw->toolbar);
1777 gtk_widget_hide(lw->utility_box);
1778 g_object_ref(lw->utility_box);
1779 gtk_container_remove(GTK_CONTAINER(lw->utility_box->parent), lw->utility_box);
1780 }
1781 1777
1782 /* clear it all */ 1778 /* clear it all */
1783 1779
1784 lw->h_pane = NULL; 1780 lw->h_pane = NULL;
1785 lw->v_pane = NULL; 1781 lw->v_pane = NULL;
1786 1782
1787 lw->toolbar = NULL;
1788 lw->path_entry = NULL; 1783 lw->path_entry = NULL;
1789 lw->dir_view = NULL; 1784 lw->dir_view = NULL;
1790 lw->vd = NULL; 1785 lw->vd = NULL;
1791 1786
1792 lw->file_view = NULL; 1787 lw->file_view = NULL;
1799 lw->info_status = NULL; 1794 lw->info_status = NULL;
1800 lw->info_details = NULL; 1795 lw->info_details = NULL;
1801 lw->info_pixel = NULL; 1796 lw->info_pixel = NULL;
1802 lw->info_zoom = NULL; 1797 lw->info_zoom = NULL;
1803 1798
1799 /*
1804 if (lw->ui_manager) g_object_unref(lw->ui_manager); 1800 if (lw->ui_manager) g_object_unref(lw->ui_manager);
1805 lw->ui_manager = NULL; 1801 lw->ui_manager = NULL;
1806 lw->action_group = NULL; 1802 lw->action_group = NULL;
1807 lw->action_group_editors = NULL; 1803 lw->action_group_editors = NULL;
1804 */
1808 1805
1809 gtk_container_remove(GTK_CONTAINER(lw->main_box), lw->group_box); 1806 gtk_container_remove(GTK_CONTAINER(lw->main_box), lw->group_box);
1810 lw->group_box = NULL; 1807 lw->group_box = NULL;
1811 1808
1812 /* re-fill */ 1809 /* re-fill */
1814 layout_grid_setup(lw); 1811 layout_grid_setup(lw);
1815 layout_tools_hide(lw, lw->options.tools_hidden); 1812 layout_tools_hide(lw, lw->options.tools_hidden);
1816 1813
1817 layout_util_sync(lw); 1814 layout_util_sync(lw);
1818 layout_status_update_all(lw); 1815 layout_status_update_all(lw);
1816
1817
1818 // printf("%d %d %d \n", G_OBJECT(lw->utility_box)->ref_count, G_OBJECT(lw->menu_bar)->ref_count, G_OBJECT(lw->toolbar)->ref_count);
1819 1819
1820 /* sync */ 1820 /* sync */
1821 1821
1822 if (image_get_fd(lw->image)) 1822 if (image_get_fd(lw->image))
1823 { 1823 {
2206 2206
2207 if (lw->exif_window) g_signal_handlers_disconnect_matched(G_OBJECT(lw->exif_window), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, lw); 2207 if (lw->exif_window) g_signal_handlers_disconnect_matched(G_OBJECT(lw->exif_window), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, lw);
2208 2208
2209 layout_bars_close(lw); 2209 layout_bars_close(lw);
2210 2210
2211 g_object_unref(lw->menu_bar);
2212 g_object_unref(lw->toolbar);
2213 g_object_unref(lw->utility_box);
2214
2211 gtk_widget_destroy(lw->window); 2215 gtk_widget_destroy(lw->window);
2212 2216
2213 if (lw->split_image_sizegroup) g_object_unref(lw->split_image_sizegroup); 2217 if (lw->split_image_sizegroup) g_object_unref(lw->split_image_sizegroup);
2214 2218
2215 file_data_unregister_notify_func(layout_image_notify_cb, lw); 2219 file_data_unregister_notify_func(layout_image_notify_cb, lw);