projects
/
platform
/
upstream
/
glib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GVariant: support serialising to GVariantVectors
[platform/upstream/glib.git]
/
gio
/
gfilenamecompleter.c
diff --git
a/gio/gfilenamecompleter.c
b/gio/gfilenamecompleter.c
index
2177407
..
f1d9f8a
100644
(file)
--- a/
gio/gfilenamecompleter.c
+++ b/
gio/gfilenamecompleter.c
@@
-13,20
+13,21
@@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Author: Alexander Larsson <alexl@redhat.com>
*/
#include "config.h"
#include "gfilenamecompleter.h"
*
* Author: Alexander Larsson <alexl@redhat.com>
*/
#include "config.h"
#include "gfilenamecompleter.h"
+#include "gfileenumerator.h"
+#include "gfileattribute.h"
#include "gfile.h"
#include "gfile.h"
+#include "gfileinfo.h"
+#include "gcancellable.h"
#include <string.h>
#include "glibintl.h"
#include <string.h>
#include "glibintl.h"
-#include "gioalias.h"
/**
* SECTION:gfilenamecompleter
/**
* SECTION:gfilenamecompleter
@@
-61,8
+62,8
@@
struct _GFilenameCompleter {
GFile *basenames_dir;
gboolean basenames_are_escaped;
GFile *basenames_dir;
gboolean basenames_are_escaped;
- GList *basenames;
gboolean dirs_only;
gboolean dirs_only;
+ GList *basenames;
LoadBasenamesData *basename_loader;
};
LoadBasenamesData *basename_loader;
};
@@
-83,8
+84,7
@@
g_filename_completer_finalize (GObject *object)
if (completer->basenames_dir)
g_object_unref (completer->basenames_dir);
if (completer->basenames_dir)
g_object_unref (completer->basenames_dir);
- g_list_foreach (completer->basenames, (GFunc)g_free, NULL);
- g_list_free (completer->basenames);
+ g_list_free_full (completer->basenames, g_free);
G_OBJECT_CLASS (g_filename_completer_parent_class)->finalize (object);
}
G_OBJECT_CLASS (g_filename_completer_parent_class)->finalize (object);
}
@@
-100,7
+100,7
@@
g_filename_completer_class_init (GFilenameCompleterClass *klass)
*
* Emitted when the file name completion information comes available.
**/
*
* Emitted when the file name completion information comes available.
**/
- signals[GOT_COMPLETION_DATA] = g_signal_new (I_("got
_completion_
data"),
+ signals[GOT_COMPLETION_DATA] = g_signal_new (I_("got
-completion-
data"),
G_TYPE_FILENAME_COMPLETER,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GFilenameCompleterClass, got_completion_data),
G_TYPE_FILENAME_COMPLETER,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GFilenameCompleterClass, got_completion_data),
@@
-152,8
+152,7
@@
load_basenames_data_free (LoadBasenamesData *data)
g_object_unref (data->cancellable);
g_object_unref (data->dir);
g_object_unref (data->cancellable);
g_object_unref (data->dir);
- g_list_foreach (data->basenames, (GFunc)g_free, NULL);
- g_list_free (data->basenames);
+ g_list_free_full (data->basenames, g_free);
g_free (data);
}
g_free (data);
}
@@
-240,8
+239,7
@@
got_more_files (GObject *source_object,
if (data->completer->basenames_dir)
g_object_unref (data->completer->basenames_dir);
if (data->completer->basenames_dir)
g_object_unref (data->completer->basenames_dir);
- g_list_foreach (data->completer->basenames, (GFunc)g_free, NULL);
- g_list_free (data->completer->basenames);
+ g_list_free_full (data->completer->basenames, g_free);
data->completer->basenames_dir = g_object_ref (data->dir);
data->completer->basenames = data->basenames;
data->completer->basenames_dir = g_object_ref (data->dir);
data->completer->basenames = data->basenames;
@@
-278,8
+276,7
@@
got_enum (GObject *source_object,
if (data->completer->basenames_dir)
g_object_unref (data->completer->basenames_dir);
if (data->completer->basenames_dir)
g_object_unref (data->completer->basenames_dir);
- g_list_foreach (data->completer->basenames, (GFunc)g_free, NULL);
- g_list_free (data->completer->basenames);
+ g_list_free_full (data->completer->basenames, g_free);
/* Mark uptodate with no basenames */
data->completer->basenames_dir = g_object_ref (data->dir);
/* Mark uptodate with no basenames */
data->completer->basenames_dir = g_object_ref (data->dir);
@@
-461,12
+458,12
@@
g_filename_completer_get_completion_suffix (GFilenameCompleter *completer,
*
* Gets an array of completion strings for a given initial text.
*
*
* Gets an array of completion strings for a given initial text.
*
- * Returns: array of strings with possible completions for @initial_text.
+ * Returns:
(array zero-terminated=1) (transfer full):
array of strings with possible completions for @initial_text.
* This array must be freed by g_strfreev() when finished.
**/
char **
g_filename_completer_get_completions (GFilenameCompleter *completer,
* This array must be freed by g_strfreev() when finished.
**/
char **
g_filename_completer_get_completions (GFilenameCompleter *completer,
- const char *initial_text)
+ const char
*initial_text)
{
GList *possible_matches, *l;
char *prefix;
{
GList *possible_matches, *l;
char *prefix;
@@
-482,14
+479,16
@@
g_filename_completer_get_completions (GFilenameCompleter *completer,
for (l = possible_matches; l != NULL; l = l->next)
{
possible_match = l->data;
for (l = possible_matches; l != NULL; l = l->next)
{
possible_match = l->data;
-
+
if (g_str_has_prefix (possible_match, prefix))
g_ptr_array_add (res,
g_strconcat (initial_text, possible_match + strlen (prefix), NULL));
}
g_free (prefix);
if (g_str_has_prefix (possible_match, prefix))
g_ptr_array_add (res,
g_strconcat (initial_text, possible_match + strlen (prefix), NULL));
}
g_free (prefix);
-
+
+ g_ptr_array_add (res, NULL);
+
return (char**)g_ptr_array_free (res, FALSE);
}
return (char**)g_ptr_array_free (res, FALSE);
}
@@
-509,6
+508,3
@@
g_filename_completer_set_dirs_only (GFilenameCompleter *completer,
completer->dirs_only = dirs_only;
}
completer->dirs_only = dirs_only;
}
-
-#define __G_FILENAME_COMPLETER_C__
-#include "gioaliasdef.c"