aboutsummaryrefslogtreecommitdiffstats
path: root/autoarchive/autoar-pref.h
blob: 357f0022c25bef9959c4f699a0dee988461e9a62 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* vim: set sw=2 ts=2 sts=2 et: */
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * autoar-pref.h
 * User preferences of automatic archives creation and extraction
 *
 * 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_PREF_H
#define AUTOAR_PREF_H

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

G_BEGIN_DECLS

#define AUTOAR_PREF_DEFAULT_GSCHEMA_ID  "org.gnome.desktop.archives"

typedef enum {
  AUTOAR_PREF_FORMAT_0, /*< skip >*/
  AUTOAR_PREF_FORMAT_ZIP,
  AUTOAR_PREF_FORMAT_TAR,
  AUTOAR_PREF_FORMAT_CPIO,
  AUTOAR_PREF_FORMAT_ISO9660,
  AUTOAR_PREF_FORMAT_LAST /*< skip >*/
} AutoarPrefFormat;

typedef enum {
  AUTOAR_PREF_FILTER_0, /*< skip >*/
  AUTOAR_PREF_FILTER_NONE,
  AUTOAR_PREF_FILTER_COMPRESS,
  AUTOAR_PREF_FILTER_GZIP,
  AUTOAR_PREF_FILTER_BZIP2,
  AUTOAR_PREF_FILTER_LZMA,
  AUTOAR_PREF_FILTER_XZ,
  AUTOAR_PREF_FILTER_LZIP,
  AUTOAR_PREF_FILTER_LAST /*< skip >*/
} AutoarPrefFilter;

#define AUTOAR_TYPE_PREF                autoar_pref_get_type ()
#define AUTOAR_PREF(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUTOAR_TYPE_PREF, AutoarPref))
#define AUTOAR_PREF_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), AUTOAR_TYPE_PREF, AutoarPrefClass))
#define AUTOAR_IS_PREF(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUTOAR_TYPE_PREF))
#define AUTOAR_IS_PREF_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), AUTOAR_TYPE_PREF))
#define AUTOAR_PREF_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), AUTOAR_TYPE_PREF, AutoarPrefClass))

typedef struct _AutoarPref AutoarPref;
typedef struct _AutoarPrefClass AutoarPrefClass;
typedef struct _AutoarPrefPrivate AutoarPrefPrivate;

struct _AutoarPref
{
  GObject parent;

  AutoarPrefPrivate *priv;
};

struct _AutoarPrefClass
{
  GObjectClass parent_class;
};

GType              autoar_pref_get_type              (void) G_GNUC_CONST;

AutoarPref        *autoar_pref_new                   (void);
AutoarPref        *autoar_pref_new_with_gsettings    (GSettings *settings);

void               autoar_pref_read_gsettings        (AutoarPref *arpref,
                                                      GSettings *settings);
void               autoar_pref_write_gsettings       (AutoarPref *arpref,
                                                      GSettings *settings);
void               autoar_pref_write_gsettings_force (AutoarPref *arpref,
                                                      GSettings *settings);

gboolean           autoar_pref_has_changes           (AutoarPref *arpref);
void               autoar_pref_forget_changes        (AutoarPref *arpref);

gboolean           autoar_pref_check_file_name       (AutoarPref *arpref,
                                                      const char *filepath);
gboolean           autoar_pref_check_mime_type       (AutoarPref *arpref,
                                                      const char *filepath);

AutoarPrefFormat   autoar_pref_get_default_format    (AutoarPref *arpref);
AutoarPrefFilter   autoar_pref_get_default_filter    (AutoarPref *arpref);
const char       **autoar_pref_get_file_name_suffix  (AutoarPref *arpref);
const char       **autoar_pref_get_file_mime_type    (AutoarPref *arpref);
const char       **autoar_pref_get_pattern_to_ignore (AutoarPref *arpref);
gboolean           autoar_pref_get_delete_if_succeed (AutoarPref *arpref);

void               autoar_pref_set_default_format    (AutoarPref *arpref,
                                                      AutoarPrefFormat format);
void               autoar_pref_set_default_filter    (AutoarPref *arpref,
                                                      AutoarPrefFilter filter);
void               autoar_pref_set_file_name_suffix  (AutoarPref *arpref,
                                                      const char **strv);
void               autoar_pref_set_file_mime_type    (AutoarPref *arpref,
                                                      const char **strv);
void               autoar_pref_set_pattern_to_ignore (AutoarPref *arpref,
                                                      const char **strv);
void               autoar_pref_set_delete_if_succeed (AutoarPref *arpref,
                                                      gboolean delete_yes);


G_END_DECLS

#endif /* AUTOAR_PREF_H */