[Xfce4-commits] r23473 - in xarchiver/branches/xarchiver-psybsd: . libxarchiver src
Stephan Arts
stephan at xfce.org
Thu Oct 19 14:24:08 UTC 2006
Author: stephan
Date: 2006-10-19 14:24:07 +0000 (Thu, 19 Oct 2006)
New Revision: 23473
Modified:
xarchiver/branches/xarchiver-psybsd/configure.in.in
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h
xarchiver/branches/xarchiver-psybsd/src/archive_store.c
xarchiver/branches/xarchiver-psybsd/src/main.c
xarchiver/branches/xarchiver-psybsd/src/tool_bar.c
Log:
Changed archive-store
Changed configure.in.in
Fixed GUI errors.
Modified: xarchiver/branches/xarchiver-psybsd/configure.in.in
===================================================================
--- xarchiver/branches/xarchiver-psybsd/configure.in.in 2006-10-19 12:55:16 UTC (rev 23472)
+++ xarchiver/branches/xarchiver-psybsd/configure.in.in 2006-10-19 14:24:07 UTC (rev 23473)
@@ -18,6 +18,11 @@
m4_define([xarchiver_version_tag], [svn]) # Leave empty for releases
m4_define([xarchiver_version], [ifelse(xarchiver_version_branch(), [], [xarchiver_version_major().xarchiver_version_minor().xarchiver_version_micro()ifelse(xarchiver_version_nano(), [], [], [.xarchiver_version_nano()])], [xarchiver_version_branch()])-ifelse(xarchiver_version_tag(), [svn], [xarchiver_version_tag()-xarchiver_version_build()], [xarchiver_version_tag()])])
+dnl *******************************************
+dnl *** Debugging support for SVN snapshots ***
+dnl *******************************************
+m4_define([xarchiver_debug_default], [ifelse(xarchiver_version_tag(), [svn], [full], [minimum])])
+
AC_COPYRIGHT([Copyright (c) 2006
The Xfce development team. All rights reserved.
@@ -47,6 +52,62 @@
AC_SYS_LARGEFILE
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
+dnl ***********************************
+dnl *** Check for debugging support ***
+dnl ***********************************
+AC_ARG_ENABLE([debug],
+AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes/full@:>@], [Turn on debugging @<:@default=xarchiver_debug_default@:>@]),
+ [], [enable_debug=xarchiver_debug_default])
+AC_MSG_CHECKING([whether to enable debugging support])
+if test x"$enable_debug" = x"full" -o x"$enable_debug" = x"yes"; then
+ dnl Print the result
+ AC_MSG_RESULT([$enable_debug])
+
+ dnl Make sure we detect possible errors (if supported)
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wall -Werror"
+ AC_MSG_CHECKING([whether $CC accepts -Wall -Werror])
+ AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
+ AC_MSG_RESULT([yes])
+ PLATFORM_CFLAGS="$PLATFORM_CFLAGS -Wall -Werror"
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+ CFLAGS="$save_CFLAGS"
+
+ dnl Paranoia for --enable-debug=full
+ if test x"$enable_debug" = x"full"; then
+ dnl Enable extensive debugging
+ PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_ENABLE_DEBUG"
+
+ dnl Use -O0 -g3 if the compiler supports it
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -O0 -g3"
+ AC_MSG_CHECKING([whether $CC accepts -O0 -g3])
+ AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
+ AC_MSG_RESULT([yes])
+ PLATFORM_CFLAGS="$PLATFORM_CFLAGS -O0 -g3"
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+ CFLAGS="$save_CFLAGS"
+ fi
+else
+ dnl Print the result
+ AC_MSG_RESULT([$enable_debug])
+
+ dnl Disable debugging (release build)
+ PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DNDEBUG"
+
+ dnl Disable object cast checks
+ PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_CAST_CHECKS"
+
+ dnl Disable all checks for --enable-debug=no
+ if test x"$enable_debug" = x"no"; then
+ PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
+ fi
+fi
+
dnl Check for i18n support
XDT_I18N([@LINGUAS@])
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-10-19 12:55:16 UTC (rev 23472)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-10-19 14:24:07 UTC (rev 23473)
@@ -59,6 +59,12 @@
static void
lxa_archive_finalize(GObject *object);
+static GType *
+lxa_archive_get_property_types(LXAArchive *archive, guint size);
+
+static gchar **
+lxa_archive_get_property_names(LXAArchive *archive, guint size);
+
static LXAEntry *
lxa_entry_new(const gchar *);
@@ -242,11 +248,66 @@
return child;
}
+static GType *
+lxa_archive_get_property_types(LXAArchive *archive, guint size)
+{
+ GType *new_props;
+ gchar **new_names;
+ guint i;
+
+ if(archive->n_property < size)
+ {
+ new_props = g_new0(GType, size);
+ new_names = g_new0(gchar*, size);
+ for(i = 0; i < archive->n_property; ++i)
+ {
+ new_props[i] = archive->property_types[i];
+ new_names[i] = archive->property_names[i];
+ }
+ g_free(archive->property_types);
+ g_free(archive->property_names);
+ archive->property_types = new_props;
+ archive->property_names = new_names;
+ archive->n_property = size;
+ }
+ return archive->property_types;
+}
+
+static gchar **
+lxa_archive_get_property_names(LXAArchive *archive, guint size)
+{
+ GType *new_types;
+ gchar **new_names;
+ guint i;
+
+ if(archive->n_property < size)
+ {
+ new_types = g_new0(GType, size);
+ new_names = g_new0(gchar*, size);
+ for(i = 0; i < archive->n_property; ++i)
+ {
+ new_types[i] = archive->property_types[i];
+ new_names[i] = archive->property_names[i];
+ }
+ g_free(archive->property_types);
+ g_free(archive->property_names);
+ archive->property_types = new_types;
+ archive->property_names = new_names;
+ archive->n_property = size;
+ }
+ return archive->property_names;
+}
+
+/*
+ * GType
+ * lxa_archive_get_property_type(LXAArchive *archive, guint i)
+ *
+ */
GType
lxa_archive_get_property_type(LXAArchive *archive, guint i)
{
#ifdef DEBUG /* n_property + 2, filename and MIME */
- g_return_val_if_fail(i < (archive->n_property+2), G_TYPE_INVALID);
+ g_return_val_if_fail(i < (archive->n_property+LXA_ARCHIVE_PROP_USER), G_TYPE_INVALID);
#endif
switch(i)
{
@@ -260,7 +321,99 @@
return G_TYPE_NONE;
}
+/*
+ * void
+ * lxa_archive_set_property_type(LXAArchive *archive, guint i, GType *, const gchar *)
+ *
+ */
+void
+lxa_archive_set_property_type(LXAArchive *archive, guint i, GType type, const gchar *name)
+{
+#ifdef DEBUG
+ g_return_if_fail(i >= LXA_ARCHIVE_PROP_USER);
+#endif
+ GType *types_iter = lxa_archive_get_property_types(archive, i+1-LXA_ARCHIVE_PROP_USER);
+ gchar **names_iter = lxa_archive_get_property_names(archive, i+1-LXA_ARCHIVE_PROP_USER);
+ types_iter[i-LXA_ARCHIVE_PROP_USER] = type;
+ g_free(names_iter[i-LXA_ARCHIVE_PROP_USER]);
+ names_iter[i-LXA_ARCHIVE_PROP_USER] = g_strdup(name);
+}
+
+/*
+ * void
+ * lxa_archive_set_property_typesv(LXAArchive *archive, GType *)
+ *
+ */
+void
+lxa_archive_set_property_typesv(LXAArchive *archive, GType *types, const gchar **names)
+{
+ guint size = 0;
+ GType *type_iter = types;
+ const gchar **name_iter = names;
+ while(type_iter && name_iter)
+ {
+ size++;
+ type_iter++;
+ name_iter++;
+ }
+ GType *types_iter = lxa_archive_get_property_types(archive, size);
+ gchar **names_iter = lxa_archive_get_property_names(archive, size);
+ type_iter = types;
+ name_iter = names;
+ while(type_iter && name_iter)
+ {
+ *types_iter = *type_iter;
+ g_free(*names_iter);
+ *names_iter = g_strdup(*name_iter);
+ types_iter++;
+ type_iter++;
+ names_iter++;
+ name_iter++;
+ }
+}
+
+guint
+lxa_archive_n_property(LXAArchive *archive)
+{
+ return archive->n_property + LXA_ARCHIVE_PROP_USER;
+}
+
+LXAArchiveIter *
+lxa_archive_get_iter(LXAArchive *archive, const gchar *path)
+{
+ if(!path)
+ return (LXAArchiveIter *)archive->root_entry;
+
+ gchar **buf = g_strsplit_set(path, "/\n", -1);
+ gchar **iter = buf;
+ LXAArchiveIter *entry = (LXAArchiveIter *)archive->root_entry;
+
+ if(path[0] == '/' && lxa_archive_iter_get_child(archive, archive->root_entry, "/"))
+ {
+ iter[0] = strdup("/");
+ }
+
+ while(*iter)
+ {
+ if((*iter)[0])
+ {
+ entry = lxa_archive_iter_get_child(archive, entry, *iter);
+ if(!entry)
+ {
+ g_strfreev(buf);
+ return NULL;
+ }
+ }
+ iter++;
+ }
+
+ g_strfreev(buf);
+
+ return entry;
+}
+
+
/******************
* LXAEntry stuff *
******************/
@@ -498,11 +651,7 @@
}
}
-#ifdef DEBUG
entry->props = g_malloc0(size);
-#else
- entry->props = g_malloc(size);
-#endif
}
return entry->props;
@@ -695,13 +844,14 @@
void
lxa_archive_iter_set_prop_uint(LXAArchive *archive, LXAArchiveIter *iter, guint i, guint int_val)
{
- gpointer props_iter = lxa_archive_entry_get_props(archive, (LXAEntry *)iter);
- guint n;
#ifdef DEBUG
g_return_if_fail(i < (archive->n_property+LXA_ARCHIVE_PROP_USER));
g_return_if_fail(i >= LXA_ARCHIVE_PROP_USER);
g_return_if_fail(archive->property_types[i-LXA_ARCHIVE_PROP_USER] == G_TYPE_UINT);
#endif
+ gpointer props_iter = lxa_archive_entry_get_props(archive, (LXAEntry *)iter);
+ guint n;
+
for(n = 0; n < (i-LXA_ARCHIVE_PROP_USER); ++n)
{
switch(archive->property_types[n])
@@ -728,13 +878,14 @@
void
lxa_archive_iter_set_prop_uint64(LXAArchive *archive, LXAArchiveIter *iter, guint i, guint64 int64_val)
{
- gpointer props_iter = lxa_archive_entry_get_props(archive, (LXAEntry *)iter);
- guint n;
#ifdef DEBUG
g_return_if_fail(i < (archive->n_property+LXA_ARCHIVE_PROP_USER));
g_return_if_fail(i >= LXA_ARCHIVE_PROP_USER);
g_return_if_fail(archive->property_types[i-LXA_ARCHIVE_PROP_USER] == G_TYPE_UINT64);
#endif
+ gpointer props_iter = lxa_archive_entry_get_props(archive, (LXAEntry *)iter);
+ guint n;
+
for(n = 0; n < (i-LXA_ARCHIVE_PROP_USER); ++n)
{
switch(archive->property_types[n])
@@ -789,7 +940,7 @@
va_start(ap, iter);
- for(i = 0; i < (archive->n_property-LXA_ARCHIVE_PROP_USER); ++i)
+ for(i = 0; i < archive->n_property; ++i)
{
switch(archive->property_types[i])
{
@@ -812,6 +963,37 @@
}
/**
+ * void
+ * lxa_archive_iter_set_propsv(const LXAArchive *, const LXAArchiveIter *, guint, gconstpointer *)
+ *
+ */
+void
+lxa_archive_iter_set_propsv(LXAArchive *archive, LXAArchiveIter *iter, gconstpointer *props)
+{
+ gpointer props_iter = lxa_archive_entry_get_props(archive, (LXAEntry *)iter);
+ guint i;
+
+ for(i = 0; i < archive->n_property; ++i)
+ {
+ switch(archive->property_types[i])
+ {
+ case G_TYPE_STRING:
+ (*((gchar **)props_iter)) = g_strdup((const gchar*)props[i]);
+ props_iter += sizeof(gchar *);
+ break;
+ case G_TYPE_UINT:
+ (*((guint *)props_iter)) = ((const guint)props[i]);
+ props_iter += sizeof(guint);
+ break;
+ case G_TYPE_UINT64:
+ (*((guint64 *)props_iter)) = ((const guint)props[i]);
+ props_iter += sizeof(guint64);
+ break;
+ }
+ }
+}
+
+/**
* gboolean
* lxa_archive_iter_get_prop_value(const LXAArchive *, const LXAArchiveIter *, guint, const GValue *)
*
@@ -960,6 +1142,7 @@
return (*((guint64 *)props_iter));
}
+
/**************
* Depricated *
**************/
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h 2006-10-19 12:55:16 UTC (rev 23472)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h 2006-10-19 14:24:07 UTC (rev 23473)
@@ -113,6 +113,7 @@
void lxa_archive_iter_set_prop_uint64(LXAArchive *, LXAArchiveIter *, guint, guint64);
void lxa_archive_iter_set_prop_value(LXAArchive *, LXAArchiveIter *, guint, const GValue *);
void lxa_archive_iter_set_props(LXAArchive *, LXAArchiveIter *, ...);
+void lxa_archive_iter_set_propsv(LXAArchive *, LXAArchiveIter *, gconstpointer *);
const gchar *lxa_archive_iter_get_filename(const LXAArchive *, const LXAArchiveIter *);
const gchar *lxa_archive_iter_get_mime(const LXAArchive *, const LXAArchiveIter *);
@@ -122,7 +123,12 @@
gboolean lxa_archive_iter_get_prop_value(const LXAArchive *, const LXAArchiveIter *, guint, GValue *);
LXAArchiveIter *lxa_archive_add_file(LXAArchive *, const gchar *);
+LXAArchiveIter *lxa_archive_get_iter(LXAArchive *, const gchar *);
GType lxa_archive_get_property_type(LXAArchive *, guint);
+const gchar *lxa_archive_get_property_name(LXAArchive *, guint);
+void lxa_archive_set_property_type(LXAArchive *, guint, GType, const gchar *);
+void lxa_archive_set_property_typesv(LXAArchive *, GType *, const gchar **);
+guint lxa_archive_n_property(LXAArchive *);
G_END_DECLS
Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.c 2006-10-19 12:55:16 UTC (rev 23472)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.c 2006-10-19 14:24:07 UTC (rev 23473)
@@ -1182,14 +1182,14 @@
gchar **buf = g_strsplit_set(path, "/\n", -1);
gchar **iter = buf;
- LXAArchiveIter *entry = store->archive->root_entry;
+ LXAArchiveIter *entry = lxa_archive_get_iter(store->archive, NULL);
GSList *stack = g_slist_prepend(NULL, entry);
gint prev_size = lxa_archive_iter_n_children(store->archive, ((LXAArchiveIter*)store->current_entry->data));
if(store->props._show_up_dir && store->archive->root_entry != store->current_entry->data)
prev_size++;
- if(path[0] == '/' && lxa_archive_iter_get_child(store->archive, store->archive->root_entry, "/"))
+ if(path[0] == '/' && lxa_archive_iter_get_child(store->archive, entry, "/"))
{
iter[0] = strdup("/");
}
Modified: xarchiver/branches/xarchiver-psybsd/src/main.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main.c 2006-10-19 12:55:16 UTC (rev 23472)
+++ xarchiver/branches/xarchiver-psybsd/src/main.c 2006-10-19 14:24:07 UTC (rev 23473)
@@ -253,6 +253,10 @@
} else
{
gtk_widget_destroy(main_window);
+ dialog = gtk_message_dialog_new (NULL,GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Xarchiver\nERROR: Could not open file \"%s\""), argv[i]);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
+ gtk_dialog_run (GTK_DIALOG (dialog) );
+ gtk_widget_destroy (GTK_WIDGET (dialog) );
}
}
opened_archives--;
Modified: xarchiver/branches/xarchiver-psybsd/src/tool_bar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/tool_bar.c 2006-10-19 12:55:16 UTC (rev 23472)
+++ xarchiver/branches/xarchiver-psybsd/src/tool_bar.c 2006-10-19 14:24:07 UTC (rev 23473)
@@ -181,6 +181,7 @@
xa_tool_bar_refresh(XAToolBar *tool_bar, gchar *path)
{
gtk_entry_set_text(GTK_ENTRY(tool_bar->path_field), path);
+ gtk_editable_set_position(GTK_EDITABLE(tool_bar->path_field), -1);
if(strlen(path) < 1 || (strlen(path) == 1 && path[0] == '/'))
{
More information about the Xfce4-commits
mailing list