]> spindle.queued.net Git - midori/commitdiff
Move MidoriWebList and MidoriWebItem to Katze
authorChristian Dywan <christian@twotoasts.de>
Tue, 5 Aug 2008 03:03:05 +0000 (05:03 +0200)
committerChristian Dywan <christian@twotoasts.de>
Tue, 5 Aug 2008 03:03:05 +0000 (05:03 +0200)
23 files changed:
katze/Makefile.am
katze/katze-throbber.c
katze/katze-throbber.h
katze/katze-webitem.c [new file with mode: 0644]
katze/katze-webitem.h [new file with mode: 0644]
katze/katze-weblist.c [new file with mode: 0644]
katze/katze-weblist.h [new file with mode: 0644]
katze/katze.h
midori/Makefile.am
midori/main.c
midori/midori-app.c
midori/midori-app.h
midori/midori-panel.c
midori/midori-searchentry.c
midori/midori-searchentry.h
midori/midori-webitem.c [deleted file]
midori/midori-webitem.h [deleted file]
midori/midori-weblist.c [deleted file]
midori/midori-weblist.h [deleted file]
midori/midori-webview.h
midori/sokoke.c
midori/sokoke.h
po/POTFILES.in

index ba058a4f85f1a165ec489c3ca12afefd9e097032..ed4128d686c9e643af28698f5238f0963b9b8d99 100644 (file)
@@ -14,4 +14,6 @@ libkatze_la_SOURCES = \
     katze.h                           \
     katze-throbber.c katze-throbber.h \
     katze-utils.c    katze-utils.h    \
+    katze-webitem.c  katze-webitem.h  \
+    katze-weblist.c  katze-weblist.h  \
     katze-xbel.c     katze-xbel.h
index 34f3510bb6db42cd0b6f0c40adab3634824fce79..b8ea1847b87f4e85a33bbb5e559268736b29d042 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "katze-throbber.h"
 
+#include "katze-utils.h"
+
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
index 7a459129203439795dfac7811a0c2f326b639d07..b4ef681c19b3ae85e65f4961362fe2a35f6fd9fc 100644 (file)
@@ -15,8 +15,6 @@
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
-#include "katze-utils.h"
-
 G_BEGIN_DECLS
 
 #define KATZE_TYPE_THROBBER \
