]> spindle.queued.net Git - midori/commitdiff
Remove the viewable scheme registration mechanism
authorChristian Dywan <christian@twotoasts.de>
Sun, 12 Sep 2010 19:03:14 +0000 (21:03 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 12 Sep 2010 19:03:14 +0000 (21:03 +0200)
midori/midori-viewable.c
midori/midori-viewable.h

index 566f847ea7084c803f3b00f5177a0736b4f7fa19..f17c305a8f167b0e1d513e0558751a33a62e6f7f 100644 (file)
@@ -97,8 +97,6 @@ midori_viewable_base_init (MidoriViewableIface* iface)
         G_TYPE_NONE, 1,
         GTK_TYPE_MENU);
 
-    iface->p = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
     iface->get_stock_id = midori_viewable_default_get_stock_id;
     iface->get_label = midori_viewable_default_get_label;
     iface->get_toolbar = midori_viewable_default_get_toolbar;
@@ -109,137 +107,6 @@ midori_viewable_base_init (MidoriViewableIface* iface)
 static void
 midori_viewable_base_finalize (MidoriViewableIface* iface)
 {
-    g_hash_table_destroy (iface->p);
-}
-
-/**
- * midori_viewable_new_from_uri:
- * @uri: an URI
- *
- * Attempts to create a new #MidoriViewable from the specified URI.
- *
- * The protocol of @uri must previously have been registered by
- * the #MidoriViewable via midori_viewable_register_protocol().
- *
- * Return value: a new #MidoriViewable, or %NULL
- *
- * Deprecated: 0.2.6
- **/
-GtkWidget*
-midori_viewable_new_from_uri (const gchar* uri)
-{
-    MidoriViewableIface* iface;
-    gchar** parts;
-    gchar* type_name;
-    GType type;
-
-    if (!(iface = g_type_default_interface_peek (MIDORI_TYPE_VIEWABLE)))
-    {
-        g_warning ("No viewable interface available");
-        return NULL;
-    }
-
-    g_return_val_if_fail (uri != NULL, NULL);
-
-    if (!g_hash_table_size (iface->p))
-        return NULL;
-
-    if ((parts = g_strsplit (uri, "://", 2)))
-    {
-        if (!(type_name = g_hash_table_lookup (iface->p, parts[0])))
-        {
-            /* FIXME: Support midori://dummy/foo */
-
-            type_name = g_hash_table_lookup (iface->p, uri);
-        }
-        g_strfreev (parts);
-        if (type_name)
-        {
-            type = g_type_from_name (type_name);
-            g_free (type_name);
-            if (type)
-                return g_object_new (type, "uri", uri, NULL);
-        }
-    }
-    else if ((parts = g_strsplit_set (uri, ":", 2)))
-    {
-        type_name = g_hash_table_lookup (iface->p, parts[0]);
-        g_strfreev (parts);
-        if (type_name)
-        {
-            type = g_type_from_name (type_name);
-            g_free (type_name);
-            if (type)
-                return g_object_new (type, "uri", uri, NULL);
-        }
-    }
-    return NULL;
-}
-
-static gboolean
-viewable_type_implements (GType type,
-                          GType interface)
-{
-    GType *interfaces;
-    guint i;
-
-    if (!(interfaces = g_type_interfaces (type, NULL)))
-        return FALSE;
-    for (i = 0; interfaces[i]; i++)
-    {
-        if (interfaces[i] == interface)
-        {
-            g_free (interfaces);
-            return TRUE;
-        }
-    }
-    g_free (interfaces);
-    return FALSE;
-}
-
-/**
- * midori_viewable_register_protocol:
- * @type: a type that implements #MidoriViewable
- * @protocol: a protocol
- *
- * Registers the specified protocol as supported by @type.
- *
- * The following kinds of protocols are supported:
- *
- * "dummy":       support URIs like "dummy://foo/bar"
- * "about:dummy": support URIs like "about:dummy"
- * FIXME: The following is not yet fully supported
- * "midori://dummy": support URIs like "midori://dummy/foo"
- *
- * Return value: a new #MidoriViewable, or %NULL
- *
- * Deprecated: 0.2.6
- **/
-void
-midori_viewable_register_protocol (GType        type,
-                                   const gchar* protocol)
-{
-    MidoriViewableIface* iface;
-    GObjectClass* class;
-
-    if (!(iface = g_type_default_interface_peek (MIDORI_TYPE_VIEWABLE)))
-    {
-        g_warning ("No viewable interface available");
-        return;
-    }
-
-    g_return_if_fail (viewable_type_implements (type, MIDORI_TYPE_VIEWABLE));
-
-    if (!(class = g_type_class_peek (type)))
-    {
-        g_warning ("No class for %s available", g_type_name (type));
-        return;
-    }
-    g_return_if_fail (g_object_class_find_property (class, "uri"));
-    /* FIXME: Verify the syntax of protocol */
-
-    g_hash_table_insert (iface->p, g_strdup (protocol),
-                         g_strdup (g_type_name (type)));
 }
 
 /**
index fca3e6035ea6c5b6e1c9ffbf631b509164f89210..7e36c7b04d8810d47120c23618474a5a562db6e3 100644 (file)
@@ -12,8 +12,6 @@
 #ifndef __MIDORI_VIEWABLE_H__
 #define __MIDORI_VIEWABLE_H__
 
-#include <gtk/gtk.h>
-
 #include <katze/katze.h>
 
 G_BEGIN_DECLS
@@ -44,21 +42,11 @@ struct _MidoriViewableIface
 
     GtkWidget*
     (*get_toolbar)            (MidoriViewable*             viewable);
-
-    /* Private data */
-    gpointer p;
 };
 
 GType
 midori_viewable_get_type               (void) G_GNUC_CONST;
 
-GtkWidget*
-midori_viewable_new_from_uri           (const gchar*           uri);
-
-void
-midori_viewable_register_protocol      (GType                  type,
-                                        const gchar*           protocol);
-
 const gchar*
 midori_viewable_get_stock_id           (MidoriViewable*        viewable);