static void fm_tab_page_init(FmTabPage *page) { GtkPaned* paned = GTK_PANED(page); FmTabLabel* tab_label; FmFolderView* folder_view; GList* focus_chain = NULL; FmSidePaneMode mode = app_config->side_pane_mode; page->side_pane = fm_side_pane_new(); fm_side_pane_set_mode(page->side_pane, (mode & FM_SP_MODE_MASK)); /* TODO: add a close button to side pane */ gtk_paned_add1(paned, GTK_WIDGET(page->side_pane)); focus_chain = g_list_prepend(focus_chain, page->side_pane); /* handlers below will be used when FmMainWin detects new page added */ folder_view = (FmFolderView*)fm_standard_view_new(app_config->view_mode, update_files_popup, open_folder_func); page->folder_view = folder_view; fm_folder_view_set_selection_mode(folder_view, GTK_SELECTION_MULTIPLE); page->nav_history = fm_nav_history_new(); gtk_paned_add2(paned, GTK_WIDGET(page->folder_view)); focus_chain = g_list_prepend(focus_chain, page->folder_view); /* We need this to change tab order to focus folder view before left pane. */ gtk_container_set_focus_chain(GTK_CONTAINER(page), focus_chain); g_list_free(focus_chain); gtk_widget_show_all(GTK_WIDGET(page)); if(mode & FM_SP_HIDE) gtk_widget_hide(GTK_WIDGET(page->side_pane)); /* create tab label */ tab_label = (FmTabLabel*)fm_tab_label_new(""); gtk_label_set_max_width_chars(tab_label->label, app_config->max_tab_chars); #if ! GTK_CHECK_VERSION(3, 0, 0) gtk_label_set_ellipsize(tab_label->label, PANGO_ELLIPSIZE_END); #endif page->tab_label = tab_label; g_signal_connect(page->folder_view, "sel-changed", G_CALLBACK(on_folder_view_sel_changed), page); /* g_signal_connect(page->folder_view, "chdir", G_CALLBACK(on_folder_view_chdir), page); g_signal_connect(page->folder_view, "loaded", G_CALLBACK(on_folder_view_loaded), page); g_signal_connect(page->folder_view, "error", G_CALLBACK(on_folder_view_error), page); */ /* the folder view is already loded, call the "loaded" callback ourself. */ //if(fm_folder_view_is_loaded(folder_view)) // on_folder_view_loaded(folder_view, fm_folder_view_get_cwd(folder_view), page); }
static void fm_tab_page_init(FmTabPage *page) { GtkPaned* paned = GTK_PANED(page); FmTabLabel* tab_label; FmFolderView* folder_view; GList* focus_chain = NULL; page->side_pane = fm_side_pane_new(); fm_side_pane_set_mode(FM_SIDE_PANE(page->side_pane), app_config->side_pane_mode); /* TODO: add a close button to side pane */ gtk_paned_add1(paned, page->side_pane); focus_chain = g_list_prepend(focus_chain, page->side_pane); page->folder_view = fm_folder_view_new(app_config->view_mode); folder_view = FM_FOLDER_VIEW(page->folder_view); fm_folder_view_set_hint_type(folder_view, app_config->hint_type); fm_folder_view_sort(folder_view, app_config->sort_type, app_config->sort_by); fm_folder_view_set_selection_mode(folder_view, GTK_SELECTION_MULTIPLE); page->nav_history = fm_nav_history_new(); gtk_paned_add2(paned, page->folder_view); focus_chain = g_list_prepend(focus_chain, page->folder_view); /* We need this to change tab order to focus folder view before left pane. */ gtk_container_set_focus_chain(page, focus_chain); g_list_free(focus_chain); gtk_widget_show_all(GTK_WIDGET(page)); /* create tab label */ tab_label = (FmTabLabel*)fm_tab_label_new(""); gtk_label_set_max_width_chars(tab_label->label, app_config->max_tab_chars); gtk_label_set_ellipsize(tab_label->label, PANGO_ELLIPSIZE_END); page->tab_label = GTK_WIDGET(tab_label); g_signal_connect(page->folder_view, "sel-changed", G_CALLBACK(on_folder_view_sel_changed), page); g_signal_connect(page->folder_view, "loaded", G_CALLBACK(on_folder_view_loaded), page); /* the folder view is already loded, call the "loaded" callback ourself. */ if(fm_folder_view_get_is_loaded(folder_view)) on_folder_view_loaded(folder_view, fm_folder_view_get_cwd(folder_view), page); }