diff --git a/katze/katze-webitem.c b/katze/katze-webitem.c
new file mode 100644 (file)
index 0000000..cd2927f
--- /dev/null
@@ -0,0 +1,376 @@
+/*
+ Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See the file COPYING for the full license text.
+*/
+
+#include "katze-webitem.h"
+
+#include "katze-utils.h"
+
+#include <glib/gi18n.h>
+
+struct _MidoriWebItem
+{
+    GObject parent_instance;
+
+    gchar* name;
+    gchar* description;
+    gchar* uri;
+    gchar* icon;
+    gchar* token;
+};
+
+G_DEFINE_TYPE (MidoriWebItem, midori_web_item, G_TYPE_OBJECT)
+
+enum
+{
+    PROP_0,
+
+    PROP_NAME,
+    PROP_DESCRIPTION,
+    PROP_URI,
+    PROP_ICON,
+    PROP_TOKEN
+};
+
+static void
+midori_web_item_finalize (GObject* object);
+
+static void
+midori_web_item_set_property (GObject*      object,
+                              guint         prop_id,
+                              const GValue* value,
+                              GParamSpec*   pspec);
+
+static void
+midori_web_item_get_property (GObject*    object,
+                              guint       prop_id,
+                              GValue*     value,
+                              GParamSpec* pspec);
+
+static void
+midori_web_item_class_init (MidoriWebItemClass* class)
+{
+    GObjectClass* gobject_class = G_OBJECT_CLASS (class);
+    gobject_class->finalize = midori_web_item_finalize;
+    gobject_class->set_property = midori_web_item_set_property;
+    gobject_class->get_property = midori_web_item_get_property;
+
+    GParamFlags flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
+
+    g_object_class_install_property (gobject_class,
+                                     PROP_NAME,
+                                     g_param_spec_string (
+                                     "name",
+                                     _("Name"),
+                                     _("The name of the web item"),
+                                     NULL,
+                                     flags));
+
+    g_object_class_install_property (gobject_class,
+                                     PROP_DESCRIPTION,
+                                     g_param_spec_string (
+                                     "description",
+                                     _("Description"),
+                                     _("The description of the web item"),
+                                     NULL,
+                                     flags));
+
+    g_object_class_install_property (gobject_class,
+                                     PROP_URI,
+                                     g_param_spec_string (
+                                     "uri",
+                                     _("URI"),
+                                     _("The URI of the web item"),
+                                     NULL,
+                                     flags));
+
+    g_object_class_install_property (gobject_class,
+                                     PROP_ICON,
+                                     g_param_spec_string (
+                                     "icon",
+                                     _("Icon"),
+                                     _("The icon of the web item"),
+                                     NULL,
+                                     flags));
+
+    g_object_class_install_property (gobject_class,
+                                     PROP_TOKEN,
+                                     g_param_spec_string (
+                                     "token",
+                                     _("Token"),
+                                     _("The token of the web item"),
+                                     NULL,
+                                     flags));
+}
+
+
+
+static void
+midori_web_item_init (MidoriWebItem* web_item)
+{
+    /* Nothing to do here */
+}
+
+static void
+midori_web_item_finalize (GObject* object)
+{
+    MidoriWebItem* web_item = MIDORI_WEB_ITEM (object);
+
+    g_free (web_item->name);
+    g_free (web_item->description);
+    g_free (web_item->uri);
+    g_free (web_item->icon);
+    g_free (web_item->token);
+
+    G_OBJECT_CLASS (midori_web_item_parent_class)->finalize (object);
+}
+
+static void
+midori_web_item_set_property (GObject*      object,
+                              guint         prop_id,
+                              const GValue* value,
+                              GParamSpec*   pspec)
+{
+    MidoriWebItem* web_item = MIDORI_WEB_ITEM (object);
+
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        web_item->name = g_value_dup_string (value);
+        break;
+    case PROP_DESCRIPTION:
+        web_item->description = g_value_dup_string (value);
+        break;
+    case PROP_URI:
+        web_item->uri = g_value_dup_string (value);
+        break;
+    case PROP_ICON:
+        web_item->icon = g_value_dup_string (value);
+        break;
+    case PROP_TOKEN:
+        web_item->token = g_value_dup_string (value);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
+static void
+midori_web_item_get_property (GObject*    object,
+                              guint       prop_id,
+                              GValue*     value,
+                              GParamSpec* pspec)
+{
+    MidoriWebItem* web_item = MIDORI_WEB_ITEM (object);
+
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        g_value_set_string (value, web_item->name);
+        break;
+    case PROP_DESCRIPTION:
+        g_value_set_string (value, web_item->description);
+        break;
+    case PROP_URI:
+        g_value_set_string (value, web_item->uri);
+        break;
+    case PROP_ICON:
+        g_value_set_string (value, web_item->icon);
+        break;
+    case PROP_TOKEN:
+        g_value_set_string (value, web_item->token);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
+/**
+ * midori_web_item_new:
+ *
+ * Creates a new #MidoriWebItem.
+ *
+ * Return value: a new #MidoriWebItem
+ **/
+MidoriWebItem*
+midori_web_item_new (void)
+{
+    MidoriWebItem* web_item = g_object_new (MIDORI_TYPE_WEB_ITEM,
+                                            NULL);
+
+    return web_item;
+}
+
+/**
+ * midori_web_item_get_name:
+ * @web_item: a #MidoriWebItem
+ *
+ * Retrieves the name of @web_item.
+ *
+ * Return value: the name of the web item
+ **/
+const gchar*
+midori_web_item_get_name (MidoriWebItem* web_item)
+{
+    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
+
+    return web_item->name;
+}
+
+/**
+ * midori_web_item_set_name:
+ * @web_item: a #MidoriWebItem
+ * @name: a string
+ *
+ * Sets the name of @web_item.
+ **/
+void
+midori_web_item_set_name (MidoriWebItem* web_item,
+                          const gchar*   name)
+{
+    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
+
+    katze_assign (web_item->name, g_strdup (name));
+    g_object_notify (G_OBJECT (web_item), "name");
+}
+
+/**
+ * midori_web_item_get_description:
+ * @web_item: a #MidoriWebItem
+ *
+ * Retrieves the description of @web_item.
+ *
+ * Return value: the description of the web item
+ **/
+const gchar*
+midori_web_item_get_description (MidoriWebItem* web_item)
+{
+    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
+
+    return web_item->description;
+}
+
+/**
+ * midori_web_item_set_description:
+ * @web_item: a #MidoriWebItem
+ * @description: a string
+ *
+ * Sets the description of @web_item.
+ **/
+void
+midori_web_item_set_description (MidoriWebItem* web_item,
+                                 const gchar*   description)
+{
+    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
+
+    katze_assign (web_item->description, g_strdup (description));
+    g_object_notify (G_OBJECT (web_item), "description");
+}
+
+/**
+ * midori_web_item_get_uri:
+ * @web_item: a #MidoriWebItem
+ *
+ * Retrieves the URI of @web_item.
+ *
+ * Return value: the URI of the web item
+ **/
+const gchar*
+midori_web_item_get_uri (MidoriWebItem* web_item)
+{
+    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
+
+    return web_item->uri;
+}
+
+/**
+ * midori_web_item_set_uri:
+ * @web_item: a #MidoriWebItem
+ * @uri: a string
+ *
+ * Sets the URI of @web_item.
+ **/
+void
+midori_web_item_set_uri (MidoriWebItem* web_item,
+                         const gchar*   uri)
+{
+    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
+
+    katze_assign (web_item->uri, g_strdup (uri));
+    g_object_notify (G_OBJECT (web_item), "uri");
+}
+
+/**
+ * midori_web_item_get_icon:
+ * @web_item: a #MidoriWebItem
+ *
+ * Retrieves the icon of @web_item.
+ *
+ * Return value: the icon of the web item
+ **/
+const gchar*
+midori_web_item_get_icon (MidoriWebItem* web_item)
+{
+    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
+
+    return web_item->icon;
+}
+
+/**
+ * midori_web_item_set_icon:
+ * @web_item: a #MidoriWebItem
+ * @icon: a string
+ *
+ * Sets the icon of @web_item.
+ **/
+void
+midori_web_item_set_icon (MidoriWebItem* web_item,
+                          const gchar*   icon)
+{
+    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
+
+    katze_assign (web_item->icon, g_strdup (icon));
+    g_object_notify (G_OBJECT (web_item), "icon");
+}
+
+/**
+ * midori_web_item_get_token:
+ * @web_item: a #MidoriWebItem
+ *
+ * Retrieves the token of @web_item.
+ *
+ * Return value: the token of the web item
+ **/
+const gchar*
+midori_web_item_get_token (MidoriWebItem* web_item)
+{
+    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
+
+    return web_item->token;
+}
+
+/**
+ * midori_web_item_set_token:
+ * @web_item: a #MidoriWebItem
+ * @token: a string
+ *
+ * Sets the token of @web_item.
+ **/
+void
+midori_web_item_set_token (MidoriWebItem* web_item,
+                           const gchar*   token)
+{
+    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
+
+    katze_assign (web_item->token, g_strdup (token));
+    g_object_notify (G_OBJECT (web_item), "token");
+}
diff --git a/katze/katze-webitem.h b/katze/katze-webitem.h
new file mode 100644 (file)
index 0000000..c1276ab
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See the file COPYING for the full license text.
+*/
+
+#ifndef __MIDORI_WEB_ITEM_H__
+#define __MIDORI_WEB_ITEM_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MIDORI_TYPE_WEB_ITEM \
+    (midori_web_item_get_type ())
+#define MIDORI_WEB_ITEM(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_WEB_ITEM, MidoriWebItem))
+#define MIDORI_WEB_ITEM_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_WEB_ITEM, MidoriWebItemClass))
+#define MIDORI_IS_WEB_ITEM(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_WEB_ITEM))
+#define MIDORI_IS_WEB_ITEM_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_WEB_ITEM))
+#define MIDORI_WEB_ITEM_GET_CLASS(obj) \
+    (G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_WEB_ITEM, MidoriWebItemClass))
+
+typedef struct _MidoriWebItem                MidoriWebItem;
+typedef struct _MidoriWebItemClass           MidoriWebItemClass;
+
+struct _MidoriWebItemClass
+{
+    GObjectClass parent_class;
+};
+
+GType
+midori_web_item_get_type               (void);
+
+MidoriWebItem*
+midori_web_item_new                    (void);
+
+const gchar*
+midori_web_item_get_name               (MidoriWebItem*  web_item);
+
+void
+midori_web_item_set_name               (MidoriWebItem*  web_item,
+                                        const gchar*    name);
+
+const gchar*
+midori_web_item_get_description        (MidoriWebItem*  web_item);
+
+void
+midori_web_item_set_description        (MidoriWebItem*  web_item,
+                                        const gchar*    description);
+
+const gchar*
+midori_web_item_get_uri                (MidoriWebItem*  web_item);
+
+void
+midori_web_item_set_uri                (MidoriWebItem*  web_item,
+                                        const gchar*    uri);
+
+const gchar*
+midori_web_item_get_icon               (MidoriWebItem*  web_item);
+
+void
+midori_web_item_set_icon               (MidoriWebItem*  web_item,
+                                        const gchar*    icon);
+
+const gchar*
+midori_web_item_get_token              (MidoriWebItem*  web_item);
+
+void
+midori_web_item_set_token              (MidoriWebItem*  web_item,
+                                        const gchar*    token);
+
+G_END_DECLS
+
+#endif /* __MIDORI_WEB_ITEM_H__ */
diff --git a/katze/katze-weblist.c b/katze/katze-weblist.c
new file mode 100644 (file)
index 0000000..e4abd21
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See the file COPYING for the full license text.
+*/
+
+#include "katze-weblist.h"
+
+#include "katze-utils.h"
+
+#include <glib/gi18n.h>
+#include <string.h>
+
+/**
+ * SECTION:midori-weblist
+ * @short_description: A versatile object container
+ * @see_also: #MidoriWebItem
+ *
+ * #MidoriWebList is a versatile container for objects with
+ * explicit support for #MidoriWebList and #MidoriWebItem children.
+ */
+
+struct _MidoriWebList
+{
+    GObject parent_instance;
+
+    GList* items;
+};
+
+G_DEFINE_TYPE (MidoriWebList, midori_web_list, G_TYPE_OBJECT)
+
+enum {
+    ADD_ITEM,
+    REMOVE_ITEM,
+
+    LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
+static void
+midori_web_list_finalize (GObject* object);
+
+static void
+_midori_web_list_add_item (MidoriWebList* web_list,
+                           GObject*       item)
+{
+    g_object_ref (item);
+    web_list->items = g_list_append (web_list->items, item);
+}
+
+static void
+_midori_web_list_remove_item (MidoriWebList* web_list,
+                              GObject*       item)
+{
+    web_list->items = g_list_remove (web_list->items, item);
+    g_object_unref (item);
+}
+
+static void
+midori_web_list_class_init (MidoriWebListClass* class)
+{
+    signals[ADD_ITEM] = g_signal_new (
+        "add-item",
+        G_TYPE_FROM_CLASS (class),
+        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+        G_STRUCT_OFFSET (MidoriWebListClass, add_item),
+        0,
+        NULL,
+        g_cclosure_marshal_VOID__OBJECT,
+        G_TYPE_NONE, 1,
+        G_TYPE_OBJECT);
+
+    signals[REMOVE_ITEM] = g_signal_new (
+        "remove-item",
+        G_TYPE_FROM_CLASS (class),
+        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+        G_STRUCT_OFFSET (MidoriWebListClass, remove_item),
+        0,
+        NULL,
+        g_cclosure_marshal_VOID__OBJECT,
+        G_TYPE_NONE, 1,
+        G_TYPE_OBJECT);
+
+    class->add_item = _midori_web_list_add_item;
+    class->remove_item = _midori_web_list_remove_item;
+
+    GObjectClass* gobject_class = G_OBJECT_CLASS (class);
+    gobject_class->finalize = midori_web_list_finalize;
+}
+
+static void
+midori_web_list_init (MidoriWebList* web_list)
+{
+    web_list->items = NULL;
+}
+
+static void
+midori_web_list_finalize (GObject* object)
+{
+    MidoriWebList* web_list = MIDORI_WEB_LIST (object);
+    guint n, i;
+
+    /* Scruffily remove all items, no need for signals */
+    n = g_list_length (web_list->items);
+    for (i = 0; i < n; i++)
+        g_object_unref (g_list_nth_data (web_list->items, i));
+    g_list_free (web_list->items);
+
+    G_OBJECT_CLASS (midori_web_list_parent_class)->finalize (object);
+}
+
+/**
+ * midori_web_list_new:
+ *
+ * Creates a new #MidoriWebList.
+ *
+ * Return value: a new #MidoriWebList
+ **/
+MidoriWebList*
+midori_web_list_new (void)
+{
+    MidoriWebList* web_list = g_object_new (MIDORI_TYPE_WEB_LIST,
+                                            NULL);
+
+    return web_list;
+}
+
+/**
+ * midori_web_list_add_item:
+ * @web_list: a #MidoriWebList
+ * @item: a #GObject
+ *
+ * Adds an item to the list.
+ **/
+void
+midori_web_list_add_item (MidoriWebList* web_list,
+                          gpointer       item)
+{
+    g_return_if_fail (MIDORI_IS_WEB_LIST (web_list));
+    g_return_if_fail (G_IS_OBJECT (item));
+
+    g_signal_emit (web_list, signals[ADD_ITEM], 0, item);
+}
+
+/**
+ * midori_web_list_add_item:
+ * @web_list: a #MidoriWebList
+ * @item: a #GObject
+ *
+ * Removes an item from the list.
+ **/
+void
+midori_web_list_remove_item (MidoriWebList* web_list,
+                             gpointer       item)
+{
+    g_return_if_fail (MIDORI_IS_WEB_LIST (web_list));
+    g_return_if_fail (G_IS_OBJECT (item));
+
+    g_signal_emit (web_list, signals[REMOVE_ITEM], 0, item);
+}
+
+/**
+ * midori_web_list_get_nth_item:
+ * @web_list: a #MidoriWebList
+ * @n: an index in the list
+ *
+ * Retrieves the item in @web_list at the position @n.
+ *
+ * Return value: an item, or %NULL
+ **/
+gpointer
+midori_web_list_get_nth_item (MidoriWebList* web_list,
+                              guint          n)
+{
+    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), NULL);
+
+    return g_list_nth_data (web_list->items, n);
+}
+
+/**
+ * midori_web_list_is_empty:
+ * @web_list: a #MidoriWebList
+ *
+ * Determines if @web_list is empty.
+ *
+ * Return value: an item, or %NULL
+ **/
+gboolean
+midori_web_list_is_empty (MidoriWebList* web_list)
+{
+    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), TRUE);
+
+    return !g_list_nth_data (web_list->items, 0);
+}
+
+/**
+ * midori_web_list_get_item_position:
+ * @web_list: a #MidoriWebList
+ * @item: an item in the list
+ *
+ * Retrieves the index of the item in @web_list.
+ *
+ * Return value: an item, or -1
+ **/
+gint
+midori_web_list_get_item_index (MidoriWebList* web_list,
+                                gpointer       item)
+{
+    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), -1);
+    g_return_val_if_fail (G_IS_OBJECT (item), -1);
+
+    return g_list_index (web_list->items, item);
+}
+
+/**
+ * midori_web_list_find_token:
+ * @web_list: a #MidoriWebList
+ * @token: a token string
+ *
+ * Looks up an item in the list which has the specified token.
+ *
+ * Supported is #MidoriWebItem.
+ *
+ * Note that @token is by definition unique to one item.
+ *
+ * Return value: an item, or %NULL
+ **/
+gpointer
+midori_web_list_find_token (MidoriWebList* web_list,
+                            const gchar*   token)
+{
+    guint n, i;
+    GObject* item;
+    MidoriWebItem* web_item;
+
+    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), NULL);
+
+    n = g_list_length (web_list->items);
+    for (i = 0; i < n; i++)
+    {
+        item = (GObject*)g_list_nth_data (web_list->items, i);
+        if (!MIDORI_IS_WEB_ITEM (item))
+            continue;
+        web_item = (MidoriWebItem*)item;
+        if (!strcmp (midori_web_item_get_token (web_item), token))
+            return item;
+    }
+    return NULL;
+}
+
+/**
+ * midori_web_list_get_length:
+ * @web_list: a #MidoriWebList
+ *
+ * Retrieves the number of items in @web_list.
+ *
+ * Return value: the length of the list
+ **/
+guint
+midori_web_list_get_length (MidoriWebList* web_list)
+{
+    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), 0);
+
+    return g_list_length (web_list->items);
+}
+
+/**
+ * midori_web_list_clear:
+ * @web_list: a #MidoriWebList
+ *
+ * Deletes all items currently contained in @web_list.
+ **/
+void
+midori_web_list_clear (MidoriWebList* web_list)
+{
+    guint n;
+    guint i;
+    GObject* item;
+
+    g_return_if_fail (MIDORI_IS_WEB_LIST (web_list));
+
+    n = g_list_length (web_list->items);
+    for (i = 0; i < n; i++)
+    {
+        if ((item = g_list_nth_data (web_list->items, i)))
+            midori_web_list_remove_item (web_list, item);
+    }
+    g_list_free (web_list->items);
+    web_list->items = NULL;
+}
diff --git a/katze/katze-weblist.h b/katze/katze-weblist.h
new file mode 100644 (file)
index 0000000..4f74cf4
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See the file COPYING for the full license text.
+*/
+
+#ifndef __MIDORI_WEB_LIST_H__
+#define __MIDORI_WEB_LIST_H__
+
+#include "katze-webitem.h"
+
+G_BEGIN_DECLS
+
+#define MIDORI_TYPE_WEB_LIST \
+    (midori_web_list_get_type ())
+#define MIDORI_WEB_LIST(obj) \
+    (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_WEB_LIST, MidoriWebList))
+#define MIDORI_WEB_LIST_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_WEB_LIST, MidoriWebListClass))
+#define MIDORI_IS_WEB_LIST(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_WEB_LIST))
+#define MIDORI_IS_WEB_LIST_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_WEB_LIST))
+#define MIDORI_WEB_LIST_GET_CLASS(obj) \
+    (G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_WEB_LIST, MidoriWebListClass))
+
+typedef struct _MidoriWebList                MidoriWebList;
+typedef struct _MidoriWebListClass           MidoriWebListClass;
+
+struct _MidoriWebListClass
+{
+    GObjectClass parent_class;
+
+    /* Signals */
+    void
+    (*add_item)               (MidoriWebList* web_list,
+                               GObject*       item);
+    void
+    (*remove_item)            (MidoriWebList* web_list,
+                               GObject*       item);
+};
+
+GType
+midori_web_list_get_type               (void);
+
+MidoriWebList*
+midori_web_list_new                    (void);
+
+void
+midori_web_list_add_item               (MidoriWebList* web_list,
+                                        gpointer       item);
+
+void
+midori_web_list_remove_item            (MidoriWebList* web_list,
+                                        gpointer       item);
+
+gpointer
+midori_web_list_get_nth_item           (MidoriWebList* web_list,
+                                        guint          n);
+
+gboolean
+midori_web_list_is_empty               (MidoriWebList* web_list);
+
+gint
+midori_web_list_get_item_index         (MidoriWebList* web_list,
+                                        gpointer       item);
+
+gpointer
+midori_web_list_find_token             (MidoriWebList* web_list,
+                                        const gchar*   token);
+
+guint
+midori_web_list_get_length             (MidoriWebList* web_list);
+
+void
+midori_web_list_clear                  (MidoriWebList* web_list);
+
+G_END_DECLS
+
+#endif /* __MIDORI_WEB_LIST_H__ */
index e0e72c9a13e7d58a1cb0babb06a1ac28a4f7203a..5523a1315ebde7f5289e50d294219f156d1a1b19 100644 (file)
@@ -14,6 +14,8 @@
 
 #include "katze-throbber.h"
 #include "katze-utils.h"
