Revision as of 17:53, 8 November 2012 by Smile4ever (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


A glib/gio-based library providing some file management utilities and related-widgets missing in gtk+/glib. This is the core of PCManFM. The library is desktop independent (not LXDE specific) and has clean API. It can be used to develop other applications requiring file management functionality. For example, you can create your own file manager with facilities provided by libfm.


How To Use

Here is a simple gtk+ program demonstrating how to show the content of your home directory with libfm.

#include <gtk/gtk.h>
#include <libfm/fm.h> /* header file of libfm */

int main(int argc, char** argv)
    FmFolder* folder;
    FmFolderModel* model;
    FmFolderView* view;
    GtkWidget* window, *scroll;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    scroll = gtk_scrolled_window_new(NULL, NULL);
    gtk_container_add(GTK_CONTAINER(window), scroll);

    folder = fm_folder_get(fm_path_get_home());
    model = fm_folder_model_new(folder, FALSE);
    view = fm_folder_view_new(FM_FV_LIST_VIEW);
    gtk_container_add(GTK_CONTAINER(scroll), view);
    fm_folder_view_set_model(view, model);

    gtk_widget_show_all(window); /* show the main window */
    return 0;

Build the library from source