[devhelp] DhLink: remove get_file_name()



commit d2c0dafa06adc62842ec12fedb98e45fad5064e2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Dec 6 21:13:43 2017 +0100

    DhLink: remove get_file_name()
    
    Several problems with that function:
    - Bad name, since it can contain an anchor. A better name would be
      get_relative_url().
    - Strange implementation for the book top-level link, it returns the
      empty string. The empty string meaning the default page is now better
      handled by dh_link_match_relative_url() and dh_link_belongs_to_page().
    
    And the function is now no longer used, it is dead code. It is not used
    by gnome-builder nor Anjuta.
    
    (It's a good time to add my copyright, I've already done a lot of
    commits in DhLink).

 docs/reference/api-breaks.xml       |    5 +++++
 docs/reference/devhelp-sections.txt |    1 -
 src/dh-link.c                       |   23 ++---------------------
 src/dh-link.h                       |    3 +--
 4 files changed, 8 insertions(+), 24 deletions(-)
---
diff --git a/docs/reference/api-breaks.xml b/docs/reference/api-breaks.xml
index 1c3cfe9..a479fcd 100644
--- a/docs/reference/api-breaks.xml
+++ b/docs/reference/api-breaks.xml
@@ -145,6 +145,11 @@
           <link linkend="DH-LINK-TYPE-BOOK:CAPS">DH_LINK_TYPE_BOOK</link>.
         </para>
       </listitem>
+      <listitem>
+        <para>
+          The <code>dh_link_get_file_name()</code> function has been removed.
+        </para>
+      </listitem>
     </itemizedlist>
   </refsect1>
 </part>
diff --git a/docs/reference/devhelp-sections.txt b/docs/reference/devhelp-sections.txt
index 93ae521..1a7190e 100644
--- a/docs/reference/devhelp-sections.txt
+++ b/docs/reference/devhelp-sections.txt
@@ -116,7 +116,6 @@ dh_link_get_link_type
 dh_link_get_flags
 dh_link_set_flags
 dh_link_get_name
-dh_link_get_file_name
 dh_link_match_relative_url
 dh_link_belongs_to_page
 dh_link_get_uri
diff --git a/src/dh-link.c b/src/dh-link.c
index 9207b3c..a252789 100644
--- a/src/dh-link.c
+++ b/src/dh-link.c
@@ -1,7 +1,8 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 /*
  * Copyright (C) 2001-2002 Mikael Hallendal <micke imendio com>
- * Copyright (C) 2008      Imendio AB
+ * Copyright (C) 2008 Imendio AB
+ * Copyright (C) 2017 Sébastien Wilmet <swilmet gnome org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -248,26 +249,6 @@ dh_link_get_name (DhLink *link)
 }
 
 /**
- * dh_link_get_file_name:
- * @link: a #DhLink.
- *
- * Returns: the name of the file that the @link is contained in.
- */
-const gchar *
-dh_link_get_file_name (DhLink *link)
-{
-        g_return_val_if_fail (link != NULL, NULL);
-
-        /* Return filename if the link is itself a page or if the link is within
-         * a page (i.e. every link type except a book).
-         */
-        if (link->type != DH_LINK_TYPE_BOOK)
-                return link->relative_url;
-
-        return "";
-}
-
-/**
  * dh_link_match_relative_url:
  * @link: a #DhLink.
  * @relative_url: an URL relative to the book base path. Can contain an anchor.
diff --git a/src/dh-link.h b/src/dh-link.h
index 69e9ad2..53c8304 100644
--- a/src/dh-link.h
+++ b/src/dh-link.h
@@ -2,6 +2,7 @@
 /*
  * Copyright (C) 2002 Mikael Hallendal <micke imendio com>
  * Copyright (C) 2008 Imendio AB
+ * Copyright (C) 2017 Sébastien Wilmet <swilmet gnome org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -91,8 +92,6 @@ void         dh_link_set_flags          (DhLink        *link,
 
 const gchar *dh_link_get_name           (DhLink        *link);
 
-const gchar *dh_link_get_file_name      (DhLink        *link);
-
 gboolean     dh_link_match_relative_url (DhLink        *link,
                                          const gchar   *relative_url);
 


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