annotate finch/libgnt/gntfilesel.h @ 32796:5ae7e1f36b43

Fix a possible XMPP remote crash A series of specially crafted file transfer requests can cause clients to reference invalid memory. The user must have accepted one of the file transfer requests. The fix is to correctly cancel and free a SOCKS5 connection attempt so that it does not trigger an attempt to access invalid memory later. This was reported to us by Jos«± Valent«żn Guti«±rrez and this patch is written by Paul Aurich.
author Mark Doliner <mark@kingant.net>
date Mon, 07 May 2012 03:16:31 +0000
parents ae330012956f
children 5876584828e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
1 /**
18303
5c6f019e48f8 Generate doxy-help files for libgnt. And make it actually work.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17928
diff changeset
2 * @file gntfilesel.h File selector API
5c6f019e48f8 Generate doxy-help files for libgnt. And make it actually work.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17928
diff changeset
3 * @ingroup gnt
5c6f019e48f8 Generate doxy-help files for libgnt. And make it actually work.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17928
diff changeset
4 */
5c6f019e48f8 Generate doxy-help files for libgnt. And make it actually work.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17928
diff changeset
5 /*
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
6 * GNT - The GLib Ncurses Toolkit
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
7 *
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
8 * GNT is the legal property of its developers, whose names are too numerous
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
10 * source distribution.
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
11 *
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
12 * This library is free software; you can redistribute it and/or modify
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
13 * it under the terms of the GNU General Public License as published by
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
15 * (at your option) any later version.
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
16 *
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
17 * This program is distributed in the hope that it will be useful,
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
20 * GNU General Public License for more details.
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
21 *
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
22 * You should have received a copy of the GNU General Public License
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
23 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18303
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
25 */
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
26
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
27 #ifndef GNT_FILE_SEL_H
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
28 #define GNT_FILE_SEL_H
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
29
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
30 #include "gntwindow.h"
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
31 #include "gnt.h"
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
32 #include "gntcolors.h"
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
33 #include "gntkeys.h"
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
34
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
35 #define GNT_TYPE_FILE_SEL (gnt_file_sel_get_gtype())
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
36 #define GNT_FILE_SEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_FILE_SEL, GntFileSel))
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
37 #define GNT_FILE_SEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_FILE_SEL, GntFileSelClass))
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
38 #define GNT_IS_FILE_SEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_FILE_SEL))
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
39 #define GNT_IS_FILE_SEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_FILE_SEL))
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
40 #define GNT_FILE_SEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_FILE_SEL, GntFileSelClass))
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
41
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
42 #define GNT_FILE_SEL_FLAGS(obj) (GNT_FILE_SEL(obj)->priv.flags)
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
43 #define GNT_FILE_SEL_SET_FLAGS(obj, flags) (GNT_FILE_SEL_FLAGS(obj) |= flags)
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
44 #define GNT_FILE_SEL_UNSET_FLAGS(obj, flags) (GNT_FILE_SEL_FLAGS(obj) &= ~(flags))
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
45
15923
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
46 typedef struct _GntFileSel GntFileSel;
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
47 typedef struct _GntFileSelPriv GntFileSelPriv;
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
48 typedef struct _GntFileSelClass GntFileSelClass;
15988
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
49 typedef struct _GntFile GntFile;
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
50
15923
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
51 struct _GntFileSel
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
52 {
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
53 GntWindow parent;
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
54
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
55 GntWidget *dirs; /* list of files */
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
56 GntWidget *files; /* list of directories */
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
57 GntWidget *location; /* location entry */
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
58
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
59 GntWidget *select; /* select button */
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
60 GntWidget *cancel; /* cancel button */
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
61
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
62 char *current; /* Full path of the current location */
15936
0f1ab43db297 fix file saving
Richard Nelson <wabz@pidgin.im>
parents: 15926
diff changeset
63 char *suggest; /* Suggested filename */
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
64 /* XXX: someone should make these useful */
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
65 gboolean must_exist; /* Make sure the selected file (the name entered in 'location') exists */
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
66 gboolean dirsonly; /* Show only directories */
15923
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
67 gboolean multiselect;
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
68 GList *tags; /* List of tagged files when multiselect is set */
15988
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
69
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
70 gboolean (*read_fn)(const char *path, GList **files, GError **error);
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
71 };
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
72
15923
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
73 struct _GntFileSelClass
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
74 {
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
75 GntWindowClass parent;
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
76
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
77 void (*file_selected)(GntFileSel *sel, const char *path, const char *filename);
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
78 void (*gnt_reserved1)(void);
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
79 void (*gnt_reserved2)(void);
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
80 void (*gnt_reserved3)(void);
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
81 void (*gnt_reserved4)(void);
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
82 };
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
83
15988
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
84 typedef enum _GntFileType
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
85 {
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
86 GNT_FILE_REGULAR,
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
87 GNT_FILE_DIR
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
88 } GntFileType;
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
89
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
90 struct _GntFile
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
91 {
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
92 char *fullpath;
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
93 char *basename;
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
94 GntFileType type;
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
95 unsigned long size;
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
96 };
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
97
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
98 G_BEGIN_DECLS
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
99
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
100 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
101 * @return GType for GntFileSel.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
102 */
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
103 GType gnt_file_sel_get_gtype(void);
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
104
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
105 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
106 * Create a new file selector.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
107 *
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
108 * @return The newly created file selector.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
109 */
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
110 GntWidget * gnt_file_sel_new(void);
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
111
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
112 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
113 * Set the current location of the file selector.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
114 *
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
115 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
116 * @param path The current path of the selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
117 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
118 * @return @c TRUE if the current location was successfully changed, @c FALSE otherwise.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
119 */
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
120 gboolean gnt_file_sel_set_current_location(GntFileSel *sel, const char *path);
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
121
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
122 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
123 * Set wheter to only allow selecting directories.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
124 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
125 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
126 * @param dirs @c TRUE if only directories can be selected, @c FALSE if files
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
127 * can also be selected.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
128 */
15848
3da9d5da9054 Directory only selection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15846
diff changeset
129 void gnt_file_sel_set_dirs_only(GntFileSel *sel, gboolean dirs);
3da9d5da9054 Directory only selection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15846
diff changeset
130
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
131 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
132 * Check whether the file selector allows only selecting directories.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
133 *
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
134 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
135 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
136 * @return @c TRUE if only directories can be selected.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
137 */
15848
3da9d5da9054 Directory only selection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15846
diff changeset
138 gboolean gnt_file_sel_get_dirs_only(GntFileSel *sel);
3da9d5da9054 Directory only selection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15846
diff changeset
139
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
140 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
141 * Set whether a selected file must exist.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
142 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
143 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
144 * @param must @c TRUE if the selected file must exist.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
145 */
15849
65b45106bfbb Use the file selector for request-file.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15848
diff changeset
146 void gnt_file_sel_set_must_exist(GntFileSel *sel, gboolean must);
65b45106bfbb Use the file selector for request-file.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15848
diff changeset
147
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
148 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
149 * Check whether the selector allows selecting non-existent files.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
150 *
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
151 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
152 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
153 * @return @c TRUE if the selected file must exist, @c FALSE if a non-existent
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
154 * file can be selected.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
155 */
15849
65b45106bfbb Use the file selector for request-file.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15848
diff changeset
156 gboolean gnt_file_sel_get_must_exist(GntFileSel *sel);
65b45106bfbb Use the file selector for request-file.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15848
diff changeset
157
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
158 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
159 * Get the selected file in the selector.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
160 *
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
161 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
162 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
163 * @return The path of the selected file. The caller should g_free the returned
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
164 * string.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
165 */
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
166 char * gnt_file_sel_get_selected_file(GntFileSel *sel);
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
167
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
168 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
169 * Get the list of selected files in the selector.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
170 *
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
171 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
172 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
173 * @return A list of paths for the selected files. The caller must g_free the
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
174 * contents of the list, and g_list_free the list.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
175 */
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
176 GList * gnt_file_sel_get_selected_multi_files(GntFileSel *sel);
15923
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
177
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
178 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
179 * Allow selecting multiple files.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
180 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
181 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
182 * @param set @c TRUE if selecting multiple files should be allowed.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
183 */
15923
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
184 void gnt_file_sel_set_multi_select(GntFileSel *sel, gboolean set);
f8c16848b76d Allow selecting multiple files from the file-select dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15922
diff changeset
185
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
186 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
187 * Set the suggested file to have selected at startup.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
188 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
189 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
190 * @param suggest The suggested filename.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
191 */
15936
0f1ab43db297 fix file saving
Richard Nelson <wabz@pidgin.im>
parents: 15926
diff changeset
192 void gnt_file_sel_set_suggested_filename(GntFileSel *sel, const char *suggest);
0f1ab43db297 fix file saving
Richard Nelson <wabz@pidgin.im>
parents: 15926
diff changeset
193
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
194 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
195 * Set custom functions to read the names of files.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
196 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
197 * @param sel The file selector.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
198 * @param read_fn The custom read function.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
199 */
15988
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
200 void gnt_file_sel_set_read_fn(GntFileSel *sel, gboolean (*read_fn)(const char *path, GList **files, GError **error));
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
201
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
202 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
203 * Create a new GntFile.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
204 *
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
205 * @param name The name of the file.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
206 * @param size The size of the file.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
207 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
208 * @return The newly created GntFile.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
209 */
15988
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
210 GntFile* gnt_file_new(const char *name, unsigned long size);
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
211
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
212 /**
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
213 * Create a new GntFile for a directory.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
214 *
21253
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
215 * @param name The name of the directory.
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
216 *
ae330012956f Doxygen for gnt.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
217 * @return The newly created GntFile.
17928
8410511f4dbb applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents: 15988
diff changeset
218 */
15988
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
219 GntFile* gnt_file_new_dir(const char *name);
e05e5b148723 Allow using different methods for reading directory entries.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15936
diff changeset
220
15846
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
221 G_END_DECLS
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
222
a2ab257116ce File selector dialog. Still in an experimental state. When properly complete, this can be used for file/folder-request etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
223 #endif /* GNT_FILE_SEL_H */
15925
5b065c7ff5cd merge of '04076a446ca2bc48c37d00b8b255bc1311b6c51c'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15850 15923
diff changeset
224