aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTing-Wei Lan <lantw44@gmail.com>2013-07-30 17:14:59 +0800
committerLAN-TW <lantw44@gmail.com>2013-07-30 17:14:59 +0800
commit93431e0eeb2bfa566ce1d5240ce9c75e976d0c07 (patch)
tree8449069978cea30ded56ec82faa8dd2c6a6b124e
parent8fce3492c142e654d7ebea40cf2c50ddefae3d17 (diff)
downloadgsoc2013-epiphany-93431e0eeb2bfa566ce1d5240ce9c75e976d0c07.tar
gsoc2013-epiphany-93431e0eeb2bfa566ce1d5240ce9c75e976d0c07.tar.gz
gsoc2013-epiphany-93431e0eeb2bfa566ce1d5240ce9c75e976d0c07.tar.bz2
gsoc2013-epiphany-93431e0eeb2bfa566ce1d5240ce9c75e976d0c07.tar.lz
gsoc2013-epiphany-93431e0eeb2bfa566ce1d5240ce9c75e976d0c07.tar.xz
gsoc2013-epiphany-93431e0eeb2bfa566ce1d5240ce9c75e976d0c07.tar.zst
gsoc2013-epiphany-93431e0eeb2bfa566ce1d5240ce9c75e976d0c07.zip
Add some missing definitions and functions
-rw-r--r--autoarchive/autoar-create.c84
-rw-r--r--autoarchive/autoar-create.h7
-rw-r--r--autoarchive/autoar-pref.h4
3 files changed, 87 insertions, 8 deletions
diff --git a/autoarchive/autoar-create.c b/autoarchive/autoar-create.c
index 514afbe99..4b946bd43 100644
--- a/autoarchive/autoar-create.c
+++ b/autoarchive/autoar-create.c
@@ -30,6 +30,7 @@
#include <gio/gio.h>
#include <glib.h>
+#include <stdarg.h>
G_DEFINE_TYPE (AutoarCreate, autoar_create, G_TYPE_OBJECT)
@@ -43,6 +44,7 @@ struct _AutoarCreatePrivate
char **source;
char *output;
+ guint64 size; /* This field is currently unused */
guint64 completed_size;
guint files;
@@ -70,6 +72,7 @@ enum
PROP_0,
PROP_SOURCE,
PROP_OUTPUT,
+ PROP_SIZE, /* This property is currently unused */
PROP_COMPLETED_SIZE,
PROP_FILES,
PROP_COMPLETED_FILES
@@ -102,6 +105,8 @@ autoar_create_get_property (GObject *object,
case PROP_OUTPUT:
g_value_set_string (value, priv->output);
break;
+ case PROP_SIZE:
+ g_value_set_uint64 (value, priv->size);
case PROP_COMPLETED_SIZE:
g_value_set_uint64 (value, priv->completed_size);
break;
@@ -132,6 +137,9 @@ autoar_create_set_property (GObject *object,
priv = arcreate->priv;
switch (property_id) {
+ case PROP_SIZE:
+ autoar_create_set_size (arcreate, g_value_get_uint64 (value));
+ break;
case PROP_COMPLETED_SIZE:
autoar_create_set_completed_size (arcreate, g_value_get_uint64 (value));
break;
@@ -171,6 +179,13 @@ autoar_create_get_output (AutoarCreate *arcreate)
}
guint64
+autoar_create_get_size (AutoarCreate *arcreate)
+{
+ g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), 0);
+ return arcreate->priv->size;
+}
+
+guint64
autoar_create_get_completed_size (AutoarCreate *arcreate)
{
g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), 0);
@@ -192,6 +207,14 @@ autoar_create_get_completed_files (AutoarCreate *arcreate)
}
void
+autoar_create_set_size (AutoarCreate *arcreate,
+ guint64 size)
+{
+ g_return_if_fail (AUTOAR_IS_CREATE (arcreate));
+ arcreate->priv->size = size;
+}
+
+void
autoar_create_set_completed_size (AutoarCreate *arcreate,
guint64 completed_size)
{
@@ -310,6 +333,16 @@ autoar_create_class_init (AutoarCreateClass *klass)
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (object_class, PROP_SIZE,
+ g_param_spec_uint64 ("size",
+ "Size",
+ "Unused property",
+ 0, G_MAXUINT64, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
g_object_class_install_property (object_class, PROP_COMPLETED_SIZE,
g_param_spec_uint64 ("completed-size",
"Read file size",
@@ -412,11 +445,11 @@ autoar_create_init (AutoarCreate *arcreate)
}
AutoarCreate*
-autoar_create_new (const char **source,
- const char *output,
- AutoarPref *arpref)
+autoar_create_newv (AutoarPref *arpref,
+ const char *output,
+ const char **source)
{
- AutoarCreate* arcreate;
+ AutoarCreate *arcreate;
g_return_val_if_fail (source != NULL, NULL);
g_return_val_if_fail (output != NULL, NULL);
@@ -429,3 +462,46 @@ autoar_create_new (const char **source,
return arcreate;
}
+
+AutoarCreate*
+autoar_create_new (AutoarPref *arpref,
+ const char *output,
+ ...)
+{
+ AutoarCreate *arcreate;
+ char *str;
+ va_list ap;
+ GPtrArray *strv;
+
+ va_start (ap, output);
+ strv = g_ptr_array_new_with_free_func (g_free);
+ while ((str = va_arg (ap, char*)) != NULL) {
+ g_ptr_array_add (strv, str);
+ }
+ g_ptr_array_add (strv, NULL);
+ va_end (ap);
+
+ arcreate = autoar_create_newv (arpref, output, (const char**)(strv->pdata));
+ g_ptr_array_unref (strv);
+ return arcreate;
+}
+
+static void
+autoar_create_run (AutoarCreate *arcreate,
+ gboolean in_thread)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+
+}
+
+void
+autoar_create_start (AutoarCreate *arcreate)
+{
+ autoar_create_run (arcreate, FALSE);
+}
+
+void
+autoar_create_start_async (AutoarCreate *arcreate)
+{
+}
diff --git a/autoarchive/autoar-create.h b/autoarchive/autoar-create.h
index 682a1887e..3c37945b3 100644
--- a/autoarchive/autoar-create.h
+++ b/autoarchive/autoar-create.h
@@ -67,9 +67,12 @@ struct _AutoarCreateClass
GType autoar_create_get_type (void) G_GNUC_CONST;
-AutoarCreate *autoar_create_new (const char **source,
+AutoarCreate* autoar_create_new (AutoarPref *arpref,
+ const char *output,
+ ...);
+AutoarCreate* autoar_create_newv (AutoarPref *arpref,
const char *output,
- AutoarPref *arpref);
+ const char **source);
void autoar_create_start (AutoarCreate *arcreate);
void autoar_create_start_async (AutoarCreate *arcreate);
diff --git a/autoarchive/autoar-pref.h b/autoarchive/autoar-pref.h
index b256ac059..a935ad324 100644
--- a/autoarchive/autoar-pref.h
+++ b/autoarchive/autoar-pref.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
typedef enum {
AUTOAR_PREF_FORMAT_0, /*< skip >*/
- AUTOAR_PREF_FORMAT_ZIP, /* .zip */
+ AUTOAR_PREF_FORMAT_ZIP = 1, /* .zip */
AUTOAR_PREF_FORMAT_TAR, /* .tar, pax_restricted */
AUTOAR_PREF_FORMAT_CPIO, /* .cpio, odc */
AUTOAR_PREF_FORMAT_7ZIP, /* .7z */
@@ -52,7 +52,7 @@ typedef enum {
typedef enum {
AUTOAR_PREF_FILTER_0, /*< skip >*/
- AUTOAR_PREF_FILTER_NONE,
+ AUTOAR_PREF_FILTER_NONE = 1,
AUTOAR_PREF_FILTER_COMPRESS, /* .Z */
AUTOAR_PREF_FILTER_GZIP, /* .gz */
AUTOAR_PREF_FILTER_BZIP2, /* .bz2 */