[gnome-commander/treeview: 52/53] treeview: merged the latest work
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/treeview: 52/53] treeview: merged the latest work
- Date: Sat, 7 May 2011 20:59:18 +0000 (UTC)
commit 821ceb7a68df9cd589becaf3ce76f2b014b0a9b8
Author: Guillaume Wardavoir <earlgrey free fr>
Date: Sat May 7 22:55:53 2011 +0200
treeview: merged the latest work
src/foldview/Makefile.am | 56 +-
.../gnome-cmd-connection-treeview-control.cc | 30 +-
...gnome-cmd-connection-treeview-control.snippet.h | 12 +-
.../gnome-cmd-connection-treeview-model-struct.cc | 18 +-
...-cmd-connection-treeview-model-struct.snippet.h | 39 +-
.../gnome-cmd-connection-treeview-model-vfs.cc | 58 +-
.../gnome-cmd-connection-treeview-model.cc | 28 +-
.../gnome-cmd-connection-treeview-model.snippet.h | 3 +
src/foldview/gnome-cmd-connection-treeview-view.cc | 6 +-
src/foldview/gnome-cmd-connection-treeview.cc | 48 +-
src/foldview/gnome-cmd-connection-treeview.h | 37 +-
src/foldview/gnome-cmd-foldview-control.cc | 1017 --------------------
src/foldview/gnome-cmd-foldview-docs.h | 29 +-
src/foldview/gnome-cmd-foldview-gvfs.cc | 808 ----------------
src/foldview/gnome-cmd-foldview-gvfs.h | 282 ------
src/foldview/gnome-cmd-foldview-logger.cc | 1 +
src/foldview/gnome-cmd-foldview-logger.h | 1 +
src/foldview/gnome-cmd-foldview-model.cc | 637 ------------
src/foldview/gnome-cmd-foldview-utils.h | 2 +
src/foldview/gnome-cmd-foldview-view.cc | 796 ---------------
src/foldview/gnome-cmd-foldview.cc | 40 +-
21 files changed, 289 insertions(+), 3659 deletions(-)
---
diff --git a/src/foldview/Makefile.am b/src/foldview/Makefile.am
index 49f6d52..fb6fa4d 100644
--- a/src/foldview/Makefile.am
+++ b/src/foldview/Makefile.am
@@ -1,34 +1,46 @@
-## Process this file with automake to produce Makefile.in
-AM_CPPFLAGS = \
- $(CC_WARNINGS) \
- -I$(top_srcdir) \
- -I$(srcdir)/.. \
- $(GLIB_CFLAGS) \
- $(GTK_CFLAGS) \
- $(GNOMEUI_CFLAGS) \
- $(GNOMEVFS_CFLAGS)
-
-noinst_LIBRARIES = libtreeview.a
+lib_LIBRARIES = \
+ libfoldview.a
-libtreeview_a_SOURCES = \
+libfoldview_a_SOURCES = \
+ gnome-cmd-foldview-docs.h\
+ gnome-cmd-foldview-logger.cc \
+ gnome-cmd-foldview-logger.h \
+ gnome-cmd-foldview-quickstack.h \
+ gnome-cmd-foldview-utils.h \
+ gnome-cmd-foldview-treestore.cc \
+ gnome-cmd-foldview-treestore.h \
+ gnome-cmd-connection-treeview.cc \
+ gnome-cmd-connection-treeview.h \
gnome-cmd-connection-treeview-control.cc \
gnome-cmd-connection-treeview-control.snippet.h \
+ gnome-cmd-connection-treeview-model.cc \
+ gnome-cmd-connection-treeview-model.snippet.h \
gnome-cmd-connection-treeview-model-gio.cc \
gnome-cmd-connection-treeview-model-struct.cc \
gnome-cmd-connection-treeview-model-struct.snippet.h \
gnome-cmd-connection-treeview-model-vfs.cc \
- gnome-cmd-connection-treeview-model.cc \
- gnome-cmd-connection-treeview-model.snippet.h \
gnome-cmd-connection-treeview-view.cc \
gnome-cmd-connection-treeview-view.snippet.h \
- gnome-cmd-connection-treeview.cc gnome-cmd-connection-treeview.h \
- gnome-cmd-foldview-docs.h\
- gnome-cmd-foldview-logger.cc gnome-cmd-foldview-logger.h \
+ gnome-cmd-foldview.cc \
gnome-cmd-foldview-private.h \
- gnome-cmd-foldview-quickstack.h \
- gnome-cmd-foldview-treestore.cc gnome-cmd-foldview-treestore.h \
- gnome-cmd-foldview-utils.h \
- gnome-cmd-foldview.cc gnome-cmd-foldview.h
+ gnome-cmd-foldview.h
+
+libfoldview_a_CFLAGS = \
+ -Wno-unused-label
+
+AM_CPPFLAGS = \
+ $(CC_WARNINGS) \
+ -I$(top_srcdir) \
+ -I$(srcdir)/.. \
+ $(GNOMEUI_CFLAGS) \
+ $(GNOMEVFS_CFLAGS) \
+ $(EXIV2_CFLAGS) \
+ $(TAGLIB_CFLAGS) \
+ $(CHM_CFLAGS) \
+ $(GSF_CFLAGS) \
+ $(POPPLER_CFLAGS) \
+ -DPLUGIN_DIR=\""$(libdir)/$(PACKAGE)/plugins"\"
+
+## File created by the gnome-build tools
--include $(top_srcdir)/git.mk
diff --git a/src/foldview/gnome-cmd-connection-treeview-control.cc b/src/foldview/gnome-cmd-connection-treeview-control.cc
index 3a34baf..66b646e 100644
--- a/src/foldview/gnome-cmd-connection-treeview-control.cc
+++ b/src/foldview/gnome-cmd-connection-treeview-control.cc
@@ -366,11 +366,27 @@ void GnomeCmdConnectionTreeview::Control::set_active_tab(GtkTreePath *_path)
row = model()->iter_get_treerow(&iter);
g_return_if_fail( row );
- // open the new tab
+ // create a temporary GnomeVFSURI for getting rid of scheme, using uri->text
uri = gnome_vfs_uri_new(row->uri_utf8());
- path = gnome_cmd_con_create_path(connection_treeview()->connection(), uri->text);
- dir = gnome_cmd_dir_new(connection_treeview()->connection(), path);
- fs->file_list()->set_connection(connection_treeview()->connection(), dir);
+
+ // special case of GnomeCmdConDevice, with mount point
+ if ( is_con_device() )
+ {
+ gchar * v = g_utf8_offset_to_pointer(uri->text, connection_treeview()->con_device_mount_point_len());
+
+ GCMD_WNG("Control::set_active_tab():path [%s]", v);
+
+ path = gnome_cmd_con_create_path(gnome_cmd_connection(), v);
+ }
+ // normal case
+ else
+ {
+ path = gnome_cmd_con_create_path(gnome_cmd_connection(), uri->text);
+ }
+
+ // go
+ dir = gnome_cmd_dir_new(gnome_cmd_connection(), path);
+ fs->file_list()->set_connection(gnome_cmd_connection(), dir);
gnome_vfs_uri_unref(uri);
}
// ===========================================================================
@@ -890,14 +906,14 @@ GnomeCmdConnectionTreeview::Control::iter_message_add_first_tree(
row_new = new Model::Row(
Model::eRowRoot, info.row()->uri_utf8(), _msg->file()->name_utf8(), (gchar*)((Model::Symlink*)_msg->file())->target_uri(),
_msg->file()->access(), TRUE,
- is_samba(), is_local(), host_redmond());
+ is_con_samba(), is_con_local(), host_redmond());
}
else
{
row_new = new Model::Row(
Model::eRowRoot, info.row()->uri_utf8(), _msg->file()->name_utf8(), NULL,
_msg->file()->access(), FALSE,
- is_samba(), is_local(), host_redmond());
+ is_con_samba(), is_con_local(), host_redmond());
}
// replace treerow by the new one, signal will be emitted
@@ -1036,6 +1052,8 @@ GnomeCmdConnectionTreeview::Control::iter_message_add_dummy_child(
MSG_WNG("iter_message_add_dummy_child():iter has an unique child, but not a dummy");
goto lab_exit_false;
}
+ // here already dummy child, silently exir
+ goto lab_exit_true;
}
//.........................................................................
diff --git a/src/foldview/gnome-cmd-connection-treeview-control.snippet.h b/src/foldview/gnome-cmd-connection-treeview-control.snippet.h
index e97fc01..809daa1 100644
--- a/src/foldview/gnome-cmd-connection-treeview-control.snippet.h
+++ b/src/foldview/gnome-cmd-connection-treeview-control.snippet.h
@@ -131,10 +131,14 @@ struct Control
// wrappers on GnomeCmdConnectionTreeview
// =======================================================================
public:
- inline gboolean is_samba() { return a_connection_treeview->is_samba(); }
- inline gboolean is_local() { return a_connection_treeview->is_local(); }
- inline gboolean host_redmond() { return a_connection_treeview->host_redmond(); }
- inline GnomeCmdCon * connection() { return a_connection_treeview->connection(); }
+ inline gboolean is_con_device() { return a_connection_treeview->is_con_device(); }
+ inline gboolean is_con_samba() { return a_connection_treeview->is_con_samba(); }
+ inline gboolean is_con_local() { return a_connection_treeview->is_con_local(); }
+ inline gboolean host_redmond() { return a_connection_treeview->host_redmond(); }
+ inline GnomeCmdCon * gnome_cmd_connection() { return a_connection_treeview->connection(); }
+ inline GnomeCmdConDevice* con_device() { return a_connection_treeview->con_device(); }
+
+ inline eAccessCheckMode access_check_mode() { return a_connection_treeview->access_check_mode(); }
// =======================================================================
// Widgets signals
// =======================================================================
diff --git a/src/foldview/gnome-cmd-connection-treeview-model-struct.cc b/src/foldview/gnome-cmd-connection-treeview-model-struct.cc
index 5ea5abf..ed987ec 100644
--- a/src/foldview/gnome-cmd-connection-treeview-model-struct.cc
+++ b/src/foldview/gnome-cmd-connection-treeview-model-struct.cc
@@ -940,7 +940,7 @@ GnomeCmdConnectionTreeview::Model::AsyncCallerData::~AsyncCallerData()
// Model::AsyncCore
//=============================================================================
GnomeCmdConnectionTreeview::Model::AsyncCore::AsyncCore(
- AsyncCallerData * _acd)
+ AsyncCallerData * _acd)
{
a_caller_data = _acd;
@@ -966,13 +966,25 @@ GnomeCmdConnectionTreeview::Model::AsyncCore::error_set(
}
//=============================================================================
+// Model::AsyncGet
+//=============================================================================
+GnomeCmdConnectionTreeview::Model::AsyncGet::AsyncGet(
+ AsyncCallerData * _acd) : AsyncCore(_acd)
+{
+}
+
+GnomeCmdConnectionTreeview::Model::AsyncGet::~AsyncGet()
+{
+}
+
+//=============================================================================
// Model::AsyncEnumerateChildren
//=============================================================================
GnomeCmdConnectionTreeview::Model::AsyncEnumerateChildren::AsyncEnumerateChildren(
AsyncCallerData * _caller_data,
const Uri _uri,
gint _max_result,
- gboolean _follow_links) : AsyncCore(_caller_data)
+ gboolean _follow_links) : AsyncGet(_caller_data)
{
d_uri = g_strdup(_uri);
a_max_result = _max_result;
@@ -1027,7 +1039,7 @@ GnomeCmdConnectionTreeview::Model::AsyncEnumerateChildren::list_append(
//=============================================================================
GnomeCmdConnectionTreeview::Model::AsyncGetFileInfo::AsyncGetFileInfo(
AsyncCallerData * _caller_data,
- const Uri _uri) : AsyncCore(_caller_data)
+ const Uri _uri) : AsyncGet(_caller_data)
{
d_uri = g_strdup(_uri);
a_name = NULL;
diff --git a/src/foldview/gnome-cmd-connection-treeview-model-struct.snippet.h b/src/foldview/gnome-cmd-connection-treeview-model-struct.snippet.h
index 78787d7..35d84ab 100644
--- a/src/foldview/gnome-cmd-connection-treeview-model-struct.snippet.h
+++ b/src/foldview/gnome-cmd-connection-treeview-model-struct.snippet.h
@@ -356,14 +356,17 @@ struct AsyncCallerData
Model * model() { return a_model; }
AsyncCallerCallback callback() { return a_callback; }
};
-//.....................................................................
+//.............................................................................
struct AsyncCore
{
+ private:
eFileError a_error;
gchar * d_error_str;
protected:
AsyncCallerData * a_caller_data;
+ gboolean a_check_client_perm;
+ gboolean a_check_owner_perm;
protected:
AsyncCore(AsyncCallerData*);
@@ -377,6 +380,26 @@ struct AsyncCore
gboolean error() { return ( a_error != eErrorNone ); }
const gchar* error_str() { return d_error_str; }
+ inline gboolean check_client_perm() { return a_check_client_perm; }
+ inline gboolean check_owner_perm() { return a_check_owner_perm; }
+};
+//.............................................................................
+struct AsyncGet : public AsyncCore
+{
+ private:
+ eAccessCheckMode a_access_check_mode;
+
+ protected:
+ AsyncGet(AsyncCallerData*);
+ virtual ~AsyncGet();
+
+ public:
+ inline void set_access_check_mode(eAccessCheckMode _m) { a_access_check_mode = _m; }
+ inline eAccessCheckMode get_access_check_mode() { return a_access_check_mode; }
+};
+//.............................................................................
+struct AsyncSet : public AsyncCore
+{
};
// ###########################################################################
// Filesystem access structs : Get file info
@@ -384,7 +407,7 @@ struct AsyncCore
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Filesystem access structs : Get file info : Core ( GIO & GnomeVFS independant )
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-struct AsyncGetFileInfo : AsyncCore
+struct AsyncGetFileInfo : AsyncGet
{
friend struct GnomeVFS;
friend struct GIO;
@@ -416,7 +439,7 @@ struct AsyncGetFileInfo : AsyncCore
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Filesystem access structs : Enumerate : Core ( GIO & GnomeVFS independant )
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-struct AsyncEnumerateChildren : AsyncCore
+struct AsyncEnumerateChildren : AsyncGet
{
private:
Uri d_uri;
@@ -427,7 +450,7 @@ struct AsyncEnumerateChildren : AsyncCore
gint a_list_card;
protected:
- AsyncEnumerateChildren(AsyncCallerData*, const Uri, gint _max_result, gboolean _follow_links) ;
+ AsyncEnumerateChildren(AsyncCallerData*, const Uri, gint _max_result, gboolean _follow_links);
virtual ~AsyncEnumerateChildren();
public:
@@ -472,7 +495,7 @@ struct GnomeVFS
friend struct GnomeVFSMonitor;
private:
- static eFileAccess Access_from_GnomeVFSFilePermissions (GnomeVFSFilePermissions);
+ static eFileAccess Access_from_GnomeVFSFilePermissions (GnomeVFSFilePermissions, eAccessCheckMode);
static eFileType Type_from_GnomeVFSFileType (GnomeVFSFileType);
static eFileError Error_from_GnomeVFSResult (GnomeVFSResult);
@@ -482,9 +505,9 @@ struct GnomeVFS
static void Iter_enumerate_children_callback(GnomeVFSAsyncHandle*, GnomeVFSResult, GList*, guint, gpointer);
public:
- void iter_enumerate_children (AsyncCallerData*, const Uri);
- void iter_check_if_empty (AsyncCallerData*, const Uri);
- void iter_get_file_info (AsyncCallerData*, const Uri);
+ void iter_enumerate_children (AsyncCallerData*, const Uri, eAccessCheckMode);
+ void iter_check_if_empty (AsyncCallerData*, const Uri, eAccessCheckMode);
+ void iter_get_file_info (AsyncCallerData*, const Uri, eAccessCheckMode);
// no need for this one for instant
//void iter_get_file_info (AsyncCallerData*, const Uri);
//.................................................................
diff --git a/src/foldview/gnome-cmd-connection-treeview-model-vfs.cc b/src/foldview/gnome-cmd-connection-treeview-model-vfs.cc
index ec18e1b..184eba0 100644
--- a/src/foldview/gnome-cmd-connection-treeview-model-vfs.cc
+++ b/src/foldview/gnome-cmd-connection-treeview-model-vfs.cc
@@ -42,13 +42,30 @@
// ###########################################################################
GnomeCmdConnectionTreeview::eFileAccess
GnomeCmdConnectionTreeview::Model::GnomeVFS::Access_from_GnomeVFSFilePermissions(
- GnomeVFSFilePermissions _permissions)
+ GnomeVFSFilePermissions _permissions,
+ eAccessCheckMode _mode)
{
- return Access_from_read_write
- (
- ( ( _permissions & GNOME_VFS_PERM_ACCESS_READABLE ) != 0 ),
- ( ( _permissions & GNOME_VFS_PERM_ACCESS_WRITABLE ) != 0 )
- );
+ gboolean r = FALSE;
+ gboolean w = FALSE;
+ //.........................................................................
+ if ( _mode == eAccessCheckNone )
+ {
+ r = TRUE;
+ w = TRUE;
+ }
+
+ if ( _mode | eAccessCheckClientPerm )
+ {
+ r = r | ( ( _permissions & GNOME_VFS_PERM_ACCESS_READABLE ) != 0 );
+ w = w | ( ( _permissions & GNOME_VFS_PERM_ACCESS_WRITABLE ) != 0 );
+ }
+ if ( _mode | eAccessCheckOwnerPerm )
+ {
+ r = r | ( ( _permissions & GNOME_VFS_PERM_USER_READ ) != 0 );
+ w = w | ( ( _permissions & GNOME_VFS_PERM_USER_WRITE ) != 0 );
+ }
+
+ return Access_from_read_write(r, w);
}
GnomeCmdConnectionTreeview::eFileType
@@ -375,7 +392,7 @@ GnomeCmdConnectionTreeview::Model::GnomeVFS::Iter_get_file_info_callback(
gfi->a_is_symlink = GNOME_VFS_FILE_INFO_SYMLINK(info);
gfi->a_symlink_name = info->symlink_name;
gfi->a_type = Type_from_GnomeVFSFileType(info->type);
- gfi->a_access = Access_from_GnomeVFSFilePermissions(info->permissions);
+ gfi->a_access = Access_from_GnomeVFSFilePermissions(info->permissions, gfi->get_access_check_mode());
lab_call_caller:
(gfi->caller_data()->callback())(gfi);
@@ -418,8 +435,6 @@ GnomeCmdConnectionTreeview::Model::GnomeVFS::Iter_enumerate_children_callback(
FoldviewFile * file = NULL;
const gchar * file_display_name = NULL;
const gchar * file_display_name_ck = NULL;
- gboolean b_read;
- gboolean b_write;
eFileAccess file_access = eAccessUN;
gboolean file_has_flag_symlink = FALSE;
const gchar * file_symlink_target_name = NULL;
@@ -442,8 +457,6 @@ GnomeCmdConnectionTreeview::Model::GnomeVFS::Iter_enumerate_children_callback(
lab_loop:
- b_read = b_write = FALSE;
-
count++;
info = (GnomeVFSFileInfo*)(l->data);
@@ -453,9 +466,7 @@ lab_loop:
file_display_name = info->name;
file_display_name_ck = g_utf8_collate_key(file_display_name, -1);
- if ( ( info->permissions & GNOME_VFS_PERM_ACCESS_READABLE ) != 0 ) b_read = TRUE;
- if ( ( info->permissions & GNOME_VFS_PERM_ACCESS_WRITABLE ) != 0 ) b_write = TRUE;
- file_access = Access_from_read_write(b_read,b_write);
+ file_access = Access_from_GnomeVFSFilePermissions(info->permissions, vaec->get_access_check_mode());
file_has_flag_symlink = ( ( info->flags & GNOME_VFS_FILE_FLAGS_SYMLINK ) != 0 );
file_symlink_target_name = info->symlink_name;
@@ -505,9 +516,6 @@ lab_loop:
if ( strcmp(GnomeCmdConnectionTreeview::Collate_key_dot, file_display_name_ck ) &&
strcmp(GnomeCmdConnectionTreeview::Collate_key_dotdot, file_display_name_ck ))
{
- ENUMERATE_INF("strcmp:%i", strcmp(GnomeCmdConnectionTreeview::Collate_key_dot, file_display_name_ck ));
- ENUMERATE_INF("strcmp:%i", strcmp(GnomeCmdConnectionTreeview::Collate_key_dotdot, file_display_name_ck ));
-
added++;
ENUMERATE_INF("alsc:[%03i][0x%16x] [%03i][%03i][%03i] +<%s>", vaec->handle(), l, count, added, vaec->max_result(), file_display_name);
@@ -858,7 +866,7 @@ GnomeCmdConnectionTreeview::Model::GnomeVFS::Monitor_callback_child_new(
name = info->name;
type = Type_from_GnomeVFSFileType(info->type);
- access = Access_from_GnomeVFSFilePermissions(info->permissions);
+ access = Access_from_GnomeVFSFilePermissions(info->permissions, eAccessCheckClientPerm);
is_symlink = GNOME_VFS_FILE_INFO_SYMLINK(info);
symlink_name = info->symlink_name;
@@ -1014,7 +1022,7 @@ GnomeCmdConnectionTreeview::Model::GnomeVFS::Monitor_callback_child_acc(
name = info->name;
type = Type_from_GnomeVFSFileType(info->type);
- access = Access_from_GnomeVFSFilePermissions(info->permissions);
+ access = Access_from_GnomeVFSFilePermissions(info->permissions, eAccessCheckClientPerm);
is_symlink = GNOME_VFS_FILE_INFO_SYMLINK(info);
symlink_name = info->symlink_name;
@@ -1041,12 +1049,14 @@ abort:
void
GnomeCmdConnectionTreeview::Model::GnomeVFS::iter_check_if_empty(
AsyncCallerData * _acd,
- const Uri _uri)
+ const Uri _uri,
+ eAccessCheckMode _mode)
{
GnomeVFSAsyncEnumerateChildren * vaec = NULL;
//.........................................................................
//vaec = new GnomeVFSAsyncEnumerateChildren(_acd, _uri, 1, TRUE);
vaec = GCMD_STRUCT_NEW(GnomeVFSAsyncEnumerateChildren, _acd, _uri, 1, TRUE);
+ vaec->set_access_check_mode(_mode);
// Launch gvfs async op !
// uri ref_count is not incremented
@@ -1071,11 +1081,13 @@ GnomeCmdConnectionTreeview::Model::GnomeVFS::iter_check_if_empty(
void
GnomeCmdConnectionTreeview::Model::GnomeVFS::iter_enumerate_children(
AsyncCallerData * _acd,
- const Uri _uri)
+ const Uri _uri,
+ eAccessCheckMode _mode)
{
GnomeVFSAsyncEnumerateChildren * vaec = NULL;
//.........................................................................
vaec = GCMD_STRUCT_NEW(GnomeVFSAsyncEnumerateChildren, _acd, _uri, -1, TRUE);
+ vaec->set_access_check_mode(_mode);
// Launch gvfs async op !
// uri ref_count is not incremented
@@ -1100,12 +1112,14 @@ GnomeCmdConnectionTreeview::Model::GnomeVFS::iter_enumerate_children(
void
GnomeCmdConnectionTreeview::Model::GnomeVFS::iter_get_file_info(
AsyncCallerData * _acd,
- const Uri _uri)
+ const Uri _uri,
+ eAccessCheckMode _mode)
{
GnomeVFSAsyncGetFileInfo * gfi = NULL;
GList * list = NULL;
//.........................................................................
gfi = GCMD_STRUCT_NEW(GnomeVFSAsyncGetFileInfo, _acd, _uri);
+ gfi->set_access_check_mode(_mode);
list = g_list_append(list, gfi->gnomevfs_uri());
//GCMD_INF_vfs("als :[%03i] [0x%16x][0x%16x][%03i] Launch", hi, ga, ls, max_result);
diff --git a/src/foldview/gnome-cmd-connection-treeview-model.cc b/src/foldview/gnome-cmd-connection-treeview-model.cc
index 17d447f..cad6040 100644
--- a/src/foldview/gnome-cmd-connection-treeview-model.cc
+++ b/src/foldview/gnome-cmd-connection-treeview-model.cc
@@ -395,7 +395,7 @@ GtkTreeIter *iter_tree_out)
return iter_add_tree(
rw->uri_utf8(), rw->utf8_name_display(), rw->utf8_symlink_target_uri(),
rw->access(), rw->is_link(),
- control()->is_samba(), control()->is_local(), control()->host_redmond(),
+ control()->is_con_samba(), control()->is_con_local(), control()->host_redmond(),
iter_tree_out);
}
// ===========================================================================
@@ -1423,8 +1423,8 @@ GnomeCmdConnectionTreeview::Model::iter_refresh(
// create a struct for knowing what to do with GVFS answers
acd = GCMD_STRUCT_NEW(AsyncCallerData, this, Iter_refresh_callback, row->path()->dup());
- _USE_GIO_ ? a_GIO.iter_get_file_info(acd, row->uri_utf8()) :
- a_GnomeVFS.iter_get_file_info(acd, row->uri_utf8()) ;
+ _USE_GIO_ ? a_GIO.iter_get_file_info(acd, row->uri_utf8()) :
+ a_GnomeVFS.iter_get_file_info(acd, row->uri_utf8(), control()->access_check_mode()) ;
return;
}
@@ -1442,8 +1442,8 @@ GnomeCmdConnectionTreeview::Model::iter_refresh(
// create a struct for knowing what to do with GVFS answers
acd = GCMD_STRUCT_NEW(AsyncCallerData, this, Iter_refresh_callback, row->path()->dup());
- _USE_GIO_ ? a_GIO.iter_get_file_info(acd, row->uri_utf8()) :
- a_GnomeVFS.iter_get_file_info(acd, row->uri_utf8()) ;
+ _USE_GIO_ ? a_GIO.iter_get_file_info(acd, row->uri_utf8()) :
+ a_GnomeVFS.iter_get_file_info(acd, row->uri_utf8(), control()->access_check_mode()) ;
}
while ( treestore()->iter_next(treemodel(), &child) );
@@ -1594,8 +1594,8 @@ GnomeCmdConnectionTreeview::Model::iter_check_if_empty(
// create a struct for knowing what to do with async answers
acd = GCMD_STRUCT_NEW(AsyncCallerData, this, Iter_check_if_empty_callback, row->path()->dup());
- _USE_GIO_ ? a_GIO.iter_check_if_empty(acd, row->uri_utf8()) :
- a_GnomeVFS.iter_check_if_empty(acd, row->uri_utf8()) ;
+ _USE_GIO_ ? a_GIO.iter_check_if_empty(acd, row->uri_utf8()) :
+ a_GnomeVFS.iter_check_if_empty(acd, row->uri_utf8(), control()->access_check_mode()) ;
}
// ###########################################################################
@@ -1727,8 +1727,8 @@ GnomeCmdConnectionTreeview::Model::iter_expanded_from_ui(
// create a struct for knowing what to do with async answers
acd = GCMD_STRUCT_NEW(AsyncCallerData, this, Iter_expanded_from_ui_callback, row->path()->dup());
- _USE_GIO_ ? a_GIO.iter_enumerate_children(acd, row->uri_utf8()) :
- a_GnomeVFS.iter_enumerate_children(acd, row->uri_utf8());
+ _USE_GIO_ ? a_GIO.iter_enumerate_children(acd, row->uri_utf8()) :
+ a_GnomeVFS.iter_enumerate_children(acd, row->uri_utf8(), control()->access_check_mode());
}
// ###########################################################################
@@ -1759,8 +1759,8 @@ GnomeCmdConnectionTreeview::Model::iter_enumerate_children(
// create a struct for knowing what to do with async answers
acd = GCMD_STRUCT_NEW(AsyncCallerData, this, _callback, row->path()->dup());
- _USE_GIO_ ? a_GIO.iter_enumerate_children(acd, row->uri_utf8()) :
- a_GnomeVFS.iter_enumerate_children(acd, row->uri_utf8());
+ _USE_GIO_ ? a_GIO.iter_enumerate_children(acd, row->uri_utf8()) :
+ a_GnomeVFS.iter_enumerate_children(acd, row->uri_utf8(), control()->access_check_mode());
}
// ###########################################################################
@@ -1894,14 +1894,14 @@ GnomeCmdConnectionTreeview::Model::add_first_tree(
// create the first iter
row = new Row(eRowRoot, _uri, _alias, NULL,
eAccessRW, FALSE,
- control()->is_samba(), control()->is_local(), control()->host_redmond());
+ control()->is_con_samba(), control()->is_con_local(), control()->host_redmond());
iter_add_child(NULL, &iter_child, row);
// create a struct for knowing what to do with async answer
acd = GCMD_STRUCT_NEW(AsyncCallerData, this, Add_first_tree_callback, treestore()->ext_path_from_iter(&iter_child));
- _USE_GIO_ ? a_GIO.iter_get_file_info(acd, _uri) :
- a_GnomeVFS.iter_get_file_info(acd, _uri) ;
+ _USE_GIO_ ? a_GIO.iter_get_file_info(acd, _uri) :
+ a_GnomeVFS.iter_get_file_info(acd, _uri, control()->access_check_mode()) ;
}
// ###########################################################################
diff --git a/src/foldview/gnome-cmd-connection-treeview-model.snippet.h b/src/foldview/gnome-cmd-connection-treeview-model.snippet.h
index e869823..7349b13 100644
--- a/src/foldview/gnome-cmd-connection-treeview-model.snippet.h
+++ b/src/foldview/gnome-cmd-connection-treeview-model.snippet.h
@@ -214,6 +214,9 @@ struct Model
inline GnomeCmdFoldviewTreestore * treestore() { return d_treestore; }
inline GtkTreeModel * treemodel() { return GTK_TREE_MODEL(d_treestore); }
inline GtkTreeSortable * treesortable() { return GTK_TREE_SORTABLE(d_treestore);}
+ // =======================================================================
+ // divers
+ // =======================================================================
// =======================================================================
// NO LOCK : GtkTreeModelIface impl
diff --git a/src/foldview/gnome-cmd-connection-treeview-view.cc b/src/foldview/gnome-cmd-connection-treeview-view.cc
index 8669e18..3a74028 100644
--- a/src/foldview/gnome-cmd-connection-treeview-view.cc
+++ b/src/foldview/gnome-cmd-connection-treeview-view.cc
@@ -88,12 +88,12 @@ GnomeCmdConnectionTreeview::View::HeadBand::init_instance(
gtk_entry_set_has_frame(GTK_ENTRY(d_entry_path), TRUE);
gtk_entry_set_alignment(GTK_ENTRY(d_entry_path), 0.0f);
gtk_entry_set_editable(GTK_ENTRY(d_entry_path), FALSE);
- gtk_entry_set_text(GTK_ENTRY(d_entry_path), view()->control()->connection()->alias);
+ gtk_entry_set_text(GTK_ENTRY(d_entry_path), view()->control()->gnome_cmd_connection()->alias);
//.........................................................................
//
// Buttons setup
//
- gtk_button_set_image(GTK_BUTTON(d_button_connection_image), gtk_image_new_from_pixbuf(gnome_cmd_con_get_open_pixmap(view()->control()->connection())->pixbuf));
+ gtk_button_set_image(GTK_BUTTON(d_button_connection_image), gtk_image_new_from_pixbuf(gnome_cmd_con_get_open_pixmap(view()->control()->gnome_cmd_connection())->pixbuf));
gtk_button_set_image(GTK_BUTTON(d_button_refresh), gtk_image_new_from_pixbuf(GnomeCmdConnectionTreeview::s_gdk_pixbuf[eIconGtkRefresh]));
gtk_button_set_image(GTK_BUTTON(d_button_sort), gtk_image_new_from_pixbuf(GnomeCmdConnectionTreeview::s_gdk_pixbuf[eIconGtkSortDescending]));
gtk_button_set_image(GTK_BUTTON(d_button_show_hide), gtk_image_new_from_pixbuf(GnomeCmdConnectionTreeview::s_gdk_pixbuf[eIconFolderOpened]));
@@ -112,7 +112,7 @@ GnomeCmdConnectionTreeview::View::HeadBand::init_instance(
gtk_box_pack_start(GTK_BOX(d_hbox_main), d_entry_path, TRUE , TRUE , 0);
//gtk_box_pack_start(GTK_BOX(d_hbox_main), d_alignement_padder, TRUE , TRUE, 0);
gtk_box_pack_start(GTK_BOX(d_hbox_main), d_button_refresh, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(d_hbox_main), d_button_sort, FALSE, FALSE, 0);
+ //gtk_box_pack_start(GTK_BOX(d_hbox_main), d_button_sort, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(d_hbox_main), d_button_show_hide, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(d_hbox_main), d_button_close, FALSE, FALSE, 0);
}
diff --git a/src/foldview/gnome-cmd-connection-treeview.cc b/src/foldview/gnome-cmd-connection-treeview.cc
index a253c3f..cd0934f 100644
--- a/src/foldview/gnome-cmd-connection-treeview.cc
+++ b/src/foldview/gnome-cmd-connection-treeview.cc
@@ -32,6 +32,10 @@
*/
#include "gnome-cmd-connection-treeview.h"
+#include "gnome-cmd-con-device.h"
+#include "gnome-cmd-con-home.h"
+#include "gnome-cmd-con-smb.h"
+
// ###########################################################################
//
// GnomeCmdConnectionTreeview
@@ -74,8 +78,26 @@ GnomeCmdConnectionTreeview::GnomeCmdConnectionTreeview(
Collate_key_uri_01 = g_utf8_collate_key(_("file:///"), -1);
}
- a_foldview = _foldview;
- a_connection = _con;
+ a_foldview = _foldview;
+ a_connection = _con;
+ a_con_device_mount_point = NULL;
+ a_con_device_mount_point_len = 0;
+
+ // for device connections, we need to know the mount point because the way
+ // gnome_cmd_path is coded
+ if ( GNOME_CMD_IS_CON_DEVICE(_con) )
+ {
+ a_con_device_mount_point = g_strdup( gnome_cmd_con_device_get_mountp (GNOME_CMD_CON_DEVICE(_con)) );
+ a_con_device_mount_point_len = g_utf8_strlen(a_con_device_mount_point, -1);
+ }
+
+ // access check mode
+ a_access_check_mode = eAccessCheckClientPerm;
+
+ if ( a_connection->method == CON_FTP )
+ {
+ a_access_check_mode = eAccessCheckNone;
+ }
// create the control
d_control = GCMD_STRUCT_NEW(Control, this);
@@ -87,7 +109,7 @@ GnomeCmdConnectionTreeview::GnomeCmdConnectionTreeview(
d_view = GCMD_STRUCT_NEW(View, d_control, model()->treemodel());
// go !
- if ( gnome_cmd_con_is_local(a_connection) )
+ //if ( gnome_cmd_con_is_local(a_connection) )
{
p = gnome_cmd_con_create_path(a_connection, "");
u = gnome_cmd_con_create_uri(a_connection, p);
@@ -196,14 +218,19 @@ GnomeCmdConnectionTreeview::Pixbuf_unload_all()
//
// ***************************************************************************
gboolean
-GnomeCmdConnectionTreeview::is_samba()
+GnomeCmdConnectionTreeview::is_con_device()
{
- return ( a_connection->method == CON_SMB );
+ return GNOME_CMD_IS_CON_DEVICE( connection() );
}
gboolean
-GnomeCmdConnectionTreeview::is_local()
+GnomeCmdConnectionTreeview::is_con_samba()
{
- return ( a_connection->method == CON_LOCAL );
+ return GNOME_CMD_IS_CON_SMB( connection() );
+}
+gboolean
+GnomeCmdConnectionTreeview::is_con_local()
+{
+ return GNOME_CMD_IS_CON_HOME( connection() );
}
gboolean
@@ -212,6 +239,13 @@ GnomeCmdConnectionTreeview::host_redmond()
return FALSE; // _GWR_TODO_
}
+
+GnomeCmdConDevice*
+GnomeCmdConnectionTreeview::con_device()
+{
+ return GNOME_CMD_CON_DEVICE( connection() );
+}
+
// ***************************************************************************
//
// Actions
diff --git a/src/foldview/gnome-cmd-connection-treeview.h b/src/foldview/gnome-cmd-connection-treeview.h
index c0bf754..b51631c 100644
--- a/src/foldview/gnome-cmd-connection-treeview.h
+++ b/src/foldview/gnome-cmd-connection-treeview.h
@@ -48,6 +48,7 @@
// ...........................................................................
#include "gnome-cmd-includes.h"
#include "gnome-cmd-con.h"
+#include "gnome-cmd-con-device.h"
// ...........................................................................
#include "gnome-cmd-foldview-utils.h"
#include "gnome-cmd-foldview-logger.h"
@@ -103,6 +104,17 @@ struct GnomeCmdConnectionTreeview
eAccessUN = 4
};
+ public:
+ enum eAccessCheckMode
+ {
+ eAccessCheckNone = (guint32)(GCMD_B8(00000000)),
+
+ eAccessCheckClientPerm = (guint32)(GCMD_B8(00000000)),
+ eAccessCheckOwnerPerm = (guint32)(GCMD_B8(00000000)),
+
+ eAccessCheckAll = (guint32)((eAccessCheckClientPerm + eAccessCheckOwnerPerm))
+ };
+
public : enum eFileType
{
eTypeUnknown = 0 ,
@@ -194,8 +206,13 @@ struct GnomeCmdConnectionTreeview
static gboolean s_gdk_pixbuf_loaded;
GnomeCmdCon * a_connection;
+ gchar * a_con_device_mount_point;
+ gint a_con_device_mount_point_len;
+
GcmdGtkFoldview * a_foldview;
+ eAccessCheckMode a_access_check_mode;
+
GcmdStruct<Model> * d_model;
GcmdStruct<View> * d_view;
GcmdStruct<Control> * d_control;
@@ -219,11 +236,12 @@ struct GnomeCmdConnectionTreeview
// accessors
// =======================================================================
public:
- inline GcmdGtkFoldview * foldview() { return a_foldview; }
- inline GnomeCmdCon * connection() { return a_connection; }
- inline Model * model() { return d_model; }
- inline View * view() { return d_view; }
- inline Control * control() { return d_control; }
+ inline GcmdGtkFoldview * foldview() { return a_foldview; }
+ inline GnomeCmdCon * connection() { return a_connection; }
+ inline Model * model() { return d_model; }
+ inline View * view() { return d_view; }
+ inline Control * control() { return d_control; }
+ inline eAccessCheckMode access_check_mode() { return a_access_check_mode; }
// =======================================================================
// wrappers
// =======================================================================
@@ -243,9 +261,14 @@ struct GnomeCmdConnectionTreeview
// connection infos
// =======================================================================
public:
- gboolean is_samba();
- gboolean is_local();
+ gboolean is_con_device();
+ gboolean is_con_samba();
+ gboolean is_con_local();
gboolean host_redmond();
+
+ GnomeCmdConDevice * con_device();
+ const gchar* con_device_mount_point() { return a_con_device_mount_point; }
+ gint con_device_mount_point_len() { return a_con_device_mount_point_len; }
// =======================================================================
// some stuff
// =======================================================================
diff --git a/src/foldview/gnome-cmd-foldview-docs.h b/src/foldview/gnome-cmd-foldview-docs.h
index 163969b..b3db044 100644
--- a/src/foldview/gnome-cmd-foldview-docs.h
+++ b/src/foldview/gnome-cmd-foldview-docs.h
@@ -33,16 +33,20 @@
Check all g_list_append / prepend, doc says it works with NULL pointers
- ReEnable double-click
-
- Separators between multiples trees
-
Effective sorting in GtkTreeView
Test with GIO
Show broken symlinks
+ Broken access for gnome_cmd_con_device connections : seems that is
+ a bug in gcmd code
+
+ Is sorting realy useful ?
+
+ Set_connection on active pane fail as it seems there is no active pane
+ at the start of the program !
+
..................... facultative / later ............................
sync file_list when it is not active ( in a hidden tab )
@@ -55,6 +59,23 @@
depth info in uids ? seems impossible with actual code...
.......................................................................
+DONE 20.12.2010
+ fixed pb gnome_cmd_file_get_path in gnome-cmd-file.cc
+
+DONE 20.12.2010
+ removed sort button, sort is not yet effective and confuse users
+
+DONE 19.12.2010
+ File permissions on ftp connections :
+ - owner perms instead of client perms
+ - root folder has permissions 0, unable to browse...
+
+DONE Separators between multiples trees
+ -> headband above treeview control
+
+DONE ReEnable double-click
+
+
DONE _GWR_BUG_#01_
DONE Notification from filesystem, GIO based ( half coded )
diff --git a/src/foldview/gnome-cmd-foldview-logger.cc b/src/foldview/gnome-cmd-foldview-logger.cc
index cf669fb..6ce1bbe 100644
--- a/src/foldview/gnome-cmd-foldview-logger.cc
+++ b/src/foldview/gnome-cmd-foldview-logger.cc
@@ -41,6 +41,7 @@ Logger::LogFunction Logger::Log_function[6] =
static char s1 [1024];
static char s2 [1024];
+
/*
Prompt color format : <ESC>[{attr};{fg};{bg}m
diff --git a/src/foldview/gnome-cmd-foldview-logger.h b/src/foldview/gnome-cmd-foldview-logger.h
index 56df380..9ffc4ce 100644
--- a/src/foldview/gnome-cmd-foldview-logger.h
+++ b/src/foldview/gnome-cmd-foldview-logger.h
@@ -55,6 +55,7 @@ struct Logger
//=========================================================================
// Structs
//=========================================================================
+
private:
struct Channel
{
diff --git a/src/foldview/gnome-cmd-foldview-utils.h b/src/foldview/gnome-cmd-foldview-utils.h
index ac7c7eb..8ba9d1c 100644
--- a/src/foldview/gnome-cmd-foldview-utils.h
+++ b/src/foldview/gnome-cmd-foldview-utils.h
@@ -140,6 +140,8 @@ template <typename T> struct GcmdStruct : public T
template <typename U1, typename U2, typename U3> GcmdStruct(U1 u1, U2 u2, U3 u3) : T(u1, u2, u3) {}
template <typename U1, typename U2, typename U3, typename U4> GcmdStruct(U1 u1, U2 u2, U3 u3, U4 u4) : T(u1, u2, u3, u4) {}
template <typename U1, typename U2, typename U3, typename U4, typename U5> GcmdStruct(U1 u1, U2 u2, U3 u3, U4 u4, U5 u5) : T(u1, u2, u3, u4, u5) {}
+ template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6> GcmdStruct(U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6) : T(u1, u2, u3, u4, u5, u6) {}
+ template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7> GcmdStruct(U1 u1, U2 u2, U3 u3, U4 u4, U5 u5, U6 u6, U7 u7) : T(u1, u2, u3, u4, u5, u6, u7) {}
virtual ~GcmdStruct<T>() {}
};
diff --git a/src/foldview/gnome-cmd-foldview.cc b/src/foldview/gnome-cmd-foldview.cc
index 3a3c985..4ad78a3 100644
--- a/src/foldview/gnome-cmd-foldview.cc
+++ b/src/foldview/gnome-cmd-foldview.cc
@@ -384,25 +384,27 @@ void GcmdGtkFoldview::init_instance()
//
//
- // common
- sLogger.channel_create(eLogGcmd, "GCMD ", GCMD_B8(111000));
- sLogger.channel_create(eLogLeaks, "LEAKS ", GCMD_B8(111111));
- // control
- sLogger.channel_create(eLogFifo, "FIFO ", GCMD_B8(000000));
- sLogger.channel_create(eLogMsg, "MESSAGES ", GCMD_B8(111011));
- // model
- sLogger.channel_create(eLogFiles, "FILES ", GCMD_B8(000000));
- sLogger.channel_create(eLogRefresh, "REFRESH ", GCMD_B8(011011));
- sLogger.channel_create(eLogSort, "SORT ", GCMD_B8(111111));
- sLogger.channel_create(eLogEnumerate, "ENUMERATE", GCMD_B8(111000));
- sLogger.channel_create(eLogCheck, "CHECK ", GCMD_B8(111000));
- sLogger.channel_create(eLogExpand, "EXPAND ", GCMD_B8(111000));
- sLogger.channel_create(eLogMonitor, "MONITOR ", GCMD_B8(000000));
-
- sLogger.channel_create(eLogTreeNode, "TREENODE ", GCMD_B8(111011));
- sLogger.channel_create(eLogTreeBlock, "TREEBLOCK", GCMD_B8(111100));
- sLogger.channel_create(eLogTreeStore, "TREESTORE", GCMD_B8(111100));
-
+ if ( ! sLogger.channel(eLogGcmd) )
+ {
+ // common
+ sLogger.channel_create(eLogGcmd, "GCMD ", GCMD_B8(011000));
+ sLogger.channel_create(eLogLeaks, "LEAKS ", GCMD_B8(111111));
+ // control
+ sLogger.channel_create(eLogFifo, "FIFO ", GCMD_B8(011000));
+ sLogger.channel_create(eLogMsg, "MESSAGES ", GCMD_B8(011000));
+ // model
+ sLogger.channel_create(eLogFiles, "FILES ", GCMD_B8(000000));
+ sLogger.channel_create(eLogRefresh, "REFRESH ", GCMD_B8(011011));
+ sLogger.channel_create(eLogSort, "SORT ", GCMD_B8(011111));
+ sLogger.channel_create(eLogEnumerate, "ENUMERATE", GCMD_B8(011000));
+ sLogger.channel_create(eLogCheck, "CHECK ", GCMD_B8(011000));
+ sLogger.channel_create(eLogExpand, "EXPAND ", GCMD_B8(011000));
+ sLogger.channel_create(eLogMonitor, "MONITOR ", GCMD_B8(000000));
+
+ sLogger.channel_create(eLogTreeNode, "TREENODE ", GCMD_B8(111011));
+ sLogger.channel_create(eLogTreeBlock, "TREEBLOCK", GCMD_B8(111011));
+ sLogger.channel_create(eLogTreeStore, "TREESTORE", GCMD_B8(111011));
+ }
//.........................................................................
//
// Images
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]