[gedit] HistoryEntry: remove append_text() (dead code)



commit a4ebcefe6c7419053a15e3772e6772c1877487e8
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Jul 17 05:19:33 2020 +0200

    HistoryEntry: remove append_text() (dead code)

 gedit/gedit-history-entry.c | 47 +++++++++------------------------------------
 gedit/gedit-history-entry.h |  3 ---
 2 files changed, 9 insertions(+), 41 deletions(-)
---
diff --git a/gedit/gedit-history-entry.c b/gedit/gedit-history-entry.c
index 1f5416ed9..bdb9adc14 100644
--- a/gedit/gedit-history-entry.c
+++ b/gedit/gedit-history-entry.c
@@ -316,60 +316,31 @@ clamp_list_store (GtkListStore *store,
        gtk_tree_path_free (path);
 }
 
-static void
-insert_history_item (GeditHistoryEntry *entry,
-                    const gchar       *text,
-                    gboolean           prepend)
+void
+gedit_history_entry_prepend_text (GeditHistoryEntry *entry,
+                                 const gchar       *text)
 {
        GtkListStore *store;
 
+       g_return_if_fail (GEDIT_IS_HISTORY_ENTRY (entry));
+       g_return_if_fail (text != NULL);
+
        if (g_utf8_strlen (text, -1) <= MIN_ITEM_LEN)
+       {
                return;
+       }
 
        store = get_history_store (entry);
 
-       /* remove the text from the store if it was already
-        * present. If it wasn't, clamp to max history - 1
-        * before inserting the new row, otherwise appending
-        * would not work */
-
        if (!remove_item (entry, text))
        {
                clamp_list_store (store, entry->history_length - 1);
        }
 
-       if (prepend)
-       {
-               gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT (entry), text);
-       }
-       else
-       {
-               gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (entry), text);
-       }
-
+       gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT (entry), text);
        gedit_history_entry_save_history (entry);
 }
 
-void
-gedit_history_entry_prepend_text (GeditHistoryEntry *entry,
-                                 const gchar       *text)
-{
-       g_return_if_fail (GEDIT_IS_HISTORY_ENTRY (entry));
-       g_return_if_fail (text != NULL);
-
-       insert_history_item (entry, text, TRUE);
-}
-
-void
-gedit_history_entry_append_text (GeditHistoryEntry *entry,
-                                const gchar       *text)
-{
-       g_return_if_fail (GEDIT_IS_HISTORY_ENTRY (entry));
-       g_return_if_fail (text != NULL);
-
-       insert_history_item (entry, text, FALSE);
-}
-
 void
 gedit_history_entry_clear (GeditHistoryEntry *entry)
 {
diff --git a/gedit/gedit-history-entry.h b/gedit/gedit-history-entry.h
index b3e1b7044..553fa7b9a 100644
--- a/gedit/gedit-history-entry.h
+++ b/gedit/gedit-history-entry.h
@@ -36,9 +36,6 @@ GtkWidget *   gedit_history_entry_new                         (const gchar *history_id,
 void           gedit_history_entry_prepend_text                (GeditHistoryEntry *entry,
                                                                 const gchar       *text);
 
-void           gedit_history_entry_append_text                 (GeditHistoryEntry *entry,
-                                                                const gchar       *text);
-
 void           gedit_history_entry_clear                       (GeditHistoryEntry *entry);
 
 void           gedit_history_entry_set_history_length          (GeditHistoryEntry *entry,


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