[gnome-commander] Adding optional Samba support back, removed in commit aca5508f



commit 579a0f00480b6b12a2352b7c5dd2ff57fb9b62f9
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Mon Oct 11 22:49:03 2021 +0200

    Adding optional Samba support back, removed in commit aca5508f

 configure.ac                            | 13 ++++++++
 data/gnome-commander.ebuild.in          |  4 ++-
 src/Makefile.am                         |  6 +++-
 src/dialogs/gnome-cmd-con-dialog.cc     | 59 +++++++++++++++++++--------------
 src/dialogs/gnome-cmd-mkdir-dialog.cc   |  2 ++
 src/dialogs/gnome-cmd-options-dialog.cc |  4 +++
 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                   | 22 ++++++++++--
 src/gnome-cmd-data.h                    |  8 +++++
 src/gnome-cmd-dir.cc                    |  4 +++
 src/gnome-cmd-file-list.cc              |  2 ++
 src/gnome-cmd-file-selector.cc          | 14 ++++++++
 src/gnome-cmd-user-actions.cc           |  2 ++
 16 files changed, 136 insertions(+), 28 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 01821aad..0c29a5e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,18 @@ else
    AC_MSG_WARN([unique >= ${UNIQUE_REQ} not found, disabling unique support])
 fi
 
+dnl Check for samba support
+AC_ARG_WITH(samba, [AS_HELP_STRING([--without-samba], [disable SAMBA support])])
+have_samba=no
+if test "x$with_samba" != "xno"; then
+ have_samba=yes
+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
 AC_ARG_WITH(exiv2, [AS_HELP_STRING([--without-exiv2], [disable EXIF and IPTC support])])
 have_exiv2=no
@@ -258,6 +270,7 @@ echo "  CXXFLAGS         : ${CXXFLAGS}"
 echo "  LDFLAGS          : ${LDFLAGS}"
 echo ""
 echo "  libunique support:      ${have_unique}"
+echo "  Samba support:          ${have_samba}"
 echo ""
 echo "Optional file metadata support:"
 echo ""
diff --git a/data/gnome-commander.ebuild.in b/data/gnome-commander.ebuild.in
index f9f8d669..77438031 100644
--- a/data/gnome-commander.ebuild.in
+++ b/data/gnome-commander.ebuild.in
@@ -13,7 +13,7 @@ HOMEPAGE="https://gcmd.github.io/";
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-IUSE="chm exif gsf pdf taglib test +unique"
+IUSE="chm exif gsf pdf samba taglib test +unique"
 RESTRICT="!test? ( test )"
 
 RDEPEND="
@@ -24,6 +24,7 @@ RDEPEND="
        exif? ( >=media-gfx/exiv2-@EXIV2_REQ@ )
        gsf? ( >=gnome-extra/libgsf-@LIBGSF_REQ@ )
        pdf? ( >=app-text/poppler-@POPPLER_REQ@ )
+       samba? ( gnome-base/gvfs[samba] )
        taglib? ( >=media-libs/taglib-@TAGLIB_REQ@ )
        unique? ( >=dev-libs/libunique-@UNIQUE_REQ@:1 )
 "
@@ -51,6 +52,7 @@ src_configure() {
                $(use_with exif exiv2) \
                $(use_with gsf libgsf) \
                $(use_with pdf poppler) \
+               $(use_with samba) \
                $(use_with taglib) \
                $(use_with unique)
 }
diff --git a/src/Makefile.am b/src/Makefile.am
index 565f9407..6cde3327 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -80,10 +80,14 @@ gnome_commander_SOURCES = \
        tuple.h \
        utils.h utils.cc \
        utils-no-dependencies.h utils-no-dependencies.cc \
-       widget-factory.h \
+       widget-factory.h
+
+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 \
diff --git a/src/dialogs/gnome-cmd-con-dialog.cc b/src/dialogs/gnome-cmd-con-dialog.cc
index 51c5fc95..38d99bed 100644
--- a/src/dialogs/gnome-cmd-con-dialog.cc
+++ b/src/dialogs/gnome-cmd-con-dialog.cc
@@ -192,12 +192,14 @@ void GnomeCmdConnectDialog::Private::setup_for_type()
             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);
