[gedit/wip/gedit-next] utils: remove deprecated functions



commit af69e973a2f7473a41a12e831344035f49508018
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Mar 27 14:36:55 2016 +0200

    utils: remove deprecated functions
    
    Spring cleanup.

 gedit/gedit-utils.c |  285 ---------------------------------------------------
 gedit/gedit-utils.h |   38 -------
 2 files changed, 0 insertions(+), 323 deletions(-)
---
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index 2229dc0..37e886b 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -232,55 +232,6 @@ gedit_warning (GtkWindow *parent, const gchar *format, ...)
        gtk_widget_show (dialog);
 }
 
-/**
- * gedit_utils_escape_underscores:
- * @text: some text.
- * @length: the length.
- *
- * Doubles underscore to avoid spurious menu accels.
- *
- * Returns: the text escaped.
- * Deprecated: 3.18
- */
-gchar *
-gedit_utils_escape_underscores (const gchar *text,
-                               gssize       length)
-{
-       GString *str;
-       const gchar *p;
-       const gchar *end;
-
-       g_return_val_if_fail (text != NULL, NULL);
-
-       if (length < 0)
-               length = strlen (text);
-
-       str = g_string_sized_new (length);
-
-       p = text;
-       end = text + length;
-
-       while (p != end)
-       {
-               const gchar *next;
-               next = g_utf8_next_char (p);
-
-               switch (*p)
-               {
-                       case '_':
-                               g_string_append (str, "__");
-                               break;
-                       default:
-                               g_string_append_len (str, p, next - p);
-                               break;
-               }
-
-               p = next;
-       }
-
-       return g_string_free (str, FALSE);
-}
-
 /* the following functions are taken from eel */
 
 static gchar *
