~noskcaj/ubuntu/utopic/libfm/merge

« back to all changes in this revision

Viewing changes to src/gtk/fm-folder-view.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Lee (李健秋)
  • Date: 2010-04-29 03:52:06 UTC
  • Revision ID: james.westby@ubuntu.com-20100429035206-qlj1jwsfcgr5mdx3
Tags: upstream-0.1.11
Import upstream version 0.1.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *      folder-view.h
 
3
 *
 
4
 *      Copyright 2009 PCMan <pcman.tw@gmail.com>
 
5
 *
 
6
 *      This program is free software; you can redistribute it and/or modify
 
7
 *      it under the terms of the GNU General Public License as published by
 
8
 *      the Free Software Foundation; either version 2 of the License, or
 
9
 *      (at your option) any later version.
 
10
 *
 
11
 *      This program is distributed in the hope that it will be useful,
 
12
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *      GNU General Public License for more details.
 
15
 *
 
16
 *      You should have received a copy of the GNU General Public License
 
17
 *      along with this program; if not, write to the Free Software
 
18
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
19
 *      MA 02110-1301, USA.
 
20
 */
 
21
 
 
22
 
 
23
#ifndef __FOLDER_VIEW_H__
 
24
#define __FOLDER_VIEW_H__
 
25
 
 
26
#include <gtk/gtk.h>
 
27
#include "fm-file-info.h"
 
28
#include "fm-path.h"
 
29
#include "fm-dnd-src.h"
 
30
#include "fm-dnd-dest.h"
 
31
#include "fm-folder.h"
 
32
 
 
33
G_BEGIN_DECLS
 
34
 
 
35
#define FM_FOLDER_VIEW_TYPE                             (fm_folder_view_get_type())
 
36
#define FM_FOLDER_VIEW(obj)                             (G_TYPE_CHECK_INSTANCE_CAST((obj),\
 
37
                        FM_FOLDER_VIEW_TYPE, FmFolderView))
 
38
#define FM_FOLDER_VIEW_CLASS(klass)             (G_TYPE_CHECK_CLASS_CAST((klass),\
 
39
                        FM_FOLDER_VIEW_TYPE, FmFolderViewClass))
 
40
#define IS_FM_FOLDER_VIEW(obj)                  (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
 
41
                        FM_FOLDER_VIEW_TYPE))
 
42
#define IS_FM_FOLDER_VIEW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),\
 
43
                        FM_FOLDER_VIEW_TYPE))
 
44
 
 
45
typedef enum _FmFolderViewMode FmFolderViewMode;
 
46
enum _FmFolderViewMode
 
47
{
 
48
        FM_FV_ICON_VIEW,
 
49
        FM_FV_COMPACT_VIEW,
 
50
    FM_FV_THUMBNAIL_VIEW,
 
51
        FM_FV_LIST_VIEW
 
52
};
 
53
 
 
54
typedef enum _FmFolderViewClickType FmFolderViewClickType;
 
55
enum _FmFolderViewClickType
 
56
{
 
57
        FM_FV_CLICK_NONE,
 
58
        FM_FV_ACTIVATED, /* this can be triggered by both
 
59
                                                left single or double click depending on
 
60
                                                whether single-click activation is used or not. */
 
61
        FM_FV_MIDDLE_CLICK,
 
62
        FM_FV_CONTEXT_MENU
 
63
};
 
64
 
 
65
typedef struct _FmFolderView                    FmFolderView;
 
66
typedef struct _FmFolderViewClass               FmFolderViewClass;
 
67
 
 
68
struct _FmFolderView
 
69
{
 
70
        GtkScrolledWindow parent;
 
71
 
 
72
        FmFolderViewMode mode;
 
73
        GtkSelectionMode sel_mode;
 
74
        GtkSortType sort_type;
 
75
        int sort_by;
 
76
 
 
77
        gboolean show_hidden;
 
78
 
 
79
        GtkWidget* view;
 
80
    FmFolder* folder;
 
81
        GtkTreeModel* model;
 
82
    GtkCellRenderer* renderer_pixbuf;
 
83
    guint icon_size_changed_handler;
 
84
 
 
85
        FmPath* cwd;
 
86
        FmDndSrc* dnd_src; /* dnd source manager */
 
87
        FmDndDest* dnd_dest; /* dnd dest manager */
 
88
 
 
89
    /* wordarounds to fix new gtk+ bug introduced in gtk+ 2.20: #612802 */
 
90
    GtkTreeRowReference* activated_row_ref; /* for row-activated handler */
 
91
    guint row_activated_idle;
 
92
};
 
93
 
 
94
struct _FmFolderViewClass
 
95
{
 
96
        GtkScrolledWindowClass parent_class;
 
97
        void (*chdir)(FmFolderView* fv, FmPath* dir_path);
 
98
        void (*loaded)(FmFolderView* fv, FmPath* dir_path);
 
99
        void (*status)(FmFolderView* fv, const char* msg);
 
100
        void (*clicked)(FmFolderView* fv, FmFolderViewClickType type, FmFileInfo* file);
 
101
    void (*sel_changed)(FmFolderView* fv, FmFileInfoList* sels);
 
102
    void (*sort_changed)(FmFolderView* fv);
 
103
};
 
104
 
 
105
GType           fm_folder_view_get_type         (void);
 
106
GtkWidget*      fm_folder_view_new                      (FmFolderViewMode mode);
 
107
 
 
108
void fm_folder_view_set_mode(FmFolderView* fv, FmFolderViewMode mode);
 
109
FmFolderViewMode fm_folder_view_get_mode(FmFolderView* fv);
 
110
 
 
111
void fm_folder_view_set_selection_mode(FmFolderView* fv, GtkSelectionMode mode);
 
112
GtkSelectionMode fm_folder_view_get_selection_mode(FmFolderView* fv);
 
113
 
 
114
void fm_folder_view_sort(FmFolderView* fv, GtkSortType type, int by);
 
115
GtkSortType fm_folder_view_get_sort_type(FmFolderView* fv);
 
116
int fm_folder_view_get_sort_by(FmFolderView* fv);
 
117
 
 
118
void fm_folder_view_set_show_hidden(FmFolderView* fv, gboolean show);
 
119
gboolean fm_folder_view_get_show_hidden(FmFolderView* fv);
 
120
 
 
121
gboolean fm_folder_view_chdir(FmFolderView* fv, FmPath* path);
 
122
gboolean fm_folder_view_chdir_by_name(FmFolderView* fv, const char* path_str);
 
123
FmPath* fm_folder_view_get_cwd(FmFolderView* fv);
 
124
FmFileInfo* fm_folder_view_get_cwd_info(FmFolderView* fv);
 
125
 
 
126
FmFileInfoList* fm_folder_view_get_selected_files(FmFolderView* fv);
 
127
FmPathList* fm_folder_view_get_selected_file_paths(FmFolderView* fv);
 
128
 
 
129
void fm_folder_view_select_all(FmFolderView* fv);
 
130
void fm_folder_view_select_invert(FmFolderView* fv);
 
131
void fm_folder_view_select_file_path(FmFolderView* fv, FmPath* path);
 
132
void fm_folder_view_select_file_paths(FmFolderView* fv, FmPathList* paths);
 
133
 
 
134
/* select files by custom func, not yet implemented */
 
135
void fm_folder_view_custom_select(FmFolderView* fv, GFunc filter, gpointer user_data);
 
136
 
 
137
 
 
138
G_END_DECLS
 
139
 
 
140
#endif /* __FOLDER_VIEW_H__ */