@@ -444,7 +446,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"));
@@ -559,37 +563,44 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
 
         gtk_entry_set_text (GTK_ENTRY (dialog->priv->server_entry), host);
 
-        if (con->method==CON_SMB)
-        {
-            gchar **a = g_strsplit (path, "/", 3);
-            if (g_strv_length (a) > 2)
+#ifdef HAVE_SAMBA
+            if (con->method==CON_SMB)
             {
-                gtk_entry_set_text (GTK_ENTRY (dialog->priv->share_entry), a[1]);
-                gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), a[2]);
-            }
-            else
-                gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), path);
-            g_strfreev (a);
-            if (user_name)
-            {
-                a = g_strsplit (user_name, ";", 2);
-                if (g_strv_length (a) > 1)
+                gchar **a = g_strsplit (path, "/", 3);
+
+                if (g_strv_length (a) > 2)
                 {
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->domain_entry), a[0]);
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), a[1]);
+                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->share_entry), a[1]);
+                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), a[2]);
                 }
                 else
+                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), path);
+
+                g_strfreev (a);
+
+                if (user_name)
                 {
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), user_name);
+                    a = g_strsplit (user_name, ";", 2);
+                    if (g_strv_length (a) > 1)
+                    {
+                        gtk_entry_set_text (GTK_ENTRY (dialog->priv->domain_entry), a[0]);
+                        gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), a[1]);
+                    }
+                    else
+                    {
+                        gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), user_name);
+                    }
+                    g_strfreev (a);
                 }
-                g_strfreev (a);
             }
-        }
-        else
-        {
-            gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), path);
-            gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), user_name);
-        }
+            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 (port)
             gtk_entry_set_text (GTK_ENTRY (dialog->priv->port_entry), stringify(port).c_str());
diff --git a/src/dialogs/gnome-cmd-mkdir-dialog.cc b/src/dialogs/gnome-cmd-mkdir-dialog.cc
index 0e3b2b85..f2ee5e60 100644
--- a/src/dialogs/gnome-cmd-mkdir-dialog.cc
+++ b/src/dialogs/gnome-cmd-mkdir-dialog.cc
@@ -47,6 +47,7 @@ GSList *make_gfile_list (GnomeCmdDir *dir, string filename)
             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
     auto dir_gFile = gnome_cmd_dir_get_gfile (dir);
@@ -62,6 +63,7 @@ GSList *make_gfile_list (GnomeCmdDir *dir, string filename)
     }
     g_free(uriScheme);
     g_object_unref (dir_gFile);
+#endif
 
     GSList *gFile_list = NULL;
 
diff --git a/src/dialogs/gnome-cmd-options-dialog.cc b/src/dialogs/gnome-cmd-options-dialog.cc
index 1226de00..7d2bb818 100644
--- a/src/dialogs/gnome-cmd-options-dialog.cc
+++ b/src/dialogs/gnome-cmd-options-dialog.cc
@@ -2115,9 +2115,11 @@ static GtkWidget *create_devices_tab (GtkWidget *parent, GnomeCmdData::Options &
     GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
     gtk_container_add (GTK_CONTAINER (bbox), button);
 
+#ifdef HAVE_SAMBA
     check = create_check (parent, _("Show Samba workgroups button\n(Needs program restart if altered)"), 
"samba_workgroups_button");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.show_samba_workgroups_button);
+#endif
 
     check = create_check (parent, _("Show only the icons"), "device_only_icon");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
@@ -2137,8 +2139,10 @@ void store_devices_options (GtkWidget *dialog, GnomeCmdData::Options &cfg)
     GtkWidget *device_only_icon = lookup_widget (dialog, "device_only_icon");
     cfg.device_only_icon = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (device_only_icon));
 
+#ifdef HAVE_SAMBA
     GtkWidget *samba_workgroups_button = lookup_widget (dialog, "samba_workgroups_button");
     cfg.show_samba_workgroups_button = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(samba_workgroups_button));
+#endif
 }
 
 