+#include "katze-webitem.h"
+#include "katze-weblist.h"
 #include "katze-xbel.h"
 
 #endif /* __KATZE_H__ */
index 716295686a0554c608600dceff6f5d4dcb980d0f..b3a009b7223049a4341fed821b460d5022c525f8 100644 (file)
@@ -20,9 +20,7 @@ bin_PROGRAMS = \
 
 midori_SOURCES = \
     main.c                 main.h                 \
-       gtkiconentry.c         gtkiconentry.h         \
-    midori-webitem.c       midori-webitem.h       \
-    midori-weblist.c       midori-weblist.h       \
+    gtkiconentry.c         gtkiconentry.h         \
     midori-app.c           midori-app.h           \
     midori-browser.c       midori-browser.h       \
     midori-panel.c         midori-panel.h         \
index 4f89a358e5e46365a7ceedf2ff51c83764e0bd88..0b064ae10066794b03ca1fc790d13b22ca0843c7 100644 (file)
@@ -16,7 +16,6 @@
 #include "midori-app.h"
 #include "midori-websettings.h"
 #include "midori-browser.h"
-#include "midori-weblist.h"
 #include "gjs.h"
 
 #include <string.h>
index fab0b780903ce0aef4a0e6d43aedcf1187475f5d..58335a2f7fbc7420dd0826d5183e8fa7f5a5dbe4 100644 (file)
@@ -11,8 +11,6 @@
 
 #include "midori-app.h"
 
