{
uri = g_strdup_printf ("view-source:%s",
midori_view_get_display_uri (MIDORI_VIEW (view)));
- source_view = midori_view_new ();
+ source_view = midori_view_new (browser->net);
midori_view_set_settings (MIDORI_VIEW (source_view), browser->settings);
midori_view_set_uri (MIDORI_VIEW (source_view), uri);
midori_view_notify_icon_cb (MIDORI_VIEW (source_view), NULL, browser);
STOCK_BOOKMARKS, _("Bookmarks"));
/* Transfers */
- GtkWidget* panel = midori_view_new ();
+ GtkWidget* panel = midori_view_new (browser->net);
gtk_widget_show (panel);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, NULL,
STOCK_HISTORY, _("History"));
/* Pageholder */
- browser->panel_pageholder = midori_view_new ();
+ browser->panel_pageholder = midori_view_new (browser->net);
midori_view_set_settings (MIDORI_VIEW (browser->panel_pageholder),
browser->settings);
gtk_widget_show (browser->panel_pageholder);
g_signal_handlers_disconnect_by_func (browser->settings,
midori_browser_settings_notify,
browser);
- katze_object_assign (browser->settings, g_value_get_object (value));
- g_object_ref (browser->settings);
+ katze_object_assign (browser->settings, g_value_dup_object (value));
_midori_browser_update_settings (browser);
g_signal_connect (browser->settings, "notify",
G_CALLBACK (midori_browser_settings_notify), browser);
break;
case PROP_BOOKMARKS:
; /* FIXME: Disconnect handlers */
- katze_object_assign (browser->bookmarks, g_value_get_object (value));
- g_object_ref (browser->bookmarks);
+ katze_object_assign (browser->bookmarks, g_value_dup_object (value));
g_object_set (_action_by_name (browser, "Bookmarks"), "array",
browser->bookmarks, NULL);
midori_browser_load_bookmarks (browser);
break;
case PROP_TRASH:
; /* FIXME: Disconnect handlers */
- katze_object_assign (browser->trash, g_value_get_object (value));
- g_object_ref (browser->trash);
+ katze_object_assign (browser->trash, g_value_dup_object (value));
g_object_set (_action_by_name (browser, "Trash"), "array",
browser->trash, NULL);
/* FIXME: Connect to updates */
break;
case PROP_SEARCH_ENGINES:
; /* FIXME: Disconnect handlers */
- katze_object_assign (browser->search_engines, g_value_get_object (value));
- g_object_ref (browser->search_engines);
+ katze_object_assign (browser->search_engines, g_value_dup_object (value));
midori_search_action_set_search_engines (MIDORI_SEARCH_ACTION (
_action_by_name (browser, "Search")), browser->search_engines);
/* FIXME: Connect to updates */
break;
case PROP_HISTORY:
; /* FIXME: Disconnect handlers */
- katze_object_assign (browser->history, g_value_get_object (value));
- g_object_ref (browser->history);
+ katze_object_assign (browser->history, g_value_dup_object (value));
midori_browser_load_history (browser);
g_object_set (_action_by_name (browser, "RecentlyVisited"), "array",
browser->history, NULL);
PROP_PROGRESS,
PROP_ZOOM_LEVEL,
PROP_STATUSBAR_TEXT,
- PROP_SETTINGS
+ PROP_SETTINGS,
+ PROP_NET
};
enum {
"The associated settings",
MIDORI_TYPE_WEB_SETTINGS,
G_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_NET,
+ g_param_spec_object (
+ "net",
+ "Net",
+ "The associated net",
+ KATZE_TYPE_NET,
+ G_PARAM_READWRITE));
}
static void
g_signal_handlers_disconnect_by_func (view->settings,
midori_view_settings_notify_cb, view);
- g_free (view->uri);
- g_free (view->title);
- if (view->icon)
- g_object_unref (view->icon);
- g_free (view->statusbar_text);
- g_free (view->link_uri);
- g_free (view->selected_text);
- if (view->settings)
- g_object_unref (view->settings);
- if (view->item)
- g_object_unref (view->item);
+ katze_assign (view->uri, NULL);
+ katze_assign (view->title, NULL);
+ katze_object_assign (view->icon, NULL);
+ katze_assign (view->statusbar_text, NULL);
+ katze_assign (view->link_uri, NULL);
+ katze_assign (view->selected_text, NULL);
- g_free (view->download_manager);
+ katze_object_assign (view->settings, NULL);
+ katze_object_assign (view->item, NULL);
- g_object_unref (view->net);
+ katze_assign (view->download_manager, NULL);
+
+ katze_object_assign (view->net, NULL);
/* web_frame = webkit_web_view_get_main_frame
(WEBKIT_WEB_VIEW (view->web_view));
case PROP_SETTINGS:
midori_view_set_settings (view, g_value_get_object (value));
break;
+ case PROP_NET:
+ katze_object_assign (view->net, g_value_dup_object (value));
+ if (!view->net)
+ view->net = katze_net_new ();
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_SETTINGS:
g_value_set_object (value, view->settings);
break;
+ case PROP_NET:
+ g_value_set_object (value, view->net);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
/**
* midori_view_new:
- * @view: a #MidoriView
+ * @net: a #KatzeNet
*
* Creates a new view.
*
* Return value: a new #MidoriView
**/
GtkWidget*
-midori_view_new (void)
+midori_view_new (KatzeNet* net)
{
- return g_object_new (MIDORI_TYPE_VIEW, NULL);
+ return g_object_new (MIDORI_TYPE_VIEW, "net", net, NULL);
}
static void