Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://pcmanfm.git.sourceforge.net/gitroot/pc…

…manfm/libfm into mloskot-fixes
  • Loading branch information...
commit 359a70b8fcd3d21bf6bdac8dc6f4604f6f8ff5da 2 parents ca7f021 + 1861785
@mloskot authored
View
2  docs/reference/libfm/libfm-sections.txt
@@ -606,6 +606,8 @@ fm_folder_model_get_type
FM_FOLDER_VIEW_TYPE
FmFolderView
FmFolderViewClass
+FmFolderViewClickType
+FmFolderViewMode
fm_folder_view_dup_selected_file_paths
fm_folder_view_dup_selected_files
fm_folder_view_get_cwd
View
18 src/gtk/exo/exo-icon-view.c
@@ -5588,6 +5588,24 @@ exo_icon_view_get_selected_items (const ExoIconView *icon_view)
+gint exo_icon_view_count_selected_items (const ExoIconView *icon_view)
+{
+ GList *lp;
+ gint i = 0;
+
+ g_return_val_if_fail (EXO_IS_ICON_VIEW (icon_view), 0);
+
+ for (lp = icon_view->priv->items; lp != NULL; lp = lp->next)
+ {
+ if (EXO_ICON_VIEW_ITEM (lp->data)->selected)
+ i++;
+ }
+
+ return i;
+}
+
+
+
/**
* exo_icon_view_select_all:
* @icon_view : A #ExoIconView.
View
1  src/gtk/exo/exo-icon-view.h
@@ -264,6 +264,7 @@ void exo_icon_view_unselect_path (ExoIconView
gboolean exo_icon_view_path_is_selected (const ExoIconView *icon_view,
GtkTreePath *path);
GList *exo_icon_view_get_selected_items (const ExoIconView *icon_view);
+gint exo_icon_view_count_selected_items (const ExoIconView *icon_view);
void exo_icon_view_select_all (ExoIconView *icon_view);
void exo_icon_view_unselect_all (ExoIconView *icon_view);
void exo_icon_view_item_activated (ExoIconView *icon_view,
View
2  src/gtk/fm-dnd-dest.h
@@ -98,7 +98,7 @@ gboolean fm_dnd_dest_drag_drop(FmDndDest* dd, GdkDragContext *drag_context,
GdkDragAction fm_dnd_dest_get_default_action(FmDndDest* dd,
GdkDragContext* drag_context,
- GdkTarget target);
+ GdkAtom target);
void fm_dnd_dest_drag_leave(FmDndDest* dd, GdkDragContext* drag_context, guint time);
View
138 src/gtk/fm-folder-model.c
@@ -20,6 +20,17 @@
* MA 02110-1301, USA.
*/
+/**
+ * SECTION:fm-folder-model
+ * @short_description: A model for folder view window.
+ * @title: FmFolderModel
+ *
+ * @include: libfm/fm-folder-model.h
+ *
+ * The #FmFolderModel is used by widgets such as #FmFolderView to arrange
+ * items of folder.
+ */
+
#include "fm-config.h"
#include "fm-folder-model.h"
#include "fm-file-info.h"
@@ -192,6 +203,8 @@ static void fm_folder_model_class_init(FmFolderModelClass *klass)
*
* It can be used if view has some data associated with the row so
* those data can be freed safely.
+ *
+ * Since: 1.0.0
*/
signals[ROW_DELETING] =
g_signal_new("row-deleting",
@@ -277,6 +290,17 @@ static void fm_folder_model_dispose(GObject *object)
(*G_OBJECT_CLASS(fm_folder_model_parent_class)->dispose)(object);
}
+/**
+ * fm_folder_model_new
+ * @dir: the folder to create model
+ * @show_hidden: whether show hidden files initially or not
+ *
+ * Creates new folder model for the @dir.
+ *
+ * Returns: (transfer full): a new #FmFolderModel object.
+ *
+ * Since: 0.1.0
+ */
FmFolderModel *fm_folder_model_new(FmFolder* dir, gboolean show_hidden)
{
FmFolderModel* model;
@@ -340,16 +364,48 @@ static void _fm_folder_model_files_removed(FmFolder* dir, GSList* files,
fm_folder_model_file_deleted(model, FM_FILE_INFO(l->data));
}
+/**
+ * fm_folder_model_get_folder
+ * @model: the folder model instance
+ *
+ * Retrieves a folder that @model is created for. Returned data are owned
+ * by the @model and should not be freed by caller.
+ *
+ * Returns: (transfer none): the folder descriptor.
+ *
+ * Since: 1.0.0
+ */
FmFolder* fm_folder_model_get_folder(FmFolderModel* model)
{
return model->folder;
}
+/**
+ * fm_folder_model_get_folder_path
+ * @model: the folder model instance
+ *
+ * Retrieves path of folder that @model is created for. Returned data
+ * are owned by the @model and should not be freed by caller.
+ *
+ * Returns: (transfer none): the path of the folder of the model.
+ *
+ * Since: 1.0.0
+ */
FmPath* fm_folder_model_get_folder_path(FmFolderModel* model)
{
return model->folder ? fm_folder_get_path(model->folder) : NULL;
}
+/**
+ * fm_folder_model_set_folder
+ * @model: a folder model instance
+ * @dir: a new folder for the model
+ *
+ * Changes folder which model handles. This call allows reusing the model
+ * for different folder, in case, e.g. directory was changed.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_model_set_folder(FmFolderModel* model, FmFolder* dir)
{
if(model->folder == dir)
@@ -833,12 +889,30 @@ static void _fm_folder_model_insert_item(FmFolder* dir,
gtk_tree_path_free(path);
}
+/**
+ * fm_folder_model_file_created
+ * @model: the folder model instance
+ * @file: new file into
+ *
+ * Adds new created @file into @model.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_model_file_created(FmFolderModel* model, FmFileInfo* file)
{
FmFolderItem* new_item = fm_folder_item_new(file);
_fm_folder_model_insert_item(model->folder, new_item, model);
}
+/**
+ * fm_folder_model_file_deleted
+ * @model: the folder model instance
+ * @file: removed file into
+ *
+ * Removes a @file from @model.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_model_file_deleted(FmFolderModel* model, FmFileInfo* file)
{
GSequenceIter *seq_it;
@@ -879,6 +953,15 @@ void fm_folder_model_file_deleted(FmFolderModel* model, FmFileInfo* file)
g_sequence_remove(seq_it);
}
+/**
+ * fm_folder_model_file_changed
+ * @model: a folder model instance
+ * @file: a file into
+ *
+ * Updates info for the @file in the @model.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_model_file_changed(FmFolderModel* model, FmFileInfo* file)
{
FmFolderItem* item = NULL;
@@ -916,11 +999,30 @@ void fm_folder_model_file_changed(FmFolderModel* model, FmFileInfo* file)
gtk_tree_path_free(path);
}
+/**
+ * fm_folder_model_get_show_hidden
+ * @model: the folder model instance
+ *
+ * Retrieves info whether folder model includes hidden files.
+ *
+ * Returns: %TRUE if hidden files are visible within @model.
+ *
+ * Since: 0.1.0
+ */
gboolean fm_folder_model_get_show_hidden(FmFolderModel* model)
{
return model->show_hidden;
}
+/**
+ * fm_folder_model_set_show_hidden
+ * @model: the folder model instance
+ * @show_hidden: whether show hidden files or not
+ *
+ * Changes visibility of hodden files within @model.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_model_set_show_hidden(FmFolderModel* model, gboolean show_hidden)
{
FmFolderItem* item;
@@ -1029,6 +1131,19 @@ static void on_icon_theme_changed(GtkIconTheme* theme, FmFolderModel* model)
reload_icons(model, RELOAD_ICONS);
}
+/**
+ * fm_folder_model_find_iter_by_filename
+ * @model: the folder model instance
+ * @it: pointer to iterator to fill
+ * @name: file name to search
+ *
+ * Searches @model for existance of some file in it. If file was found
+ * then sets @it to match found file.
+ *
+ * Returns: %TRUE if file was found.
+ *
+ * Since: 0.1.0
+ */
gboolean fm_folder_model_find_iter_by_filename(FmFolderModel* model, GtkTreeIter* it, const char* name)
{
GSequenceIter *item_it = g_sequence_get_begin_iter(model->items);
@@ -1084,6 +1199,15 @@ static void on_thumbnail_loaded(FmThumbnailRequest* req, gpointer user_data)
}
}
+/**
+ * fm_folder_model_set_icon_size
+ * @model: the folder model instance
+ * @icon_size: new size for icons in pixels
+ *
+ * Changes the size of icons in @model data.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_model_set_icon_size(FmFolderModel* model, guint icon_size)
{
if(model->icon_size == icon_size)
@@ -1092,6 +1216,16 @@ void fm_folder_model_set_icon_size(FmFolderModel* model, guint icon_size)
reload_icons(model, RELOAD_BOTH);
}
+/**
+ * fm_folder_model_get_icon_size
+ * @model: the folder model instance
+ *
+ * Retrieves the size of icons in @model data.
+ *
+ * Returns: size of icons in pixels.
+ *
+ * Since: 0.1.0
+ */
guint fm_folder_model_get_icon_size(FmFolderModel* model)
{
return model->icon_size;
@@ -1277,6 +1411,8 @@ static void on_thumbnail_max_changed(FmConfig* cfg, gpointer user_data)
* @user_data : user data that will be associated with the row
*
* Sets the data that can be retrieved by fm_folder_model_get_item_userdata().
+ *
+ * Since: 1.0.0
*/
void fm_folder_model_set_item_userdata(FmFolderModel* model, GtkTreeIter* it,
gpointer user_data)
@@ -1302,6 +1438,8 @@ void fm_folder_model_set_item_userdata(FmFolderModel* model, GtkTreeIter* it,
* fm_folder_model_set_item_userdata() on that row.
*
* Return value: user data that was set on that row
+ *
+ * Since: 1.0.0
*/
gpointer fm_folder_model_get_item_userdata(FmFolderModel* model, GtkTreeIter* it)
{
View
21 src/gtk/fm-folder-model.h
@@ -39,7 +39,20 @@ G_BEGIN_DECLS
#define FM_IS_FOLDER_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FM_TYPE_FOLDER_MODEL))
#define FM_FOLDER_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FM_TYPE_FOLDER_MODEL, FmFolderModelClass))
-/** Columns of folder view */
+/**
+ * FmFolderModelViewCol:
+ * @COL_FILE_GICON: (#GIcon *) icon image
+ * @COL_FILE_ICON: (#FmIcon *) icon descriptor
+ * @COL_FILE_NAME: (#gchar *) file name
+ * @COL_FILE_SIZE: (#gchar *) file size text
+ * @COL_FILE_DESC: (#gchar *) file MIME description
+ * @COL_FILE_PERM: (#gchar *) reserved, not implemented
+ * @COL_FILE_OWNER: (#gchar *) reserved, not implemented
+ * @COL_FILE_MTIME: (#gchar *) modification time text
+ * @COL_FILE_INFO: (#FmFileInfo *) file info
+ *
+ * Columns of folder view
+ */
typedef enum {
COL_FILE_GICON = 0,
COL_FILE_ICON,
@@ -50,6 +63,7 @@ typedef enum {
COL_FILE_OWNER,
COL_FILE_MTIME,
COL_FILE_INFO,
+ /*< private >*/
N_FOLDER_MODEL_COLS
} FmFolderModelViewCol;
@@ -61,6 +75,11 @@ typedef enum {
typedef struct _FmFolderModel FmFolderModel;
typedef struct _FmFolderModelClass FmFolderModelClass;
+/**
+ * FmFolderModelClass:
+ * @parent: the parent class
+ * @row_deleting: the class closure for the #FmFolderModel::row-deleting signal
+ */
struct _FmFolderModelClass
{
GObjectClass parent;
View
286 src/gtk/fm-folder-view.c
@@ -19,6 +19,17 @@
* MA 02110-1301, USA.
*/
+/**
+ * SECTION:fm-folder-view
+ * @short_description: A folder view widget.
+ * @title: FmFolderView
+ *
+ * @include: libfm/fm-folder-view.h
+ *
+ * The #FmFolderView represents view of content of a folder with
+ * support of drag & drop and other file/directory operations.
+ */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -117,6 +128,18 @@ static void fm_folder_view_class_init(FmFolderViewClass *klass)
fm_folder_view_parent_class = (GtkScrolledWindowClass*)g_type_class_peek(GTK_TYPE_SCROLLED_WINDOW);
+ /**
+ * FmFolderView::clicked:
+ * @view: the widget that emitted the signal
+ * @type: (#FmFolderViewClickType) type of click
+ * @file: (#FmFileInfo *) file on which cursor is
+ *
+ * The #FmFolderView::clicked signal is emitted when user clicked
+ * somewhere in the folder area. If click was on free folder area
+ * then @file is %NULL.
+ *
+ * Since: 0.1.0
+ */
signals[CLICKED]=
g_signal_new("clicked",
G_TYPE_FROM_CLASS(klass),
@@ -126,19 +149,36 @@ static void fm_folder_view_class_init(FmFolderViewClass *klass)
g_cclosure_marshal_VOID__UINT_POINTER,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
- /* Emitted when selection of the view got changed.
- * Currently selected files are passed as the parameter.
- * If there is no file selected, NULL is passed instead. */
+ /**
+ * FmFolderView::sel-changed:
+ * @view: the widget that emitted the signal
+ * @n_sel: number of files currently selected in the folder
+ *
+ * The #FmFolderView::sel-changed signal is emitted when
+ * selection of the view got changed.
+ *
+ * Before 1.0.0 parameter was list of currently selected files.
+ *
+ * Since: 0.1.0
+ */
signals[SEL_CHANGED]=
g_signal_new("sel-changed",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(FmFolderViewClass, sel_changed),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- /* Emitted when sorting of the view got changed. */
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
+
+ /**
+ * FmFolderView::sort-changed:
+ * @view: the widget that emitted the signal
+ *
+ * The #FmFolderView::sort-changed signal is emitted when sorting
+ * of the view got changed.
+ *
+ * Since: 0.1.10
+ */
signals[SORT_CHANGED]=
g_signal_new("sort-changed",
G_TYPE_FROM_CLASS(klass),
@@ -254,7 +294,16 @@ static void fm_folder_view_init(FmFolderView *self)
self->sort_by = COL_FILE_NAME;
}
-
+/**
+ * fm_folder_view_new
+ * @mode: initial mode of view
+ *
+ * Creates new folder view.
+ *
+ * Returns: a new #FmFolderView widget.
+ *
+ * Since: 0.1.0
+ */
FmFolderView* fm_folder_view_new(FmFolderViewMode mode)
{
FmFolderView* fv = (FmFolderView*)g_object_new(FM_FOLDER_VIEW_TYPE, NULL);
@@ -664,6 +713,15 @@ static void unset_view(FmFolderView* fv)
fv->view = NULL;
}
+/**
+ * fm_folder_view_set_mode
+ * @fv: a widget to apply
+ * @mode: new mode of view
+ *
+ * Changes current view mode for folder in @fv.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_view_set_mode(FmFolderView* fv, FmFolderViewMode mode)
{
if( mode != fv->mode )
@@ -740,11 +798,30 @@ void fm_folder_view_set_mode(FmFolderView* fv, FmFolderViewMode mode)
}
}
+/**
+ * fm_folder_view_get_mode
+ * @fv: a widget to inspect
+ *
+ * Retrieves current view mode for folder in @fv.
+ *
+ * Returns: current mode of view.
+ *
+ * Since: 0.1.0
+ */
FmFolderViewMode fm_folder_view_get_mode(FmFolderView* fv)
{
return fv->mode;
}
+/**
+ * fm_folder_view_set_selection_mode
+ * @fv: a widget to apply
+ * @mode: new mode of selection in @fv.
+ *
+ * Changes selection mode in @fv.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_view_set_selection_mode(FmFolderView* fv, GtkSelectionMode mode)
{
if(fv->sel_mode != mode)
@@ -767,11 +844,31 @@ void fm_folder_view_set_selection_mode(FmFolderView* fv, GtkSelectionMode mode)
}
}
+/**
+ * fm_folder_view_get_selection_mode
+ * @fv: a widget to inspect
+ *
+ * Retrieves current selection mode in @fv.
+ *
+ * Returns: current selection mode.
+ *
+ * Since: 0.1.0
+ */
GtkSelectionMode fm_folder_view_get_selection_mode(FmFolderView* fv)
{
return fv->sel_mode;
}
+/**
+ * fm_folder_view_sort
+ * @fv: a widget to apply
+ * @type: new mode of sorting (ascending or descending)
+ * @by: criteria of sorting
+ *
+ * Changes sorting in the view.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_view_sort(FmFolderView* fv, GtkSortType type, FmFolderModelViewCol by)
{
if(type == GTK_SORT_ASCENDING || type == GTK_SORT_DESCENDING)
@@ -783,16 +880,48 @@ void fm_folder_view_sort(FmFolderView* fv, GtkSortType type, FmFolderModelViewCo
fv->sort_by, fv->sort_type);
}
+/**
+ * fm_folder_view_get_sort_type
+ * @fv: a widget to inspect
+ *
+ * Retrieves current sorting type in @fv.
+ *
+ * Returns: mode of sorting (ascending or descending)
+ *
+ * Since: 0.1.0
+ */
GtkSortType fm_folder_view_get_sort_type(FmFolderView* fv)
{
return fv->sort_type;
}
+/**
+ * fm_folder_view_get_sort_by
+ * @fv: a widget to inspect
+ *
+ * Retrieves current criteria of sorting in @fv (e.g. by name).
+ *
+ * Returns: criteria of sorting.
+ *
+ * Since: 0.1.0
+ */
int fm_folder_view_get_sort_by(FmFolderView* fv)
{
return fv->sort_by;
}
+/**
+ * fm_folder_view_set_show_hidden
+ * @fv: a widget to apply
+ * @show: new setting
+ *
+ * Changes whether hidden files in folder shown in @fv should be visible
+ * or not.
+ *
+ * See also: fm_folder_view_get_show_hidden().
+ *
+ * Since: 0.1.0
+ */
void fm_folder_view_set_show_hidden(FmFolderView* fv, gboolean show)
{
if(show != fv->show_hidden )
@@ -803,6 +932,19 @@ void fm_folder_view_set_show_hidden(FmFolderView* fv, gboolean show)
}
}
+/**
+ * fm_folder_view_get_show_hidden
+ * @fv: a widget to inspect
+ *
+ * Retrieves setting whether hidden files in folder shown in @fv should
+ * be visible or not.
+ *
+ * Returns: %TRUE if hidden files are visible.
+ *
+ * See also: fm_folder_view_set_show_hidden().
+ *
+ * Since: 0.1.0
+ */
gboolean fm_folder_view_get_show_hidden(FmFolderView* fv)
{
return fv->show_hidden;
@@ -834,11 +976,17 @@ static GList* fm_folder_view_get_selected_tree_paths(FmFolderView* fv)
* fm_folder_view_dup_selected_files
* @fv: a FmFolderView object
*
- * Return value: An referenced FmFileInfoList containing FmFileInfos of
+ * Retrieves a list of
* the currently selected files. The list should be freed after usage with
* fm_file_info_list_unref(). If there are no files selected then return
* value is %NULL.
- **/
+ *
+ * Before 1.0.0 this API had name fm_folder_view_get_selected_files.
+ *
+ * Return value: (transfer full): list of selected file infos.
+ *
+ * Since: 0.1.0
+ */
static inline FmFileInfoList* fm_folder_view_get_selected_files(FmFolderView* fv)
{
/* don't generate the data again if we have it cached. */
@@ -876,11 +1024,17 @@ FmFileInfoList* fm_folder_view_dup_selected_files(FmFolderView* fv)
* fm_folder_view_dup_selected_file_paths
* @fv: a FmFolderView object
*
- * Return value: An referenced FmPathList containing FmPaths of the
+ * Retrieves a list of
* the currently selected files. The list should be freed after usage with
* fm_path_list_unref(). If there are no files selected then return value
* is %NULL.
- **/
+ *
+ * Before 1.0.0 this API had name fm_folder_view_get_selected_file_paths.
+ *
+ * Return value: (transfer full): list of selected file paths.
+ *
+ * Since: 0.1.0
+ */
FmPathList* fm_folder_view_dup_selected_file_paths(FmFolderView* fv)
{
if(!fv->cached_selected_file_paths)
@@ -897,7 +1051,6 @@ FmPathList* fm_folder_view_dup_selected_file_paths(FmFolderView* fv)
static void on_sel_changed(GObject* obj, FmFolderView* fv)
{
/* FIXME: this is inefficient, but currently there is no better way */
- FmFileInfoList* files;
/* clear cached selected files */
if(fv->cached_selected_files)
@@ -915,11 +1068,26 @@ static void on_sel_changed(GObject* obj, FmFolderView* fv)
if(g_signal_has_handler_pending(fv, signals[SEL_CHANGED], 0, TRUE))
{
/* get currently selected files, and cached them inside fm_folder_view_dup_selected_files(). */
- files = fm_folder_view_dup_selected_files(fv);
+ gint files = 0;
+
+ switch(fv->mode)
+ {
+ case FM_FV_LIST_VIEW:
+ {
+ GtkTreeSelection* sel;
+ sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(fv->view));
+ files = gtk_tree_selection_count_selected_rows(sel);
+ break;
+ }
+ case FM_FV_ICON_VIEW:
+ case FM_FV_COMPACT_VIEW:
+ case FM_FV_THUMBNAIL_VIEW:
+ files = exo_icon_view_count_selected_items(EXO_ICON_VIEW(fv->view));
+ break;
+ }
/* emit a selection changed notification to the world. */
g_signal_emit(fv, signals[SEL_CHANGED], 0, files);
- fm_file_info_list_unref(files);
}
}
@@ -1021,6 +1189,14 @@ void fm_folder_view_select_custom(FmFolderView* fv, GFunc filter, gpointer user_
{
}
+/**
+ * fm_folder_view_select_all
+ * @fv: a widget to apply
+ *
+ * Selects all files in folder.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_view_select_all(FmFolderView* fv)
{
GtkTreeSelection * tree_sel;
@@ -1048,7 +1224,14 @@ static void on_dnd_src_data_get(FmDndSrc* ds, FmFolderView* fv)
}
}
-
+/**
+ * fm_folder_view_select_invert
+ * @fv: a widget to apply
+ *
+ * Selects all unselected files in @fv but unselects all selected.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_view_select_invert(FmFolderView* fv)
{
switch(fv->mode)
@@ -1092,6 +1275,15 @@ void fm_folder_view_select_invert(FmFolderView* fv)
}
}
+/**
+ * fm_folder_view_select_file_path
+ * @fv: a widget to apply
+ * @path: a file path to select
+ *
+ * Selects a file in the folder.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_view_select_file_path(FmFolderView* fv, FmPath* path)
{
FmPath* cwd = fm_folder_view_get_cwd(fv);
@@ -1126,6 +1318,15 @@ void fm_folder_view_select_file_path(FmFolderView* fv, FmPath* path)
}
}
+/**
+ * fm_folder_view_select_file_paths
+ * @fv: a widget to apply
+ * @paths: list of files to select
+ *
+ * Selects few files in the folder.
+ *
+ * Since: 0.1.0
+ */
void fm_folder_view_select_file_paths(FmFolderView* fv, FmPathList* paths)
{
GList* l;
@@ -1136,12 +1337,34 @@ void fm_folder_view_select_file_paths(FmFolderView* fv, FmPathList* paths)
}
}
+/**
+ * fm_folder_view_get_cwd_info
+ * @fv: a widget to inspect
+ *
+ * Retrieves file info of the folder shown by @fv. Returned data are
+ * owned by @fv and should not be freed by caller.
+ *
+ * Returns: (transfer none): file info descriptor of the folder.
+ *
+ * Since: 0.1.0
+ */
FmFileInfo* fm_folder_view_get_cwd_info(FmFolderView* fv)
{
FmFolder* folder = fm_folder_view_get_folder(fv);
return folder ? fm_folder_get_info(folder) : NULL;
}
+/**
+ * fm_folder_view_get_cwd
+ * @fv: a widget to inspect
+ *
+ * Retrieves file path of the folder shown by @fv. Returned data are
+ * owned by @fv and should not be freed by caller.
+ *
+ * Returns: (transfer none): file path of the folder.
+ *
+ * Since: 0.1.0
+ */
FmPath* fm_folder_view_get_cwd(FmFolderView* fv)
{
FmFolder* folder = fm_folder_view_get_folder(fv);
@@ -1166,16 +1389,47 @@ static void cancel_pending_row_activated(FmFolderView* fv)
}
}
+/**
+ * fm_folder_view_get_model
+ * @fv: a widget to inspect
+ *
+ * Retrieves the model used by @fv. Returned data are owned by @fv and
+ * should not be freed by caller.
+ *
+ * Returns: (transfer none): the model of view.
+ *
+ * Since: 0.1.16
+ */
FmFolderModel* fm_folder_view_get_model(FmFolderView* fv)
{
return fv->model;
}
+/**
+ * fm_folder_view_get_folder
+ * @fv: a widget to inspect
+ *
+ * Retrieves the folder shown by @fv. Returned data are owned by @fv and
+ * should not be freed by caller.
+ *
+ * Returns: (transfer none): the folder of view.
+ *
+ * Since: 1.0.0
+ */
FmFolder* fm_folder_view_get_folder(FmFolderView* fv)
{
return fv->model ? fm_folder_model_get_folder(fv->model) : NULL;
}
+/**
+ * fm_folder_view_set_model
+ * @fv: a widget to apply
+ * @model: (allow-none): new view model
+ *
+ * Changes model for the @fv.
+ *
+ * Since: 1.0.0
+ */
void fm_folder_view_set_model(FmFolderView* fv, FmFolderModel* model)
{
int icon_size;
View
42 src/gtk/fm-folder-view.h
@@ -43,37 +43,59 @@ G_BEGIN_DECLS
#define FM_IS_FOLDER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
FM_FOLDER_VIEW_TYPE))
-enum _FmFolderViewMode
+/**
+ * FmFolderViewMode
+ * @FM_FV_ICON_VIEW: standard icon view
+ * @FM_FV_COMPACT_VIEW: view with small icons and text on right of them
+ * @FM_FV_THUMBNAIL_VIEW: view with big icons/thumbnails
+ * @FM_FV_LIST_VIEW: table-form view
+ */
+typedef enum
{
FM_FV_ICON_VIEW,
FM_FV_COMPACT_VIEW,
FM_FV_THUMBNAIL_VIEW,
FM_FV_LIST_VIEW
-};
-typedef enum _FmFolderViewMode FmFolderViewMode;
+} FmFolderViewMode;
#define FM_FOLDER_VIEW_MODE_IS_VALID(mode) ((guint)mode <= FM_FV_LIST_VIEW)
-enum _FmFolderViewClickType
+/**
+ * FmFolderViewClickType
+ * @FM_FV_CLICK_NONE: no click
+ * @FM_FV_ACTIVATED: this can be triggered by both
+ left single or double click depending on
+ whether single-click activation is used or not.
+ * @FM_FV_MIDDLE_CLICK: middle mouse button pressed
+ * @FM_FV_CONTEXT_MENU: right mouse button pressed
+ *
+ * Click type for #FmFolderView::clicked signal handlers.
+ */
+typedef enum
{
FM_FV_CLICK_NONE,
- FM_FV_ACTIVATED, /* this can be triggered by both
- left single or double click depending on
- whether single-click activation is used or not. */
+ FM_FV_ACTIVATED,
FM_FV_MIDDLE_CLICK,
FM_FV_CONTEXT_MENU
-};
-typedef enum _FmFolderViewClickType FmFolderViewClickType;
+} FmFolderViewClickType;
+
#define FM_FOLDER_VIEW_CLICK_TYPE_IS_VALID(type) (type > FM_FV_CLICK_NONE && type <= FM_FV_CONTEXT_MENU)
typedef struct _FmFolderView FmFolderView;
typedef struct _FmFolderViewClass FmFolderViewClass;
+/**
+ * FmFolderViewClass:
+ * @parent_class: the parent class
+ * @clicked: the class closure for the #FmFolderView::clicked signal
+ * @sel_changed: the class closure for the #FmFolderView::sel-changed signal
+ * @sort_changed: the class closure for the #FmFolderView::sort-changed signal
+ */
struct _FmFolderViewClass
{
GtkScrolledWindowClass parent_class;
void (*clicked)(FmFolderView* fv, FmFolderViewClickType type, FmFileInfo* file);
- void (*sel_changed)(FmFolderView* fv, FmFileInfoList* sels);
+ void (*sel_changed)(FmFolderView* fv, gint n_sel);
void (*sort_changed)(FmFolderView* fv);
};
View
52 src/gtk/fm-path-bar.c
@@ -19,6 +19,16 @@
* MA 02110-1301, USA.
*/
+/**
+ * SECTION:fm-path-bar
+ * @short_description: A widget for representing current path.
+ * @title: FmPathBar
+ *
+ * @include: libfm/fm-path-bar.h
+ *
+ * The #FmPathBar represents current path as number of buttons so it is
+ * possible to click buttons to change directory to parent or child.
+ */
#include "fm-path-bar.h"
#include <string.h>
@@ -68,8 +78,16 @@ static void fm_path_bar_class_init(FmPathBarClass *klass)
btn_data_id = g_quark_from_static_string("FmPathBtn");
- /* chdir signal is emitted when the user toggles a path element
- * in the bar and when a new path is set via fm_path_bar_set_path. */
+ /**
+ * FmPathBar::chdir:
+ * @bar: the object which emitted the signal
+ * @path: (#FmPath *) new path
+ *
+ * The FmPathBar::chdir signal is emitted when the user toggles a path
+ * element in the bar or when new path is set via fm_path_bar_set_path().
+ *
+ * Since: 0.1.16
+ */
signals[CHDIR] =
g_signal_new("chdir",
G_TYPE_FROM_CLASS(klass),
@@ -156,12 +174,31 @@ static void fm_path_bar_init(FmPathBar *bar)
gtk_widget_show_all(GTK_WIDGET(bar));
}
-
+/**
+ * fm_path_bar_new
+ *
+ * Creates new path bar.
+ *
+ * Returns: (transfer full): a new #FmPathBar object.
+ *
+ * Since: 0.1.16
+ */
FmPathBar* fm_path_bar_new(void)
{
return (FmPathBar*)g_object_new(FM_TYPE_PATH_BAR, NULL);
}
+/**
+ * fm_path_bar_get_path
+ * @bar: a path bar widget
+ *
+ * Retrieves current path from path bar. Returned data are owned by @bar
+ * and should be not freed by caller.
+ *
+ * Returns: (transfer none): current path.
+ *
+ * Since: 0.1.16
+ */
FmPath* fm_path_bar_get_path(FmPathBar* bar)
{
return bar->cur_path;
@@ -198,6 +235,15 @@ static GtkRadioButton* create_btn(FmPathBar* bar, GSList* grp, FmPath* path_elem
return btn;
}
+/**
+ * fm_path_bar_set_path
+ * @bar: a path bar widget
+ * @path: a new path to set
+ *
+ * Changes path for the @bar.
+ *
+ * Since: 0.1.16
+ */
void fm_path_bar_set_path(FmPathBar* bar, FmPath* path)
{
FmPath* path_element;
View
5 src/gtk/fm-path-bar.h
@@ -55,6 +55,11 @@ struct _FmPathBar
FmPath* full_path; /* full path shown in the bar */
};
+/**
+ * FmPathBarClass:
+ * @parent_class: the parent class
+ * @chdir: the class closure for the #FmPathBar::chdir signal
+ */
struct _FmPathBarClass
{
GtkHBoxClass parent_class;
View
50 src/gtk/fm-path-entry.c
@@ -20,6 +20,17 @@
* MA 02110-1301, USA.
*/
+/**
+ * SECTION:fm-path-entry
+ * @short_description: An entry to enter path with completion.
+ * @title: FmPathEntry
+ *
+ * @include: libfm/fm-path-entry.h
+ *
+ * The #FmPathEntry represents a widget to enter folder path for changing
+ * current directory.
+ */
+
#include "fm-path-entry.h"
/* for completion */
#include "fm-folder-model.h"
@@ -189,6 +200,14 @@ static void fm_path_entry_class_init(FmPathEntryClass *klass)
object_class->get_property = fm_path_entry_get_property;
object_class->set_property = fm_path_entry_set_property;
+ /**
+ * FmPathEntry:highlight-completion-match:
+ *
+ * The #FmPathEntry:highlight-completion-match property is the flag
+ * whether the completion match should be highlighted or not.
+ *
+ * Since: 0.1.0
+ */
g_object_class_install_property( object_class,
PROP_HIGHLIGHT_COMPLETION_MATCH,
g_param_spec_boolean("highlight-completion-match",
@@ -574,11 +593,29 @@ fm_path_entry_finalize(GObject *object)
(*G_OBJECT_CLASS(fm_path_entry_parent_class)->finalize)(object);
}
-FmPathEntry* fm_path_entry_new()
+/**
+ * fm_path_entry_new
+ *
+ * Creates new path entry widget.
+ *
+ * Returns: (transfer full): a new #FmPathEntry object.
+ *
+ * Since: 0.1.0
+ */
+FmPathEntry* fm_path_entry_new(void)
{
return g_object_new(FM_TYPE_PATH_ENTRY, NULL);
}
+/**
+ * fm_path_entry_set_path
+ * @entry: a widget to apply
+ * @path: new path to set
+ *
+ * Sets new path into enter field.
+ *
+ * Since: 0.1.10
+ */
void fm_path_entry_set_path(FmPathEntry *entry, FmPath* path)
{
FmPathEntryPrivate *priv = FM_PATH_ENTRY_GET_PRIVATE(entry);
@@ -626,6 +663,17 @@ static gboolean fm_path_entry_match_func(GtkEntryCompletion *completion,
}
+/**
+ * fm_path_entry_get_path
+ * @entry: the widget to inspect
+ *
+ * Retrieves the current path in the @entry. Returned data are owned by
+ * @entry and should be not freed by caller.
+ *
+ * Returns: (transfer none): the current path.
+ *
+ * Since: 0.1.10
+ */
FmPath* fm_path_entry_get_path(FmPathEntry *entry)
{
FmPathEntryPrivate *priv = FM_PATH_ENTRY_GET_PRIVATE(entry);
View
1  src/gtk/fm-path-entry.h
@@ -48,6 +48,7 @@ struct _FmPathEntry
struct _FmPathEntryClass
{
+ /*< private >*/
GtkEntryClass parent_class;
};
Please sign in to comment.
Something went wrong with that request. Please try again.