[devhelp/wip/swilmet/misc-improvements] Remove unused util functions



commit 1bafcc841b17753a3594285355c25102340b2cf2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon May 25 18:35:01 2015 +0200

    Remove unused util functions
    
    dh-util.h is not a public header, so we can remove the functions.

 src/dh-util.c |  127 ---------------------------------------------------------
 src/dh-util.h |   12 +-----
 2 files changed, 1 insertions(+), 138 deletions(-)
---
diff --git a/src/dh-util.c b/src/dh-util.c
index 4746c00..26d150e 100644
--- a/src/dh-util.c
+++ b/src/dh-util.c
@@ -24,96 +24,6 @@
 #include <gtk/gtk.h>
 #include <math.h>
 
-static GtkBuilder *
-get_builder_file (const gchar *filename,
-                  const gchar *root,
-                  const gchar *domain,
-                  const gchar *first_required_widget,
-                  va_list args)
-{
-        GtkBuilder  *builder;
-        const char  *name;
-        GObject    **object_ptr;
-        GError      *error = NULL;
-
-        builder = gtk_builder_new ();
-
-        if (!gtk_builder_add_from_resource (builder, "/org/gnome/devhelp/devhelp.ui", &error)) {
-                g_warning ("Couldn't add resource: %s", error ? error->message : "unknown");
-                g_object_unref (builder);
-                g_clear_error (&error);
-                return NULL;
-        }
-
-        for (name = first_required_widget; name; name = va_arg (args, char *)) {
-                object_ptr = va_arg (args, void *);
-                *object_ptr = gtk_builder_get_object (builder, name);
-
-                if (!*object_ptr) {
-                        g_warning ("UI file '%s' is missing widget '%s'.",
-                                   filename, name);
-                        continue;
-                }
-        }
-
-        return builder;
-}
-
-GtkBuilder *
-dh_util_builder_get_file (const gchar *filename,
-                          const gchar *root,
-                          const gchar *domain,
-                          const gchar *first_required_widget,
-                          ...)
-{
-        va_list     args;
-        GtkBuilder *builder;
-
-        va_start (args, first_required_widget);
-        builder = get_builder_file (filename,
-                                    root,
-                                    domain,
-                                    first_required_widget,
-                                    args);
-        va_end (args);
-
-        return builder;
-}
-
-void
-dh_util_builder_connect (GtkBuilder *builder,
-                         gpointer    user_data,
-                         gchar     *first_widget,
-                         ...)
-{
-        va_list      args;
-        const gchar *name;
-        const gchar *signal;
-        GObject     *object;
-        gpointer    *callback;
-
-        va_start (args, first_widget);
-
-        for (name = first_widget; name; name = va_arg (args, char *)) {
-                signal = va_arg (args, void *);
-                callback = va_arg (args, void *);
-
-                object = gtk_builder_get_object (builder, name);
-                if (!object) {
-                        g_warning ("UI file is missing widget '%s', aborting",
-                                   name);
-                        continue;
-                }
-
-                g_signal_connect (object,
-                                  signal,
-                                  G_CALLBACK (callback),
-                                  user_data);
-        }
-
-        va_end (args);
-}
-
 gchar *
 dh_util_build_data_filename (const gchar *first_part,
                              ...)
@@ -153,43 +63,6 @@ dh_util_build_data_filename (const gchar *first_part,
         return ret;
 }
 
-gint
-dh_util_cmp_book (DhLink *a, DhLink *b)
-{
-        const gchar *name_a;
-        const gchar *name_b;
-        gchar       *name_a_casefold;
-        gchar       *name_b_casefold;
-        int          rc;
-
-        name_a = dh_link_get_name (a);
-        if (!name_a) {
-                name_a = "";
-        }
-
-        name_b = dh_link_get_name (b);
-        if (!name_b) {
-                name_b = "";
-        }
-
-        if (g_ascii_strncasecmp (name_a, "the ", 4) == 0) {
-                name_a += 4;
-        }
-        if (g_ascii_strncasecmp (name_b, "the ", 4) == 0) {
-                name_b += 4;
-        }
-
-        name_a_casefold = g_utf8_casefold (name_a, -1);
-        name_b_casefold = g_utf8_casefold (name_b, -1);
-
-        rc = strcmp (name_a_casefold, name_b_casefold);
-
-        g_free (name_a_casefold);
-        g_free (name_b_casefold);
-
-        return rc;
-}
-
 /* We're only going to expect ASCII strings here, so there's no point in
  * playing with g_unichar_totitle() and such.
  * Note that we modify the string in place.
diff --git a/src/dh-util.h b/src/dh-util.h
index 78a669d..1a7b203 100644
--- a/src/dh-util.h
+++ b/src/dh-util.h
@@ -26,21 +26,11 @@
 
 G_BEGIN_DECLS
 
-GtkBuilder * dh_util_builder_get_file             (const gchar *filename,
-                                                   const gchar *root,
-                                                   const gchar *domain,
-                                                   const gchar *first_required_widget,
-                                                   ...);
-void         dh_util_builder_connect              (GtkBuilder  *gui,
-                                                   gpointer     user_data,
-                                                   gchar       *first_widget,
-                                                   ...);
 gchar *      dh_util_build_data_filename          (const gchar *first_part,
                                                    ...);
-gint         dh_util_cmp_book                     (DhLink *a,
-                                                   DhLink *b);
 
 void         dh_util_ascii_strtitle               (gchar *str);
+
 gchar       *dh_util_create_data_uri_for_filename (const gchar *filename,
                                                    const gchar *mime_type);
 


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