-#include "midori-weblist.h"
-
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
index 9372d7e59c802161c07b8138d958e422455d08e5..6735a98c59b4638bfb469865f698acf3cc433ba7 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "midori-browser.h"
 #include "midori-websettings.h"
-#include "midori-weblist.h"
 
 G_BEGIN_DECLS
 
index 22e153c4f42108ae08f18fbaa4353e89c9fa577f..794d37e17372fcbaf3ee82f5d7f75783038cfeb3 100644 (file)
@@ -143,7 +143,7 @@ midori_panel_class_init (MidoriPanelClass* class)
                                      PROP_SHADOW_TYPE,
                                      g_param_spec_enum (
                                      "shadow-type",
-                                     "Shadow Type",
+                                     _("Shadow Type"),
                                      _("Appearance of the shadow around each panel"),
                                      GTK_TYPE_SHADOW_TYPE,
                                      GTK_SHADOW_NONE,
@@ -153,7 +153,7 @@ midori_panel_class_init (MidoriPanelClass* class)
                                      PROP_MENU,
                                      g_param_spec_object (
                                      "menu",
-                                     "Menu",
+                                     _("Menu"),
                                      _("Menu to hold panel items"),
                                      GTK_TYPE_MENU,
                                      G_PARAM_READWRITE));