diff --git a/src/gnome-cmd-con-list.cc b/src/gnome-cmd-con-list.cc
index 18a6c59c..1955cfa3 100644
--- a/src/gnome-cmd-con-list.cc
+++ b/src/gnome-cmd-con-list.cc
@@ -24,7 +24,9 @@
 #include "gnome-cmd-includes.h"
 #include "gnome-cmd-con-home.h"
 #include "gnome-cmd-con-list.h"
+#ifdef HAVE_SAMBA
 #include "gnome-cmd-con-smb.h"
+#endif
 
 using namespace std;
 
@@ -42,7 +44,9 @@ struct GnomeCmdConList::Private
     GList *quick_ftp_cons {nullptr};
 
     GnomeCmdCon *home_con {nullptr};
+#ifdef HAVE_SAMBA
     GnomeCmdCon *smb_con  {nullptr};
+#endif
     GList *all_cons;
 };
 
@@ -146,13 +150,17 @@ static void init (GnomeCmdConList *con_list)
 
     con_list->priv->home_con = gnome_cmd_con_home_new ();
 
+#ifdef HAVE_SAMBA
     if (gnome_cmd_data.options.show_samba_workgroups_button)
         con_list->priv->smb_con = gnome_cmd_con_smb_new ();
+#endif
 
     con_list->priv->all_cons = g_list_append (nullptr, con_list->priv->home_con);
 
+#ifdef HAVE_SAMBA
     if (gnome_cmd_data.options.show_samba_workgroups_button)
         con_list->priv->all_cons = g_list_append (con_list->priv->all_cons, con_list->priv->smb_con);
+#endif
 }
 
 
@@ -371,7 +379,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 d9029873..af26102d 100644
--- a/src/gnome-cmd-con-list.h
+++ b/src/gnome-cmd-con-list.h
@@ -104,10 +104,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 83aaeb77..277b3238 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -55,7 +55,9 @@ static GtkObjectClass *parent_class = nullptr;
 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
@@ -635,6 +637,7 @@ string &__gnome_cmd_con_make_uri (string &s, const gchar *method, string &server
     return s;
 }
 
+#ifdef HAVE_SAMBA
 std::string &gnome_cmd_con_make_smb_uri (std::string &uriString, std::string &server, std::string &share, 
std::string &folder, std::string &domain, std::string &user, std::string &password)
 {
     user = stringify (g_strescape (user.c_str(), nullptr));
@@ -669,3 +672,4 @@ std::string &gnome_cmd_con_make_smb_uri (std::string &uriString, std::string &se
 
     return uriString;
 }
+#endif
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index 91dc7348..eaae6073 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -45,7 +45,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,
@@ -439,7 +441,9 @@ inline ConnectionMethodID gnome_cmd_con_get_scheme (const gchar *uriString)
            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;
 
     g_free(user);
@@ -481,7 +485,9 @@ inline std::string &gnome_cmd_con_make_ftp_uri (std::string &s, std::string &ser
     return __gnome_cmd_con_make_uri (s, "ftp://";, server, port, folder, user, password);
 }
 
+#ifdef HAVE_SAMBA
 std::string &gnome_cmd_con_make_smb_uri (std::string &s, std::string &server, std::string &share, 
std::string &folder, std::string &domain, std::string &user, std::string &password);
+#endif
 
 inline std::string &gnome_cmd_con_make_dav_uri (std::string &s, std::string &server, std::string &port, 
std::string &folder, std::string &user, std::string &password)
 {
@@ -502,7 +508,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, server, port, folder, user, password);
 
+#ifdef HAVE_SAMBA
         case CON_SMB:       return gnome_cmd_con_make_smb_uri (s, server, share, folder, domain, user, 
password);
+#endif
 
         case CON_DAV:       return gnome_cmd_con_make_dav_uri (s, server, port, folder, user, password);
 
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 302aa34d..43875a5a 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -129,8 +129,9 @@ static void gcmd_settings_dispose (GObject *object)
 static void on_bookmarks_changed ()
 {
     gnome_cmd_con_erase_bookmark (gnome_cmd_data.priv->con_list->get_home());
-
+#ifdef HAVE_SAMBA
     gnome_cmd_con_erase_bookmark (gnome_cmd_data.priv->con_list->get_smb());
+#endif
 
     gnome_cmd_data.load_bookmarks();
 
@@ -824,6 +825,7 @@ static void on_dev_only_icon_changed()
     gnome_cmd_data.options.device_only_icon = dev_only_icon;
 }
 
+#ifdef HAVE_SAMBA
 static void on_samba_device_icon_changed()
 {
     gboolean show_samba_workgroups_button;
@@ -831,6 +833,7 @@ static void on_samba_device_icon_changed()
     show_samba_workgroups_button = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_SAMBA_WORKGROUP_BUTTON);
     gnome_cmd_data.options.show_samba_workgroups_button = show_samba_workgroups_button;
 }
