Don't pass around KatzeNet instances anymore
The KatzeNet is always a singleton, no need to pass it around.
This commit is contained in:
parent
76c7319ddb
commit
c571a6394f
5 changed files with 23 additions and 38 deletions
|
@ -30,7 +30,6 @@ struct _FeedPanel
|
||||||
GtkWidget* webview;
|
GtkWidget* webview;
|
||||||
GtkWidget* delete;
|
GtkWidget* delete;
|
||||||
GdkPixbuf* pixbuf;
|
GdkPixbuf* pixbuf;
|
||||||
KatzeNet* net;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _FeedPanelClass
|
struct _FeedPanelClass
|
||||||
|
@ -750,7 +749,6 @@ feed_panel_finalize (GObject* object)
|
||||||
FeedPanel* panel = FEED_PANEL (object);
|
FeedPanel* panel = FEED_PANEL (object);
|
||||||
|
|
||||||
g_object_unref (panel->pixbuf);
|
g_object_unref (panel->pixbuf);
|
||||||
g_object_unref (panel->net);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -826,8 +824,6 @@ feed_panel_init (FeedPanel* panel)
|
||||||
gtk_icon_factory_add_default (factory);
|
gtk_icon_factory_add_default (factory);
|
||||||
g_object_unref (factory);
|
g_object_unref (factory);
|
||||||
|
|
||||||
panel->net = katze_net_new ();
|
|
||||||
|
|
||||||
model = gtk_tree_store_new (1, KATZE_TYPE_ITEM);
|
model = gtk_tree_store_new (1, KATZE_TYPE_ITEM);
|
||||||
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||||
panel->treeview = treeview;
|
panel->treeview = treeview;
|
||||||
|
|
|
@ -40,7 +40,6 @@ typedef struct
|
||||||
MidoriExtension* extension;
|
MidoriExtension* extension;
|
||||||
GtkWidget* panel;
|
GtkWidget* panel;
|
||||||
KatzeArray* feeds;
|
KatzeArray* feeds;
|
||||||
KatzeNet* net;
|
|
||||||
GSList* parsers;
|
GSList* parsers;
|
||||||
|
|
||||||
guint source_id;
|
guint source_id;
|
||||||
|
@ -96,8 +95,6 @@ feed_deactivate_cb (MidoriExtension* extension,
|
||||||
g_source_remove (priv->source_id);
|
g_source_remove (priv->source_id);
|
||||||
g_slist_foreach (priv->parsers, (GFunc)g_free, NULL);
|
g_slist_foreach (priv->parsers, (GFunc)g_free, NULL);
|
||||||
g_slist_free (priv->parsers);
|
g_slist_free (priv->parsers);
|
||||||
if (priv->feeds)
|
|
||||||
g_object_unref (priv->net);
|
|
||||||
if (priv->feeds)
|
if (priv->feeds)
|
||||||
g_object_unref (priv->feeds);
|
g_object_unref (priv->feeds);
|
||||||
gtk_widget_destroy (priv->panel);
|
gtk_widget_destroy (priv->panel);
|
||||||
|
@ -286,7 +283,7 @@ update_feed (FeedPrivate* priv,
|
||||||
netpriv->extension = priv->extension;
|
netpriv->extension = priv->extension;
|
||||||
netpriv->feed = KATZE_ARRAY (feed);
|
netpriv->feed = KATZE_ARRAY (feed);
|
||||||
|
|
||||||
katze_net_load_uri (priv->net,
|
katze_net_load_uri (NULL,
|
||||||
katze_item_get_uri (feed),
|
katze_item_get_uri (feed),
|
||||||
(KatzeNetStatusCb) feed_status_cb,
|
(KatzeNetStatusCb) feed_status_cb,
|
||||||
(KatzeNetTransferCb) feed_transfer_cb,
|
(KatzeNetTransferCb) feed_transfer_cb,
|
||||||
|
@ -437,7 +434,6 @@ feed_app_add_browser_cb (MidoriApp* app,
|
||||||
GtkWidget* addon;
|
GtkWidget* addon;
|
||||||
GtkActionGroup* action_group;
|
GtkActionGroup* action_group;
|
||||||
GtkAction* action;
|
GtkAction* action;
|
||||||
KatzeNet* net;
|
|
||||||
KatzeArray* feeds;
|
KatzeArray* feeds;
|
||||||
KatzeArray* feed;
|
KatzeArray* feed;
|
||||||
FeedPrivate* priv;
|
FeedPrivate* priv;
|
||||||
|
@ -453,14 +449,12 @@ feed_app_add_browser_cb (MidoriApp* app,
|
||||||
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
|
midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
|
||||||
g_object_unref (panel);
|
g_object_unref (panel);
|
||||||
|
|
||||||
net = katze_net_new ();
|
|
||||||
feeds = katze_array_new (KATZE_TYPE_ARRAY);
|
feeds = katze_array_new (KATZE_TYPE_ARRAY);
|
||||||
feed_panel_add_feeds (FEED_PANEL (addon), KATZE_ITEM (feeds));
|
feed_panel_add_feeds (FEED_PANEL (addon), KATZE_ITEM (feeds));
|
||||||
|
|
||||||
priv->extension = extension;
|
priv->extension = extension;
|
||||||
priv->browser = browser;
|
priv->browser = browser;
|
||||||
priv->panel = addon;
|
priv->panel = addon;
|
||||||
priv->net = net;
|
|
||||||
priv->feeds = feeds;
|
priv->feeds = feeds;
|
||||||
priv->parsers = g_slist_prepend (priv->parsers, atom_init_parser ());
|
priv->parsers = g_slist_prepend (priv->parsers, atom_init_parser ());
|
||||||
priv->parsers = g_slist_prepend (priv->parsers, rss_init_parser ());
|
priv->parsers = g_slist_prepend (priv->parsers, rss_init_parser ());
|
||||||
|
|
|
@ -77,6 +77,8 @@ katze_net_finalize (GObject* object)
|
||||||
* Instantiates a new #KatzeNet instance.
|
* Instantiates a new #KatzeNet instance.
|
||||||
*
|
*
|
||||||
* Return value: a new #KatzeNet
|
* Return value: a new #KatzeNet
|
||||||
|
*
|
||||||
|
* Deprecated: 0.2.7
|
||||||
**/
|
**/
|
||||||
KatzeNet*
|
KatzeNet*
|
||||||
katze_net_new (void)
|
katze_net_new (void)
|
||||||
|
@ -102,14 +104,14 @@ katze_net_new (void)
|
||||||
*
|
*
|
||||||
* Return value: a session, or %NULL
|
* Return value: a session, or %NULL
|
||||||
*
|
*
|
||||||
* Since: 0.1.3
|
* Deprecated: 0.2.7: Use webkit_get_default_session ().
|
||||||
**/
|
**/
|
||||||
gpointer
|
gpointer
|
||||||
katze_net_get_session (KatzeNet* net)
|
katze_net_get_session (KatzeNet* net)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (KATZE_IS_NET (net), NULL);
|
g_return_val_if_fail (KATZE_IS_NET (net), NULL);
|
||||||
|
|
||||||
return net->session;
|
return webkit_get_default_session ();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -147,6 +149,9 @@ katze_net_get_cached_path (KatzeNet* net,
|
||||||
gchar* cached_filename;
|
gchar* cached_filename;
|
||||||
gchar* cached_path;
|
gchar* cached_path;
|
||||||
|
|
||||||
|
if (!net)
|
||||||
|
net = katze_net_new ();
|
||||||
|
|
||||||
if (subfolder)
|
if (subfolder)
|
||||||
cache_path = g_build_filename (net->cache_path, subfolder, NULL);
|
cache_path = g_build_filename (net->cache_path, subfolder, NULL);
|
||||||
else
|
else
|
||||||
|
@ -301,7 +306,7 @@ katze_net_default_cb (KatzeNetPriv* priv)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* katze_net_load_uri:
|
* katze_net_load_uri:
|
||||||
* @net: a #KatzeNet
|
* @net: a #KatzeNet, or %NULL
|
||||||
* @uri: an URI string
|
* @uri: an URI string
|
||||||
* @status_cb: function to call for status information
|
* @status_cb: function to call for status information
|
||||||
* @transfer_cb: function to call upon transfer
|
* @transfer_cb: function to call upon transfer
|
||||||
|
@ -330,12 +335,14 @@ katze_net_load_uri (KatzeNet* net,
|
||||||
KatzeNetPriv* priv;
|
KatzeNetPriv* priv;
|
||||||
SoupMessage* msg;
|
SoupMessage* msg;
|
||||||
|
|
||||||
g_return_if_fail (KATZE_IS_NET (net));
|
|
||||||
g_return_if_fail (uri != NULL);
|
g_return_if_fail (uri != NULL);
|
||||||
|
|
||||||
if (!status_cb && !transfer_cb)
|
if (!status_cb && !transfer_cb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (net == NULL)
|
||||||
|
net = katze_net_new ();
|
||||||
|
|
||||||
request = g_new0 (KatzeNetRequest, 1);
|
request = g_new0 (KatzeNetRequest, 1);
|
||||||
request->uri = g_strdup (uri);
|
request->uri = g_strdup (uri);
|
||||||
request->mime_type = NULL;
|
request->mime_type = NULL;
|
||||||
|
|
|
@ -104,8 +104,6 @@ struct _MidoriBrowser
|
||||||
KatzeArray* history;
|
KatzeArray* history;
|
||||||
gboolean show_tabs;
|
gboolean show_tabs;
|
||||||
|
|
||||||
KatzeNet* net;
|
|
||||||
|
|
||||||
gboolean show_navigationbar;
|
gboolean show_navigationbar;
|
||||||
gboolean show_statusbar;
|
gboolean show_statusbar;
|
||||||
gboolean speed_dial_in_new_tabs;
|
gboolean speed_dial_in_new_tabs;
|
||||||
|
@ -1100,7 +1098,7 @@ midori_browser_save_uri (MidoriBrowser* browser,
|
||||||
webkit_download_start (download);
|
webkit_download_start (download);
|
||||||
g_free (destination);
|
g_free (destination);
|
||||||
#else
|
#else
|
||||||
katze_net_load_uri (browser->net, uri, NULL,
|
katze_net_load_uri (NULL, uri, NULL,
|
||||||
(KatzeNetTransferCb)midori_browser_save_transfer_cb, filename);
|
(KatzeNetTransferCb)midori_browser_save_transfer_cb, filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3765,7 +3763,7 @@ _action_source_view_activate (GtkAction* action,
|
||||||
GtkWidget* source;
|
GtkWidget* source;
|
||||||
GtkWidget* web_view;
|
GtkWidget* web_view;
|
||||||
|
|
||||||
source = midori_view_new (browser->net);
|
source = midori_view_new (NULL);
|
||||||
midori_view_set_settings (MIDORI_VIEW (source), browser->settings);
|
midori_view_set_settings (MIDORI_VIEW (source), browser->settings);
|
||||||
midori_view_set_uri (MIDORI_VIEW (source), "");
|
midori_view_set_uri (MIDORI_VIEW (source), "");
|
||||||
web_view = midori_view_get_web_view (MIDORI_VIEW (source));
|
web_view = midori_view_get_web_view (MIDORI_VIEW (source));
|
||||||
|
@ -3800,7 +3798,7 @@ _action_source_view_activate (GtkAction* action,
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
katze_net_load_uri (browser->net, uri, NULL,
|
katze_net_load_uri (NULL, uri, NULL,
|
||||||
(KatzeNetTransferCb)midori_browser_source_transfer_cb, browser);
|
(KatzeNetTransferCb)midori_browser_source_transfer_cb, browser);
|
||||||
g_free (text_editor);
|
g_free (text_editor);
|
||||||
}
|
}
|
||||||
|
@ -4903,7 +4901,7 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog,
|
||||||
button = g_object_get_data (G_OBJECT (dialog), "cookies");
|
button = g_object_get_data (G_OBJECT (dialog), "cookies");
|
||||||
if (gtk_toggle_button_get_active (button))
|
if (gtk_toggle_button_get_active (button))
|
||||||
{
|
{
|
||||||
SoupSession* session = katze_net_get_session (browser->net);
|
SoupSession* session = webkit_get_default_session ();
|
||||||
SoupSessionFeature* jar = soup_session_get_feature (session,
|
SoupSessionFeature* jar = soup_session_get_feature (session,
|
||||||
SOUP_TYPE_COOKIE_JAR);
|
SOUP_TYPE_COOKIE_JAR);
|
||||||
GSList* cookies = soup_cookie_jar_all_cookies (SOUP_COOKIE_JAR (jar));
|
GSList* cookies = soup_cookie_jar_all_cookies (SOUP_COOKIE_JAR (jar));
|
||||||
|
@ -5449,7 +5447,7 @@ midori_browser_notebook_button_press_event_after_cb (GtkNotebook* notebook,
|
||||||
|
|
||||||
view = g_object_new (MIDORI_TYPE_VIEW,
|
view = g_object_new (MIDORI_TYPE_VIEW,
|
||||||
"settings", browser->settings,
|
"settings", browser->settings,
|
||||||
"net", browser->net, NULL);
|
NULL);
|
||||||
midori_view_set_uri (MIDORI_VIEW (view), "");
|
midori_view_set_uri (MIDORI_VIEW (view), "");
|
||||||
gtk_widget_show (view);
|
gtk_widget_show (view);
|
||||||
g_object_set_data (G_OBJECT (view), "midori-view-append", (void*)1);
|
g_object_set_data (G_OBJECT (view), "midori-view-append", (void*)1);
|
||||||
|
@ -6233,8 +6231,6 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
GtkWidget* scrolled;
|
GtkWidget* scrolled;
|
||||||
GtkWidget* icon;
|
GtkWidget* icon;
|
||||||
|
|
||||||
browser->net = katze_net_new ();
|
|
||||||
|
|
||||||
browser->settings = midori_web_settings_new ();
|
browser->settings = midori_web_settings_new ();
|
||||||
browser->proxy_array = katze_array_new (KATZE_TYPE_ARRAY);
|
browser->proxy_array = katze_array_new (KATZE_TYPE_ARRAY);
|
||||||
browser->bookmarks = NULL;
|
browser->bookmarks = NULL;
|
||||||
|
@ -6790,8 +6786,6 @@ midori_browser_finalize (GObject* object)
|
||||||
katze_object_assign (browser->search_engines, NULL);
|
katze_object_assign (browser->search_engines, NULL);
|
||||||
katze_object_assign (browser->history, NULL);
|
katze_object_assign (browser->history, NULL);
|
||||||
|
|
||||||
katze_object_assign (browser->net, NULL);
|
|
||||||
|
|
||||||
katze_assign (browser->news_aggregator, NULL);
|
katze_assign (browser->news_aggregator, NULL);
|
||||||
|
|
||||||
G_OBJECT_CLASS (midori_browser_parent_class)->finalize (object);
|
G_OBJECT_CLASS (midori_browser_parent_class)->finalize (object);
|
||||||
|
@ -7509,7 +7503,6 @@ midori_browser_add_item (MidoriBrowser* browser,
|
||||||
view = g_object_new (MIDORI_TYPE_VIEW,
|
view = g_object_new (MIDORI_TYPE_VIEW,
|
||||||
"title", title,
|
"title", title,
|
||||||
"settings", browser->settings,
|
"settings", browser->settings,
|
||||||
"net", browser->net,
|
|
||||||
NULL);
|
NULL);
|
||||||
midori_view_set_uri (MIDORI_VIEW (view), uri);
|
midori_view_set_uri (MIDORI_VIEW (view), uri);
|
||||||
gtk_widget_show (view);
|
gtk_widget_show (view);
|
||||||
|
@ -7551,7 +7544,7 @@ midori_browser_add_uri (MidoriBrowser* browser,
|
||||||
g_return_val_if_fail (uri != NULL, -1);
|
g_return_val_if_fail (uri != NULL, -1);
|
||||||
|
|
||||||
view = g_object_new (MIDORI_TYPE_VIEW, "settings", browser->settings,
|
view = g_object_new (MIDORI_TYPE_VIEW, "settings", browser->settings,
|
||||||
"net", browser->net, NULL);
|
NULL);
|
||||||
midori_view_set_uri (MIDORI_VIEW (view), uri);
|
midori_view_set_uri (MIDORI_VIEW (view), uri);
|
||||||
gtk_widget_show (view);
|
gtk_widget_show (view);
|
||||||
|
|
||||||
|
|
|
@ -887,7 +887,7 @@ _midori_web_view_load_icon (MidoriView* view)
|
||||||
icon_uri = g_strdup_printf ("%s/favicon.ico", view->uri);
|
icon_uri = g_strdup_printf ("%s/favicon.ico", view->uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
icon_file = katze_net_get_cached_path (view->net, icon_uri, "icons");
|
icon_file = katze_net_get_cached_path (NULL, icon_uri, "icons");
|
||||||
if (g_hash_table_lookup_extended (view->memory,
|
if (g_hash_table_lookup_extended (view->memory,
|
||||||
icon_file, NULL, (gpointer)&pixbuf))
|
icon_file, NULL, (gpointer)&pixbuf))
|
||||||
{
|
{
|
||||||
|
@ -910,7 +910,7 @@ _midori_web_view_load_icon (MidoriView* view)
|
||||||
priv->icon_uri = icon_uri;
|
priv->icon_uri = icon_uri;
|
||||||
priv->view = view;
|
priv->view = view;
|
||||||
|
|
||||||
katze_net_load_uri (view->net, icon_uri,
|
katze_net_load_uri (NULL, icon_uri,
|
||||||
(KatzeNetStatusCb)katze_net_icon_status_cb,
|
(KatzeNetStatusCb)katze_net_icon_status_cb,
|
||||||
(KatzeNetTransferCb)katze_net_icon_transfer_cb, priv);
|
(KatzeNetTransferCb)katze_net_icon_transfer_cb, priv);
|
||||||
}
|
}
|
||||||
|
@ -2600,7 +2600,6 @@ webkit_web_view_create_web_view_cb (GtkWidget* web_view,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_view = g_object_new (MIDORI_TYPE_VIEW,
|
new_view = g_object_new (MIDORI_TYPE_VIEW,
|
||||||
"net", view->net,
|
|
||||||
"settings", view->settings,
|
"settings", view->settings,
|
||||||
NULL);
|
NULL);
|
||||||
midori_view_construct_web_view (new_view);
|
midori_view_construct_web_view (new_view);
|
||||||
|
@ -2967,8 +2966,6 @@ midori_view_set_property (GObject* object,
|
||||||
break;
|
break;
|
||||||
case PROP_NET:
|
case PROP_NET:
|
||||||
katze_object_assign (view->net, g_value_dup_object (value));
|
katze_object_assign (view->net, g_value_dup_object (value));
|
||||||
if (!view->net)
|
|
||||||
view->net = katze_net_new ();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -3047,7 +3044,7 @@ midori_view_focus_in_event (GtkWidget* widget,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midori_view_new:
|
* midori_view_new:
|
||||||
* @net: a #KatzeNet
|
* @net: a #KatzeNet, or %NULL
|
||||||
*
|
*
|
||||||
* Creates a new view.
|
* Creates a new view.
|
||||||
*
|
*
|
||||||
|
@ -3056,9 +3053,7 @@ midori_view_focus_in_event (GtkWidget* widget,
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
midori_view_new (KatzeNet* net)
|
midori_view_new (KatzeNet* net)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (!net || KATZE_IS_NET (net), NULL);
|
return g_object_new (MIDORI_TYPE_VIEW, NULL);
|
||||||
|
|
||||||
return g_object_new (MIDORI_TYPE_VIEW, "net", net, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3986,7 +3981,7 @@ midori_view_tab_label_menu_duplicate_tab_cb (GtkWidget* menuitem,
|
||||||
{
|
{
|
||||||
MidoriNewView where = MIDORI_NEW_VIEW_TAB;
|
MidoriNewView where = MIDORI_NEW_VIEW_TAB;
|
||||||
GtkWidget* new_view = g_object_new (MIDORI_TYPE_VIEW,
|
GtkWidget* new_view = g_object_new (MIDORI_TYPE_VIEW,
|
||||||
"net", view->net, "settings", view->settings, NULL);
|
"settings", view->settings, NULL);
|
||||||
midori_view_set_uri (MIDORI_VIEW (new_view),
|
midori_view_set_uri (MIDORI_VIEW (new_view),
|
||||||
midori_view_get_display_uri (view));
|
midori_view_get_display_uri (view));
|
||||||
gtk_widget_show (new_view);
|
gtk_widget_show (new_view);
|
||||||
|
|
Loading…
Reference in a new issue