@@ -427,21 +378,6 @@ uri_get_dirname (const gchar *uri)
 }
 
 /**
- * gedit_utils_uri_get_dirname:
- * @uri: the URI.
- *
- * Note: this function replace home dir with ~.
- *
- * Returns: the directory name.
- * Deprecated: 3.18
- */
-gchar *
-gedit_utils_uri_get_dirname (const gchar *uri)
-{
-       return uri_get_dirname (uri);
-}
-
-/**
  * gedit_utils_location_get_dirname_for_display:
  * @location: the location
  *
@@ -819,214 +755,6 @@ gedit_utils_is_valid_location (GFile *location)
        return is_valid;
 }
 
-static GtkWidget *handle_builder_error (const gchar *message, ...) G_GNUC_PRINTF (1, 2);
-
-static GtkWidget *
-handle_builder_error (const gchar *message, ...)
-{
-       GtkWidget *label;
-       gchar *msg;
-       gchar *msg_plain;
-       va_list args;
-
-       va_start (args, message);
-       msg_plain = g_strdup_vprintf (message, args);
-       va_end (args);
-
-       label = gtk_label_new (NULL);
-       gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-
-       msg = g_strconcat ("<span size=\"large\" weight=\"bold\">",
-                          msg_plain, "</span>\n\n",
-                          _("Please check your installation."),
-                          NULL);
-
-       gtk_label_set_markup (GTK_LABEL (label), msg);
-
-       g_free (msg_plain);
-       g_free (msg);
-
-       gtk_widget_set_margin_start (label, 6);
-       gtk_widget_set_margin_end (label, 6);
-       gtk_widget_set_margin_top (label, 6);
-       gtk_widget_set_margin_bottom (label, 6);
-
-       return label;
-}
-
-/* TODO: just add a translation_doamin arg to get_ui_objects method */
-static gboolean
-get_ui_objects_with_translation_domain (const gchar  *filename,
-                                        const gchar  *translation_domain,
-                                        gchar       **root_objects,
-                                        GtkWidget   **error_widget,
-                                        const gchar  *object_name,
-                                        va_list       args)
-{
-       GtkBuilder *builder;
-       const gchar *name;
-       GError *error = NULL;
-       gchar *filename_markup;
-       gboolean ret = TRUE;
-
-       g_return_val_if_fail (filename != NULL, FALSE);
-       g_return_val_if_fail (error_widget != NULL, FALSE);
-       g_return_val_if_fail (object_name != NULL, FALSE);
-
-       filename_markup = g_markup_printf_escaped ("<i>%s</i>", filename);
-       *error_widget = NULL;
-
-       builder = gtk_builder_new ();
-
-       if (translation_domain != NULL)
-       {
-               gtk_builder_set_translation_domain (builder, translation_domain);
-       }
-
-       if (root_objects != NULL)
-       {
-               gtk_builder_add_objects_from_file (builder,
-                                                  filename,
-                                                  root_objects,
-                                                  &error);
-       }
-       else
-       {
-               gtk_builder_add_from_file (builder,
-                                          filename,
-                                          &error);
-       }
-
-       if (error != NULL)
-       {
-               *error_widget = handle_builder_error (_("Unable to open UI file %s. Error: %s"),
-                                                     filename_markup,
-                                                     error->message);
-               g_error_free (error);
-               g_free (filename_markup);
-               g_object_unref (builder);
-
-               return FALSE;
-       }
-
-       for (name = object_name; name; name = va_arg (args, const gchar *))
-       {
-               GObject **gobj;
-
-               gobj = va_arg (args, GObject **);
-               *gobj = gtk_builder_get_object (builder, name);
-
-               if (!*gobj)
-               {
-                       *error_widget = handle_builder_error (_("Unable to find the object '%s' inside file 
%s."),
-                                                             name,
-                                                             filename_markup),
-                       ret = FALSE;
-                       break;
-               }
-
-               /* we return a new ref for the root objects,
-                * the others are already reffed by their parent root object */
-               if (root_objects != NULL)
-               {
-                       gint i;
-
-                       for (i = 0; root_objects[i] != NULL; ++i)
-                       {
-                               if ((strcmp (name, root_objects[i]) == 0))
-                               {
-                                       g_object_ref (*gobj);
-                               }
-                       }
-               }
-       }
-
-       g_free (filename_markup);
-       g_object_unref (builder);
-
-       return ret;
-}
-
-/**
- * gedit_utils_get_ui_objects:
- * @filename: the path to the gtk builder file
- * @root_objects: a %NULL terminated list of root objects to load or NULL to
- *                load all objects
- * @error_widget: a pointer were a #GtkLabel
- * @object_name: the name of the first object
- * @...: a pointer were the first object is returned, followed by more
- *       name / object pairs and terminated by %NULL.
- *
- * This function gets the requested objects from a GtkBuilder ui file. In case
- * of error it returns %FALSE and sets error_widget to a GtkLabel containing
- * the error message to display.
- *
- * Returns: %FALSE if an error occurs, %TRUE on success.
- * Deprecated: 3.18
- */
-gboolean
-gedit_utils_get_ui_objects (const gchar  *filename,
-                           gchar       **root_objects,
-                           GtkWidget   **error_widget,
-                           const gchar  *object_name,
-                           ...)
-{
-       gboolean ret;
-       va_list args;
-
-       va_start (args, object_name);
-       ret = get_ui_objects_with_translation_domain (filename,
-                                                     NULL,
-                                                     root_objects,
-                                                     error_widget,
-                                                     object_name,
-                                                     args);
-       va_end (args);
-
-       return ret;
-}
-
-/**
- * gedit_utils_get_ui_objects_with_translation_domain:
- * @filename: the path to the gtk builder file
- * @translation_domain: the specific translation domain
- * @root_objects: a %NULL terminated list of root objects to load or NULL to
- *                load all objects
- * @error_widget: a pointer were a #GtkLabel
- * @object_name: the name of the first object
- * @...: a pointer were the first object is returned, followed by more
- *       name / object pairs and terminated by %NULL.
- *
- * This function gets the requested objects from a GtkBuilder ui file. In case
- * of error it returns %FALSE and sets error_widget to a GtkLabel containing
- * the error message to display.
- *
- * Returns: %FALSE if an error occurs, %TRUE on success.
- * Deprecated: 3.18
- */
-gboolean
-gedit_utils_get_ui_objects_with_translation_domain (const gchar  *filename,
-                                                    const gchar  *translation_domain,
-                                                    gchar       **root_objects,
-                                                    GtkWidget   **error_widget,
-                                                    const gchar  *object_name,
-                                                    ...)
-{
-       gboolean ret;
-       va_list args;
-
-       va_start (args, object_name);
-       ret = get_ui_objects_with_translation_domain (filename,
-                                                     translation_domain,
-                                                     root_objects,
-                                                     error_widget,
-                                                     object_name,
-                                                     args);
-       va_end (args);
-
-       return ret;
-}
-
 static gchar *
 make_canonical_uri_from_shell_arg (const gchar *str)
 {
@@ -1067,19 +795,6 @@ make_canonical_uri_from_shell_arg (const gchar *str)
 }
 
 /**
- * gedit_utils_make_canonical_uri_from_shell_arg:
- * @str: shell arg.
- *
- * Returns: canonical URI, or %NULL if @str is not a valid URI and/or filename.
- * Deprecated: 3.18
- */
-gchar *
-gedit_utils_make_canonical_uri_from_shell_arg (const gchar *str)
-{
-       return make_canonical_uri_from_shell_arg (str);
-}
-
-/**
  * gedit_utils_basename_for_display:
  * @location: location for which the basename should be displayed
  *
diff --git a/gedit/gedit-utils.h b/gedit/gedit-utils.h
index 5032d1e..6e73bd6 100644
--- a/gedit/gedit-utils.h
+++ b/gedit/gedit-utils.h
@@ -31,16 +31,6 @@ G_BEGIN_DECLS
 #define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
 #define GPOINTER_TO_BOOLEAN(i) ((gboolean) ((GPOINTER_TO_INT(i) == 2) ? TRUE : FALSE))
 
-/**
- * IS_VALID_BOOLEAN:
- * @v: a gboolean.
- *
- * Deprecated: 3.18
- */
-#ifndef GEDIT_DISABLE_DEPRECATED
-#define IS_VALID_BOOLEAN(v) (((v == TRUE) || (v == FALSE)) ? TRUE : FALSE)
-#endif
-
 enum { GEDIT_ALL_WORKSPACES = 0xffffffff };
 
 void            gedit_utils_menu_position_under_widget (GtkMenu          *menu,
@@ -56,10 +46,6 @@ void          gedit_utils_menu_position_under_tree_view
                                                         gboolean         *push_in,
                                                         gpointer          user_data);
 
-G_DEPRECATED
-gchar          *gedit_utils_escape_underscores         (const gchar      *text,
-                                                        gssize            length);
-
 gchar          *gedit_utils_str_middle_truncate        (const gchar      *string,
                                                         guint             truncate_length);
 
@@ -80,10 +66,6 @@ void          gedit_warning                          (GtkWindow        *parent,
 
 gchar          *gedit_utils_make_valid_utf8            (const char       *name);
 
-/* Note that this function replace home dir with ~ */
-G_DEPRECATED
-gchar          *gedit_utils_uri_get_dirname            (const char       *uri);
-
 gchar          *gedit_utils_location_get_dirname_for_display
                                                        (GFile            *location);
 
@@ -99,26 +81,6 @@ void          gedit_utils_get_current_viewport       (GdkScreen        *screen,
 
 gboolean        gedit_utils_is_valid_location          (GFile            *location);
 
-G_DEPRECATED
-gboolean        gedit_utils_get_ui_objects             (const gchar      *filename,
-                                                        gchar           **root_objects,
-                                                        GtkWidget       **error_widget,
-                                                        const gchar      *object_name,
-                                                        ...) G_GNUC_NULL_TERMINATED;
-
-G_DEPRECATED
-gboolean         gedit_utils_get_ui_objects_with_translation_domain
-                                                        (const gchar  *filename,
-                                                         const gchar  *translation_domain,
-                                                         gchar       **root_objects,
-                                                         GtkWidget   **error_widget,
-                                                         const gchar  *object_name,
-                                                         ...) G_GNUC_NULL_TERMINATED;
-
-G_DEPRECATED
-gchar          *gedit_utils_make_canonical_uri_from_shell_arg
-                                                       (const gchar      *str);
-
 gchar          *gedit_utils_basename_for_display       (GFile            *location);
 gboolean        gedit_utils_decode_uri                 (const gchar      *uri,
                                                         gchar           **scheme,


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