[gtranslator] Removed gtr_utils_get_ui_objects function



commit 76715008c342155e90102cb977cfb2f3cd084726
Author: Daniel Mustieles <daniel mustieles gmail com>
Date:   Thu Apr 19 14:44:14 2012 +0200

    Removed gtr_utils_get_ui_objects function

 src/gtr-utils.c |  121 -------------------------------------------------------
 src/gtr-utils.h |    7 ---
 2 files changed, 0 insertions(+), 128 deletions(-)
---
diff --git a/src/gtr-utils.c b/src/gtr-utils.c
index b0adac2..fbd51cd 100644
--- a/src/gtr-utils.c
+++ b/src/gtr-utils.c
@@ -299,127 +299,6 @@ gtr_utils_menu_position_under_tree_view (GtkMenu * menu,
     }
 }
 
-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);
-
-  msg = g_strconcat ("<span size=\"large\" weight=\"bold\">",
-                     msg_plain, "</span>\n\n",
-                     _("Please check your installation."), NULL);
-  label = gtk_label_new (msg);
-
-  gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-
-  g_free (msg_plain);
-  g_free (msg);
-
-  gtk_misc_set_padding (GTK_MISC (label), 5, 5);
-
-  return label;
-}
-
-/**
- * gtr_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.
- */
-gboolean
-gtr_utils_get_ui_objects (const gchar * filename,
-                          gchar ** root_objects,
-                          GtkWidget ** error_widget,
-                          const gchar * object_name, ...)
-{
-  GtkBuilder *builder;
-  va_list args;
-  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 (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);
-
-      return FALSE;
-    }
-
-  va_start (args, object_name);
-  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);
-                }
-            }
-        }
-    }
-  va_end (args);
-
-  g_free (filename_markup);
-  g_object_unref (builder);
-
-  return ret;
-}
 
 static gboolean
 is_valid_scheme_character (gchar c)
diff --git a/src/gtr-utils.h b/src/gtr-utils.h
index a840a92..2653d3d 100644
--- a/src/gtr-utils.h
+++ b/src/gtr-utils.h
@@ -49,13 +49,6 @@ void gtr_utils_menu_position_under_tree_view (GtkMenu * menu,
                                               gboolean * push_in,
                                               gpointer user_data);
 
-gboolean
-gtr_utils_get_ui_objects (const gchar * filename,
-                          gchar ** root_objects,
-                          GtkWidget ** error_widget,
-                          const gchar * object_name, ...)
-  G_GNUC_NULL_TERMINATED;
-
      GSList *gtr_utils_drop_get_locations (GtkSelectionData * selection_data);
 
      gchar *gtr_utils_escape_search_text (const gchar * text);



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