katze-throbber.c katze-throbber.h \
katze-utils.c katze-utils.h \
katze-item.c katze-item.h \
- katze-weblist.c katze-weblist.h \
+ katze-list.c katze-list.h \
+ katze-array.c katze-array.h \
katze-xbel.c katze-xbel.h
--- /dev/null
+/*
+ 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-array.h"
+
+#include "katze-utils.h"
+
+#include <glib/gi18n.h>
+#include <string.h>
+
+/**
+ * SECTION:katze-array
+ * @short_description: A type aware item container
+ * @see_also: #KatzeArray
+ *
+ * #KatzeArray is a type aware container for items.
+ */
+
+struct _KatzeArray
+{
+ KatzeList parent_instance;
+
+ GType type;
+};
+
+struct _KatzeArrayClass
+{
+ KatzeListClass parent_class;
+};
+
+G_DEFINE_TYPE (KatzeArray, katze_array, KATZE_TYPE_LIST)
+
+static void
+katze_array_finalize (GObject* object);
+
+static void
+_katze_array_add_item (KatzeList* list,
+ gpointer item)
+{
+ if (katze_array_is_a ((KatzeArray*)list, G_TYPE_OBJECT))
+ g_object_ref (item);
+ KATZE_LIST_CLASS (katze_array_parent_class)->add_item (list, item);
+}
+
+static void
+_katze_array_remove_item (KatzeList* list,
+ gpointer item)
+{
+ KATZE_LIST_CLASS (katze_array_parent_class)->remove_item (list, item);
+ if (katze_array_is_a ((KatzeArray*)list, G_TYPE_OBJECT))
+ g_object_unref (item);
+}
+
+static void
+katze_array_class_init (KatzeArrayClass* class)
+{
+ GObjectClass* gobject_class;
+ KatzeListClass* katzelist_class;
+
+ gobject_class = G_OBJECT_CLASS (class);
+ gobject_class->finalize = katze_array_finalize;
+
+ katzelist_class = KATZE_LIST_CLASS (class);
+ katzelist_class->add_item = _katze_array_add_item;
+ katzelist_class->remove_item = _katze_array_remove_item;
+}
+
+static void
+katze_array_init (KatzeArray* array)
+{
+ array->type = G_TYPE_NONE;
+}
+
+static void
+katze_array_finalize (GObject* object)
+{
+ KatzeArray* array;
+ guint n, i;
+
+ array = KATZE_ARRAY (object);
+ if (katze_array_is_a (array, G_TYPE_OBJECT))
+ {
+ n = katze_list_get_length ((KatzeList*)array);
+ for (i = 0; i < n; i++)
+ g_object_unref (katze_list_get_nth_item ((KatzeList*)array, i));
+ }
+
+ G_OBJECT_CLASS (katze_array_parent_class)->finalize (object);
+}
+
+/**
+ * katze_array_new:
+ * @type: the expected item type
+ *
+ * Creates a new #KatzeArray for @type items.
+ *
+ * You may only add items of the given type or inherited
+ * from it to this array.
+ *
+ * The array will keep a reference on each object until
+ * it is removed from the array.
+ *
+ * Note: While you *can* (currently) use #KatzeList accessors
+ * to circumvent type safety, you are *encouraged* to use
+ * only #KatzeArray accessors, or behaviour is undefined.
+ *
+ * Return value: a new #KatzeArray
+ **/
+KatzeArray*
+katze_array_new (GType type)
+{
+ KatzeArray* array = g_object_new (KATZE_TYPE_ARRAY, NULL);
+ array->type = type;
+
+ return array;
+}
+
+/**
+ *
+ * katze_array_is_a:
+ * @array: a #KatzeArray
+ * @is_a_type: type to compare with
+ *
+ * Checks whether the array is compatible
+ * with items of the specified type.
+ *
+ * Retur value: %TRUE if @array is compatible with @is_a_type
+ **/
+gboolean
+katze_array_is_a (KatzeArray* array,
+ GType is_a_type)
+{
+ g_return_val_if_fail (KATZE_IS_ARRAY (array), FALSE);
+
+ return g_type_is_a (array->type, is_a_type);
+}
+
+/**
+ * katze_array_add_item:
+ * @array: a #KatzeArray
+ * @item: a #GObject
+ *
+ * Adds an item to the array.
+ **/
+void
+katze_array_add_item (KatzeArray* array,
+ gpointer item)
+{
+ g_return_if_fail (KATZE_IS_ARRAY (array));
+ if (katze_array_is_a (array, G_TYPE_OBJECT))
+ g_return_if_fail (katze_array_is_a (array, G_OBJECT_TYPE (item)));
+
+ g_signal_emit_by_name (array, "add-item", item);
+}
+
+/**
+ * katze_array_add_item:
+ * @array: a #KatzeArray
+ * @item: a #GObject
+ *
+ * Removes an item from the array.
+ **/
+void
+katze_array_remove_item (KatzeArray* array,
+ gpointer item)
+{
+ g_return_if_fail (KATZE_IS_ARRAY (array));
+ if (katze_array_is_a (array, G_TYPE_OBJECT))
+ g_return_if_fail (katze_array_is_a (array, G_OBJECT_TYPE (item)));
+
+ g_signal_emit_by_name (array, "remove-item", item);
+}
+
+/**
+ * katze_array_get_nth_item:
+ * @array: a #KatzeArray
+ * @n: an index in the array
+ *
+ * Retrieves the item in @array at the position @n.
+ *
+ * Return value: an item, or %NULL
+ **/
+gpointer
+katze_array_get_nth_item (KatzeArray* array,
+ guint n)
+{
+ g_return_val_if_fail (KATZE_IS_ARRAY (array), NULL);
+
+ return katze_list_get_nth_item (KATZE_LIST (array), n);
+}
+
+/**
+ * katze_array_is_empty:
+ * @array: a #KatzeArray
+ *
+ * Determines if @array is empty.
+ *
+ * Return value: an item, or %NULL
+ **/
+gboolean
+katze_array_is_empty (KatzeArray* array)
+{
+ g_return_val_if_fail (KATZE_IS_ARRAY (array), TRUE);
+
+ return katze_list_is_empty (KATZE_LIST (array));
+}
+
+/**
+ * katze_array_get_item_position:
+ * @array: a #KatzeArray
+ * @item: an item in the array
+ *
+ * Retrieves the index of the item in @array.
+ *
+ * Return value: an item, or -1
+ **/
+gint
+katze_array_get_item_index (KatzeArray* array,
+ gpointer item)
+{
+ g_return_val_if_fail (KATZE_IS_ARRAY (array), -1);
+ if (katze_array_is_a (array, G_TYPE_OBJECT))
+ g_return_val_if_fail (katze_array_is_a (array, G_OBJECT_TYPE (item)), -1);
+
+ return katze_list_get_item_index (KATZE_LIST (array), item);
+}
+
+/**
+ * katze_array_find_token:
+ * @array: a #KatzeArray
+ * @token: a token string
+ *
+ * Looks up an item in the array which has the specified token.
+ *
+ * This function will silently fail if the type of the list
+ * is not based on #GObject and only #KatzeItem children
+ * are checked for their token, any other objects are skipped.
+ *
+ * Note that @token is by definition unique to one item.
+ *
+ * Return value: an item, or %NULL
+ **/
+gpointer
+katze_array_find_token (KatzeArray* array,
+ const gchar* token)
+{
+ guint n, i;
+ gpointer item;
+ const gchar* found_token;
+
+ g_return_val_if_fail (KATZE_IS_ARRAY (array), NULL);
+
+ if (!katze_array_is_a (array, G_TYPE_OBJECT))
+ return NULL;
+
+ n = katze_list_get_length ((KatzeList*)array);
+ for (i = 0; i < n; i++)
+ {
+ item = katze_list_get_nth_item ((KatzeList*)array, i);
+ if (!g_type_is_a (G_OBJECT_TYPE (item), KATZE_TYPE_ITEM))
+ continue;
+ found_token = katze_item_get_token ((KatzeItem*)item);
+ if (found_token && !strcmp (found_token, token))
+ return item;
+ }
+ return NULL;
+}
+
+/**
+ * katze_array_get_length:
+ * @array: a #KatzeArray
+ *
+ * Retrieves the number of items in @array.
+ *
+ * Return value: the length of the list
+ **/
+guint
+katze_array_get_length (KatzeArray* array)
+{
+ g_return_val_if_fail (KATZE_IS_ARRAY (array), 0);
+
+ return katze_list_get_length (KATZE_LIST (array));
+}
+
+/**
+ * katze_array_clear:
+ * @array: a #KatzeArray
+ *
+ * Deletes all items currently contained in @array.
+ **/
+void
+katze_array_clear (KatzeArray* array)
+{
+ g_return_if_fail (KATZE_IS_ARRAY (array));
+
+ katze_list_clear (KATZE_LIST (array));
+}
--- /dev/null
+/*
+ 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 __KATZE_ARRAY_H__
+#define __KATZE_ARRAY_H__
+
+#include "katze-list.h"
+
+G_BEGIN_DECLS
+
+#define KATZE_TYPE_ARRAY \
+ (katze_array_get_type ())
+#define KATZE_ARRAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), KATZE_TYPE_ARRAY, KatzeArray))
+#define KATZE_ARRAY_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), KATZE_TYPE_ARRAY, KatzeArrayClass))
+#define KATZE_IS_ARRAY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KATZE_TYPE_ARRAY))
+#define KATZE_IS_ARRAY_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), KATZE_TYPE_ARRAY))
+#define KATZE_ARRAY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), KATZE_TYPE_ARRAY, KatzeArrayClass))
+
+typedef struct _KatzeArray KatzeArray;
+typedef struct _KatzeArrayClass KatzeArrayClass;
+
+GType
+katze_array_get_type (void);
+
+KatzeArray*
+katze_array_new (GType type);
+
+gboolean
+katze_array_is_a (KatzeArray* array,
+ GType is_a_type);
+
+void
+katze_array_add_item (KatzeArray* array,
+ gpointer item);
+
+void
+katze_array_remove_item (KatzeArray* array,
+ gpointer item);
+
+gpointer
+katze_array_get_nth_item (KatzeArray* array,
+ guint n);
+
+gboolean
+katze_array_is_empty (KatzeArray* array);
+
+gint
+katze_array_get_item_index (KatzeArray* array,
+ gpointer item);
+
+gpointer
+katze_array_find_token (KatzeArray* array,
+ const gchar* token);
+
+guint
+katze_array_get_length (KatzeArray* array);
+
+void
+katze_array_clear (KatzeArray* array);
+
+G_END_DECLS
+
+#endif /* __KATZE_ARRAY_H__ */
/**
* SECTION:katze-item
* @short_description: A useful item
- * @see_also: #MidoriWebList
+ * @see_also: #KatzeArray
*
* #KatzeItem is a particularly useful item that provides
* several commonly needed properties.
See the file COPYING for the full license text.
*/
-#ifndef __MIDORI_WEB_ITEM_H__
-#define __MIDORI_WEB_ITEM_H__
+#ifndef __KATZE_ITEM_H__
+#define __KATZE_ITEM_H__
#include <glib-object.h>
--- /dev/null
+/*
+ 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-list.h"
+
+#include "katze-utils.h"
+
+#include <glib/gi18n.h>
+#include <string.h>
+
+/**
+ * SECTION:katze-list
+ * @short_description: A verbose and versatile item container
+ * @see_also: #KatzeItem
+ *
+ * #KatzeList is a verbose and versatile container for items.
+ */
+
+G_DEFINE_TYPE (KatzeList, katze_list, KATZE_TYPE_ITEM)
+
+enum {
+ ADD_ITEM,
+ REMOVE_ITEM,
+
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
+static void
+katze_list_finalize (GObject* object);
+
+static void
+_katze_list_add_item (KatzeList* list,
+ gpointer item)
+{
+ list->items = g_list_append (list->items, item);
+}
+
+static void
+_katze_list_remove_item (KatzeList* list,
+ gpointer item)
+{
+ list->items = g_list_remove (list->items, item);
+}
+
+static void
+katze_list_class_init (KatzeListClass* class)
+{
+ GObjectClass* gobject_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 (KatzeListClass, add_item),
+ 0,
+ NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+
+ signals[REMOVE_ITEM] = g_signal_new (
+ "remove-item",
+ G_TYPE_FROM_CLASS (class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+ G_STRUCT_OFFSET (KatzeListClass, remove_item),
+ 0,
+ NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+
+ gobject_class = G_OBJECT_CLASS (class);
+ gobject_class->finalize = katze_list_finalize;
+
+ class->add_item = _katze_list_add_item;
+ class->remove_item = _katze_list_remove_item;
+}
+
+static void
+katze_list_init (KatzeList* list)
+{
+ list->items = NULL;
+}
+
+static void
+katze_list_finalize (GObject* object)
+{
+ KatzeList* list;
+
+ list = KATZE_LIST (object);
+ g_list_free (list->items);
+
+ G_OBJECT_CLASS (katze_list_parent_class)->finalize (object);
+}
+
+/**
+ * katze_list_new:
+ *
+ * Creates a new #KatzeList.
+ *
+ * Return value: a new #KatzeList
+ **/
+KatzeList*
+katze_list_new (void)
+{
+ KatzeList* list = g_object_new (KATZE_TYPE_LIST, NULL);
+
+ return list;
+}
+
+/**
+ * katze_list_add_item:
+ * @list: a #KatzeList
+ * @item: a #GObject
+ *
+ * Adds an item to the list.
+ **/
+void
+katze_list_add_item (KatzeList* list,
+ gpointer item)
+{
+ g_return_if_fail (KATZE_IS_LIST (list));
+
+ g_signal_emit (list, signals[ADD_ITEM], 0, item);
+}
+
+/**
+ * katze_list_add_item:
+ * @list: a #KatzeList
+ * @item: a #GObject
+ *
+ * Removes an item from the list.
+ **/
+void
+katze_list_remove_item (KatzeList* list,
+ gpointer item)
+{
+ g_return_if_fail (KATZE_IS_LIST (list));
+
+ g_signal_emit (list, signals[REMOVE_ITEM], 0, item);
+}
+
+/**
+ * katze_list_get_nth_item:
+ * @list: a #KatzeList
+ * @n: an index in the list
+ *
+ * Retrieves the item in @list at the position @n.
+ *
+ * Return value: an item, or %NULL
+ **/
+gpointer
+katze_list_get_nth_item (KatzeList* list,
+ guint n)
+{
+ g_return_val_if_fail (KATZE_IS_LIST (list), NULL);
+
+ return g_list_nth_data (list->items, n);
+}
+
+/**
+ * katze_list_is_empty:
+ * @list: a #KatzeList
+ *
+ * Determines if @list is empty.
+ *
+ * Return value: an item, or %NULL
+ **/
+gboolean
+katze_list_is_empty (KatzeList* list)
+{
+ g_return_val_if_fail (KATZE_IS_LIST (list), TRUE);
+
+ return !g_list_nth_data (list->items, 0);
+}
+
+/**
+ * katze_list_get_item_position:
+ * @list: a #KatzeList
+ * @item: an item in the list
+ *
+ * Retrieves the index of the item in @list.
+ *
+ * Return value: an item, or -1
+ **/
+gint
+katze_list_get_item_index (KatzeList* list,
+ gpointer item)
+{
+ g_return_val_if_fail (KATZE_IS_LIST (list), -1);
+
+ return g_list_index (list->items, item);
+}
+
+/**
+ * katze_list_get_length:
+ * @list: a #KatzeList
+ *
+ * Retrieves the number of items in @list.
+ *
+ * Return value: the length of the list
+ **/
+guint
+katze_list_get_length (KatzeList* list)
+{
+ g_return_val_if_fail (KATZE_IS_LIST (list), 0);
+
+ return g_list_length (list->items);
+}
+
+/**
+ * katze_list_clear:
+ * @list: a #KatzeList
+ *
+ * Deletes all items currently contained in @list.
+ **/
+void
+katze_list_clear (KatzeList* list)
+{
+ guint n;
+ guint i;
+ GObject* item;
+
+ g_return_if_fail (KATZE_IS_LIST (list));
+
+ n = g_list_length (list->items);
+ for (i = 0; i < n; i++)
+ {
+ if ((item = g_list_nth_data (list->items, i)))
+ katze_list_remove_item (list, item);
+ }
+ g_list_free (list->items);
+ list->items = NULL;
+}
--- /dev/null
+/*
+ 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 __KATZE_LIST_H__
+#define __KATZE_LIST_H__
+
+#include "katze-item.h"
+
+G_BEGIN_DECLS
+
+#define KATZE_TYPE_LIST \
+ (katze_list_get_type ())
+#define KATZE_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), KATZE_TYPE_LIST, KatzeList))
+#define KATZE_LIST_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), KATZE_TYPE_LIST, KatzeListClass))
+#define KATZE_IS_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KATZE_TYPE_LIST))
+#define KATZE_IS_LIST_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), KATZE_TYPE_LIST))
+#define KATZE_LIST_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), KATZE_TYPE_LIST, KatzeListClass))
+
+typedef struct _KatzeList KatzeList;
+typedef struct _KatzeListClass KatzeListClass;
+
+struct _KatzeList
+{
+ KatzeItem parent_instance;
+
+ GList* items;
+};
+
+struct _KatzeListClass
+{
+ KatzeItemClass parent_class;
+
+ /* Signals */
+ void
+ (*add_item) (KatzeList* list,
+ gpointer item);
+ void
+ (*remove_item) (KatzeList* list,
+ gpointer item);
+};
+
+GType
+katze_list_get_type (void);
+
+KatzeList*
+katze_list_new (void);
+
+void
+katze_list_add_item (KatzeList* list,
+ gpointer item);
+
+void
+katze_list_remove_item (KatzeList* list,
+ gpointer item);
+
+gpointer
+katze_list_get_nth_item (KatzeList* list,
+ guint n);
+
+gboolean
+katze_list_is_empty (KatzeList* list);
+
+gint
+katze_list_get_item_index (KatzeList* list,
+ gpointer item);
+
+guint
+katze_list_get_length (KatzeList* list);
+
+void
+katze_list_clear (KatzeList* list);
+
+G_END_DECLS
+
+#endif /* __KATZE_LIST_H__ */
+++ /dev/null
-/*
- 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: #KatzeItem
- *
- * #MidoriWebList is a versatile container for objects.
- */
-
-struct _MidoriWebList
-{
- KatzeItem parent_instance;
-
- GList* items;
-};
-
-struct _MidoriWebListClass
-{
- KatzeItemClass parent_class;
-
- /* Signals */
- void
- (*add_item) (MidoriWebList* web_list,
- GObject* item);
- void
- (*remove_item) (MidoriWebList* web_list,
- GObject* item);
-};
-
-G_DEFINE_TYPE (MidoriWebList, midori_web_list, KATZE_TYPE_ITEM)
-
-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.
- *
- * Currently only #KatzeItem is supported.
- *
- * 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;
- gpointer item;
- const gchar* found_token;
-
- 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 = g_list_nth_data (web_list->items, i);
- if (!KATZE_IS_ITEM (item))
- continue;
- found_token = katze_item_get_token ((KatzeItem*)item);
- if (found_token && !strcmp (found_token, 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;
-}
+++ /dev/null
-/*
- 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-item.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;
-
-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__ */
See the file COPYING for the full license text.
*/
-#ifndef __KATZE__
-#define __KATZE__
+#ifndef __KATZE_H__
+#define __KATZE_H__
#include "katze-throbber.h"
#include "katze-utils.h"
#include "katze-item.h"
-#include "katze-weblist.h"
+#include "katze-list.h"
+#include "katze-array.h"
#include "katze-xbel.h"
#endif /* __KATZE_H__ */
return saved;
}
-static MidoriWebList*
+static KatzeArray*
search_engines_new_from_file (const gchar* filename,
GError** error)
{
- MidoriWebList* search_engines;
+ KatzeArray* search_engines;
GKeyFile* key_file;
gchar** engines;
guint i, j, n_properties;
const gchar* property;
gchar* value;
- search_engines = midori_web_list_new ();
+ search_engines = katze_array_new (KATZE_TYPE_ITEM);
key_file = g_key_file_new ();
g_key_file_load_from_file (key_file, filename,
G_KEY_FILE_KEEP_COMMENTS, error);
g_object_set (item, property, value, NULL);
g_free (value);
}
- midori_web_list_add_item (search_engines, item);
+ katze_array_add_item (search_engines, item);
}
g_strfreev (engines);
g_key_file_free (key_file);
}
static gboolean
-search_engines_save_to_file (MidoriWebList* search_engines,
- const gchar* filename,
- GError** error)
+search_engines_save_to_file (KatzeArray* search_engines,
+ const gchar* filename,
+ GError** error)
{
GKeyFile* key_file;
guint n, i, j, n_properties;
gboolean saved;
key_file = g_key_file_new ();
- n = midori_web_list_get_length (search_engines);
+ n = katze_array_get_length (search_engines);
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (search_engines),
&n_properties);
for (i = 0; i < n; i++)
{
- item = midori_web_list_get_nth_item (search_engines, i);
+ item = katze_array_get_nth_item (search_engines, i);
name = katze_item_get_name (item);
for (j = 0; j < n_properties; j++)
{
}
static void
-midori_web_list_add_item_cb (MidoriWebList* trash,
- GObject* item)
+midori_web_list_add_item_cb (KatzeArray* trash,
+ GObject* item)
{
- guint n = midori_web_list_get_length (trash);
+ guint n;
+ GObject* obsolete_item;
+
+ n = katze_array_get_length (trash);
if (n > 10)
{
- GObject* obsolete_item = midori_web_list_get_nth_item (trash, 0);
+ obsolete_item = katze_array_get_nth_item (trash, 0);
g_object_unref (obsolete_item);
}
}
int
-main (int argc,
+main (int argc,
char** argv)
{
gboolean version;
};
MidoriStartup load_on_startup;
gchar* homepage;
- MidoriWebList* search_engines;
+ KatzeArray* search_engines;
#if ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, MIDORI_LOCALEDIR);
stock_items_init ();
- MidoriWebList* trash = midori_web_list_new ();
+ KatzeArray* trash = katze_array_new (KATZE_TYPE_XBEL_ITEM);
guint n = katze_xbel_folder_get_n_items (xbel_trash);
guint i;
for (i = 0; i < n; i++)
{
KatzeXbelItem* item = katze_xbel_folder_get_nth_item (xbel_trash, i);
- midori_web_list_add_item (trash, item);
+ katze_array_add_item (trash, item);
}
g_signal_connect_after (trash, "add-item",
G_CALLBACK (midori_web_list_add_item_cb), NULL);
GtkAccelGroup* accel_group;
MidoriWebSettings* settings;
- MidoriWebList* trash;
- MidoriWebList* search_engines;
+ KatzeArray* trash;
+ KatzeArray* search_engines;
gpointer instance;
};
"trash",
_("Trash"),
_("The trash, collecting recently closed tabs and windows"),
- MIDORI_TYPE_WEB_LIST,
+ KATZE_TYPE_ARRAY,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
"search-engines",
_("Search Engines"),
_("The list of search engines"),
- MIDORI_TYPE_WEB_LIST,
+ KATZE_TYPE_ARRAY,
G_PARAM_READWRITE));
}
switch (command)
{
case UNIQUE_ACTIVATE:
- g_print("activate\n");
gtk_window_set_screen (GTK_WINDOW (app->browser),
unique_message_data_get_screen (message));
gtk_window_present (GTK_WINDOW (app->browser));
response = UNIQUE_RESPONSE_OK;
break;
case UNIQUE_OPEN:
- g_print("open\n");
uris = unique_message_data_get_uris (message);
if (!uris)
response = UNIQUE_RESPONSE_FAIL;
else
{
- g_print("open uris\n");
while (*uris)
{
midori_browser_add_uri (app->browser, *uris);
- g_print ("uri: %s\n", *uris);
uris++;
}
/* g_strfreev (uris); */
}
break;
default:
- g_print("fail\n");
response = UNIQUE_RESPONSE_FAIL;
break;
}
app->accel_group = gtk_accel_group_new ();
app->settings = midori_web_settings_new ();
- app->trash = midori_web_list_new ();
- app->search_engines = midori_web_list_new ();
+ app->trash = katze_array_new (KATZE_TYPE_XBEL_ITEM);
+ app->search_engines = katze_array_new (KATZE_TYPE_ITEM);
#if HAVE_UNIQUE
display_name = g_strdup (gdk_display_get_name (gdk_display_get_default ()));
*
* Return value: the assigned #MidoriTrash
**/
-MidoriWebList*
+KatzeArray*
midori_app_get_trash (MidoriApp* app)
{
g_return_val_if_fail (MIDORI_IS_APP (app), NULL);
(*add_browser) (MidoriApp* app,
MidoriBrowser* browser);
void
- (*quit) (MidoriApp* app);
+ (*quit) (MidoriApp* app);
};
GType
midori_app_set_settings (MidoriApp* app,
MidoriWebSettings* settings);
-MidoriWebList*
+KatzeArray*
midori_app_get_trash (MidoriApp* app);
void
GList* close_buttons;
KatzeXbelItem* proxy_xbel_folder;
- MidoriWebList* trash;
- MidoriWebList* search_engines;
+ KatzeArray* trash;
+ KatzeArray* search_engines;
};
G_DEFINE_TYPE (MidoriBrowser, midori_browser, GTK_TYPE_WINDOW)
_midori_browser_update_actions (MidoriBrowser* browser)
{
guint n;
+ gboolean trash_empty;
n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook));
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (browser->notebook), n > 1);
if (browser->trash)
{
- gboolean trash_empty = midori_web_list_is_empty (browser->trash);
+ trash_empty = katze_array_is_empty (browser->trash);
_action_set_sensitive (browser, "UndoTabClose", !trash_empty);
_action_set_sensitive (browser, "Trash", !trash_empty);
}
MIDORI_WEB_VIEW (widget));
uri = katze_xbel_bookmark_get_href (xbel_item);
if (browser->trash && uri && *uri)
- midori_web_list_add_item (browser->trash, xbel_item);
+ katze_array_add_item (browser->trash, xbel_item);
katze_xbel_folder_remove_item (browser->proxy_xbel_folder, xbel_item);
katze_xbel_item_unref (xbel_item);
}
"trash",
_("Trash"),
_("The trash, collecting recently closed tabs and windows"),
- MIDORI_TYPE_WEB_LIST,
+ KATZE_TYPE_ARRAY,
G_PARAM_READWRITE));
/**
"search-engines",
_("Search Engines"),
_("The list of search engines to be used for web search"),
- MIDORI_TYPE_WEB_LIST,
+ KATZE_TYPE_ARRAY,
G_PARAM_READWRITE));
}
"KatzeXbelItem");
gint n = midori_browser_add_xbel_item (browser, item);
midori_browser_set_current_page (browser, n);
- midori_web_list_remove_item (browser->trash, item);
+ katze_array_remove_item (browser->trash, item);
_midori_browser_update_actions (browser);
}
MidoriBrowser* browser)
{
GtkWidget* menu = gtk_menu_new ();
- guint n = midori_web_list_get_length (browser->trash);
+ guint n = katze_array_get_length (browser->trash);
GtkWidget* menuitem;
guint i;
for (i = 0; i < n; i++)
{
- KatzeXbelItem* item = midori_web_list_get_nth_item (browser->trash, i);
+ KatzeXbelItem* item = katze_array_get_nth_item (browser->trash, i);
const gchar* title = katze_xbel_item_get_title (item);
const gchar* uri = katze_xbel_bookmark_get_href (item);
menuitem = gtk_image_menu_item_new_with_label (title ? title : uri);
MidoriBrowser* browser)
{
MidoriWebView* web_view;
- MidoriWebList* news_feeds;
+ KatzeArray* news_feeds;
GtkWidget* menu;
guint n, i;
GjsValue* feed;
if (web_view)
{
news_feeds = midori_web_view_get_news_feeds (web_view);
- n = news_feeds ? midori_web_list_get_length (news_feeds) : 0;
+ n = news_feeds ? katze_array_get_length (news_feeds) : 0;
if (n)
{
menu = gtk_menu_new ();
for (i = 0; i < n; i++)
{
- if (!(feed = midori_web_list_get_nth_item (news_feeds, i)))
+ if (!(feed = katze_array_get_nth_item (news_feeds, i)))
continue;
uri = gjs_value_get_attribute_string (feed, "href");
guint n;
/* Reopen the most recent trash item */
- last = midori_web_list_get_length (browser->trash) - 1;
- item = midori_web_list_get_nth_item (browser->trash, last);
+ last = katze_array_get_length (browser->trash) - 1;
+ item = katze_array_get_nth_item (browser->trash, last);
n = midori_browser_add_xbel_item (browser, item);
midori_browser_set_current_page (browser, n);
- midori_web_list_remove_item (browser->trash, item);
+ katze_array_remove_item (browser->trash, item);
_midori_browser_update_actions (browser);
}
_action_trash_empty_activate (GtkAction* action,
MidoriBrowser* browser)
{
- midori_web_list_clear (browser->trash);
+ katze_array_clear (browser->trash);
_midori_browser_update_actions (browser);
}
midori_browser_search_activate_cb (GtkWidget* widget,
MidoriBrowser* browser)
{
- MidoriWebList* search_engines;
+ KatzeArray* search_engines;
const gchar* keywords;
guint last_web_search;
KatzeItem* item;
search_engines = browser->search_engines;
keywords = gtk_entry_get_text (GTK_ENTRY (widget));
g_object_get (browser->settings, "last-web-search", &last_web_search, NULL);
- item = midori_web_list_get_nth_item (search_engines, last_web_search);
+ item = katze_array_get_nth_item (search_engines, last_web_search);
if (item)
{
location_entry_search = NULL;
search_entry = MIDORI_SEARCH_ENTRY (browser->search);
item = midori_search_entry_get_current_item (search_entry);
if (item)
- index = midori_web_list_get_item_index (browser->search_engines, item);
+ index = katze_array_get_item_index (browser->search_engines, item);
else
index = 0;
g_object_ref (browser->popup_bookmark);
browser->menu_tools = gtk_menu_item_get_submenu (GTK_MENU_ITEM (
gtk_ui_manager_get_widget (ui_manager, "/menubar/Tools")));
- menuitem = gtk_separator_menu_item_new();
+ menuitem = gtk_separator_menu_item_new ();
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (browser->menu_tools), menuitem);
browser->menu_window = gtk_menu_item_get_submenu (GTK_MENU_ITEM (
gtk_ui_manager_get_widget (ui_manager, "/menubar/Window")));
- menuitem = gtk_separator_menu_item_new();
+ menuitem = gtk_separator_menu_item_new ();
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (browser->menu_window), menuitem);
gtk_widget_show (browser->menubar);
if (browser->search_engines)
{
- item = midori_web_list_get_nth_item (browser->search_engines,
- last_web_search);
+ item = katze_array_get_nth_item (browser->search_engines,
+ last_web_search);
if (item)
midori_search_entry_set_current_item (
MIDORI_SEARCH_ENTRY (browser->search), item);
{
g_object_get (browser->settings, "last-web-search",
&last_web_search, NULL);
- item = midori_web_list_get_nth_item (browser->search_engines,
- last_web_search);
+ item = katze_array_get_nth_item (browser->search_engines,
+ last_web_search);
if (item)
g_object_set (browser->search, "current-item", item, NULL);
}
{
GtkIconEntry parent_instance;
- MidoriWebList* search_engines;
+ KatzeArray* search_engines;
KatzeItem* current_item;
};
"search-engines",
_("Search Engines"),
_("The list of search engines"),
- MIDORI_TYPE_WEB_LIST,
+ KATZE_TYPE_ARRAY,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
gint button)
{
MidoriSearchEntry* search_entry;
- MidoriWebList* search_engines;
+ KatzeArray* search_engines;
GtkWidget* menu;
guint n, i;
GtkWidget* menuitem;
search_entry = MIDORI_SEARCH_ENTRY (widget);
search_engines = search_entry->search_engines;
menu = gtk_menu_new ();
- n = midori_web_list_get_length (search_engines);
+ n = katze_array_get_length (search_engines);
if (n)
{
for (i = 0; i < n; i++)
{
- item = midori_web_list_get_nth_item (search_engines, i);
+ item = katze_array_get_nth_item (search_engines, i);
menuitem = gtk_image_menu_item_new_with_label (
katze_item_get_name (item));
pixbuf = sokoke_web_icon (katze_item_get_icon (item),
gint i;
KatzeItem* item;
- i = midori_web_list_get_item_index (search_entry->search_engines,
- search_entry->current_item);
- item = midori_web_list_get_nth_item (search_entry->search_engines, i + n);
+ i = katze_array_get_item_index (search_entry->search_engines,
+ search_entry->current_item);
+ item = katze_array_get_nth_item (search_entry->search_engines, i + n);
if (item)
midori_search_entry_set_current_item (search_entry, item);
}
}
static void
-midori_search_entry_engines_add_item_cb (MidoriWebList* web_list,
- KatzeItem* item,
+midori_search_entry_engines_add_item_cb (KatzeArray* list,
+ KatzeItem* item,
MidoriSearchEntry* search_entry)
{
if (!search_entry->current_item)
}
static void
-midori_search_entry_engines_remove_item_cb (MidoriWebList* web_list,
+midori_search_entry_engines_remove_item_cb (KatzeArray* list,
KatzeItem* item,
MidoriSearchEntry* search_entry)
{
if (search_entry->current_item == item)
{
- found_item = midori_web_list_get_nth_item (web_list, 0);
+ found_item = katze_array_get_nth_item (list, 0);
if (found_item)
midori_search_entry_set_current_item (search_entry, found_item);
else
static void
midori_search_entry_init (MidoriSearchEntry* search_entry)
{
- search_entry->search_engines = midori_web_list_new ();
+ search_entry->search_engines = katze_array_new (KATZE_TYPE_ITEM);
search_entry->current_item = NULL;
gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (search_entry),
*
* Return value: the list of search engines
**/
-MidoriWebList*
+KatzeArray*
midori_search_entry_get_search_engines (MidoriSearchEntry* search_entry)
{
g_return_val_if_fail (MIDORI_IS_SEARCH_ENTRY (search_entry), NULL);
**/
void
midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry,
- MidoriWebList* search_engines)
+ KatzeArray* search_engines)
{
g_return_if_fail (MIDORI_IS_SEARCH_ENTRY (search_entry));
+ g_return_if_fail (katze_array_is_a (search_engines, KATZE_TYPE_ITEM));
g_object_ref (search_engines);
katze_object_assign (search_entry->search_engines, search_engines);
search_entry = g_object_get_data (G_OBJECT (treeview), "search-entry");
if (new_engine)
- midori_web_list_add_item (search_entry->search_engines, item);
+ katze_array_add_item (search_entry->search_engines, item);
}
gtk_widget_destroy (dialog);
}
GtkTreeModel* liststore;
GtkTreeIter iter;
KatzeItem* item;
- MidoriWebList* search_engines;
+ KatzeArray* search_engines;
search_entry = g_object_get_data (G_OBJECT (treeview), "search-entry");
search_engines = search_entry->search_engines;
if (gtk_tree_selection_get_selected (selection, &liststore, &iter))
{
gtk_tree_model_get (liststore, &iter, 0, &item, -1);
- midori_web_list_remove_item (search_engines, item);
+ katze_array_remove_item (search_engines, item);
g_object_unref (item);
/* FIXME: we want to allow undo of some kind */
}
}
static void
-midori_search_entry_dialog_engines_add_item_cb (MidoriWebList* web_list,
- KatzeItem* item,
- GtkWidget* treeview)
+midori_search_entry_dialog_engines_add_item_cb (KatzeArray* list,
+ KatzeItem* item,
+ GtkWidget* treeview)
{
GtkTreeModel* liststore;
GtkTreeIter iter;
}
static void
-midori_search_entry_dialog_engines_remove_item_cb (MidoriWebList* web_list,
- KatzeItem* item,
- GtkWidget* treeview)
+midori_search_entry_dialog_engines_remove_item_cb (KatzeArray* list,
+ KatzeItem* item,
+ GtkWidget* treeview)
{
GtkTreeModel* liststore;
GtkTreeIter iter;
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (hbox), scrolled, TRUE, TRUE, 5);
- n = midori_web_list_get_length (search_entry->search_engines);
+ n = katze_array_get_length (search_entry->search_engines);
for (i = 0; i < n; i++)
{
- item = midori_web_list_get_nth_item (search_entry->search_engines, i);
+ item = katze_array_get_nth_item (search_entry->search_engines, i);
gtk_list_store_insert_with_values (GTK_LIST_STORE (liststore),
NULL, i, 0, item, -1);
}
GtkWidget*
midori_search_entry_new (void);
-MidoriWebList*
+KatzeArray*
midori_search_entry_get_search_engines (MidoriSearchEntry* search_entry);
void
midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry,
- MidoriWebList* name);
+ KatzeArray* name);
KatzeItem*
midori_search_entry_get_current_item (MidoriSearchEntry* search_entry);
MidoriLoadStatus load_status;
gchar* statusbar_text;
gchar* link_uri;
- MidoriWebList* news_feeds;
+ KatzeArray* news_feeds;
MidoriWebSettings* settings;
|| !strcmp (type, "application/x.atom+xml")
|| !strcmp (type, "application/atom+xml"))
{
- midori_web_list_add_item (web_view->news_feeds, link);
+ katze_array_add_item (web_view->news_feeds, link);
g_signal_emit (web_view, signals[NEWS_FEED_READY], 0,
gjs_value_get_attribute_string (link, "href"), type,
gjs_value_has_attribute (link, "title")
value = gjs_value_new (webkit_web_frame_get_global_context (web_frame), NULL);
document = gjs_value_get_by_name (value, "document");
links = gjs_value_get_elements_by_tag_name (document, "link");
- midori_web_list_clear (web_view->news_feeds);
+ katze_array_clear (web_view->news_feeds);
gjs_value_foreach (links, (GjsCallback)gjs_value_links_foreach_cb, web_view);
g_object_unref (links);
g_object_unref (document);
GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
web_view->progress = 0.0;
web_view->load_status = MIDORI_LOAD_FINISHED;
- web_view->news_feeds = midori_web_list_new ();
+ web_view->news_feeds = katze_array_new (GJS_TYPE_VALUE);
web_view->settings = midori_web_settings_new ();
g_object_set (web_view, "WebKitWebView::settings", web_view->settings, NULL);
* Retrieves a list of news feeds for the current page
* or %NULL if there are no feeds at all.
*
- * Return value: a #MidoriWebList, or %NULL
+ * Return value: a #KatzeArray, or %NULL
**/
-MidoriWebList*
+KatzeArray*
midori_web_view_get_news_feeds (MidoriWebView* web_view)
{
g_return_val_if_fail (MIDORI_IS_WEB_VIEW (web_view), NULL);
- if (!midori_web_list_is_empty (web_view->news_feeds))
+ if (!katze_array_is_empty (web_view->news_feeds))
return web_view->news_feeds;
return NULL;
}
const gchar*
midori_web_view_get_link_uri (MidoriWebView* web_view);
-MidoriWebList*
+KatzeArray*
midori_web_view_get_news_feeds (MidoriWebView* web_view);
gboolean
}
gchar*
-sokoke_magic_uri (const gchar* uri,
- MidoriWebList* search_engines)
+sokoke_magic_uri (const gchar* uri,
+ KatzeArray* search_engines)
{
gchar* current_dir;
gchar* result;
g_return_val_if_fail (uri, NULL);
if (search_engines)
- g_return_val_if_fail (MIDORI_IS_WEB_LIST (search_engines), NULL);
+ g_return_val_if_fail (katze_array_is_a (search_engines, KATZE_TYPE_ITEM), NULL);
/* Add file:// if we have a local path */
if (g_path_is_absolute (uri))
parts = g_strsplit (uri, " ", 2);
if (parts[0] && parts[1])
{
- item = midori_web_list_find_token (search_engines, parts[0]);
+ item = katze_array_find_token (search_engines, parts[0]);
if (item)
search_uri = katze_item_get_uri (item);
}
gchar*
sokoke_magic_uri (const gchar* uri,
- MidoriWebList* search_engines);
+ KatzeArray* search_engines);
void
sokoke_entry_setup_completion (GtkEntry* entry);
katze/katze-throbber.c
katze/katze-utils.c
katze/katze-item.c
-katze/katze-weblist.c
+katze/katze-list.c
+katze/katze-array.c
katze/katze-xbel.c