#include "cookie-manager.h"
#include "cookie-manager-page.h"
-
-typedef struct _CookieManagerPagePrivate CookieManagerPagePrivate;
-
-#define COOKIE_MANAGER_PAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj),\
- COOKIE_MANAGER_PAGE_TYPE, CookieManagerPagePrivate))
-
-
#define CM_EMPTY_LABEL_TEXT "\n\n\n\n\n\n"
static void cm_create_toolbar(CookieManagerPage *cmp)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
GtkWidget *toolbar;
GtkToolItem *toolitem;
static GtkWidget *cookie_manager_page_get_toolbar(MidoriViewable *viewable)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(viewable);
+ CookieManagerPage *cmp = COOKIE_MANAGER_PAGE(viewable);
+ CookieManagerPagePrivate *priv = cmp->priv;
return priv->toolbar;
}
static void cookie_manager_page_pre_cookies_change_cb(CookieManager *cm, CookieManagerPage *cmp)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
g_object_ref(priv->filter);
gtk_tree_view_set_model(GTK_TREE_VIEW(priv->treeview), NULL);
static void cookie_manager_page_cookies_changed_cb(CookieManager *cm, CookieManagerPage *cmp)
{
const gchar *filter_text;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
gtk_tree_view_set_model(GTK_TREE_VIEW(priv->treeview), GTK_TREE_MODEL(priv->filter));
g_object_unref(priv->filter);
static void cookie_manager_page_filter_changed_cb(CookieManager *cm, const gchar *text,
CookieManagerPage *cmp)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
priv->ignore_changed_filter = TRUE;
gtk_entry_set_text(GTK_ENTRY(priv->filter_entry), text);
static void cookie_manager_page_finalize(GObject *object)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(object);
+ CookieManagerPage *cmp = COOKIE_MANAGER_PAGE(object);
+ CookieManagerPagePrivate *priv = cmp->priv;
gtk_widget_destroy(priv->popup_menu);
static void cookie_manager_page_set_property(GObject *object, guint prop_id, const GValue *value,
GParamSpec *pspec)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(object);
+ CookieManagerPage *cmp = COOKIE_MANAGER_PAGE(object);
+ CookieManagerPagePrivate *priv = cmp->priv;
switch (prop_id)
{
case PROP_STORE:
static void cm_set_button_sensitiveness(CookieManagerPage *cmp, gboolean set)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
gboolean expand_set = (gtk_tree_model_iter_n_children(priv->filter, NULL) > 0);
guint i, len;
static void cm_tree_popup_collapse_activate_cb(GtkMenuItem *item, CookieManagerPage *cmp)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
gtk_tree_view_collapse_all(GTK_TREE_VIEW(priv->treeview));
}
static void cm_tree_popup_expand_activate_cb(GtkMenuItem *item, CookieManagerPage *cmp)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
gtk_tree_view_expand_all(GTK_TREE_VIEW(priv->treeview));
}
static void cm_store_remove(CookieManagerPage *cmp, GtkTreeIter *iter_model)
{
GtkTreeIter iter_store;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
gtk_tree_model_filter_convert_iter_to_child_iter(
GTK_TREE_MODEL_FILTER(priv->filter), &iter_store, iter_model);
static void cm_delete_cookie(CookieManagerPage *cmp, GtkTreeModel *model, GtkTreeIter *child)
{
SoupCookie *cookie;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
gtk_tree_model_get(model, child, COOKIE_MANAGER_COL_COOKIE, &cookie, -1);
/* select an item after deletion */
static void cm_select_path(CookieManagerPage *cmp, GtkTreeModel *model, GtkTreePath *path)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->treeview));
CMPathWalkFunc path_funcs[] = {
(CMPathWalkFunc) gtk_tree_path_prev, (CMPathWalkFunc) gtk_tree_path_up,
GtkTreeSelection *selection;
GList *rows, *row;
GList *refs = NULL;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->treeview));
rows = gtk_tree_selection_get_selected_rows(selection, &model);
static void cm_delete_all_cookies_real(CookieManagerPage *cmp)
{
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->treeview));
GtkTreeIter iter, iter_store, child;
GtkTreePath *path_first, *path;
GtkWidget *dialog;
const gchar *filter_text;
MidoriBrowser *toplevel = midori_browser_get_for_widget(GTK_WIDGET(button));
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
dialog = gtk_message_dialog_new(GTK_WINDOW(toplevel),
GTK_DIALOG_DESTROY_WITH_PARENT,
GtkTreeSelection *selection;
GtkTreeModel *model;
GList *rows;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->treeview));
rows = gtk_tree_selection_get_selected_rows(selection, &model);
gint i, n;
gchar *name;
gchar *domain;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
model = GTK_TREE_MODEL(priv->store);
if (! gtk_tree_model_get_iter_first(model, &iter))
static void cm_filter_entry_changed_cb(GtkEditable *editable, CookieManagerPage *cmp)
{
const gchar *text;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
if (priv->ignore_changed_filter)
return;
gboolean delete_possible = TRUE;
guint rows_len;
SoupCookie *cookie;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
rows = gtk_tree_selection_get_selected_rows(selection, &model);
rows_len = cm_list_length(rows);
static void cm_tree_show_popup_menu(GtkWidget *widget, GdkEventButton *event, CookieManagerPage *cmp)
{
gint button, event_time;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
if (event != NULL)
{
GtkWidget *item;
GtkWidget *menu;
GtkWidget *treeview;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(cmp);
+ CookieManagerPagePrivate *priv = cmp->priv;
treeview = priv->treeview = gtk_tree_view_new();
GtkWidget *filter_hbox;
GtkWidget *filter_label;
GtkWidget *treeview;
- CookieManagerPagePrivate *priv = COOKIE_MANAGER_PAGE_GET_PRIVATE(self);
+ CookieManagerPagePrivate *priv;
- priv->parent = NULL;
- priv->store = NULL;
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ COOKIE_MANAGER_PAGE_TYPE, CookieManagerPagePrivate);
+ priv = self->priv;
priv->ignore_changed_filter = FALSE;
cm_create_toolbar(self);
typedef struct _CookieManagerPrivate CookieManagerPrivate;
-#define COOKIE_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj),\
- COOKIE_MANAGER_TYPE, CookieManagerPrivate))
-
struct _CookieManager
{
GObject parent;
+ CookieManagerPrivate* priv;
};
struct _CookieManagerClass
static void cookie_manager_page_destroy_cb(GObject *page, CookieManager *cm)
{
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ CookieManagerPrivate *priv = cm->priv;
priv->panel_pages = g_slist_remove(priv->panel_pages, page);
}
{
MidoriPanel *panel;
GtkWidget *page;
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ CookieManagerPrivate *priv = cm->priv;
panel = katze_object_get_object(browser, "panel");
static void cookie_manager_free_cookie_list(CookieManager *cm)
{
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ CookieManagerPrivate *priv = cm->priv;
if (priv->cookies != NULL)
{
GtkTreeIter iter;
GtkTreeIter *parent_iter;
SoupCookie *cookie;
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ CookieManagerPrivate *priv = cm->priv;
g_signal_emit(cm, signals[PRE_COOKIES_CHANGE], 0);
static gboolean cookie_manager_delayed_refresh(CookieManager *cm)
{
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ CookieManagerPrivate *priv = cm->priv;
cookie_manager_refresh_store(cm);
priv->timer_id = 0;
static void cookie_manager_jar_changed_cb(SoupCookieJar *jar, SoupCookie *old, SoupCookie *new,
CookieManager *cm)
{
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ CookieManagerPrivate *priv = cm->priv;
if (priv->ignore_changed_count > 0)
{
static void cookie_manager_finalize(GObject *object)
{
CookieManager *cm = COOKIE_MANAGER(object);
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ CookieManagerPrivate *priv = cm->priv;
g_signal_handlers_disconnect_by_func(priv->app, cookie_manager_app_add_browser_cb, cm);
g_signal_handlers_disconnect_by_func(priv->jar, cookie_manager_jar_changed_cb, cm);
static void cookie_manager_init(CookieManager *self)
{
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(self);
+ CookieManagerPrivate *priv;
SoupSession *session;
- priv->filter_text = NULL;
- priv->panel_pages = NULL;
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ COOKIE_MANAGER_TYPE, CookieManagerPrivate);
+ priv = self->priv;
/* create the main store */
priv->store = gtk_tree_store_new(COOKIE_MANAGER_N_COLUMNS,
G_TYPE_STRING, SOUP_TYPE_COOKIE, G_TYPE_BOOLEAN);
void cookie_manager_update_filter(CookieManager *cm, const gchar *text)
{
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ CookieManagerPrivate *priv = cm->priv;
katze_assign(priv->filter_text, g_strdup(text));
void cookie_manager_delete_cookie(CookieManager *cm, SoupCookie *cookie)
{
- CookieManagerPrivate *priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ CookieManagerPrivate *priv = cm->priv;
if (cookie != NULL)
{
cm = g_object_new(COOKIE_MANAGER_TYPE, NULL);
- priv = COOKIE_MANAGER_GET_PRIVATE(cm);
+ priv = cm->priv;
priv->app = app;
priv->extension = extension;