@@ -162,7 +162,7 @@ midori_panel_class_init (MidoriPanelClass* class)
                                      PROP_PAGE,
                                      g_param_spec_int (
                                      "page",
-                                     "Page",
+                                     _("Page"),
                                      _("The index of the current page"),
                                      -1, G_MAXINT, -1,
                                      flags));
index bc2ceff4b5025c7fb73472b85040fc07e60fd56e..7f5a5a6593824247a9529878888b39680ed4f97d 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "sokoke.h"
 
-#include <katze/katze.h>
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n.h>
 
index ec379dd9e2dc45924586a17c17603a676f36d55c..ac7b794e1e90d4dc172e16356899b15684b9333f 100644 (file)
 #ifndef __MIDORI_SEARCH_ENTRY_H__
 #define __MIDORI_SEARCH_ENTRY_H__
 
-#include "midori-weblist.h"
 #include "gtkiconentry.h"
 
+#include <katze/katze.h>
+
 #include <gtk/gtk.h>
 
 G_BEGIN_DECLS
diff --git a/midori/midori-webitem.c b/midori/midori-webitem.c
deleted file mode 100644 (file)
index b74bbff..0000000
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#include "midori-webitem.h"
-
-#include <glib/gi18n.h>
-#include <katze/katze.h>
-
-struct _MidoriWebItem
-{
-    GObject parent_instance;
-
-    gchar* name;
-    gchar* description;
-    gchar* uri;
-    gchar* icon;
-    gchar* token;
-};
-
-G_DEFINE_TYPE (MidoriWebItem, midori_web_item, G_TYPE_OBJECT)
-
-enum
-{
-    PROP_0,
-
-    PROP_NAME,
-    PROP_DESCRIPTION,
-    PROP_URI,
-    PROP_ICON,
-    PROP_TOKEN
-};
-
-static void
-midori_web_item_finalize (GObject* object);
-
-static void
-midori_web_item_set_property (GObject*      object,
-                              guint         prop_id,
-                              const GValue* value,
-                              GParamSpec*   pspec);
-
-static void
-midori_web_item_get_property (GObject*    object,
-                              guint       prop_id,
-                              GValue*     value,
-                              GParamSpec* pspec);
-
-static void
-midori_web_item_class_init (MidoriWebItemClass* class)
-{
-    GObjectClass* gobject_class = G_OBJECT_CLASS (class);
-    gobject_class->finalize = midori_web_item_finalize;
-    gobject_class->set_property = midori_web_item_set_property;
-    gobject_class->get_property = midori_web_item_get_property;
-
-    GParamFlags flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
-
-    g_object_class_install_property (gobject_class,
-                                     PROP_NAME,
-                                     g_param_spec_string (
-                                     "name",
-                                     _("Name"),
-                                     _("The name of the web item"),
-                                     NULL,
-                                     flags));
-
-    g_object_class_install_property (gobject_class,
-                                     PROP_DESCRIPTION,
-                                     g_param_spec_string (
-                                     "description",
-                                     _("Description"),
-                                     _("The description of the web item"),
-                                     NULL,
-                                     flags));
-
-    g_object_class_install_property (gobject_class,
-                                     PROP_URI,
-                                     g_param_spec_string (
-                                     "uri",
-                                     _("URI"),
-                                     _("The URI of the web item"),
-                                     NULL,
-                                     flags));
-
-    g_object_class_install_property (gobject_class,
-                                     PROP_ICON,
-                                     g_param_spec_string (
-                                     "icon",
-                                     _("Icon"),
-                                     _("The icon of the web item"),
-                                     NULL,
-                                     flags));
-
-    g_object_class_install_property (gobject_class,
-                                     PROP_TOKEN,
-                                     g_param_spec_string (
-                                     "token",
-                                     _("Token"),
-                                     _("The token of the web item"),
-                                     NULL,
-                                     flags));
-}
-
-
-
-static void
-midori_web_item_init (MidoriWebItem* web_item)
-{
-    /* Nothing to do here */
-}
-
-static void
-midori_web_item_finalize (GObject* object)
-{
-    MidoriWebItem* web_item = MIDORI_WEB_ITEM (object);
-
-    g_free (web_item->name);
-    g_free (web_item->description);
-    g_free (web_item->uri);
-    g_free (web_item->icon);
-    g_free (web_item->token);
-
-    G_OBJECT_CLASS (midori_web_item_parent_class)->finalize (object);
-}
-
-static void
-midori_web_item_set_property (GObject*      object,
-                              guint         prop_id,
-                              const GValue* value,
-                              GParamSpec*   pspec)
-{
-    MidoriWebItem* web_item = MIDORI_WEB_ITEM (object);
-
-    switch (prop_id)
-    {
-    case PROP_NAME:
-        web_item->name = g_value_dup_string (value);
-        break;
-    case PROP_DESCRIPTION:
-        web_item->description = g_value_dup_string (value);
-        break;
-    case PROP_URI:
-        web_item->uri = g_value_dup_string (value);
-        break;
-    case PROP_ICON:
-        web_item->icon = g_value_dup_string (value);
-        break;
-    case PROP_TOKEN:
-        web_item->token = g_value_dup_string (value);
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
-}
-
-static void
-midori_web_item_get_property (GObject*    object,
-                              guint       prop_id,
-                              GValue*     value,
-                              GParamSpec* pspec)
-{
-    MidoriWebItem* web_item = MIDORI_WEB_ITEM (object);
-
-    switch (prop_id)
-    {
-    case PROP_NAME:
-        g_value_set_string (value, web_item->name);
-        break;
-    case PROP_DESCRIPTION:
-        g_value_set_string (value, web_item->description);
-        break;
-    case PROP_URI:
-        g_value_set_string (value, web_item->uri);
-        break;
-    case PROP_ICON:
-        g_value_set_string (value, web_item->icon);
-        break;
-    case PROP_TOKEN:
-        g_value_set_string (value, web_item->token);
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
-}
-
-/**
- * midori_web_item_new:
- *
- * Creates a new #MidoriWebItem.
- *
- * Return value: a new #MidoriWebItem
- **/
-MidoriWebItem*
-midori_web_item_new (void)
-{
-    MidoriWebItem* web_item = g_object_new (MIDORI_TYPE_WEB_ITEM,
-                                            NULL);
-
-    return web_item;
-}
-
-/**
- * midori_web_item_get_name:
- * @web_item: a #MidoriWebItem
- *
- * Retrieves the name of @web_item.
- *
- * Return value: the name of the web item
- **/
-const gchar*
-midori_web_item_get_name (MidoriWebItem* web_item)
-{
-    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
-
-    return web_item->name;
-}
-
-/**
- * midori_web_item_set_name:
- * @web_item: a #MidoriWebItem
- * @name: a string
- *
- * Sets the name of @web_item.
- **/
-void
-midori_web_item_set_name (MidoriWebItem* web_item,
-                          const gchar*   name)
-{
-    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
-
-    katze_assign (web_item->name, g_strdup (name));
-    g_object_notify (G_OBJECT (web_item), "name");
-}
-
-/**
- * midori_web_item_get_description:
- * @web_item: a #MidoriWebItem
- *
- * Retrieves the description of @web_item.
- *
- * Return value: the description of the web item
- **/
-const gchar*
-midori_web_item_get_description (MidoriWebItem* web_item)
-{
-    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
-
-    return web_item->description;
-}
-
-/**
- * midori_web_item_set_description:
- * @web_item: a #MidoriWebItem
- * @description: a string
- *
- * Sets the description of @web_item.
- **/
-void
-midori_web_item_set_description (MidoriWebItem* web_item,
-                                 const gchar*   description)
-{
-    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
-
-    katze_assign (web_item->description, g_strdup (description));
-    g_object_notify (G_OBJECT (web_item), "description");
-}
-
-/**
- * midori_web_item_get_uri:
- * @web_item: a #MidoriWebItem
- *
- * Retrieves the URI of @web_item.
- *
- * Return value: the URI of the web item
- **/
-const gchar*
-midori_web_item_get_uri (MidoriWebItem* web_item)
-{
-    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
-
-    return web_item->uri;
-}
-
-/**
- * midori_web_item_set_uri:
- * @web_item: a #MidoriWebItem
- * @uri: a string
- *
- * Sets the URI of @web_item.
- **/
-void
-midori_web_item_set_uri (MidoriWebItem* web_item,
-                         const gchar*   uri)
-{
-    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
-
-    katze_assign (web_item->uri, g_strdup (uri));
-    g_object_notify (G_OBJECT (web_item), "uri");
-}
-
-/**
- * midori_web_item_get_icon:
- * @web_item: a #MidoriWebItem
- *
- * Retrieves the icon of @web_item.
- *
- * Return value: the icon of the web item
- **/
-const gchar*
-midori_web_item_get_icon (MidoriWebItem* web_item)
-{
-    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
-
-    return web_item->icon;
-}
-
-/**
- * midori_web_item_set_icon:
- * @web_item: a #MidoriWebItem
- * @icon: a string
- *
- * Sets the icon of @web_item.
- **/
-void
-midori_web_item_set_icon (MidoriWebItem* web_item,
-                          const gchar*   icon)
-{
-    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
-
-    katze_assign (web_item->icon, g_strdup (icon));
-    g_object_notify (G_OBJECT (web_item), "icon");
-}
-
-/**
- * midori_web_item_get_token:
- * @web_item: a #MidoriWebItem
- *
- * Retrieves the token of @web_item.
- *
- * Return value: the token of the web item
- **/
-const gchar*
-midori_web_item_get_token (MidoriWebItem* web_item)
-{
-    g_return_val_if_fail (MIDORI_IS_WEB_ITEM (web_item), NULL);
-
-    return web_item->token;
-}
-
-/**
- * midori_web_item_set_token:
- * @web_item: a #MidoriWebItem
- * @token: a string
- *
- * Sets the token of @web_item.
- **/
-void
-midori_web_item_set_token (MidoriWebItem* web_item,
-                          const gchar*   token)
-{
-    g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item));
-
-    katze_assign (web_item->token, g_strdup (token));
-    g_object_notify (G_OBJECT (web_item), "token");
-}
diff --git a/midori/midori-webitem.h b/midori/midori-webitem.h
deleted file mode 100644 (file)
index c1276ab..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#ifndef __MIDORI_WEB_ITEM_H__
-#define __MIDORI_WEB_ITEM_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define MIDORI_TYPE_WEB_ITEM \
-    (midori_web_item_get_type ())
-#define MIDORI_WEB_ITEM(obj) \
-    (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_WEB_ITEM, MidoriWebItem))
-#define MIDORI_WEB_ITEM_CLASS(klass) \
-    (G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_WEB_ITEM, MidoriWebItemClass))
-#define MIDORI_IS_WEB_ITEM(obj) \
-    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_WEB_ITEM))
-#define MIDORI_IS_WEB_ITEM_CLASS(klass) \
-    (G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_WEB_ITEM))
-#define MIDORI_WEB_ITEM_GET_CLASS(obj) \
-    (G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_WEB_ITEM, MidoriWebItemClass))
-
-typedef struct _MidoriWebItem                MidoriWebItem;
-typedef struct _MidoriWebItemClass           MidoriWebItemClass;
-
-struct _MidoriWebItemClass
-{
-    GObjectClass parent_class;
-};
-
-GType
-midori_web_item_get_type               (void);
-
-MidoriWebItem*
-midori_web_item_new                    (void);
-
-const gchar*
-midori_web_item_get_name               (MidoriWebItem*  web_item);
-
-void
-midori_web_item_set_name               (MidoriWebItem*  web_item,
-                                        const gchar*    name);
-
-const gchar*
-midori_web_item_get_description        (MidoriWebItem*  web_item);
-
-void
-midori_web_item_set_description        (MidoriWebItem*  web_item,
-                                        const gchar*    description);
-
-const gchar*
-midori_web_item_get_uri                (MidoriWebItem*  web_item);
-
-void
-midori_web_item_set_uri                (MidoriWebItem*  web_item,
-                                        const gchar*    uri);
-
-const gchar*
-midori_web_item_get_icon               (MidoriWebItem*  web_item);
-
-void
-midori_web_item_set_icon               (MidoriWebItem*  web_item,
-                                        const gchar*    icon);
-
-const gchar*
-midori_web_item_get_token              (MidoriWebItem*  web_item);
-
-void
-midori_web_item_set_token              (MidoriWebItem*  web_item,
-                                        const gchar*    token);
-
-G_END_DECLS
-
-#endif /* __MIDORI_WEB_ITEM_H__ */
diff --git a/midori/midori-weblist.c b/midori/midori-weblist.c
deleted file mode 100644 (file)
index 8eb50a6..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#include "midori-weblist.h"
-
-#include <glib/gi18n.h>
-#include <string.h>
-
-/**
- * SECTION:midori-weblist
- * @short_description: A versatile object container
- * @see_also: #MidoriWebItem
- *
- * #MidoriWebList is a versatile container for objects with
- * explicit support for #MidoriWebList and #MidoriWebItem children.
- */
-
-struct _MidoriWebList
-{
-    GObject parent_instance;
-
-    GList* items;
-};
-
-G_DEFINE_TYPE (MidoriWebList, midori_web_list, G_TYPE_OBJECT)
-
-enum {
-    ADD_ITEM,
-    REMOVE_ITEM,
-
-    LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-static void
-midori_web_list_finalize (GObject* object);
-
-static void
-_midori_web_list_add_item (MidoriWebList* web_list,
-                           GObject*       item)
-{
-    g_object_ref (item);
-    web_list->items = g_list_append (web_list->items, item);
-}
-
-static void
-_midori_web_list_remove_item (MidoriWebList* web_list,
-                              GObject*       item)
-{
-    web_list->items = g_list_remove (web_list->items, item);
-    g_object_unref (item);
-}
-
-static void
-midori_web_list_class_init (MidoriWebListClass* class)
-{
-    signals[ADD_ITEM] = g_signal_new (
-        "add-item",
-        G_TYPE_FROM_CLASS (class),
-        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
-        G_STRUCT_OFFSET (MidoriWebListClass, add_item),
-        0,
-        NULL,
-        g_cclosure_marshal_VOID__OBJECT,
-        G_TYPE_NONE, 1,
-        G_TYPE_OBJECT);
-
-    signals[REMOVE_ITEM] = g_signal_new (
-        "remove-item",
-        G_TYPE_FROM_CLASS (class),
-        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
-        G_STRUCT_OFFSET (MidoriWebListClass, remove_item),
-        0,
-        NULL,
-        g_cclosure_marshal_VOID__OBJECT,
-        G_TYPE_NONE, 1,
-        G_TYPE_OBJECT);
-
-    class->add_item = _midori_web_list_add_item;
-    class->remove_item = _midori_web_list_remove_item;
-
-    GObjectClass* gobject_class = G_OBJECT_CLASS (class);
-    gobject_class->finalize = midori_web_list_finalize;
-}
-
-static void
-midori_web_list_init (MidoriWebList* web_list)
-{
-    web_list->items = NULL;
-}
-
-static void
-midori_web_list_finalize (GObject* object)
-{
-    MidoriWebList* web_list = MIDORI_WEB_LIST (object);
-    guint n, i;
-
-    /* Scruffily remove all items, no need for signals */
-    n = g_list_length (web_list->items);
-    for (i = 0; i < n; i++)
-        g_object_unref (g_list_nth_data (web_list->items, i));
-    g_list_free (web_list->items);
-
-    G_OBJECT_CLASS (midori_web_list_parent_class)->finalize (object);
-}
-
-/**
- * midori_web_list_new:
- *
- * Creates a new #MidoriWebList.
- *
- * Return value: a new #MidoriWebList
- **/
-MidoriWebList*
-midori_web_list_new (void)
-{
-    MidoriWebList* web_list = g_object_new (MIDORI_TYPE_WEB_LIST,
-                                            NULL);
-
-    return web_list;
-}
-
-/**
- * midori_web_list_add_item:
- * @web_list: a #MidoriWebList
- * @item: a #GObject
- *
- * Adds an item to the list.
- **/
-void
-midori_web_list_add_item (MidoriWebList* web_list,
-                          gpointer       item)
-{
-    g_return_if_fail (MIDORI_IS_WEB_LIST (web_list));
-    g_return_if_fail (G_IS_OBJECT (item));
-
-    g_signal_emit (web_list, signals[ADD_ITEM], 0, item);
-}
-
-/**
- * midori_web_list_add_item:
- * @web_list: a #MidoriWebList
- * @item: a #GObject
- *
- * Removes an item from the list.
- **/
-void
-midori_web_list_remove_item (MidoriWebList* web_list,
-                             gpointer       item)
-{
-    g_return_if_fail (MIDORI_IS_WEB_LIST (web_list));
-    g_return_if_fail (G_IS_OBJECT (item));
-
-    g_signal_emit (web_list, signals[REMOVE_ITEM], 0, item);
-}
-
-/**
- * midori_web_list_get_nth_item:
- * @web_list: a #MidoriWebList
- * @n: an index in the list
- *
- * Retrieves the item in @web_list at the position @n.
- *
- * Return value: an item, or %NULL
- **/
-gpointer
-midori_web_list_get_nth_item (MidoriWebList* web_list,
-                              guint          n)
-{
-    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), NULL);
-
-    return g_list_nth_data (web_list->items, n);
-}
-
-/**
- * midori_web_list_is_empty:
- * @web_list: a #MidoriWebList
- *
- * Determines if @web_list is empty.
- *
- * Return value: an item, or %NULL
- **/
-gboolean
-midori_web_list_is_empty (MidoriWebList* web_list)
-{
-    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), TRUE);
-
-    return !g_list_nth_data (web_list->items, 0);
-}
-
-/**
- * midori_web_list_get_item_position:
- * @web_list: a #MidoriWebList
- * @item: an item in the list
- *
- * Retrieves the index of the item in @web_list.
- *
- * Return value: an item, or -1
- **/
-gint
-midori_web_list_get_item_index (MidoriWebList* web_list,
-                                gpointer       item)
-{
-    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), -1);
-    g_return_val_if_fail (G_IS_OBJECT (item), -1);
-
-    return g_list_index (web_list->items, item);
-}
-
-/**
- * midori_web_list_find_token:
- * @web_list: a #MidoriWebList
- * @token: a token string
- *
- * Looks up an item in the list which has the specified token.
- *
- * Supported is #MidoriWebItem.
- *
- * Note that @token is by definition unique to one item.
- *
- * Return value: an item, or %NULL
- **/
-gpointer
-midori_web_list_find_token (MidoriWebList* web_list,
-                            const gchar*   token)
-{
-    guint n, i;
-    GObject* item;
-    MidoriWebItem* web_item;
-
-    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), NULL);
-
-    n = g_list_length (web_list->items);
-    for (i = 0; i < n; i++)
-    {
-        item = (GObject*)g_list_nth_data (web_list->items, i);
-        if (!MIDORI_IS_WEB_ITEM (item))
-            continue;
-        web_item = (MidoriWebItem*)item;
-        if (!strcmp (midori_web_item_get_token (web_item), token))
-            return item;
-    }
-    return NULL;
-}
-
-/**
- * midori_web_list_get_length:
- * @web_list: a #MidoriWebList
- *
- * Retrieves the number of items in @web_list.
- *
- * Return value: the length of the list
- **/
-guint
-midori_web_list_get_length (MidoriWebList* web_list)
-{
-    g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), 0);
-
-    return g_list_length (web_list->items);
-}
-
-/**
- * midori_web_list_clear:
- * @web_list: a #MidoriWebList
- *
- * Deletes all items currently contained in @web_list.
- **/
-void
-midori_web_list_clear (MidoriWebList* web_list)
-{
-    guint n;
-    guint i;
-    GObject* item;
-
-    g_return_if_fail (MIDORI_IS_WEB_LIST (web_list));
-
-    n = g_list_length (web_list->items);
-    for (i = 0; i < n; i++)
-    {
-        if ((item = g_list_nth_data (web_list->items, i)))
-            midori_web_list_remove_item (web_list, item);
-    }
-    g_list_free (web_list->items);
-    web_list->items = NULL;
-}
diff --git a/midori/midori-weblist.h b/midori/midori-weblist.h
deleted file mode 100644 (file)
index e051cbc..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#ifndef __MIDORI_WEB_LIST_H__
-#define __MIDORI_WEB_LIST_H__
-
-#include "midori-webitem.h"
-
-G_BEGIN_DECLS
-
-#define MIDORI_TYPE_WEB_LIST \
-    (midori_web_list_get_type ())
-#define MIDORI_WEB_LIST(obj) \
-    (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_WEB_LIST, MidoriWebList))
-#define MIDORI_WEB_LIST_CLASS(klass) \
-    (G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_WEB_LIST, MidoriWebListClass))
-#define MIDORI_IS_WEB_LIST(obj) \
-    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_WEB_LIST))
-#define MIDORI_IS_WEB_LIST_CLASS(klass) \
-    (G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_WEB_LIST))
-#define MIDORI_WEB_LIST_GET_CLASS(obj) \
-    (G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_WEB_LIST, MidoriWebListClass))
-
-typedef struct _MidoriWebList                MidoriWebList;
-typedef struct _MidoriWebListClass           MidoriWebListClass;
-
-struct _MidoriWebListClass
-{
-    GObjectClass parent_class;
-
-    /* Signals */
-    void
-    (*add_item)               (MidoriWebList* web_list,
-                               GObject*       item);
-    void
-    (*remove_item)            (MidoriWebList* web_list,
-                               GObject*       item);
-};
-
-GType
-midori_web_list_get_type               (void);
-
-MidoriWebList*
-midori_web_list_new                    (void);
-
-void
-midori_web_list_add_item               (MidoriWebList* web_list,
-                                        gpointer       item);
-
-void
-midori_web_list_remove_item            (MidoriWebList* web_list,
-                                        gpointer       item);
-
-gpointer
-midori_web_list_get_nth_item           (MidoriWebList* web_list,
-                                        guint          n);
-
-gboolean
-midori_web_list_is_empty               (MidoriWebList* web_list);
-
-gint
-midori_web_list_get_item_index         (MidoriWebList* web_list,
-                                        gpointer       item);
-
-gpointer
-midori_web_list_find_token             (MidoriWebList* web_list,
-                                        const gchar*   token);
-
-guint
-midori_web_list_get_length             (MidoriWebList* web_list);
-
-void
-midori_web_list_clear                  (MidoriWebList* web_list);
-
-G_END_DECLS
-
-#endif /* __MIDORI_WEB_LIST_H__ */
index c8662114ef8d6c14b413cf430cfe7a46191b608e..ed7f965b869ef784102874c5e3e52d10a30e64be 100644 (file)
@@ -13,7 +13,6 @@
 #define __MIDORI_WEB_VIEW_H__
 
 #include "midori-websettings.h"
