[Xfce4-commits] r23468 - in xarchiver/branches/xarchiver-psybsd: . libxarchiver src
Stephan Arts
stephan at xfce.org
Thu Oct 19 08:26:02 UTC 2006
Author: stephan
Date: 2006-10-19 08:26:01 +0000 (Thu, 19 Oct 2006)
New Revision: 23468
Modified:
xarchiver/branches/xarchiver-psybsd/configure.in.in
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
xarchiver/branches/xarchiver-psybsd/src/archive_store.c
xarchiver/branches/xarchiver-psybsd/src/path_bar.c
Log:
Fixed compile issue, segmentation fault and Critical warnings.
Modified: xarchiver/branches/xarchiver-psybsd/configure.in.in
===================================================================
--- xarchiver/branches/xarchiver-psybsd/configure.in.in 2006-10-19 07:41:10 UTC (rev 23467)
+++ xarchiver/branches/xarchiver-psybsd/configure.in.in 2006-10-19 08:26:01 UTC (rev 23468)
@@ -56,6 +56,8 @@
XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.2.0])
XDT_CHECK_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [0.4.0])
+AC_DEFINE([HAVE_THUNAR_VFS], [1], [Define if we have thunar-vfs])
+
dnl XDT_CHECK_OPTIONAL_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [0.4.0], [thunar-vfs],
dnl AC_HELP_STRING([--disable-thunar-vfs],
dnl [Disable the use of Thunar's VFS layer)]))
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c 2006-10-19 07:41:10 UTC (rev 23467)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c 2006-10-19 08:26:01 UTC (rev 23468)
@@ -503,7 +503,6 @@
gint n = 0, a = 0, i = 0, o = 0;
gchar *temp_filename = NULL;
- gchar *_size = NULL;
if(!LXA_IS_ARCHIVE(archive))
return FALSE;
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-10-19 07:41:10 UTC (rev 23467)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-10-19 08:26:01 UTC (rev 23468)
@@ -245,8 +245,8 @@
GType
lxa_archive_get_property_type(LXAArchive *archive, guint i)
{
-#ifdef DEBUG
- g_return_if_fail(i < archive->n_property, G_TYPE_INVALID);
+#ifdef DEBUG /* n_property + 2, filename and MIME */
+ g_return_val_if_fail(i < (archive->n_property+2), G_TYPE_INVALID);
#endif
switch(i)
{
@@ -257,6 +257,7 @@
case LXA_ARCHIVE_PROP_USER:
return archive->property_types[i - LXA_ARCHIVE_PROP_USER];
}
+ return G_TYPE_NONE;
}
@@ -344,14 +345,26 @@
guint pos = 0;
guint begin = 1;
gint cmp = 0;
+ const gchar *_pos = strchr(filename, '/');
+ gchar *_filename;
+
+ if(_pos)
+ _filename = g_strndup(filename, (gsize)(_pos - filename));
+ else
+ _filename = g_strdup(filename);
+
+
/* binary search algoritme */
while(size)
{
pos = (size / 2);
- cmp = strcmp(filename, entry->children[begin+pos]->filename);
+ cmp = strcmp(_filename, entry->children[begin+pos]->filename);
if(!cmp)
+ {
+ g_free(_filename);
return entry->children[begin+pos];
+ }
if(cmp < 0)
{
@@ -367,14 +380,18 @@
/* search the buffer */
for(buffer_iter = entry->buffer; buffer_iter; buffer_iter = buffer_iter->next)
{
- cmp = strcmp(filename, buffer_iter->entry->filename);
+ cmp = strcmp(_filename, buffer_iter->entry->filename);
if(!cmp)
+ {
+ g_free(_filename);
return buffer_iter->entry;
+ }
if(cmp < 0)
break;
}
+ g_free(_filename);
return NULL;
}
@@ -581,6 +598,7 @@
lxa_archive_iter_del_child(LXAArchive *archive, LXAArchiveIter *parent, LXAArchiveIter *child)
{
g_warning("not implemented yet");
+ return FALSE;
}
/**
Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.c 2006-10-19 07:41:10 UTC (rev 23467)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.c 2006-10-19 08:26:01 UTC (rev 23468)
@@ -271,13 +271,14 @@
xa_archive_store_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
gint prev_size = 0;
+ XAArchiveStore *store = XA_ARCHIVE_STORE(object);
switch(prop_id)
{
case XA_ARCHIVE_STORE_SHOW_ICONS:
if(XA_ARCHIVE_STORE(object)->props._show_icons != g_value_get_boolean(value)?1:0)
{
- if(XA_ARCHIVE_STORE(object)->current_entry)
- prev_size = lxa_entry_children_length(((LXAArchiveIter*)XA_ARCHIVE_STORE(object)->current_entry->data));
+ if(store->current_entry)
+ prev_size = lxa_archive_iter_n_children(store->archive, ((LXAArchiveIter*)store->current_entry->data));
XA_ARCHIVE_STORE(object)->props._show_icons = g_value_get_boolean(value)?1:0;
xa_archive_store_refresh(XA_ARCHIVE_STORE(object), prev_size);
}
@@ -285,8 +286,8 @@
case XA_ARCHIVE_STORE_SHOW_UP_DIR:
if(XA_ARCHIVE_STORE(object)->props._show_up_dir != g_value_get_boolean(value)?1:0)
{
- if(XA_ARCHIVE_STORE(object)->current_entry)
- prev_size = lxa_entry_children_length(((LXAArchiveIter*)XA_ARCHIVE_STORE(object)->current_entry->data));
+ if(store->current_entry)
+ prev_size = lxa_archive_iter_n_children(store->archive, ((LXAArchiveIter*)store->current_entry->data));
XA_ARCHIVE_STORE(object)->props._show_up_dir = g_value_get_boolean(value)?1:0;
xa_archive_store_refresh(XA_ARCHIVE_STORE(object), prev_size);
}
@@ -581,7 +582,7 @@
/* only support lists: iter is always NULL */
g_return_val_if_fail(iter == NULL, FALSE);
- return lxa_entry_children_length(entry) + (archive->root_entry == entry)?0:1;
+ return lxa_archive_iter_n_children(archive, entry) + (archive->root_entry == entry)?0:1;
}
static gboolean
@@ -687,6 +688,7 @@
return XA_ARCHIVE_STORE(s)->props._sort_folders_first?FALSE:TRUE;
}
+/* FIXME */
static gint
xa_archive_entry_compare(XAArchiveStore *store, LXAArchiveIter *a, LXAArchiveIter *b)
{
@@ -712,7 +714,6 @@
LXAArchive *archive = store->archive;
gint column = store->sort_column;
- gint i = 0;
column--;
@@ -748,7 +749,7 @@
return;
LXAArchiveIter *pentry = (LXAArchiveIter*)store->current_entry->data;
- gint psize = lxa_entry_children_length(pentry);
+ gint psize = lxa_archive_iter_n_children(store->archive, pentry);
gint i = 0;
if(psize <= 1)
@@ -861,7 +862,7 @@
g_return_if_fail(archive);
g_return_if_fail(entry);
- gint new_size = lxa_entry_children_length(entry);
+ gint new_size = lxa_archive_iter_n_children(archive, entry);
gint i = 0;
gint index = 0;
GtkTreePath *path_ = NULL;
@@ -937,7 +938,7 @@
/* only support list: depth is always 0 */
g_return_if_fail(depth == 0);
- gint prev_size = lxa_entry_children_length(entry);
+ gint prev_size = lxa_archive_iter_n_children(archive, entry);
gint index = indices[depth];
if(store->props._show_up_dir && archive->root_entry != entry)
@@ -987,7 +988,7 @@
g_return_if_fail(archive);
g_return_if_fail(entry);
- gint prev_size = lxa_entry_children_length(entry);
+ gint prev_size = lxa_archive_iter_n_children(archive, entry);
if(store->props._show_up_dir && archive->root_entry != entry)
{
@@ -1026,7 +1027,7 @@
if(store->current_entry)
{
entry = store->current_entry->data;
- prev_size = lxa_entry_children_length(entry);
+ prev_size = lxa_archive_iter_n_children(archive, entry);
if(store->props._show_up_dir && store->archive->root_entry != entry)
@@ -1062,7 +1063,7 @@
xa_archive_store_sort(store);
- for(i = 0; i < lxa_entry_children_length(archive->root_entry); i++)
+ for(i = 0; i < lxa_archive_iter_n_children(archive, archive->root_entry); i++)
{
path_ = gtk_tree_path_new();
gtk_tree_path_append_index(path_, i);
@@ -1183,7 +1184,7 @@
gchar **iter = buf;
LXAArchiveIter *entry = store->archive->root_entry;
GSList *stack = g_slist_prepend(NULL, entry);
- gint prev_size = lxa_entry_children_length(((LXAArchiveIter*)store->current_entry->data));
+ 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++;
Modified: xarchiver/branches/xarchiver-psybsd/src/path_bar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/path_bar.c 2006-10-19 07:41:10 UTC (rev 23467)
+++ xarchiver/branches/xarchiver-psybsd/src/path_bar.c 2006-10-19 08:26:01 UTC (rev 23468)
@@ -62,23 +62,8 @@
cb_xa_path_bar_path_button_clicked(GtkRadioButton *button, XAPathBar *path_bar);
static void
-cb_xa_path_bar_scroll_timeout_destroy(gpointer user_data);
-
-static gboolean
-cb_xa_path_bar_scroll_left_timeout(gpointer user_data);
-static gboolean
-cb_xa_path_bar_left_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
-static gboolean
-cb_xa_path_bar_left_button_released(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
-static void
cb_xa_path_bar_left_button_clicked(GtkWidget *button, gpointer user_data);
-static gboolean
-cb_xa_path_bar_scroll_right_timeout(gpointer user_data);
-static gboolean
-cb_xa_path_bar_right_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
-static gboolean
-cb_xa_path_bar_right_button_released(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
static void
cb_xa_path_bar_right_button_clicked(GtkWidget *button, gpointer user_data);
@@ -564,111 +549,12 @@
}
static void
-cb_xa_path_bar_scroll_timeout_destroy(gpointer user_data)
-{
- XAPathBar *path_bar = XA_PATH_BAR(user_data);
-
- path_bar->scroll_timeout = 0;
-}
-
-static gboolean
-cb_xa_path_bar_scroll_left_timeout(gpointer user_data)
-{
- XAPathBar *path_bar = XA_PATH_BAR(user_data);
-
- GSList *iter = path_bar->path_button;
- GSList *prev = NULL;
-
- while(iter)
- {
- if(gtk_widget_get_child_visible(GTK_WIDGET(iter->data)))
- {
- path_bar->first_button = prev;
- break;
- }
-
- prev = iter;
- iter = iter->next;
- }
-
- return FALSE;
-}
-
-static gboolean
-cb_xa_path_bar_left_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
-{
- XAPathBar *path_bar = XA_PATH_BAR(user_data);
-
- if(event->type != GDK_BUTTON_PRESS || event->button != 1)
- return FALSE;
-
- path_bar->scroll_timeout = g_timeout_add_full(G_PRIORITY_LOW, XA_PATH_BAR_SCROLL_TIMEOUT, cb_xa_path_bar_scroll_left_timeout, user_data, cb_xa_path_bar_scroll_timeout_destroy);
-
- return FALSE;
-}
-
-static gboolean
-cb_xa_path_bar_left_button_released(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
-{
- XAPathBar *path_bar = XA_PATH_BAR(user_data);
-
- if(event->type != GDK_BUTTON_RELEASE || event->button != 1)
- return FALSE;
-
- if(path_bar->scroll_timeout)
- g_source_remove(path_bar->scroll_timeout);
-
- return FALSE;
-}
-
-static void
cb_xa_path_bar_left_button_clicked(GtkWidget *widget, gpointer user_data)
{
- cb_xa_path_bar_scroll_left_timeout(user_data);
}
-static gboolean
-cb_xa_path_bar_scroll_right_timeout(gpointer user_data)
-{
- XAPathBar *path_bar = XA_PATH_BAR(user_data);
-
- if(!path_bar->first_button)
- path_bar->first_button = path_bar->path_button;
-
- if(path_bar->first_button->next)
- path_bar->first_button = path_bar->first_button->next;
-}
-
-static gboolean
-cb_xa_path_bar_right_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
-{
- XAPathBar *path_bar = XA_PATH_BAR(user_data);
-
- if(event->type != GDK_BUTTON_PRESS || event->button != 1)
- return FALSE;
-
- path_bar->scroll_timeout = g_timeout_add_full(G_PRIORITY_LOW, XA_PATH_BAR_SCROLL_TIMEOUT, cb_xa_path_bar_scroll_right_timeout, user_data, cb_xa_path_bar_scroll_timeout_destroy);
-
- return FALSE;
-}
-
-static gboolean
-cb_xa_path_bar_right_button_released(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
-{
- XAPathBar *path_bar = XA_PATH_BAR(user_data);
-
- if(event->type != GDK_BUTTON_RELEASE || event->button != 1)
- return FALSE;
-
- if(path_bar->scroll_timeout)
- g_source_remove(path_bar->scroll_timeout);
-
- return FALSE;
-}
-
static void
cb_xa_path_bar_right_button_clicked(GtkWidget *widget, gpointer user_data)
{
- cb_xa_path_bar_scroll_right_timeout(user_data);
}
More information about the Xfce4-commits
mailing list