Rename MidoriWebItem to KatzeItem

This commit is contained in:
Christian Dywan 2008-08-23 18:32:53 +02:00
parent d30b2bc22c
commit af2e90a4b1
14 changed files with 599 additions and 592 deletions

View file

@ -14,6 +14,6 @@ libkatze_la_SOURCES = \
katze.h \ katze.h \
katze-throbber.c katze-throbber.h \ katze-throbber.c katze-throbber.h \
katze-utils.c katze-utils.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-weblist.c katze-weblist.h \
katze-xbel.c katze-xbel.h katze-xbel.c katze-xbel.h

376
katze/katze-item.c Normal file
View file

@ -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-item.h"
#include "katze-utils.h"
#include <glib/gi18n.h>
/**
* 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");
}

94
katze/katze-item.h Normal file
View file

@ -0,0 +1,94 @@
/*
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 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__ */

View file

@ -1,376 +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 "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");
}

View file

@ -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__ */

View file

@ -19,20 +19,32 @@
/** /**
* SECTION:midori-weblist * SECTION:midori-weblist
* @short_description: A versatile object container * @short_description: A versatile object container
* @see_also: #MidoriWebItem * @see_also: #KatzeItem
* *
* #MidoriWebList is a versatile container for objects with * #MidoriWebList is a versatile container for objects.
* explicit support for #MidoriWebList and #MidoriWebItem children.
*/ */
struct _MidoriWebList struct _MidoriWebList
{ {
GObject parent_instance; KatzeItem parent_instance;
GList* items; 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 { enum {
ADD_ITEM, 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. * 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. * 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) const gchar* token)
{ {
guint n, i; guint n, i;
GObject* item; gpointer item;
MidoriWebItem* web_item; const gchar* found_token;
g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), NULL); g_return_val_if_fail (MIDORI_IS_WEB_LIST (web_list), NULL);
n = g_list_length (web_list->items); n = g_list_length (web_list->items);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
item = (GObject*)g_list_nth_data (web_list->items, i); item = g_list_nth_data (web_list->items, i);
if (!MIDORI_IS_WEB_ITEM (item)) if (!KATZE_IS_ITEM (item))
continue; continue;
web_item = (MidoriWebItem*)item; found_token = katze_item_get_token ((KatzeItem*)item);
if (!strcmp (midori_web_item_get_token (web_item), token)) if (found_token && !strcmp (found_token, token))
return item; return item;
} }
return NULL; return NULL;

View file

@ -12,7 +12,7 @@
#ifndef __MIDORI_WEB_LIST_H__ #ifndef __MIDORI_WEB_LIST_H__
#define __MIDORI_WEB_LIST_H__ #define __MIDORI_WEB_LIST_H__
#include "katze-webitem.h" #include "katze-item.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -32,19 +32,6 @@ G_BEGIN_DECLS
typedef struct _MidoriWebList MidoriWebList; typedef struct _MidoriWebList MidoriWebList;
typedef struct _MidoriWebListClass MidoriWebListClass; 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 GType
midori_web_list_get_type (void); midori_web_list_get_type (void);

View file

@ -14,7 +14,7 @@
#include "katze-throbber.h" #include "katze-throbber.h"
#include "katze-utils.h" #include "katze-utils.h"
#include "katze-webitem.h" #include "katze-item.h"
#include "katze-weblist.h" #include "katze-weblist.h"
#include "katze-xbel.h" #include "katze-xbel.h"

View file

