Remove remaining cases checking if browser->settings is set

This commit is contained in:
Christian Dywan 2009-11-13 18:27:49 +01:00
parent 694526704d
commit ca5230d2ef

View file

@ -226,7 +226,7 @@ _toggle_tabbar_smartly (MidoriBrowser* browser)
return; return;
n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook)); n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook));
if (n < 2 && browser->settings) if (n < 2)
{ {
g_object_get (browser->settings, "always-show-tabbar", g_object_get (browser->settings, "always-show-tabbar",
&always_show_tabbar, NULL); &always_show_tabbar, NULL);
@ -1275,8 +1275,7 @@ midori_browser_download_notify_status_cb (WebKitDownload* download,
g_object_set_data (G_OBJECT (gtk_widget_get_parent (button)), g_object_set_data (G_OBJECT (gtk_widget_get_parent (button)),
"done", (void*)1); "done", (void*)1);
if (browser->settings && katze_object_get_boolean ( if (katze_object_get_boolean (browser->settings, "notify-transfer-completed"))
browser->settings, "notify-transfer-completed"))
{ {
const gchar* uri = webkit_download_get_destination_uri (download); const gchar* uri = webkit_download_get_destination_uri (download);
gchar* path = soup_uri_decode (uri); gchar* path = soup_uri_decode (uri);
@ -1630,7 +1629,6 @@ _midori_browser_add_tab (MidoriBrowser* browser,
NULL); NULL);
if (!g_object_get_data (G_OBJECT (view), "midori-view-append") && if (!g_object_get_data (G_OBJECT (view), "midori-view-append") &&
browser->settings &&
katze_object_get_boolean (browser->settings, "open-tabs-next-to-current")) katze_object_get_boolean (browser->settings, "open-tabs-next-to-current"))
{ {
n = gtk_notebook_get_current_page (notebook); n = gtk_notebook_get_current_page (notebook);
@ -3060,13 +3058,12 @@ _action_preferences_activate (GtkAction* action,
{ {
static GtkWidget* dialog = NULL; static GtkWidget* dialog = NULL;
if (!browser->settings || !GTK_WIDGET_VISIBLE (browser)) if (!GTK_WIDGET_VISIBLE (browser))
return; return;
if (!dialog) if (!dialog)
{ {
dialog = midori_preferences_new (GTK_WINDOW (browser), dialog = midori_preferences_new (GTK_WINDOW (browser), browser->settings);
browser->settings);
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (midori_preferences_response_help_cb), browser); G_CALLBACK (midori_preferences_response_help_cb), browser);
g_signal_connect (dialog, "destroy", g_signal_connect (dialog, "destroy",
@ -3473,17 +3470,14 @@ static void
_action_homepage_activate (GtkAction* action, _action_homepage_activate (GtkAction* action,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
gchar* homepage;
if (g_object_get_data (G_OBJECT (action), "midori-middle-click")) if (g_object_get_data (G_OBJECT (action), "midori-middle-click"))
{ {
g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0); g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0);
return; return;
} }
gchar* homepage;
if (!browser->settings)
return;
g_object_get (browser->settings, "homepage", &homepage, NULL); g_object_get (browser->settings, "homepage", &homepage, NULL);
midori_browser_set_current_uri (browser, homepage); midori_browser_set_current_uri (browser, homepage);
g_free (homepage); g_free (homepage);
@ -3625,9 +3619,6 @@ _action_search_submit (GtkAction* action,
const gchar* url; const gchar* url;
gchar* search; gchar* search;
if (!browser->settings)
return;
g_object_get (browser->settings, "last-web-search", &last_web_search, NULL); g_object_get (browser->settings, "last-web-search", &last_web_search, NULL);
item = katze_array_get_nth_item (browser->search_engines, last_web_search); item = katze_array_get_nth_item (browser->search_engines, last_web_search);
if (item) if (item)
@ -3915,9 +3906,6 @@ midori_browser_menu_middle_click_on_navigation_action (MidoriBrowser* browser,
g_return_val_if_fail (action != NULL, FALSE); g_return_val_if_fail (action != NULL, FALSE);
if (!browser->settings)
return FALSE;
g_object_get (browser->settings, "homepage", &homepage, NULL); g_object_get (browser->settings, "homepage", &homepage, NULL);
name = gtk_action_get_name (action); name = gtk_action_get_name (action);
@ -4411,7 +4399,7 @@ midori_panel_notify_page_cb (MidoriPanel* panel,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
gint page = katze_object_get_boolean (panel, "page"); gint page = katze_object_get_boolean (panel, "page");
if (browser->settings && page > -1) if (page > -1)
g_object_set (browser->settings, "last-panel-page", page, NULL); g_object_set (browser->settings, "last-panel-page", page, NULL);
} }
@ -4452,8 +4440,7 @@ midori_panel_notify_right_aligned_cb (MidoriPanel* panel,
gint paned_position = gtk_paned_get_position (GTK_PANED (hpaned)); gint paned_position = gtk_paned_get_position (GTK_PANED (hpaned));
gint paned_size = hpaned->allocation.width; gint paned_size = hpaned->allocation.width;
g_object_set (browser->settings, "right-align-sidepanel", g_object_set (browser->settings, "right-align-sidepanel", right_aligned, NULL);
right_aligned, NULL);
g_object_ref (browser->panel); g_object_ref (browser->panel);
g_object_ref (vpaned); g_object_ref (vpaned);