+#endif
 
 static void on_mainmenu_visibility_changed()
 {
@@ -1276,10 +1279,12 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_dev_only_icon_changed),
                       nullptr);
 
+#ifdef HAVE_SAMBA
     g_signal_connect (gs->general,
                       "changed::show-samba-workgroup-button",
                       G_CALLBACK (on_samba_device_icon_changed),
                       nullptr);
+#endif
 
     g_signal_connect (gs->general,
                       "changed::mainmenu-visibility",
@@ -1432,7 +1437,9 @@ GnomeCmdData::Options::Options(const Options &cfg)
     termexec = g_strdup (cfg.termexec);
     fav_apps = cfg.fav_apps;
     device_only_icon = cfg.device_only_icon;
+#ifdef HAVE_SAMBA
     show_samba_workgroups_button = cfg.show_samba_workgroups_button;
+#endif
     gcmd_settings = nullptr;
 }
 
@@ -1494,7 +1501,9 @@ GnomeCmdData::Options &GnomeCmdData::Options::operator = (const Options &cfg)
         termexec = g_strdup (cfg.termexec);
         fav_apps = cfg.fav_apps;
         device_only_icon = cfg.device_only_icon;
+#ifdef HAVE_SAMBA
         show_samba_workgroups_button = cfg.show_samba_workgroups_button;
+#endif
         gcmd_settings = nullptr;
     }
 
@@ -1561,8 +1570,10 @@ void GnomeCmdData::save_bookmarks()
     hasBookmarks |= add_bookmark_to_gvariant_builder(gVariantBuilder, "Home", con);
 
     // Samba
+#ifdef HAVE_SAMBA
     con = priv->con_list->get_smb();
     hasBookmarks |= add_bookmark_to_gvariant_builder(gVariantBuilder, "SMB", con);
+#endif
 
     // Others
     for (GList *i = gnome_cmd_con_list_get_all_remote (gnome_cmd_data.priv->con_list); i; i=i->next)
@@ -2172,11 +2183,13 @@ void GnomeCmdData::load_bookmarks()
             }
             else
             {
+#ifdef HAVE_SAMBA
                 if (strcmp(bookmarkGroupName, "SMB") == 0)
                 {
                     gnomeCmdCon = gnome_cmd_con_list_get()->get_smb();
                 }
                 else
+#endif
                     gnomeCmdCon = nullptr;
             }
         }
@@ -3097,8 +3110,9 @@ void GnomeCmdData::load()
     options.quick_search_exact_match_end = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_END);
 
     options.device_only_icon = g_settings_get_boolean(options.gcmd_settings->general, 
GCMD_SETTINGS_DEV_ONLY_ICON);
+#ifdef HAVE_SAMBA
     options.show_samba_workgroups_button = g_settings_get_boolean(options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_SAMBA_WORKGROUP_BUTTON);