@ -265,7 +265,7 @@ search_engines_new_from_file (const gchar* filename,
GKeyFile* key_file; GKeyFile* key_file;
gchar** engines; gchar** engines;
guint i, j, n_properties; guint i, j, n_properties;
MidoriWebItem* web_item; KatzeItem* item;
GParamSpec** pspecs; GParamSpec** pspecs;
const gchar* property; const gchar* property;
gchar* value; 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_load_from_data_dirs(keyFile, sFilename, NULL
, G_KEY_FILE_KEEP_COMMENTS, error);*/ , G_KEY_FILE_KEEP_COMMENTS, error);*/
engines = g_key_file_get_groups (key_file, NULL); 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++) for (i = 0; engines[i] != NULL; i++)
{ {
web_item = midori_web_item_new (); item = katze_item_new ();
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (web_item),
&n_properties);
for (j = 0; j < n_properties; j++) for (j = 0; j < n_properties; j++)
{ {
property = g_param_spec_get_name (pspecs[j]); property = g_param_spec_get_name (pspecs[j]);
value = g_key_file_get_string (key_file, engines[i], value = g_key_file_get_string (key_file, engines[i],
property, NULL); property, NULL);
g_object_set (web_item, property, value, NULL); g_object_set (item, property, value, NULL);
g_free (value); g_free (value);
} }
midori_web_list_add_item (search_engines, web_item); midori_web_list_add_item (search_engines, item);
} }
g_strfreev (engines); g_strfreev (engines);
g_key_file_free (key_file); g_key_file_free (key_file);
@ -304,7 +304,7 @@ search_engines_save_to_file (MidoriWebList* search_engines,
{ {
GKeyFile* key_file; GKeyFile* key_file;
guint n, i, j, n_properties; guint n, i, j, n_properties;
MidoriWebItem* web_item; KatzeItem* item;
const gchar* name; const gchar* name;
GParamSpec** pspecs; GParamSpec** pspecs;
const gchar* property; const gchar* property;
@ -313,16 +313,16 @@ search_engines_save_to_file (MidoriWebList* search_engines,
key_file = g_key_file_new (); key_file = g_key_file_new ();
n = midori_web_list_get_length (search_engines); 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++) 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);
name = midori_web_item_get_name (web_item); name = katze_item_get_name (item);
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (web_item),
&n_properties);
for (j = 0; j < n_properties; j++) for (j = 0; j < n_properties; j++)
{ {
property = g_param_spec_get_name (pspecs[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) if (value)
g_key_file_set_string (key_file, name, property, value); g_key_file_set_string (key_file, name, property, value);
g_free (value); g_free (value);

View file

@ -3098,18 +3098,19 @@ midori_browser_search_activate_cb (GtkWidget* widget,
MidoriWebList* search_engines; MidoriWebList* search_engines;
const gchar* keywords; const gchar* keywords;
guint last_web_search; guint last_web_search;
MidoriWebItem* web_item; KatzeItem* item;
const gchar* url; const gchar* url;
gchar* location_entry_search; gchar* location_entry_search;
gchar* search;
search_engines = browser->search_engines; search_engines = browser->search_engines;
keywords = gtk_entry_get_text (GTK_ENTRY (widget)); keywords = gtk_entry_get_text (GTK_ENTRY (widget));
g_object_get (browser->settings, "last-web-search", &last_web_search, NULL); 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); item = midori_web_list_get_nth_item (search_engines, last_web_search);
if (web_item) if (item)
{ {
location_entry_search = NULL; 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 */ else /* The location entry search is our fallback */
{ {
@ -3117,7 +3118,6 @@ midori_browser_search_activate_cb (GtkWidget* widget,
&location_entry_search, NULL); &location_entry_search, NULL);
url = location_entry_search; url = location_entry_search;
} }
gchar* search;
if (strstr (url, "%s")) if (strstr (url, "%s"))
search = g_strdup_printf (url, keywords); search = g_strdup_printf (url, keywords);
else else
@ -3144,14 +3144,13 @@ midori_browser_search_notify_current_item_cb (GObject* gobject,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
MidoriSearchEntry* search_entry; MidoriSearchEntry* search_entry;
MidoriWebItem* web_item; KatzeItem* item;
guint index; guint index;
search_entry = MIDORI_SEARCH_ENTRY (browser->search); search_entry = MIDORI_SEARCH_ENTRY (browser->search);
web_item = midori_search_entry_get_current_item (search_entry); item = midori_search_entry_get_current_item (search_entry);
if (web_item) if (item)
index = midori_web_list_get_item_index (browser->search_engines, index = midori_web_list_get_item_index (browser->search_engines, item);
web_item);
else else
index = 0; index = 0;
@ -3677,7 +3676,7 @@ _midori_browser_set_toolbar_style (MidoriBrowser* browser,
static void static void
_midori_browser_update_settings (MidoriBrowser* browser) _midori_browser_update_settings (MidoriBrowser* browser)
{ {
MidoriWebItem* web_item; KatzeItem* item;
gboolean remember_last_window_size; gboolean remember_last_window_size;
gint last_window_width, last_window_height; gint last_window_width, last_window_height;
@ -3731,11 +3730,11 @@ _midori_browser_update_settings (MidoriBrowser* browser)
if (browser->search_engines) if (browser->search_engines)
{ {
web_item = midori_web_list_get_nth_item (browser->search_engines, item = midori_web_list_get_nth_item (browser->search_engines,
last_web_search); last_web_search);
if (web_item) if (item)
midori_search_entry_set_current_item (MIDORI_SEARCH_ENTRY (browser->search), midori_search_entry_set_current_item (
web_item); MIDORI_SEARCH_ENTRY (browser->search), item);
} }
gtk_paned_set_position (GTK_PANED (gtk_widget_get_parent (browser->panel)), 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); MidoriBrowser* browser = MIDORI_BROWSER (object);
guint last_web_search; guint last_web_search;
MidoriWebItem* web_item; KatzeItem* item;
switch (prop_id) switch (prop_id)
{ {
@ -3869,10 +3868,10 @@ midori_browser_set_property (GObject* object,
{ {
g_object_get (browser->settings, "last-web-search", g_object_get (browser->settings, "last-web-search",
&last_web_search, NULL); &last_web_search, NULL);
web_item = midori_web_list_get_nth_item (browser->search_engines, item = midori_web_list_get_nth_item (browser->search_engines,
last_web_search); last_web_search);
if (web_item) if (item)
g_object_set (browser->search, "current-item", web_item, NULL); g_object_set (browser->search, "current-item", item, NULL);
} }
break; break;
default: default:

View file

@ -21,7 +21,7 @@ struct _MidoriSearchEntry
GtkIconEntry parent_instance; GtkIconEntry parent_instance;
MidoriWebList* search_engines; MidoriWebList* search_engines;
MidoriWebItem* current_item; KatzeItem* current_item;
}; };
G_DEFINE_TYPE (MidoriSearchEntry, midori_search_entry, GTK_TYPE_ICON_ENTRY) 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",
_("Current Item"), _("Current Item"),
_("The currently selected item"), _("The currently selected item"),
MIDORI_TYPE_WEB_ITEM, KATZE_TYPE_ITEM,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
@ -90,10 +90,10 @@ static void
midori_search_entry_engine_activate_cb (GtkWidget* widget, midori_search_entry_engine_activate_cb (GtkWidget* widget,
MidoriSearchEntry* search_entry) MidoriSearchEntry* search_entry)
{ {
MidoriWebItem* web_item; KatzeItem* item;
web_item = (MidoriWebItem*)g_object_get_data (G_OBJECT (widget), "engine"); item = (KatzeItem*)g_object_get_data (G_OBJECT (widget), "engine");
midori_search_entry_set_current_item (search_entry, web_item); midori_search_entry_set_current_item (search_entry, item);
} }
static void static void
@ -119,7 +119,7 @@ midori_search_entry_icon_released_cb (GtkWidget* widget,
GtkWidget* menu; GtkWidget* menu;
guint n, i; guint n, i;
GtkWidget* menuitem; GtkWidget* menuitem;
MidoriWebItem* web_item; KatzeItem* item;
GdkPixbuf* pixbuf; GdkPixbuf* pixbuf;
GtkWidget* icon; GtkWidget* icon;
@ -131,16 +131,16 @@ midori_search_entry_icon_released_cb (GtkWidget* widget,
{ {
for (i = 0; i < n; i++) 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 ( menuitem = gtk_image_menu_item_new_with_label (
midori_web_item_get_name (web_item)); katze_item_get_name (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, menuitem); GTK_ICON_SIZE_MENU, menuitem);
icon = gtk_image_new_from_pixbuf (pixbuf); icon = gtk_image_new_from_pixbuf (pixbuf);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), icon); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), icon);
g_object_unref (pixbuf); g_object_unref (pixbuf);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); 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_signal_connect (menuitem, "activate",
G_CALLBACK (midori_search_entry_engine_activate_cb), widget); G_CALLBACK (midori_search_entry_engine_activate_cb), widget);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
@ -173,14 +173,13 @@ _midori_search_entry_move_index (MidoriSearchEntry* search_entry,
guint n) guint n)
{ {
gint i; gint i;
MidoriWebItem* web_item; KatzeItem* item;
i = midori_web_list_get_item_index (search_entry->search_engines, i = midori_web_list_get_item_index (search_entry->search_engines,
search_entry->current_item); search_entry->current_item);
web_item = midori_web_list_get_nth_item (search_entry->search_engines, item = midori_web_list_get_nth_item (search_entry->search_engines, i + n);
i + n); if (item)
if (web_item) midori_search_entry_set_current_item (search_entry, item);
midori_search_entry_set_current_item (search_entry, web_item);
} }
static gboolean static gboolean
@ -218,7 +217,7 @@ midori_search_entry_scroll_event_cb (MidoriSearchEntry* search_entry,
static void static void
midori_search_entry_engines_add_item_cb (MidoriWebList* web_list, midori_search_entry_engines_add_item_cb (MidoriWebList* web_list,
MidoriWebItem* item, KatzeItem* item,
MidoriSearchEntry* search_entry) MidoriSearchEntry* search_entry)
{ {
if (!search_entry->current_item) if (!search_entry->current_item)
@ -227,16 +226,16 @@ midori_search_entry_engines_add_item_cb (MidoriWebList* web_list,
static void static void
midori_search_entry_engines_remove_item_cb (MidoriWebList* web_list, midori_search_entry_engines_remove_item_cb (MidoriWebList* web_list,
MidoriWebItem* item, KatzeItem* item,
MidoriSearchEntry* search_entry) MidoriSearchEntry* search_entry)
{ {
MidoriWebItem* web_item; KatzeItem* found_item;
if (search_entry->current_item == item) if (search_entry->current_item == item)
{ {
web_item = midori_web_list_get_nth_item (web_list, 0); found_item = midori_web_list_get_nth_item (web_list, 0);
if (web_item) if (found_item)
midori_search_entry_set_current_item (search_entry, web_item); midori_search_entry_set_current_item (search_entry, found_item);
else else
{ {
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (search_entry), 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: * midori_search_entry_set_current_item:
* @search_entry: a #MidoriSearchEntry * @search_entry: a #MidoriSearchEntry
* @item: a #MidoriWebItem * @item: a #KatzeItem
* *
* Looks up the specified item in the list of search engines and makes * Looks up the specified item in the list of search engines and makes
* it the currently selected item. * it the currently selected item.
@ -403,24 +402,23 @@ midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry,
**/ **/
void void
midori_search_entry_set_current_item (MidoriSearchEntry* search_entry, midori_search_entry_set_current_item (MidoriSearchEntry* search_entry,
MidoriWebItem* web_item) KatzeItem* item)
{ {
GdkPixbuf* pixbuf; GdkPixbuf* pixbuf;
g_return_if_fail (MIDORI_IS_SEARCH_ENTRY (search_entry)); 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_SIZE_MENU, GTK_WIDGET (search_entry));
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (search_entry), gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (search_entry),
GTK_ICON_ENTRY_PRIMARY, GTK_ICON_ENTRY_PRIMARY,
pixbuf); pixbuf);
g_object_unref (pixbuf); g_object_unref (pixbuf);
sokoke_entry_set_default_text (GTK_ENTRY (search_entry), 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, g_object_ref (item));
katze_object_assign (search_entry->current_item, web_item);
g_object_notify (G_OBJECT (search_entry), "current-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 * Return value: the selected web item, or %NULL
**/ **/
MidoriWebItem* KatzeItem*
midori_search_entry_get_current_item (MidoriSearchEntry* search_entry) midori_search_entry_get_current_item (MidoriSearchEntry* search_entry)
{ {
g_return_val_if_fail (MIDORI_IS_SEARCH_ENTRY (search_entry), NULL); 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, GtkTreeIter* iter,
GtkWidget* treeview) GtkWidget* treeview)
{ {
MidoriWebItem* web_item; KatzeItem* item;
const gchar* icon; const gchar* icon;
GdkPixbuf* pixbuf; 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) if (icon)
{ {
pixbuf = sokoke_web_icon (icon, GTK_ICON_SIZE_DND, treeview); pixbuf = sokoke_web_icon (icon, GTK_ICON_SIZE_DND, treeview);
@ -472,15 +470,15 @@ midori_search_entry_dialog_render_text (GtkTreeViewColumn* column,
GtkTreeIter* iter, GtkTreeIter* iter,
GtkWidget* treeview) GtkWidget* treeview)
{ {
MidoriWebItem* web_item; KatzeItem* item;
const gchar* name; const gchar* name;
const gchar* description; const gchar* text;
gchar* markup; gchar* markup;
gtk_tree_model_get (model, iter, 0, &web_item, -1); gtk_tree_model_get (model, iter, 0, &item, -1);
name = midori_web_item_get_name (web_item); name = katze_item_get_name (item);
description = midori_web_item_get_description (web_item); text = katze_item_get_text (item);
markup = g_markup_printf_escaped ("<b>%s</b>\n%s", name, description); markup = g_markup_printf_escaped ("<b>%s</b>\n%s", name, text ? text : "");
g_object_set (renderer, "markup", markup, NULL); g_object_set (renderer, "markup", markup, NULL);
g_free (markup); g_free (markup);
} }
@ -507,7 +505,7 @@ midori_search_entry_get_editor (GtkWidget* treeview,
MidoriSearchEntry* search_entry; MidoriSearchEntry* search_entry;
GtkWidget* dialog; GtkWidget* dialog;
GtkSizeGroup* sizegroup; GtkSizeGroup* sizegroup;
MidoriWebItem* web_item; KatzeItem* item;
GtkWidget* hbox; GtkWidget* hbox;
GtkWidget* label; GtkWidget* label;
GtkTreeModel* liststore; GtkTreeModel* liststore;
@ -535,7 +533,7 @@ midori_search_entry_get_editor (GtkWidget* treeview,
if (new_engine) if (new_engine)
{ {
web_item = midori_web_item_new (); item = katze_item_new ();
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
GTK_RESPONSE_ACCEPT, FALSE); 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)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
gtk_tree_selection_get_selected (selection, &liststore, &iter); 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); 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); gtk_entry_set_activates_default (GTK_ENTRY (entry_name), TRUE);
if (!new_engine) if (!new_engine)
gtk_entry_set_text (GTK_ENTRY (entry_name), 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_box_pack_start (GTK_BOX (hbox), entry_name, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
gtk_widget_show_all (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); gtk_entry_set_activates_default (GTK_ENTRY (entry_description), TRUE);
if (!new_engine) if (!new_engine)
gtk_entry_set_text (GTK_ENTRY (entry_description) 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_box_pack_start (GTK_BOX (hbox), entry_description, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
gtk_widget_show_all (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); gtk_entry_set_activates_default (GTK_ENTRY (entry_uri), TRUE);
if (!new_engine) if (!new_engine)
gtk_entry_set_text (GTK_ENTRY (entry_uri) 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_box_pack_start (GTK_BOX (hbox), entry_uri, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
gtk_widget_show_all (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); gtk_entry_set_activates_default (GTK_ENTRY (entry_icon), TRUE);
if (!new_engine) if (!new_engine)
gtk_entry_set_text (GTK_ENTRY (entry_icon) 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_box_pack_start (GTK_BOX (hbox), entry_icon, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
gtk_widget_show_all (hbox); gtk_widget_show_all (hbox);
hbox = gtk_hbox_new (FALSE, 8); 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:")); label = gtk_label_new_with_mnemonic (_("_Token:"));
gtk_size_group_add_widget (sizegroup, label); gtk_size_group_add_widget (sizegroup, label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); 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); gtk_entry_set_activates_default (GTK_ENTRY (entry_token), TRUE);
if (!new_engine) if (!new_engine)
gtk_entry_set_text (GTK_ENTRY (entry_token) 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_box_pack_start (GTK_BOX (hbox), entry_token, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
gtk_widget_show_all (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); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
if (gtk_dialog_run (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)), "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)), "uri", gtk_entry_get_text (GTK_ENTRY (entry_uri)),
"icon", gtk_entry_get_text (GTK_ENTRY (entry_icon)), "icon", gtk_entry_get_text (GTK_ENTRY (entry_icon)),
"token", gtk_entry_get_text (GTK_ENTRY (entry_token)), "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"); search_entry = g_object_get_data (G_OBJECT (treeview), "search-entry");
if (new_engine) 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); gtk_widget_destroy (dialog);
} }
@ -667,7 +665,7 @@ midori_search_entry_dialog_remove_cb (GtkWidget* widget,
GtkTreeSelection* selection; GtkTreeSelection* selection;
GtkTreeModel* liststore; GtkTreeModel* liststore;
GtkTreeIter iter; GtkTreeIter iter;
MidoriWebItem* web_item; KatzeItem* item;
MidoriWebList* search_engines; MidoriWebList* search_engines;
search_entry = g_object_get_data (G_OBJECT (treeview), "search-entry"); 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)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
if (gtk_tree_selection_get_selected (selection, &liststore, &iter)) if (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);
midori_web_list_remove_item (search_engines, web_item); midori_web_list_remove_item (search_engines, item);
g_object_unref (web_item); g_object_unref (item);
/* FIXME: we want to allow undo of some kind */ /* FIXME: we want to allow undo of some kind */
} }
} }
@ -701,7 +699,7 @@ midori_search_entry_treeview_selection_cb (GtkTreeSelection* selection,
static void static void
midori_search_entry_dialog_engines_add_item_cb (MidoriWebList* web_list, midori_search_entry_dialog_engines_add_item_cb (MidoriWebList* web_list,
MidoriWebItem* item, KatzeItem* item,
GtkWidget* treeview) GtkWidget* treeview)
{ {
GtkTreeModel* liststore; GtkTreeModel* liststore;
@ -714,20 +712,20 @@ midori_search_entry_dialog_engines_add_item_cb (MidoriWebList* web_list,
static void static void
midori_search_entry_dialog_engines_remove_item_cb (MidoriWebList* web_list, midori_search_entry_dialog_engines_remove_item_cb (MidoriWebList* web_list,
MidoriWebItem* item, KatzeItem* item,
GtkWidget* treeview) GtkWidget* treeview)
{ {
GtkTreeModel* liststore; GtkTreeModel* liststore;
GtkTreeIter iter; GtkTreeIter iter;
gboolean valid; gboolean valid;
MidoriWebItem* web_item; KatzeItem* found_item;
liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
valid = gtk_tree_model_get_iter_first (liststore, &iter); valid = gtk_tree_model_get_iter_first (liststore, &iter);
while (valid) while (valid)
{ {
gtk_tree_model_get (liststore, &iter, 0, &web_item, -1); gtk_tree_model_get (liststore, &iter, 0, &found_item, -1);
if (web_item == item) if (found_item == item)
{ {
gtk_list_store_remove (GTK_LIST_STORE (liststore), &iter); gtk_list_store_remove (GTK_LIST_STORE (liststore), &iter);
valid = FALSE; valid = FALSE;
@ -777,7 +775,7 @@ midori_search_entry_get_dialog (MidoriSearchEntry* search_entry)
GtkWidget* treeview; GtkWidget* treeview;
GtkWidget* scrolled; GtkWidget* scrolled;
guint n, i; guint n, i;
MidoriWebItem* web_item; KatzeItem* item;
GtkWidget* vbox; GtkWidget* vbox;
GtkWidget* button; GtkWidget* button;
@ -814,7 +812,7 @@ midori_search_entry_get_dialog (MidoriSearchEntry* search_entry)
hbox = gtk_hbox_new (FALSE, 0); hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
TRUE, TRUE, 12); 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)); treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (liststore));
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)), g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
"changed", G_CALLBACK (midori_search_entry_treeview_selection_cb), "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); n = midori_web_list_get_length (search_entry->search_engines);
for (i = 0; i < n; i++) 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), 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_object_unref (liststore);
g_signal_connect (treeview, "destroy", g_signal_connect (treeview, "destroy",

View file

@ -54,12 +54,12 @@ void
midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry, midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry,
MidoriWebList* name); MidoriWebList* name);
MidoriWebItem* KatzeItem*
midori_search_entry_get_current_item (MidoriSearchEntry* search_entry); midori_search_entry_get_current_item (MidoriSearchEntry* search_entry);
void void
midori_search_entry_set_current_item (MidoriSearchEntry* search_entry, midori_search_entry_set_current_item (MidoriSearchEntry* search_entry,
MidoriWebItem* name); KatzeItem* name);
GtkWidget* GtkWidget*
midori_search_entry_get_dialog (MidoriSearchEntry* search_entry); midori_search_entry_get_dialog (MidoriSearchEntry* search_entry);

View file

@ -88,7 +88,7 @@ sokoke_magic_uri (const gchar* uri,
gchar* search; gchar* search;
const gchar* search_uri; const gchar* search_uri;
gchar** parts; gchar** parts;
MidoriWebItem* web_item; KatzeItem* item;
g_return_val_if_fail (uri, NULL); g_return_val_if_fail (uri, NULL);
if (search_engines) if (search_engines)
@ -122,9 +122,9 @@ sokoke_magic_uri (const gchar* uri,
parts = g_strsplit (uri, " ", 2); parts = g_strsplit (uri, " ", 2);
if (parts[0] && parts[1]) if (parts[0] && parts[1])
{ {
web_item = midori_web_list_find_token (search_engines, parts[0]); item = midori_web_list_find_token (search_engines, parts[0]);
if (web_item) if (item)
search_uri = midori_web_item_get_uri (web_item); search_uri = katze_item_get_uri (item);
} }
g_free (parts); g_free (parts);
if (search_uri) if (search_uri)

View file

@ -15,6 +15,6 @@ midori/sokoke.c
midori/gjs.c midori/gjs.c
katze/katze-throbber.c katze/katze-throbber.c
katze/katze-utils.c katze/katze-utils.c
katze/katze-webitem.c katze/katze-item.c
katze/katze-weblist.c katze/katze-weblist.c
katze/katze-xbel.c katze/katze-xbel.c