-#include "midori-weblist.h"
 
 #include <katze/katze.h>
 #include <webkit/webkit.h>
index 49eeaa3dfccb0022e05ccc5658333987a2b45e06..a9d1f6ebcc3b27425b86efc98b3bdab90d5266f1 100644 (file)
@@ -11,8 +11,6 @@
 
 #include "sokoke.h"
 
-#include "midori-webitem.h"
-
 #include "config.h"
 #include "main.h"
 
index 172b19b4400f2cd930db76459ce63627e77bcc33..6d870b2739b375fef12948d23f28d47b0c910517 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef __SOKOKE_H__
 #define __SOKOKE_H__ 1
 
-#include "midori-weblist.h"
+#include <katze/katze.h>
 
 #include <gtk/gtk.h>
 
index df1c867e0d7c4b18351b018a8b3e91c564c71d0b..16a7e207f55f8c152e6b899c687806222842a862 100644 (file)
@@ -10,11 +10,11 @@ midori/midori-panel.c
 midori/midori-websettings.c
 midori/midori-webview.c
 midori/midori-preferences.c
-midori/midori-webitem.c
-midori/midori-weblist.c
 midori/midori-searchentry.c
 midori/sokoke.c
 midori/gjs.c
 katze/katze-throbber.c
 katze/katze-utils.c
+katze/katze-webitem.c
+katze/katze-weblist.c
 katze/katze-xbel.c