[gnome-commander] Conditionally compile the SAMBA related code
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Conditionally compile the SAMBA related code
- Date: Wed, 4 Jun 2014 17:08:57 +0000 (UTC)
commit 073cd48f6cf7e42892bfab836cbd64cc0345b6cd
Author: Uwe Scholz <uwescholz src gnome org>
Date: Wed Jun 4 19:08:28 2014 +0200
Conditionally compile the SAMBA related code
NEWS | 1 +
configure.ac | 1 +
doc/C/releases.xml | 3 +++
src/Makefile.am | 10 +++++++---
src/dialogs/gnome-cmd-con-dialog.cc | 10 +++++++++-
src/dialogs/gnome-cmd-mkdir-dialog.cc | 2 ++
src/gnome-cmd-con-list.cc | 10 +++++++---
src/gnome-cmd-con-list.h | 2 ++
src/gnome-cmd-con.cc | 4 ++++
src/gnome-cmd-con.h | 8 ++++++++
src/gnome-cmd-data.cc | 9 ++++++---
src/gnome-cmd-dir.cc | 6 ++++++
src/gnome-cmd-file-list.cc | 2 ++
src/gnome-cmd-file-selector.cc | 10 ++++++++++
src/gnome-cmd-user-actions.cc | 2 ++
src/gnome-cmd-xml-config.cc | 2 ++
16 files changed, 72 insertions(+), 10 deletions(-)
---
diff --git a/NEWS b/NEWS
index 7b9fa1d..ad2d94d 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Bug fixes:
* ...
New features:
* Always reopen the tab which was previously closed in the options dialog
+* Samba support is now optionally available via configure option
* New or updated translations:
...
* New key bindings:
diff --git a/configure.ac b/configure.ac
index 48c5bc8..ff2d0ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -227,6 +227,7 @@ fi
if test "x$have_samba" = "xyes"; then
AC_DEFINE(HAVE_SAMBA, 1, [Define to 1 if you have SAMBA support])
fi
+AM_CONDITIONAL([HAVE_SAMBA],[test "x$have_samba" = "xyes"])
dnl Check for exiv2 support
diff --git a/doc/C/releases.xml b/doc/C/releases.xml
index 7270975..5d8677c 100644
--- a/doc/C/releases.xml
+++ b/doc/C/releases.xml
@@ -41,6 +41,9 @@
<para>Always reopen the tab which was previously closed in the options
dialog</para>
</listitem>
<listitem>
+ <para>Samba support is now optionally available via configure option</para>
+ </listitem>
+ <listitem>
<para>New or updated docs: ??</para>
</listitem>
<listitem>
diff --git a/src/Makefile.am b/src/Makefile.am
index fb405fc..2ffcb65 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,7 +36,6 @@ gnome_commander_SOURCES = \
gnome-cmd-con-home.h gnome-cmd-con-home.cc \
gnome-cmd-con-list.h gnome-cmd-con-list.cc \
gnome-cmd-con-remote.h gnome-cmd-con-remote.cc \
- gnome-cmd-con-smb.h gnome-cmd-con-smb.cc \
gnome-cmd-convert.h gnome-cmd-convert.cc \
gnome-cmd-data.h gnome-cmd-data.cc \
gnome-cmd-dir-indicator.h gnome-cmd-dir-indicator.cc \
@@ -59,8 +58,6 @@ gnome_commander_SOURCES = \
gnome-cmd-regex.h \
gnome-cmd-quicksearch-popup.h gnome-cmd-quicksearch-popup.cc \
gnome-cmd-selection-profile-component.h gnome-cmd-selection-profile-component.cc \
- gnome-cmd-smb-net.h gnome-cmd-smb-net.cc \
- gnome-cmd-smb-path.h gnome-cmd-smb-path.cc \
gnome-cmd-style.h gnome-cmd-style.cc \
gnome-cmd-treeview.h gnome-cmd-treeview.cc \
gnome-cmd-types.h \
@@ -84,6 +81,13 @@ gnome_commander_SOURCES += \
gnome-cmd-python-plugin.h gnome-cmd-python-plugin.cc
endif
+if HAVE_SAMBA
+gnome_commander_SOURCES += \
+ gnome-cmd-con-smb.h gnome-cmd-con-smb.cc \
+ gnome-cmd-smb-net.h gnome-cmd-smb-net.cc \
+ gnome-cmd-smb-path.h gnome-cmd-smb-path.cc
+endif
+
gnome_commander_LDADD = \
$(top_builddir)/libgcmd/libgcmd.la \
dialogs/libgcmd-dialogs.a \
diff --git a/src/dialogs/gnome-cmd-con-dialog.cc b/src/dialogs/gnome-cmd-con-dialog.cc
index 68e64ca..06e5aea 100644
--- a/src/dialogs/gnome-cmd-con-dialog.cc
+++ b/src/dialogs/gnome-cmd-con-dialog.cc
@@ -212,19 +212,21 @@ void GnomeCmdConnectDialog::Private::setup_for_type()
show_domain = FALSE;
break;
- case CON_ANON_FTP:
+ case CON_ANON_FTP:
show_share = FALSE;
show_port = TRUE;
show_user = FALSE;
show_domain = FALSE;
break;
+#ifdef HAVE_SAMBA
case CON_SMB:
show_share = TRUE;
show_port = FALSE;
show_user = TRUE;
show_domain = TRUE;
break;
+#endif
}
show_entry (table, server_entry, _("_Server:"), i);
@@ -473,7 +475,9 @@ static void gnome_cmd_connect_dialog_init (GnomeCmdConnectDialog *dialog)
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("SSH"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("FTP (with login)"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Public FTP"));
+#ifdef HAVE_SAMBA
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Windows share"));
+#endif
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("WebDAV (HTTP)"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Secure WebDAV (HTTPS)"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Custom location"));
@@ -602,6 +606,7 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
const gchar *password = gnome_vfs_uri_get_password (uri);
guint port = gnome_vfs_uri_get_host_port (uri);
+#ifdef HAVE_SAMBA
if (con->method==CON_SMB)
{
gchar **a = g_strsplit (path, "/", 3);
@@ -630,9 +635,12 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
}
else
{
+#endif
gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), path);
gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), user_name);
+#ifdef HAVE_SAMBA
}
+#endif
if (password)
gtk_entry_set_text (GTK_ENTRY (dialog->priv->password_entry), password);
diff --git a/src/dialogs/gnome-cmd-mkdir-dialog.cc b/src/dialogs/gnome-cmd-mkdir-dialog.cc
index 8fbe253..e59f549 100644
--- a/src/dialogs/gnome-cmd-mkdir-dialog.cc
+++ b/src/dialogs/gnome-cmd-mkdir-dialog.cc
@@ -41,6 +41,7 @@ inline GSList *make_uri_list (GnomeCmdDir *dir, string filename)
else
filename.erase(0,1);
+#ifdef HAVE_SAMBA
// smb exception handling: test if we are in a samba share...
// if not - change filename so that we can get a proper error message
GnomeVFSURI *dir_uri = gnome_cmd_dir_get_uri (dir);
@@ -53,6 +54,7 @@ inline GSList *make_uri_list (GnomeCmdDir *dir, string filename)
filename.erase(0,1);
}
gnome_vfs_uri_unref (dir_uri);
+#endif
GSList *uri_list = NULL;
diff --git a/src/gnome-cmd-con-list.cc b/src/gnome-cmd-con-list.cc
index 4ab87cb..45926b7 100644
--- a/src/gnome-cmd-con-list.cc
+++ b/src/gnome-cmd-con-list.cc
@@ -23,8 +23,10 @@
#include "gnome-cmd-includes.h"
#include "gnome-cmd-con-home.h"
-#include "gnome-cmd-con-smb.h"
#include "gnome-cmd-con-list.h"
+#ifdef HAVE_SAMBA
+#include "gnome-cmd-con-smb.h"
+#endif
using namespace std;
@@ -42,8 +44,9 @@ struct GnomeCmdConList::Private
GList *quick_ftp_cons;
GnomeCmdCon *home_con;
+#ifdef HAVE_SAMBA
GnomeCmdCon *smb_con;
-
+#endif
GList *all_cons;
};
@@ -398,8 +401,9 @@ GnomeCmdCon *GnomeCmdConList::get_home()
return priv->home_con;
}
-
+#ifdef HAVE_SAMBA
GnomeCmdCon *GnomeCmdConList::get_smb()
{
return priv->smb_con;
}
+#endif
diff --git a/src/gnome-cmd-con-list.h b/src/gnome-cmd-con-list.h
index 2a8d2a8..c0d210f 100644
--- a/src/gnome-cmd-con-list.h
+++ b/src/gnome-cmd-con-list.h
@@ -102,10 +102,12 @@ inline GnomeCmdCon *get_home_con ()
return gnome_cmd_con_list_get()->get_home();
}
+#ifdef HAVE_SAMBA
inline GnomeCmdCon *get_smb_con ()
{
return gnome_cmd_con_list_get()->get_smb();
}
+#endif
inline GList *get_remote_cons ()
{
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index dbe7ba7..06d989e 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -55,7 +55,9 @@ static GtkObjectClass *parent_class = NULL;
const gchar *icon_name[] = {"gnome-fs-ssh", // CON_SSH
"gnome-fs-ftp", // CON_FTP
"gnome-fs-ftp", // CON_ANON_FTP
+#ifdef HAVE_SAMBA
"gnome-fs-smb", // CON_SMB
+#endif
"gnome-fs-web", // CON_DAV
"gnome-fs-web", // CON_DAVS
"gnome-fs-network", // CON_URI
@@ -559,6 +561,7 @@ GnomeKeyringAttributeList *gnome_cmd_con_create_keyring_attributes (const gchar
gchar **a = NULL;
+#ifdef HAVE_SAMBA
if (method==CON_SMB)
{
a = g_strsplit (user, ";", 2);
@@ -569,6 +572,7 @@ GnomeKeyringAttributeList *gnome_cmd_con_create_keyring_attributes (const gchar
user = a[1];
}
}
+#endif
GnomeKeyringAttributeList *attributes = gnome_keyring_attribute_list_new ();
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index 69097a6..0b2d449 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -48,7 +48,9 @@ enum ConnectionMethodID // Keep this order in sync with strings in gnome-
CON_SFTP = CON_SSH,
CON_FTP,
CON_ANON_FTP,
+#ifdef HAVE_SAMBA
CON_SMB,
+#endif
CON_DAV,
CON_DAVS,
CON_URI,
@@ -397,7 +399,9 @@ inline ConnectionMethodID gnome_cmd_con_get_scheme (GnomeVFSURI *uri)
g_str_equal (scheme, "sftp") ? CON_SSH :
g_str_equal (scheme, "dav") ? CON_DAV :
g_str_equal (scheme, "davs") ? CON_DAVS :
+#ifdef HAVE_SAMBA
g_str_equal (scheme, "smb") ? CON_SMB :
+#endif
CON_URI;
}
@@ -429,6 +433,7 @@ inline std::string &gnome_cmd_con_make_ftp_uri (std::string &s, gboolean use_aut
return __gnome_cmd_con_make_uri (s, "ftp://", use_auth, server, port, folder, user, password);
}
+#ifdef HAVE_SAMBA
inline std::string &gnome_cmd_con_make_smb_uri (std::string &s, gboolean use_auth, std::string &server,
std::string &share, std::string &folder, std::string &domain, std::string &user, std::string &password)
{
share = '/' + share;
@@ -460,6 +465,7 @@ inline std::string &gnome_cmd_con_make_smb_uri (std::string &s, gboolean use_aut
return s;
}
+#endif
inline std::string &gnome_cmd_con_make_dav_uri (std::string &s, gboolean use_auth, std::string &server,
std::string &port, std::string &folder, std::string &user, std::string &password)
{
@@ -480,7 +486,9 @@ inline std::string &gnome_cmd_con_make_uri (std::string &s, ConnectionMethodID m
case CON_SSH: return gnome_cmd_con_make_ssh_uri (s, use_auth, server, port, folder, user,
password);
+#ifdef HAVE_SAMBA
case CON_SMB: return gnome_cmd_con_make_smb_uri (s, use_auth, server, share, folder, domain,
user, password);
+#endif
case CON_DAV: return gnome_cmd_con_make_dav_uri (s, use_auth, server, port, folder, user,
password);
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index c6d9bd6..e62cf34 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -910,7 +910,7 @@ inline void GnomeCmdData::load_local_bookmarks()
gnome_cmd_con_add_bookmark (con, (gchar *) g_list_nth_data (names, i), (gchar *) g_list_nth_data
(paths, i));
}
-
+#ifdef HAVE_SAMBA
inline void GnomeCmdData::load_smb_bookmarks()
{
gint size = gnome_cmd_data_get_int ("/smb_bookmarks/count", 0);
@@ -922,7 +922,7 @@ inline void GnomeCmdData::load_smb_bookmarks()
for (gint i=0; i<size; i++)
gnome_cmd_con_add_bookmark (con, (gchar *) g_list_nth_data (names, i), (gchar *) g_list_nth_data
(paths, i));
}
-
+#endif
inline void GnomeCmdData::load_auto_load_plugins()
{
@@ -1515,7 +1515,9 @@ void GnomeCmdData::load_more()
if (!XML_cfg_has_bookmarks)
{
load_local_bookmarks();
+#ifdef HAVE_SAMBA
load_smb_bookmarks();
+#endif
}
}
@@ -1714,8 +1716,9 @@ void GnomeCmdData::save()
xml << XML::tag("Bookmarks");
write (xml, priv->con_list->get_home(), "Home");
+#ifdef HAVE_SAMBA
write (xml, priv->con_list->get_smb(), "SMB");
-
+#endif
for (GList *i=gnome_cmd_con_list_get_all_remote (gnome_cmd_data.priv->con_list); i; i=i->next)
{
GnomeCmdCon *con = GNOME_CMD_CON (i->data);
diff --git a/src/gnome-cmd-dir.cc b/src/gnome-cmd-dir.cc
index 7daea42..6bb63d2 100644
--- a/src/gnome-cmd-dir.cc
+++ b/src/gnome-cmd-dir.cc
@@ -24,7 +24,9 @@
#include "gnome-cmd-includes.h"
#include "gnome-cmd-dir.h"
#include "gnome-cmd-main-win.h"
+#ifdef HAVE_SAMBA
#include "gnome-cmd-con-smb.h"
+#endif
#include "gnome-cmd-data.h"
#include "gnome-cmd-con.h"
#include "gnome-cmd-file-collection.h"
@@ -407,6 +409,7 @@ static GList *create_file_list (GnomeCmdDir *dir, GList *info_list)
continue;
}
+#ifdef HAVE_SAMBA
if (GNOME_CMD_IS_CON_SMB (con)
&& info->mime_type
&& (strcmp (info->mime_type, "application/x-gnome-app-info") == 0 ||
@@ -422,6 +425,7 @@ static GList *create_file_list (GnomeCmdDir *dir, GList *info_list)
info->mime_type = strcmp (uri_str, "smb:///") == 0 ? g_strdup ("x-directory/smb-workgroup") :
g_strdup ("x-directory/smb-server");
}
+#endif
GnomeCmdFile *f = info->type == GNOME_VFS_FILE_TYPE_DIRECTORY ? GNOME_CMD_FILE
(gnome_cmd_dir_new_from_info (info, dir)) :
gnome_cmd_file_new (info, dir);
@@ -641,6 +645,7 @@ GnomeVFSURI *gnome_cmd_dir_get_absolute_path_uri (GnomeCmdDir *dir, string absol
{
g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
+#ifdef HAVE_SAMBA
// include workgroups and shares for smb uris
GnomeVFSURI *dir_uri = gnome_cmd_dir_get_uri (dir);
@@ -665,6 +670,7 @@ GnomeVFSURI *gnome_cmd_dir_get_absolute_path_uri (GnomeCmdDir *dir, string absol
}
gnome_vfs_uri_unref (dir_uri);
+#endif
GnomeCmdPath *path = gnome_cmd_con_create_path (dir->priv->con, absolute_filename.c_str());
GnomeVFSURI *uri = gnome_cmd_con_create_uri (dir->priv->con, path);
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 5808cc0..9a6aa4e 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2646,6 +2646,7 @@ void GnomeCmdFileList::goto_directory(const gchar *in_dir)
if (dir[0] == '/')
new_dir = gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, dir));
else
+#ifdef HAVE_SAMBA
if (g_str_has_prefix (dir, "\\\\"))
{
GnomeCmdPath *path = gnome_cmd_con_create_path (get_smb_con (), dir);
@@ -2653,6 +2654,7 @@ void GnomeCmdFileList::goto_directory(const gchar *in_dir)
new_dir = gnome_cmd_dir_new (get_smb_con (), path);
}
else
+#endif
new_dir = gnome_cmd_dir_get_child (cwd, dir);
}
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index 527543e..3e65fca 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -24,7 +24,9 @@
#include "gnome-cmd-includes.h"
#include "gnome-cmd-file-selector.h"
#include "gnome-cmd-con-list.h"
+#ifdef HAVE_SAMBA
#include "gnome-cmd-con-smb.h"
+#endif
#include "gnome-cmd-combo.h"
#include "gnome-cmd-data.h"
#include "gnome-cmd-cmdline.h"
@@ -376,8 +378,12 @@ static void create_con_buttons (GnomeCmdFileSelector *fs)
{
GnomeCmdCon *con = GNOME_CMD_CON (l->data);
+#ifdef HAVE_SAMBA
if (!gnome_cmd_con_is_open (con) && !GNOME_CMD_IS_CON_DEVICE (con) &&
!GNOME_CMD_IS_CON_SMB (con)) continue;
+#else
+ if (!gnome_cmd_con_is_open (con) && !GNOME_CMD_IS_CON_DEVICE (con)) continue;
+#endif
GnomeCmdPixmap *pm = gnome_cmd_con_get_go_pixmap (con);
@@ -988,8 +994,12 @@ void GnomeCmdFileSelector::update_connections()
gchar *text[3];
GnomeCmdCon *con = (GnomeCmdCon *) l->data;
+#ifdef HAVE_SAMBA
if (!gnome_cmd_con_is_open (con) && !GNOME_CMD_IS_CON_DEVICE (con)
&& !GNOME_CMD_IS_CON_SMB (con)) continue;
+#else
+ if (!gnome_cmd_con_is_open (con) && !GNOME_CMD_IS_CON_DEVICE (con)) continue;
+#endif
if (con == get_connection())
found_my_con = TRUE;
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index e98ed29..e8bfe79 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1921,6 +1921,7 @@ void bookmarks_goto (GtkMenuItem *menuitem, gpointer bookmark_name)
g_warning ("[%s] Unknown bookmark name: '%s' - ignored", (char *) bookmark_name, name.c_str());
}
+#ifdef HAVE_SAMBA
else
if (group=="smb" || group=="samba")
{
@@ -1937,6 +1938,7 @@ void bookmarks_goto (GtkMenuItem *menuitem, gpointer bookmark_name)
g_warning ("[%s] Unknown bookmark name: '%s' - ignored", (char *) bookmark_name, name.c_str());
}
+#endif
else
g_warning ("[%s] Unsupported bookmark group: '%s' - ignored", (char *) bookmark_name,
group.c_str());
}
diff --git a/src/gnome-cmd-xml-config.cc b/src/gnome-cmd-xml-config.cc
index 5f953ff..2a0f216 100644
--- a/src/gnome-cmd-xml-config.cc
+++ b/src/gnome-cmd-xml-config.cc
@@ -556,9 +556,11 @@ static void xml_start(GMarkupParseContext *context,
if (strcmp(param1,"Home")==0)
xml_con = gnome_cmd_con_list_get()->get_home();
else
+#ifdef HAVE_SAMBA
if (strcmp(param1,"SMB")==0)
xml_con = gnome_cmd_con_list_get()->get_smb();
else
+#endif
xml_con = NULL;
if (!xml_con)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]