From af2e90a4b18b27f8370e9d813e58d5fa4d1ceaf6 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 23 Aug 2008 18:32:53 +0200 Subject: [PATCH] Rename MidoriWebItem to KatzeItem --- katze/Makefile.am | 2 +- katze/katze-item.c | 376 ++++++++++++++++++++++++++++++++++++ katze/katze-item.h | 94 +++++++++ katze/katze-webitem.c | 376 ------------------------------------ katze/katze-webitem.h | 83 -------- katze/katze-weblist.c | 36 ++-- katze/katze-weblist.h | 15 +- katze/katze.h | 2 +- midori/main.c | 24 +-- midori/midori-browser.c | 41 ++-- midori/midori-searchentry.c | 128 ++++++------ midori/midori-searchentry.h | 4 +- midori/sokoke.c | 8 +- po/POTFILES.in | 2 +- 14 files changed, 599 insertions(+), 592 deletions(-) create mode 100644 katze/katze-item.c create mode 100644 katze/katze-item.h delete mode 100644 katze/katze-webitem.c delete mode 100644 katze/katze-webitem.h diff --git a/katze/Makefile.am b/katze/Makefile.am index ed4128d6..5aa7f435 100644 --- a/katze/Makefile.am +++ b/katze/Makefile.am @@ -14,6 +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-item.c katze-item.h \ katze-weblist.c katze-weblist.h \ katze-xbel.c katze-xbel.h diff --git a/katze/katze-item.c b/katze/katze-item.c new file mode 100644 index 00000000..c4b36f8b --- /dev/null +++ b/katze/katze-item.c @@ -0,0 +1,376 @@ +/* + Copyright (C) 2008 Christian Dywan + + 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-item.h" + +#include "katze-utils.h" + +#include + +/** + * SECTION:katze-item + * @short_description: A useful item + * @see_also: #MidoriWebList + * + * #KatzeItem is a particularly useful item that provides + * several commonly needed properties. + */ + +G_DEFINE_TYPE (KatzeItem, katze_item, G_TYPE_OBJECT) + +enum +{ + PROP_0, + + PROP_NAME, + PROP_TEXT, + PROP_URI, + PROP_ICON, + PROP_TOKEN +}; + +static void +katze_item_finalize (GObject* object); + +static void +katze_item_set_property (GObject* object, + guint prop_id, + const GValue* value, + GParamSpec* pspec); + +static void +katze_item_get_property (GObject* object, + guint prop_id, + GValue* value, + GParamSpec* pspec); + +static void +katze_item_class_init (KatzeItemClass* class) +{ + GObjectClass* gobject_class; + GParamFlags flags; + + gobject_class = G_OBJECT_CLASS (class); + gobject_class->finalize = katze_item_finalize; + gobject_class->set_property = katze_item_set_property; + gobject_class->get_property = katze_item_get_property; + + 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 item"), + NULL, + flags)); + + g_object_class_install_property (gobject_class, + PROP_TEXT, + g_param_spec_string ( + "text", + _("Text"), + _("The descriptive text of the item"), + NULL, + flags)); + + g_object_class_install_property (gobject_class, + PROP_URI, + g_param_spec_string ( + "uri", + _("URI"), + _("The URI of the item"), + NULL, + flags)); + + g_object_class_install_property (gobject_class, + PROP_ICON, + g_param_spec_string ( + "icon", + _("Icon"), + _("The icon of the item"), + NULL, + flags)); + + g_object_class_install_property (gobject_class, + PROP_TOKEN, + g_param_spec_string ( + "token", + _("Token"), + _("The token of the item"), + NULL, + flags)); +} + + + +static void +katze_item_init (KatzeItem* item) +{ + /* Nothing to do here */ +} + +static void +katze_item_finalize (GObject* object) +{ + KatzeItem* item = KATZE_ITEM (object); + + g_free (item->name); + g_free (item->text); + g_free (item->uri); + g_free (item->icon); + g_free (item->token); + + G_OBJECT_CLASS (katze_item_parent_class)->finalize (object); +} + +static void +katze_item_set_property (GObject* object, + guint prop_id, + const GValue* value, + GParamSpec* pspec) +{ + KatzeItem* item = KATZE_ITEM (object); + + switch (prop_id) + { + case PROP_NAME: + item->name = g_value_dup_string (value); + break; + case PROP_TEXT: + item->text = g_value_dup_string (value); + break; + case PROP_URI: + item->uri = g_value_dup_string (value); + break; + case PROP_ICON: + item->icon = g_value_dup_string (value); + break; + case PROP_TOKEN: + item->token = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +katze_item_get_property (GObject* object, + guint prop_id, + GValue* value, + GParamSpec* pspec) +{ + KatzeItem* item = KATZE_ITEM (object); + + switch (prop_id) + { + case PROP_NAME: + g_value_set_string (value, item->name); + break; + case PROP_TEXT: + g_value_set_string (value, item->text); + break; + case PROP_URI: + g_value_set_string (value, item->uri); + break; + case PROP_ICON: + g_value_set_string (value, item->icon); + break; + case PROP_TOKEN: + g_value_set_string (value, item->token); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +/** + * katze_item_new: + * + * Creates a new #KatzeItem. + * + * Return value: a new #KatzeItem + **/ +KatzeItem* +katze_item_new (void) +{ + KatzeItem* item = g_object_new (KATZE_TYPE_ITEM, NULL); + + return item; +} + +/** + * katze_item_get_name: + * @item: a #KatzeItem + * + * Retrieves the name of @item. + * + * Return value: the name of the item + **/ +const gchar* +katze_item_get_name (KatzeItem* item) +{ + g_return_val_if_fail (KATZE_IS_ITEM (item), NULL); + + return item->name; +} + +/** + * katze_item_set_name: + * @item: a #KatzeItem + * @name: a string + * + * Sets the name of @item. + **/ +void +katze_item_set_name (KatzeItem* item, + const gchar* name) +{ + g_return_if_fail (KATZE_IS_ITEM (item)); + + katze_assign (item->name, g_strdup (name)); + g_object_notify (G_OBJECT (item), "name"); +} + +/** + * katze_item_get_text: + * @item: a #KatzeItem + * + * Retrieves the descriptive text of @item. + * + * Return value: the text of the item + **/ +const gchar* +katze_item_get_text (KatzeItem* item) +{ + g_return_val_if_fail (KATZE_IS_ITEM (item), NULL); + + return item->text; +} + +/** + * katze_item_set_text: + * @item: a #KatzeItem + * @description: a string + * + * Sets the descriptive text of @item. + **/ +void +katze_item_set_text (KatzeItem* item, + const gchar* text) +{ + g_return_if_fail (KATZE_IS_ITEM (item)); + + katze_assign (item->text, g_strdup (text)); + g_object_notify (G_OBJECT (item), "text"); +} + +/** + * katze_item_get_uri: + * @item: a #KatzeItem + * + * Retrieves the URI of @item. + * + * Return value: the URI of the item + **/ +const gchar* +katze_item_get_uri (KatzeItem* item) +{ + g_return_val_if_fail (KATZE_IS_ITEM (item), NULL); + + return item->uri; +} + +/** + * katze_item_set_uri: + * @item: a #KatzeItem + * @uri: a string + * + * Sets the URI of @item. + **/ +void +katze_item_set_uri (KatzeItem* item, + const gchar* uri) +{ + g_return_if_fail (KATZE_IS_ITEM (item)); + + katze_assign (item->uri, g_strdup (uri)); + g_object_notify (G_OBJECT (item), "uri"); +} + +/** + * katze_item_get_icon: + * @item: a #KatzeItem + * + * Retrieves the icon of @item. + * + * Return value: the icon of the item + **/ +const gchar* +katze_item_get_icon (KatzeItem* item) +{ + g_return_val_if_fail (KATZE_IS_ITEM (item), NULL); + + return item->icon; +} + +/** + * katze_item_set_icon: + * @item: a #KatzeItem + * @icon: a string + * + * Sets the icon of @item. + **/ +void +katze_item_set_icon (KatzeItem* item, + const gchar* icon) +{ + g_return_if_fail (KATZE_IS_ITEM (item)); + + katze_assign (item->icon, g_strdup (icon)); + g_object_notify (G_OBJECT (item), "icon"); +} + +/** + * katze_item_get_token: + * @item: a #KatzeItem + * + * Retrieves the token of @item. + * + * Return value: the token of the item + **/ +const gchar* +katze_item_get_token (KatzeItem* item) +{ + g_return_val_if_fail (KATZE_IS_ITEM (item), NULL); + + return item->token; +} + +/** + * katze_item_set_token: + * @item: a #KatzeItem + * @token: a string + * + * Sets the token of @item. + **/ +void +katze_item_set_token (KatzeItem* item, + const gchar* token) +{ + g_return_if_fail (KATZE_IS_ITEM (item)); + + katze_assign (item->token, g_strdup (token)); + g_object_notify (G_OBJECT (item), "token"); +} diff --git a/katze/katze-item.h b/katze/katze-item.h new file mode 100644 index 00000000..fa61cbca --- /dev/null +++ b/katze/katze-item.h @@ -0,0 +1,94 @@ +/* + Copyright (C) 2008 Christian Dywan + + 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 + +G_BEGIN_DECLS + +#define KATZE_TYPE_ITEM \ + (katze_item_get_type ()) +#define KATZE_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), KATZE_TYPE_ITEM, KatzeItem)) +#define KATZE_ITEM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), KATZE_TYPE_ITEM, KatzeItemClass)) +#define KATZE_IS_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KATZE_TYPE_ITEM)) +#define KATZE_IS_ITEM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), KATZE_TYPE_ITEM)) +#define KATZE_ITEM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), KATZE_TYPE_ITEM, KatzeItemClass)) + +typedef struct _KatzeItem KatzeItem; +typedef struct _KatzeItemClass KatzeItemClass; + +struct _KatzeItem +{ + GObject parent_instance; + + gchar* name; + gchar* text; + gchar* uri; + gchar* icon; + gchar* token; +}; + +struct _KatzeItemClass +{ + GObjectClass parent_class; +}; + +GType +katze_item_get_type (void); + +KatzeItem* +katze_item_new (void); + +const gchar* +katze_item_get_name (KatzeItem* item); + +void +katze_item_set_name (KatzeItem* item, + const gchar* name); + +const gchar* +katze_item_get_text (KatzeItem* item); + +void +katze_item_set_text (KatzeItem* item, + const gchar* text); + +const gchar* +katze_item_get_uri (KatzeItem* item); + +void +katze_item_set_uri (KatzeItem* item, + const gchar* uri); + +const gchar* +katze_item_get_icon (KatzeItem* item); + +void +katze_item_set_icon (KatzeItem* item, + const gchar* icon); + +const gchar* +katze_item_get_token (KatzeItem* item); + +void +katze_item_set_token (KatzeItem* item, + const gchar* token); + +G_END_DECLS + +#endif /* __MIDORI_WEB_ITEM_H__ */ diff --git a/katze/katze-webitem.c b/katze/katze-webitem.c deleted file mode 100644 index cd2927f5..00000000 --- a/katze/katze-webitem.c +++ /dev/null @@ -1,376 +0,0 @@ -/* - Copyright (C) 2008 Christian Dywan - - 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 - -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 deleted file mode 100644 index c1276ab3..00000000 --- a/katze/katze-webitem.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2008 Christian Dywan - - 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 - -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 index e4abd211..0d780bcc 100644 --- a/katze/katze-weblist.c +++ b/katze/katze-weblist.c @@ -19,20 +19,32 @@ /** * SECTION:midori-weblist * @short_description: A versatile object container - * @see_also: #MidoriWebItem + * @see_also: #KatzeItem * - * #MidoriWebList is a versatile container for objects with - * explicit support for #MidoriWebList and #MidoriWebItem children. + * #MidoriWebList is a versatile container for objects. */ struct _MidoriWebList { - GObject parent_instance; + KatzeItem parent_instance; GList* items; }; -G_DEFINE_TYPE (MidoriWebList, midori_web_list, G_TYPE_OBJECT) +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, @@ -225,7 +237,7 @@ midori_web_list_get_item_index (MidoriWebList* web_list, * * Looks up an item in the list which has the specified token. * - * Supported is #MidoriWebItem. + * Currently only #KatzeItem is supported. * * Note that @token is by definition unique to one item. * @@ -236,19 +248,19 @@ midori_web_list_find_token (MidoriWebList* web_list, const gchar* token) { guint n, i; - GObject* item; - MidoriWebItem* web_item; + 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 = (GObject*)g_list_nth_data (web_list->items, i); - if (!MIDORI_IS_WEB_ITEM (item)) + item = g_list_nth_data (web_list->items, i); + if (!KATZE_IS_ITEM (item)) continue; - web_item = (MidoriWebItem*)item; - if (!strcmp (midori_web_item_get_token (web_item), token)) + found_token = katze_item_get_token ((KatzeItem*)item); + if (found_token && !strcmp (found_token, token)) return item; } return NULL; diff --git a/katze/katze-weblist.h b/katze/katze-weblist.h index 4f74cf4b..0117f7dd 100644 --- a/katze/katze-weblist.h +++ b/katze/katze-weblist.h @@ -12,7 +12,7 @@ #ifndef __MIDORI_WEB_LIST_H__ #define __MIDORI_WEB_LIST_H__ -#include "katze-webitem.h" +#include "katze-item.h" G_BEGIN_DECLS @@ -32,19 +32,6 @@ G_BEGIN_DECLS 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); diff --git a/katze/katze.h b/katze/katze.h index 5523a131..159adf1b 100644 --- a/katze/katze.h +++ b/katze/katze.h @@ -14,7 +14,7 @@ #include "katze-throbber.h" #include "katze-utils.h" -#include "katze-webitem.h" +#include "katze-item.h" #include "katze-weblist.h" #include "katze-xbel.h" diff --git a/midori/main.c b/midori/main.c index a1651468..30e6c2fb 100644 --- a/midori/main.c +++ b/midori/main.c @@ -265,7 +265,7 @@ search_engines_new_from_file (const gchar* filename, GKeyFile* key_file; gchar** engines; guint i, j, n_properties; - MidoriWebItem* web_item; + KatzeItem* item; GParamSpec** pspecs; const gchar* property; gchar* value; @@ -277,20 +277,20 @@ search_engines_new_from_file (const gchar* filename, /*g_key_file_load_from_data_dirs(keyFile, sFilename, NULL , G_KEY_FILE_KEEP_COMMENTS, error);*/ engines = g_key_file_get_groups (key_file, NULL); + pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (search_engines), + &n_properties); for (i = 0; engines[i] != NULL; i++) { - web_item = midori_web_item_new (); - pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (web_item), - &n_properties); + item = katze_item_new (); for (j = 0; j < n_properties; j++) { property = g_param_spec_get_name (pspecs[j]); value = g_key_file_get_string (key_file, engines[i], property, NULL); - g_object_set (web_item, property, value, NULL); + g_object_set (item, property, value, NULL); g_free (value); } - midori_web_list_add_item (search_engines, web_item); + midori_web_list_add_item (search_engines, item); } g_strfreev (engines); g_key_file_free (key_file); @@ -304,7 +304,7 @@ search_engines_save_to_file (MidoriWebList* search_engines, { GKeyFile* key_file; guint n, i, j, n_properties; - MidoriWebItem* web_item; + KatzeItem* item; const gchar* name; GParamSpec** pspecs; const gchar* property; @@ -313,16 +313,16 @@ search_engines_save_to_file (MidoriWebList* search_engines, key_file = g_key_file_new (); n = midori_web_list_get_length (search_engines); + pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (search_engines), + &n_properties); for (i = 0; i < n; i++) { - web_item = midori_web_list_get_nth_item (search_engines, i); - name = midori_web_item_get_name (web_item); - pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (web_item), - &n_properties); + item = midori_web_list_get_nth_item (search_engines, i); + name = katze_item_get_name (item); for (j = 0; j < n_properties; j++) { property = g_param_spec_get_name (pspecs[j]); - g_object_get (web_item, property, &value, NULL); + g_object_get (item, property, &value, NULL); if (value) g_key_file_set_string (key_file, name, property, value); g_free (value); diff --git a/midori/midori-browser.c b/midori/midori-browser.c index dd6d570e..c30b0463 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -3098,18 +3098,19 @@ midori_browser_search_activate_cb (GtkWidget* widget, MidoriWebList* search_engines; const gchar* keywords; guint last_web_search; - MidoriWebItem* web_item; + KatzeItem* item; const gchar* url; gchar* location_entry_search; + gchar* search; 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); - web_item = midori_web_list_get_nth_item (search_engines, last_web_search); - if (web_item) + item = midori_web_list_get_nth_item (search_engines, last_web_search); + if (item) { location_entry_search = NULL; - url = midori_web_item_get_uri (web_item); + url = katze_item_get_uri (item); } else /* The location entry search is our fallback */ { @@ -3117,7 +3118,6 @@ midori_browser_search_activate_cb (GtkWidget* widget, &location_entry_search, NULL); url = location_entry_search; } - gchar* search; if (strstr (url, "%s")) search = g_strdup_printf (url, keywords); else @@ -3144,14 +3144,13 @@ midori_browser_search_notify_current_item_cb (GObject* gobject, MidoriBrowser* browser) { MidoriSearchEntry* search_entry; - MidoriWebItem* web_item; + KatzeItem* item; guint index; search_entry = MIDORI_SEARCH_ENTRY (browser->search); - web_item = midori_search_entry_get_current_item (search_entry); - if (web_item) - index = midori_web_list_get_item_index (browser->search_engines, - web_item); + item = midori_search_entry_get_current_item (search_entry); + if (item) + index = midori_web_list_get_item_index (browser->search_engines, item); else index = 0; @@ -3677,7 +3676,7 @@ _midori_browser_set_toolbar_style (MidoriBrowser* browser, static void _midori_browser_update_settings (MidoriBrowser* browser) { - MidoriWebItem* web_item; + KatzeItem* item; gboolean remember_last_window_size; gint last_window_width, last_window_height; @@ -3731,11 +3730,11 @@ _midori_browser_update_settings (MidoriBrowser* browser) if (browser->search_engines) { - web_item = midori_web_list_get_nth_item (browser->search_engines, - last_web_search); - if (web_item) - midori_search_entry_set_current_item (MIDORI_SEARCH_ENTRY (browser->search), - web_item); + item = midori_web_list_get_nth_item (browser->search_engines, + last_web_search); + if (item) + midori_search_entry_set_current_item ( + MIDORI_SEARCH_ENTRY (browser->search), item); } gtk_paned_set_position (GTK_PANED (gtk_widget_get_parent (browser->panel)), @@ -3822,7 +3821,7 @@ midori_browser_set_property (GObject* object, { MidoriBrowser* browser = MIDORI_BROWSER (object); guint last_web_search; - MidoriWebItem* web_item; + KatzeItem* item; switch (prop_id) { @@ -3869,10 +3868,10 @@ midori_browser_set_property (GObject* object, { g_object_get (browser->settings, "last-web-search", &last_web_search, NULL); - web_item = midori_web_list_get_nth_item (browser->search_engines, - last_web_search); - if (web_item) - g_object_set (browser->search, "current-item", web_item, NULL); + item = midori_web_list_get_nth_item (browser->search_engines, + last_web_search); + if (item) + g_object_set (browser->search, "current-item", item, NULL); } break; default: diff --git a/midori/midori-searchentry.c b/midori/midori-searchentry.c index 7f5a5a65..413081fd 100644 --- a/midori/midori-searchentry.c +++ b/midori/midori-searchentry.c @@ -21,7 +21,7 @@ struct _MidoriSearchEntry GtkIconEntry parent_instance; MidoriWebList* search_engines; - MidoriWebItem* current_item; + KatzeItem* current_item; }; G_DEFINE_TYPE (MidoriSearchEntry, midori_search_entry, GTK_TYPE_ICON_ENTRY) @@ -73,7 +73,7 @@ midori_search_entry_class_init (MidoriSearchEntryClass* class) "current-item", _("Current Item"), _("The currently selected item"), - MIDORI_TYPE_WEB_ITEM, + KATZE_TYPE_ITEM, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, @@ -90,10 +90,10 @@ static void midori_search_entry_engine_activate_cb (GtkWidget* widget, MidoriSearchEntry* search_entry) { - MidoriWebItem* web_item; + KatzeItem* item; - web_item = (MidoriWebItem*)g_object_get_data (G_OBJECT (widget), "engine"); - midori_search_entry_set_current_item (search_entry, web_item); + item = (KatzeItem*)g_object_get_data (G_OBJECT (widget), "engine"); + midori_search_entry_set_current_item (search_entry, item); } static void @@ -110,16 +110,16 @@ midori_search_entry_manage_activate_cb (GtkWidget* menuitem, } static void -midori_search_entry_icon_released_cb (GtkWidget* widget, +midori_search_entry_icon_released_cb (GtkWidget* widget, GtkIconEntryPosition* pos, - gint button) + gint button) { MidoriSearchEntry* search_entry; MidoriWebList* search_engines; GtkWidget* menu; guint n, i; GtkWidget* menuitem; - MidoriWebItem* web_item; + KatzeItem* item; GdkPixbuf* pixbuf; GtkWidget* icon; @@ -131,16 +131,16 @@ midori_search_entry_icon_released_cb (GtkWidget* widget, { for (i = 0; i < n; i++) { - web_item = midori_web_list_get_nth_item (search_engines, i); + item = midori_web_list_get_nth_item (search_engines, i); menuitem = gtk_image_menu_item_new_with_label ( - midori_web_item_get_name (web_item)); - pixbuf = sokoke_web_icon (midori_web_item_get_icon (web_item), + katze_item_get_name (item)); + pixbuf = sokoke_web_icon (katze_item_get_icon (item), GTK_ICON_SIZE_MENU, menuitem); icon = gtk_image_new_from_pixbuf (pixbuf); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), icon); g_object_unref (pixbuf); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); - g_object_set_data (G_OBJECT (menuitem), "engine", web_item); + g_object_set_data (G_OBJECT (menuitem), "engine", item); g_signal_connect (menuitem, "activate", G_CALLBACK (midori_search_entry_engine_activate_cb), widget); gtk_widget_show (menuitem); @@ -173,14 +173,13 @@ _midori_search_entry_move_index (MidoriSearchEntry* search_entry, guint n) { gint i; - MidoriWebItem* web_item; + KatzeItem* item; i = midori_web_list_get_item_index (search_entry->search_engines, search_entry->current_item); - web_item = midori_web_list_get_nth_item (search_entry->search_engines, - i + n); - if (web_item) - midori_search_entry_set_current_item (search_entry, web_item); + item = midori_web_list_get_nth_item (search_entry->search_engines, i + n); + if (item) + midori_search_entry_set_current_item (search_entry, item); } static gboolean @@ -218,7 +217,7 @@ midori_search_entry_scroll_event_cb (MidoriSearchEntry* search_entry, static void midori_search_entry_engines_add_item_cb (MidoriWebList* web_list, - MidoriWebItem* item, + KatzeItem* item, MidoriSearchEntry* search_entry) { if (!search_entry->current_item) @@ -227,16 +226,16 @@ midori_search_entry_engines_add_item_cb (MidoriWebList* web_list, static void midori_search_entry_engines_remove_item_cb (MidoriWebList* web_list, - MidoriWebItem* item, + KatzeItem* item, MidoriSearchEntry* search_entry) { - MidoriWebItem* web_item; + KatzeItem* found_item; if (search_entry->current_item == item) { - web_item = midori_web_list_get_nth_item (web_list, 0); - if (web_item) - midori_search_entry_set_current_item (search_entry, web_item); + found_item = midori_web_list_get_nth_item (web_list, 0); + if (found_item) + midori_search_entry_set_current_item (search_entry, found_item); else { gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (search_entry), @@ -394,7 +393,7 @@ midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry, /** * midori_search_entry_set_current_item: * @search_entry: a #MidoriSearchEntry - * @item: a #MidoriWebItem + * @item: a #KatzeItem * * Looks up the specified item in the list of search engines and makes * it the currently selected item. @@ -403,24 +402,23 @@ midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry, **/ void midori_search_entry_set_current_item (MidoriSearchEntry* search_entry, - MidoriWebItem* web_item) + KatzeItem* item) { GdkPixbuf* pixbuf; g_return_if_fail (MIDORI_IS_SEARCH_ENTRY (search_entry)); - g_return_if_fail (MIDORI_IS_WEB_ITEM (web_item)); + g_return_if_fail (KATZE_IS_ITEM (item)); - pixbuf = sokoke_web_icon (midori_web_item_get_icon (web_item), + pixbuf = sokoke_web_icon (katze_item_get_icon (item), GTK_ICON_SIZE_MENU, GTK_WIDGET (search_entry)); gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (search_entry), GTK_ICON_ENTRY_PRIMARY, pixbuf); g_object_unref (pixbuf); sokoke_entry_set_default_text (GTK_ENTRY (search_entry), - midori_web_item_get_name (web_item)); + katze_item_get_name (item)); - g_object_ref (web_item); - katze_object_assign (search_entry->current_item, web_item); + katze_object_assign (search_entry->current_item, g_object_ref (item)); g_object_notify (G_OBJECT (search_entry), "current-item"); } @@ -432,7 +430,7 @@ midori_search_entry_set_current_item (MidoriSearchEntry* search_entry, * * Return value: the selected web item, or %NULL **/ -MidoriWebItem* +KatzeItem* midori_search_entry_get_current_item (MidoriSearchEntry* search_entry) { g_return_val_if_fail (MIDORI_IS_SEARCH_ENTRY (search_entry), NULL); @@ -447,13 +445,13 @@ midori_search_entry_dialog_render_icon_cb (GtkTreeViewColumn* column, GtkTreeIter* iter, GtkWidget* treeview) { - MidoriWebItem* web_item; + KatzeItem* item; const gchar* icon; GdkPixbuf* pixbuf; - gtk_tree_model_get (model, iter, 0, &web_item, -1); + gtk_tree_model_get (model, iter, 0, &item, -1); - icon = midori_web_item_get_icon (web_item); + icon = katze_item_get_icon (item); if (icon) { pixbuf = sokoke_web_icon (icon, GTK_ICON_SIZE_DND, treeview); @@ -472,15 +470,15 @@ midori_search_entry_dialog_render_text (GtkTreeViewColumn* column, GtkTreeIter* iter, GtkWidget* treeview) { - MidoriWebItem* web_item; + KatzeItem* item; const gchar* name; - const gchar* description; + const gchar* text; gchar* markup; - gtk_tree_model_get (model, iter, 0, &web_item, -1); - name = midori_web_item_get_name (web_item); - description = midori_web_item_get_description (web_item); - markup = g_markup_printf_escaped ("%s\n%s", name, description); + gtk_tree_model_get (model, iter, 0, &item, -1); + name = katze_item_get_name (item); + text = katze_item_get_text (item); + markup = g_markup_printf_escaped ("%s\n%s", name, text ? text : ""); g_object_set (renderer, "markup", markup, NULL); g_free (markup); } @@ -507,7 +505,7 @@ midori_search_entry_get_editor (GtkWidget* treeview, MidoriSearchEntry* search_entry; GtkWidget* dialog; GtkSizeGroup* sizegroup; - MidoriWebItem* web_item; + KatzeItem* item; GtkWidget* hbox; GtkWidget* label; GtkTreeModel* liststore; @@ -535,7 +533,7 @@ midori_search_entry_get_editor (GtkWidget* treeview, if (new_engine) { - web_item = midori_web_item_new (); + item = katze_item_new (); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT, FALSE); } @@ -543,7 +541,7 @@ midori_search_entry_get_editor (GtkWidget* treeview, { selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); gtk_tree_selection_get_selected (selection, &liststore, &iter); - gtk_tree_model_get (liststore, &iter, 0, &web_item, -1); + gtk_tree_model_get (liststore, &iter, 0, &item, -1); } hbox = gtk_hbox_new (FALSE, 8); @@ -557,7 +555,7 @@ midori_search_entry_get_editor (GtkWidget* treeview, gtk_entry_set_activates_default (GTK_ENTRY (entry_name), TRUE); if (!new_engine) gtk_entry_set_text (GTK_ENTRY (entry_name), - STR_NON_NULL (midori_web_item_get_name (web_item))); + STR_NON_NULL (katze_item_get_name (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_name, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_widget_show_all (hbox); @@ -571,7 +569,7 @@ midori_search_entry_get_editor (GtkWidget* treeview, gtk_entry_set_activates_default (GTK_ENTRY (entry_description), TRUE); if (!new_engine) gtk_entry_set_text (GTK_ENTRY (entry_description) - , STR_NON_NULL (midori_web_item_get_description (web_item))); + , STR_NON_NULL (katze_item_get_text (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_description, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_widget_show_all (hbox); @@ -585,7 +583,7 @@ midori_search_entry_get_editor (GtkWidget* treeview, gtk_entry_set_activates_default (GTK_ENTRY (entry_uri), TRUE); if (!new_engine) gtk_entry_set_text (GTK_ENTRY (entry_uri) - , STR_NON_NULL (midori_web_item_get_uri (web_item))); + , STR_NON_NULL (katze_item_get_uri (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_uri, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_widget_show_all (hbox); @@ -599,13 +597,13 @@ midori_search_entry_get_editor (GtkWidget* treeview, gtk_entry_set_activates_default (GTK_ENTRY (entry_icon), TRUE); if (!new_engine) gtk_entry_set_text (GTK_ENTRY (entry_icon) - , STR_NON_NULL (midori_web_item_get_icon (web_item))); + , STR_NON_NULL (katze_item_get_icon (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_icon, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_widget_show_all (hbox); hbox = gtk_hbox_new (FALSE, 8); - gtk_container_set_border_width (GTK_CONTAINER(hbox), 5); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); label = gtk_label_new_with_mnemonic (_("_Token:")); gtk_size_group_add_widget (sizegroup, label); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); @@ -613,7 +611,7 @@ midori_search_entry_get_editor (GtkWidget* treeview, gtk_entry_set_activates_default (GTK_ENTRY (entry_token), TRUE); if (!new_engine) gtk_entry_set_text (GTK_ENTRY (entry_token) - , STR_NON_NULL (midori_web_item_get_token (web_item))); + , STR_NON_NULL (katze_item_get_token (item))); gtk_box_pack_start (GTK_BOX (hbox), entry_token, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_widget_show_all (hbox); @@ -621,9 +619,9 @@ midori_search_entry_get_editor (GtkWidget* treeview, gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { - g_object_set (web_item, + g_object_set (item, "name", gtk_entry_get_text (GTK_ENTRY (entry_name)), - "description", gtk_entry_get_text (GTK_ENTRY (entry_description)), + "text", gtk_entry_get_text (GTK_ENTRY (entry_description)), "uri", gtk_entry_get_text (GTK_ENTRY (entry_uri)), "icon", gtk_entry_get_text (GTK_ENTRY (entry_icon)), "token", gtk_entry_get_text (GTK_ENTRY (entry_token)), @@ -631,7 +629,7 @@ midori_search_entry_get_editor (GtkWidget* treeview, search_entry = g_object_get_data (G_OBJECT (treeview), "search-entry"); if (new_engine) - midori_web_list_add_item (search_entry->search_engines, web_item); + midori_web_list_add_item (search_entry->search_engines, item); } gtk_widget_destroy (dialog); } @@ -667,7 +665,7 @@ midori_search_entry_dialog_remove_cb (GtkWidget* widget, GtkTreeSelection* selection; GtkTreeModel* liststore; GtkTreeIter iter; - MidoriWebItem* web_item; + KatzeItem* item; MidoriWebList* search_engines; search_entry = g_object_get_data (G_OBJECT (treeview), "search-entry"); @@ -675,9 +673,9 @@ midori_search_entry_dialog_remove_cb (GtkWidget* widget, selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); if (gtk_tree_selection_get_selected (selection, &liststore, &iter)) { - gtk_tree_model_get (liststore, &iter, 0, &web_item, -1); - midori_web_list_remove_item (search_engines, web_item); - g_object_unref (web_item); + gtk_tree_model_get (liststore, &iter, 0, &item, -1); + midori_web_list_remove_item (search_engines, item); + g_object_unref (item); /* FIXME: we want to allow undo of some kind */ } } @@ -701,7 +699,7 @@ midori_search_entry_treeview_selection_cb (GtkTreeSelection* selection, static void midori_search_entry_dialog_engines_add_item_cb (MidoriWebList* web_list, - MidoriWebItem* item, + KatzeItem* item, GtkWidget* treeview) { GtkTreeModel* liststore; @@ -714,20 +712,20 @@ midori_search_entry_dialog_engines_add_item_cb (MidoriWebList* web_list, static void midori_search_entry_dialog_engines_remove_item_cb (MidoriWebList* web_list, - MidoriWebItem* item, + KatzeItem* item, GtkWidget* treeview) { GtkTreeModel* liststore; GtkTreeIter iter; gboolean valid; - MidoriWebItem* web_item; + KatzeItem* found_item; liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); valid = gtk_tree_model_get_iter_first (liststore, &iter); while (valid) { - gtk_tree_model_get (liststore, &iter, 0, &web_item, -1); - if (web_item == item) + gtk_tree_model_get (liststore, &iter, 0, &found_item, -1); + if (found_item == item) { gtk_list_store_remove (GTK_LIST_STORE (liststore), &iter); valid = FALSE; @@ -777,7 +775,7 @@ midori_search_entry_get_dialog (MidoriSearchEntry* search_entry) GtkWidget* treeview; GtkWidget* scrolled; guint n, i; - MidoriWebItem* web_item; + KatzeItem* item; GtkWidget* vbox; GtkWidget* button; @@ -814,7 +812,7 @@ midori_search_entry_get_dialog (MidoriSearchEntry* search_entry) hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 12); - liststore = gtk_list_store_new (1, MIDORI_TYPE_WEB_ITEM); + liststore = gtk_list_store_new (1, KATZE_TYPE_ITEM); treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (liststore)); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)), "changed", G_CALLBACK (midori_search_entry_treeview_selection_cb), @@ -843,9 +841,9 @@ midori_search_entry_get_dialog (MidoriSearchEntry* search_entry) n = midori_web_list_get_length (search_entry->search_engines); for (i = 0; i < n; i++) { - web_item = midori_web_list_get_nth_item (search_entry->search_engines, i); + item = midori_web_list_get_nth_item (search_entry->search_engines, i); gtk_list_store_insert_with_values (GTK_LIST_STORE (liststore), - NULL, i, 0, web_item, -1); + NULL, i, 0, item, -1); } g_object_unref (liststore); g_signal_connect (treeview, "destroy", diff --git a/midori/midori-searchentry.h b/midori/midori-searchentry.h index ac7b794e..30d33ae6 100644 --- a/midori/midori-searchentry.h +++ b/midori/midori-searchentry.h @@ -54,12 +54,12 @@ void midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry, MidoriWebList* name); -MidoriWebItem* +KatzeItem* midori_search_entry_get_current_item (MidoriSearchEntry* search_entry); void midori_search_entry_set_current_item (MidoriSearchEntry* search_entry, - MidoriWebItem* name); + KatzeItem* name); GtkWidget* midori_search_entry_get_dialog (MidoriSearchEntry* search_entry); diff --git a/midori/sokoke.c b/midori/sokoke.c index 0ab823de..77263a3d 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -88,7 +88,7 @@ sokoke_magic_uri (const gchar* uri, gchar* search; const gchar* search_uri; gchar** parts; - MidoriWebItem* web_item; + KatzeItem* item; g_return_val_if_fail (uri, NULL); if (search_engines) @@ -122,9 +122,9 @@ sokoke_magic_uri (const gchar* uri, parts = g_strsplit (uri, " ", 2); if (parts[0] && parts[1]) { - web_item = midori_web_list_find_token (search_engines, parts[0]); - if (web_item) - search_uri = midori_web_item_get_uri (web_item); + item = midori_web_list_find_token (search_engines, parts[0]); + if (item) + search_uri = katze_item_get_uri (item); } g_free (parts); if (search_uri) diff --git a/po/POTFILES.in b/po/POTFILES.in index 16a7e207..4f59301e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -15,6 +15,6 @@ midori/sokoke.c midori/gjs.c katze/katze-throbber.c katze/katze-utils.c -katze/katze-webitem.c +katze/katze-item.c katze/katze-weblist.c katze/katze-xbel.c