[gnome-commander] Moves first function with no class dependency from src/utils.cc into src/utils-no-dependencies.cc



commit 530bc9fb7eb1962e4999c89aaac686d500ac9f84
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Thu Jun 29 23:05:05 2017 +0200

    Moves first function with no class dependency from src/utils.cc into src/utils-no-dependencies.cc

 src/Makefile.am              |    1 +
 src/utils-no-dependencies.cc |   45 ++++++++++++++++++++++++++++++++++++++++++
 src/utils-no-dependencies.h  |   25 +++++++++++++++++++++++
 src/utils.cc                 |   19 -----------------
 src/utils.h                  |    3 +-
 5 files changed, 72 insertions(+), 21 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index b2dcc89..7c9d8bf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -81,6 +81,7 @@ gnome_commander_SOURCES = \
        plugin_manager.h plugin_manager.cc \
        tuple.h \
        utils.h utils.cc \
+       utils-no-dependencies.h utils-no-dependencies.cc \
        widget-factory.h
 
 if HAVE_PYTHON
diff --git a/src/utils-no-dependencies.cc b/src/utils-no-dependencies.cc
new file mode 100644
index 0000000..48bccdf
--- /dev/null
+++ b/src/utils-no-dependencies.cc
@@ -0,0 +1,45 @@
+/** 
+ * @file utils_no_dependencies.cc
+ * 
+ * @copyright (C) 2013-2017 Uwe Scholz\n
+ *
+ * @copyright This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * @copyright This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * @copyright You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <libgnomevfs/gnome-vfs.h>
+#include "utils-no-dependencies.h"
+
+
+gchar* str_uri_basename (const gchar *uri)
+{
+    if (!uri)
+        return NULL;
+
+    int len = strlen (uri);
+
+    if (len < 2)
+        return NULL;
+
+    int last_slash = 0;
+
+    for (int i=0; i<len; i++)
+        if (uri[i] == '/')
+            last_slash = i;
+
+    return gnome_vfs_unescape_string (&uri[last_slash+1], NULL);
+}
+
+
diff --git a/src/utils-no-dependencies.h b/src/utils-no-dependencies.h
new file mode 100644
index 0000000..34d2d16
--- /dev/null
+++ b/src/utils-no-dependencies.h
@@ -0,0 +1,25 @@
+/** 
+ * @file utils_no_dependencies.h
+ * 
+ * @copyright (C) 2013-2017 Uwe Scholz\n
+ *
+ * @copyright This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * @copyright This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * @copyright You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#pragma once
+
+#include <glib.h>
+
+
+gchar *str_uri_basename (const gchar *uri);
diff --git a/src/utils.cc b/src/utils.cc
index 31dd534..cb4319d 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -226,25 +226,6 @@ gint run_simple_dialog (GtkWidget *parent, gboolean ignore_close_box,
     return result;
 }
 
-gchar *str_uri_basename (const gchar *uri)
-{
-    if (!uri)
-        return NULL;
-
-    int len = strlen (uri),
-        last_slash=0;
-
-    if (len < 2)
-        return NULL;
-
-    for (int i=0; i<len; i++)
-        if (uri[i] == '/')
-            last_slash = i;
-
-    return gnome_vfs_unescape_string (&uri[last_slash+1], NULL);
-}
-
-
 const gchar *type2string (GnomeVFSFileType type, gchar *buf, guint max)
 {
     const char *s;
diff --git a/src/utils.h b/src/utils.h
index 8409af0..dda3046 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -33,6 +33,7 @@
 #include "gnome-cmd-types.h"
 #include "gnome-cmd-pixmap.h"
 #include "gnome-cmd-app.h"
+#include "utils-no-dependencies.h"
 
 #define TRACE(s)  std::cout << __FILE__ "(" << __LINE__ << ") " << __PRETTY_FUNCTION__ << "\t" #s ": `" << 
(s) << "'" << std::endl
 
@@ -117,8 +118,6 @@ inline char *int2string (gint i)
     return g_strdup_printf ("%d", i);
 }
 
-gchar *str_uri_basename (const gchar *uri);
-
 const gchar *type2string (GnomeVFSFileType type, gchar *buf, guint max);
 const gchar *name2string (gchar *filename, gchar *buf, guint max);
 const gchar *perm2string (GnomeVFSFilePermissions p, gchar *buf, guint max);


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