-
+#endif
     options.symlink_prefix = g_settings_get_string(options.gcmd_settings->general, 
GCMD_SETTINGS_SYMLINK_PREFIX);
     if (!*options.symlink_prefix || strcmp(options.symlink_prefix, _("link to %s"))==0)
     {
@@ -3348,7 +3362,9 @@ void GnomeCmdData::load()
     else
     {
         gnome_cmd_con_erase_bookmark (priv->con_list->get_home());
+#ifdef HAVE_SAMBA
         gnome_cmd_con_erase_bookmark (priv->con_list->get_smb());
+#endif
         advrename_defaults.profiles.clear();
     }
 
@@ -3472,7 +3488,9 @@ void GnomeCmdData::save()
     set_gsettings_when_changed      (options.gcmd_settings->general, 
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_END, &(options.quick_search_exact_match_end));
 
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_DEV_ONLY_ICON, 
&(options.device_only_icon));
+#ifdef HAVE_SAMBA
     set_gsettings_when_changed      (options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_SAMBA_WORKGROUP_BUTTON, &(options.show_samba_workgroups_button));
+#endif
 
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_TOOLBAR, 
&(show_toolbar));
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_DEVBUTTONS, 
&(show_devbuttons));
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index a90f06fb..f1522602 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -96,7 +96,9 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_BEGIN  "quick-search-exact-match-begin"
 #define GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_END    "quick-search-exact-match-end"
 #define GCMD_SETTINGS_DEV_ONLY_ICON                   "dev-only-icon"
+#ifdef HAVE_SAMBA
 #define GCMD_SETTINGS_SHOW_SAMBA_WORKGROUP_BUTTON     "show-samba-workgroup-button"
+#endif
 #define GCMD_SETTINGS_MAINMENU_VISIBILITY             "mainmenu-visibility"
 #define GCMD_SETTINGS_QUICK_SEARCH_SHORTCUT           "quick-search"
 #define GCMD_SETTINGS_MAIN_WIN_WIDTH                  "main-win-width"
@@ -372,7 +374,9 @@ struct GnomeCmdData
         GList                       *fav_apps;
         //  Devices
         gboolean                     device_only_icon;
+#ifdef HAVE_SAMBA
         gboolean                     show_samba_workgroups_button;
+#endif
 
         Options(): gcmd_settings(nullptr),
                    left_mouse_button_mode(LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK),
@@ -421,8 +425,12 @@ struct GnomeCmdData
                    termopen(nullptr),
                    termexec(nullptr),
                    fav_apps(nullptr),
+#ifdef HAVE_SAMBA
                    device_only_icon(FALSE),
                    show_samba_workgroups_button(FALSE)
+#else
+                   device_only_icon(FALSE)
+#endif
         {
             memset(&color_themes, 0, sizeof(color_themes));
             memset(&ls_colors_palette, 0, sizeof(ls_colors_palette));
diff --git a/src/gnome-cmd-dir.cc b/src/gnome-cmd-dir.cc
index d816663f..bd8cd919 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"
@@ -641,6 +643,7 @@ GFile *gnome_cmd_dir_get_absolute_path_gfile (GnomeCmdDir *dir, string absolute_
 {
     g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), nullptr);
 
+#ifdef HAVE_SAMBA
     // include workgroups and shares for smb uris
     GFile *dir_gFile = gnome_cmd_dir_get_gfile (dir);
 
@@ -663,6 +666,7 @@ GFile *gnome_cmd_dir_get_absolute_path_gfile (GnomeCmdDir *dir, string absolute_
     g_free(uriScheme);
 
     g_object_unref (dir_gFile);
+#endif
 
     GnomeCmdPath *path = gnome_cmd_con_create_path (dir->priv->con, absolute_filename.c_str());
     auto gFile = gnome_cmd_con_create_gfile (dir->priv->con, path);
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 8aaaf2a9..199baa7b 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2959,6 +2959,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);
@@ -2966,6 +2967,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 9ce5be4d..e442e86f 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"
@@ -365,8 +367,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);
 
@@ -787,8 +793,12 @@ static void init (GnomeCmdFileSelector *fs)
     {
         auto con = static_cast<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
 
         string textstring {gnome_cmd_con_get_alias (con)};
         string_size = get_string_pixel_size (textstring.c_str(), textstring.length());
@@ -1013,8 +1023,12 @@ void GnomeCmdFileSelector::update_connections()
         gchar *text[3];
         auto con = static_cast<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 1d3b2c14..0b525b62 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1906,6 +1906,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")
         {
@@ -1922,6 +1923,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());
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]