summaryrefslogtreecommitdiffstats
path: root/gnome-autoar/autoar-common.h
blob: 2070c5538bf7ea66e64a7c02814f1b16ef58d921 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* vim: set sw=2 ts=2 sts=2 et: */
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * autoar-common.h
 * Some common functions used in several classes of autoarchive
 * This file does NOT declare any new classes!
 *
 * Copyright (C) 2013  Ting-Wei Lan
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 */

#ifndef AUTOAR_COMMON_H
#define AUTOAR_COMMON_H

/* archive.h use time_t */
#include <time.h>

#include <archive.h>
#include <archive_entry.h>
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>

G_BEGIN_DECLS

/**
 * AUTOAR_LIBARCHIVE_ERROR:
 *
 * Error domain for libarchive. Error returned by functions in libarchive uses
 * this domain. Error code and messages are got using archive_errno() and
 * archive_error_string().
 **/
#define AUTOAR_LIBARCHIVE_ERROR autoar_common_libarchive_quark()

GQuark    autoar_common_libarchive_quark               (void);

char*     autoar_common_get_basename_remove_extension  (const char *filename);
char*     autoar_common_get_filename_extension         (const char *filename);

void      autoar_common_g_signal_emit                  (gpointer instance,
                                                        gboolean in_thread,
                                                        guint signal_id,
                                                        GQuark detail,
                                                        ...);
void      autoar_common_g_object_unref                 (gpointer object);

GError*   autoar_common_g_error_new_a                  (struct archive *a,
                                                        const char *pathname);
GError*   autoar_common_g_error_new_a_entry            (struct archive *a,
                                                        struct archive_entry *entry);

char*     autoar_common_g_file_get_name                (GFile *file);

G_END_DECLS

#endif /* AUTOAR_COMMON_H */