diff options
| author | Marc Jeanmougin <marcjeanmougin@free.fr> | 2017-09-29 16:31:55 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2017-09-29 16:31:55 +0000 |
| commit | e79dffd40b61de158876961997df5c3cb3f34414 (patch) | |
| tree | 92a712d41f12815f20b9021c8a78b9bd362cb1da /src | |
| parent | CI/AppVeyor: Fix tests involving font rendering (diff) | |
| download | inkscape-e79dffd40b61de158876961997df5c3cb3f34414.tar.gz inkscape-e79dffd40b61de158876961997df5c3cb3f34414.zip | |
remove helper/gnome-utils.*
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/helper/gnome-utils.cpp | 116 | ||||
| -rw-r--r-- | src/helper/gnome-utils.h | 33 | ||||
| -rw-r--r-- | src/ui/interface.cpp | 14 |
4 files changed, 7 insertions, 158 deletions
diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index 443648c5c..bcd9f7c58 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -17,7 +17,6 @@ set(helper_SRC geom-pathvectorsatellites.cpp geom-satellite.cpp gettext.cpp - gnome-utils.cpp pixbuf-ops.cpp png-write.cpp stock-items.cpp @@ -39,7 +38,6 @@ set(helper_SRC geom-satellite.h geom.h gettext.h - gnome-utils.h mathfns.h pixbuf-ops.h png-write.h diff --git a/src/helper/gnome-utils.cpp b/src/helper/gnome-utils.cpp deleted file mode 100644 index 3d2b333a2..000000000 --- a/src/helper/gnome-utils.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Helpers - * - * Authors: - * Mitsuru Oka - * Lauris Kaplinski <lauris@kaplinski.com> - * - * Copyright (C) 2002 authors - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include <string.h> -#include <ctype.h> -#include <glib.h> - -#include "gnome-utils.h" - -/** - * gnome_uri_list_extract_uris: - * @uri_list: an uri-list in the standard format. - * - * Returns a GList containing strings allocated with g_malloc - * that have been splitted from @uri-list. - */ -GList *gnome_uri_list_extract_uris(const gchar *uri_list) -{ - const gchar *p, *q; - gchar *retval; - GList *result = NULL; - - g_return_val_if_fail(uri_list != NULL, NULL); - - p = uri_list; - - /* We don't actually try to validate the URI according to RFC - * 2396, or even check for allowed characters - we just ignore - * comments and trim whitespace off the ends. We also - * allow LF delimination as well as the specified CRLF. - */ - while (p) { - if (*p != '#') { - while (isspace(*p)) - p++; - - q = p; - while (*q && (*q != '\n') && (*q != '\r')) - q++; - - if (q > p) { - q--; - while (q > p && isspace(*q)) - q--; - - retval = (gchar *)g_malloc(q - p + 2); - strncpy(retval, p, q - p + 1); - retval[q - p + 1] = '\0'; - - result = g_list_prepend(result, retval); - } - } - p = strchr(p, '\n'); - if (p) - p++; - } - - return g_list_reverse(result); -} - -/** - * gnome_uri_list_extract_filenames: - * @uri_list: an uri-list in the standard format - * - * Returns a GList containing strings allocated with g_malloc - * that contain the filenames in the uri-list. - * - * Note that unlike gnome_uri_list_extract_uris() function, this - * will discard any non-file uri from the result value. - */ -GList *gnome_uri_list_extract_filenames(const gchar *uri_list) -{ - g_return_val_if_fail(uri_list != NULL, NULL); - - GList *result = gnome_uri_list_extract_uris(uri_list); - - GList *tmp_list = result; - while (tmp_list) { - gchar *s = (gchar *)tmp_list->data; - - GList *node = tmp_list; - tmp_list = tmp_list->next; - - if (!strncmp(s, "file:", 5)) { - node->data = g_filename_from_uri(s, NULL, NULL); - /* not sure if this fallback is useful at all */ - if (!node->data) - node->data = g_strdup(s + 5); - } else { - result = g_list_remove_link(result, node); - g_list_free_1(node); - } - g_free(s); - } - return result; -} - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/helper/gnome-utils.h b/src/helper/gnome-utils.h deleted file mode 100644 index 6f2f28223..000000000 --- a/src/helper/gnome-utils.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * GNOME Utils - Migration helper - * - * Authors: - * GNOME Developer - * Mitsuru Oka <oka326@parkcity.ne.jp> - * Lauris Kaplinski <lauris@ximian.com> - * - * Copyright (C) 2001 Lauris Kaplinski and Ximian, Inc. - * - * Released under GNU GPL - */ - -#ifndef SEEN_GNOME_UTILS_H -#define SEEN_GNOME_UTILS_H - -#include <glib.h> - -GList *gnome_uri_list_extract_uris(gchar const *uri_list); -GList *gnome_uri_list_extract_filenames(gchar const *uri_list); - -#endif // !SEEN_GNOME_UTILS_H - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 0223b2b3b..93e91b8f8 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -51,7 +51,6 @@ #include "sp-namedview.h" #include "sp-root.h" #include "helper/action.h" -#include "helper/gnome-utils.h" #include "helper/window.h" #include "io/sys.h" #include "ui/dialog-events.h" @@ -1339,12 +1338,13 @@ static void sp_ui_drag_leave( GtkWidget */*widget*/, static void sp_ui_import_files(gchar *buffer) { - GList *list = gnome_uri_list_extract_filenames(buffer); - if (!list) - return; - g_list_foreach(list, sp_ui_import_one_file_with_check, NULL); - g_list_foreach(list, (GFunc) g_free, NULL); - g_list_free(list); + gchar** l = g_uri_list_extract_uris(buffer); + for (int i = 0; i< g_strv_length (l); i++) { + gchar *f = g_filename_from_uri (l[i], NULL, NULL); + sp_ui_import_one_file_with_check(f, NULL); + g_free(f); + } + g_strfreev(l); } static void |
