[gedit] Remove _gedit_tab_new_from_*() constructors



commit bf16296443dd9fb3cc90dee86601157efcd96745
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Jun 24 12:13:42 2015 +0200

    Remove _gedit_tab_new_from_*() constructors
    
    Those constructors were called at only one place, and it's as easy to
    call _gedit_tab_load() or _gedit_tab_load_stream().

 gedit/gedit-tab-private.h |   14 -------------
 gedit/gedit-tab.c         |   46 ---------------------------------------------
 gedit/gedit-window.c      |   34 ++++++++++++++++++++------------
 3 files changed, 21 insertions(+), 73 deletions(-)
---
diff --git a/gedit/gedit-tab-private.h b/gedit/gedit-tab-private.h
index 21075fa..c2a4b01 100644
--- a/gedit/gedit-tab-private.h
+++ b/gedit/gedit-tab-private.h
@@ -28,20 +28,6 @@ G_BEGIN_DECLS
 
 GtkWidget      *_gedit_tab_new                         (void);
 
-/* Whether create is TRUE, creates a new empty document if location does
- * not refer to an existing location
- */
-GtkWidget      *_gedit_tab_new_from_location           (GFile                   *location,
-                                                        const GtkSourceEncoding *encoding,
-                                                        gint                     line_pos,
-                                                        gint                     column_pos,
-                                                        gboolean                 create);
-
-GtkWidget      *_gedit_tab_new_from_stream             (GInputStream            *stream,
-                                                        const GtkSourceEncoding *encoding,
-                                                        gint                     line_pos,
-                                                        gint                     column_pos);
-
 gchar          *_gedit_tab_get_name                    (GeditTab                *tab);
 
 gchar          *_gedit_tab_get_tooltip                 (GeditTab                *tab);
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index f05bbc0..a7008a4 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -1434,52 +1434,6 @@ _gedit_tab_new (void)
        return g_object_new (GEDIT_TYPE_TAB, NULL);
 }
 
-/* Whether create is TRUE, creates a new empty document if location does
-   not refer to an existing location */
-GtkWidget *
-_gedit_tab_new_from_location (GFile                   *location,
-                             const GtkSourceEncoding *encoding,
-                             gint                     line_pos,
-                             gint                     column_pos,
-                             gboolean                 create)
-{
-       GtkWidget *tab;
-
-       g_return_val_if_fail (G_IS_FILE (location), NULL);
-
-       tab = _gedit_tab_new ();
-
-       _gedit_tab_load (GEDIT_TAB (tab),
-                        location,
-                        encoding,
-                        line_pos,
-                        column_pos,
-                        create);
-
-       return tab;
-}
-
-GtkWidget *
-_gedit_tab_new_from_stream (GInputStream            *stream,
-                           const GtkSourceEncoding *encoding,
-                           gint                     line_pos,
-                           gint                     column_pos)
-{
-       GtkWidget *tab;
-
-       g_return_val_if_fail (G_IS_INPUT_STREAM (stream), NULL);
-
-       tab = _gedit_tab_new ();
-
-       _gedit_tab_load_stream (GEDIT_TAB (tab),
-                               stream,
-                               encoding,
-                               line_pos,
-                               column_pos);
-
-       return tab;
-}
-
 /**
  * gedit_tab_get_view:
  * @tab: a #GeditTab
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index ba1c62f..84778e2 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -3117,21 +3117,25 @@ gedit_window_create_tab_from_location (GeditWindow             *window,
                                       gboolean                 jump_to)
 {
        GtkWidget *notebook;
-       GtkWidget *tab;
+       GeditTab *tab;
 
        g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
        g_return_val_if_fail (G_IS_FILE (location), NULL);
 
        gedit_debug (DEBUG_WINDOW);
 
+       tab = GEDIT_TAB (_gedit_tab_new ());
+
+       _gedit_tab_load (tab,
+                        location,
+                        encoding,
+                        line_pos,
+                        column_pos,
+                        create);
+
        notebook = _gedit_window_get_notebook (window);
-       tab = _gedit_tab_new_from_location (location,
-                                           encoding,
-                                           line_pos,
-                                           column_pos,
-                                           create);
 
-       return process_create_tab (window, notebook, GEDIT_TAB (tab), jump_to);
+       return process_create_tab (window, notebook, tab, jump_to);
 }
 
 /**
@@ -3154,20 +3158,24 @@ gedit_window_create_tab_from_stream (GeditWindow             *window,
                                     gboolean                 jump_to)
 {
        GtkWidget *notebook;
-       GtkWidget *tab;
+       GeditTab *tab;
 
        gedit_debug (DEBUG_WINDOW);
 
        g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
        g_return_val_if_fail (G_IS_INPUT_STREAM (stream), NULL);
 
+       tab = GEDIT_TAB (_gedit_tab_new ());
+
+       _gedit_tab_load_stream (tab,
+                               stream,
+                               encoding,
+                               line_pos,
+                               column_pos);
+
        notebook = _gedit_window_get_notebook (window);
-       tab = _gedit_tab_new_from_stream (stream,
-                                         encoding,
-                                         line_pos,
-                                         column_pos);
 
-       return process_create_tab (window, notebook, GEDIT_TAB (tab), jump_to);
+       return process_create_tab (window, notebook, tab, jump_to);
 }
 
 /**


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