static void create_trash_item(FmPlacesModel* model) { GtkTreeIter it; FmPlaceItem* item; GdkPixbuf* pix; GFile* gf; gf = g_file_new_for_uri("trash:///"); model->trash_monitor = fm_monitor_directory(gf, NULL); g_signal_connect(model->trash_monitor, "changed", G_CALLBACK(on_trash_changed), model); g_object_unref(gf); item = g_slice_new0(FmPlaceItem); item->type = FM_PLACES_ITEM_PATH; item->fi = fm_file_info_new(); item->fi->path = fm_path_ref(fm_path_get_trash()); item->fi->icon = fm_icon_from_name("user-trash"); gtk_list_store_insert(GTK_LIST_STORE(model), &it, 2); pix = fm_icon_get_pixbuf(item->fi->icon, fm_config->pane_icon_size); gtk_list_store_set(GTK_LIST_STORE(model), &it, FM_PLACES_MODEL_COL_ICON, pix, FM_PLACES_MODEL_COL_LABEL, _("Trash"), FM_PLACES_MODEL_COL_INFO, item, -1); g_object_unref(pix); model->trash_it = it; if(0 == model->trash_idle) model->trash_idle = g_idle_add((GSourceFunc)update_trash_item, model); }
void create_trash() { GtkTreeIter it; PlaceItem* item; GdkPixbuf* pix; GFile* gf; gf = g_file_new_for_uri("trash:///"); trash_monitor = fm_monitor_directory(gf, NULL); g_signal_connect(trash_monitor, "changed", G_CALLBACK(on_trash_changed), NULL); g_object_unref(gf); item = g_slice_new0(PlaceItem); item->type = PLACE_PATH; item->path = fm_path_ref(fm_path_get_trash()); item->icon = fm_icon_from_name("user-trash"); gtk_list_store_insert(model, &it, 2); pix = fm_icon_get_pixbuf(item->icon, fm_config->pane_icon_size); gtk_list_store_set(model, &it, COL_ICON, pix, COL_LABEL, _("Trash"), COL_INFO, item, -1); g_object_unref(pix); trash_it = it; if(0 == trash_idle) trash_idle = g_idle_add((GSourceFunc)update_trash, NULL); }
FmFolder* fm_folder_new_internal(FmPath* path, GFile* gf) { GError* err = NULL; FmFolder* folder = (FmFolder*)g_object_new(FM_TYPE_FOLDER, NULL); folder->dir_path = fm_path_ref(path); folder->gf = (GFile*)g_object_ref(gf); folder->mon = fm_monitor_directory(gf, &err); if(folder->mon) g_signal_connect(folder->mon, "changed", G_CALLBACK(on_folder_changed), folder ); else g_error_free(err); fm_folder_reload(folder); return folder; }