Omit instances of if (browser->settings)

This commit is contained in:
Christian Dywan 2009-11-13 18:24:16 +01:00
parent 8ab4123c3f
commit 694526704d

View file

@ -3082,7 +3082,7 @@ _action_menubar_activate (GtkToggleAction* action,
MidoriBrowser* browser)
{
gboolean active = gtk_toggle_action_get_active (action);
if (browser->settings)
if (1)
{
#if !HAVE_HILDON
if (active)
@ -3132,7 +3132,6 @@ _action_navigationbar_activate (GtkToggleAction* action,
MidoriBrowser* browser)
{
gboolean active = gtk_toggle_action_get_active (action);
if (browser->settings)
g_object_set (browser->settings, "show-navigationbar", active, NULL);
sokoke_widget_set_visible (browser->navigationbar, active);
@ -3147,7 +3146,6 @@ _action_bookmarkbar_activate (GtkToggleAction* action,
MidoriBrowser* browser)
{
gboolean active = gtk_toggle_action_get_active (action);
if (browser->settings)
g_object_set (browser->settings, "show-bookmarkbar", active, NULL);
sokoke_widget_set_visible (browser->bookmarkbar, active);
}
@ -3157,7 +3155,6 @@ _action_transferbar_activate (GtkToggleAction* action,
MidoriBrowser* browser)
{
gboolean active = gtk_toggle_action_get_active (action);
if (browser->settings)
g_object_set (browser->settings, "show-transferbar", active, NULL);
sokoke_widget_set_visible (browser->transferbar, active);
}
@ -3167,7 +3164,6 @@ _action_statusbar_activate (GtkToggleAction* action,
MidoriBrowser* browser)
{
gboolean active = gtk_toggle_action_get_active (action);
if (browser->settings)
g_object_set (browser->settings, "show-statusbar", active, NULL);
#if !HAVE_HILDON
sokoke_widget_set_visible (browser->statusbar, active);
@ -3364,10 +3360,7 @@ _action_source_view_activate (GtkAction* action,
if (!(view = midori_browser_get_current_tab (browser)))
return;
if (browser->settings)
g_object_get (browser->settings, "text-editor", &text_editor, NULL);
else
text_editor = NULL;
uri = midori_view_get_display_uri (MIDORI_VIEW (view));
if (!(text_editor && *text_editor))
@ -4388,7 +4381,6 @@ _action_panel_activate (GtkToggleAction* action,
MidoriBrowser* browser)
{
gboolean active = gtk_toggle_action_get_active (action);
if (browser->settings)
g_object_set (browser->settings, "show-panel", active, NULL);
sokoke_widget_set_visible (browser->panel, active);
}
@ -4398,7 +4390,6 @@ midori_browser_panel_timeout (GtkWidget* hpaned)
{
gboolean position = gtk_paned_get_position (GTK_PANED (hpaned));
MidoriBrowser* browser = midori_browser_get_for_widget (hpaned);
if (browser->settings)
g_object_set (browser->settings, "last-panel-position", position, NULL);
browser->panel_timeout = 0;
return FALSE;
@ -4430,15 +4421,12 @@ midori_panel_notify_show_titles_cb (MidoriPanel* panel,
MidoriBrowser* browser)
{
gboolean show_titles = katze_object_get_boolean (panel, "show-titles");
if (browser->settings)
{
g_signal_handlers_block_by_func (browser->settings,
midori_browser_settings_notify, browser);
g_object_set (browser->settings, "compact-sidepanel", !show_titles, NULL);
g_signal_handlers_unblock_by_func (browser->settings,
midori_browser_settings_notify, browser);
}
}
static void
midori_panel_notify_show_controls_cb (MidoriPanel* panel,
@ -4446,15 +4434,12 @@ midori_panel_notify_show_controls_cb (MidoriPanel* panel,
MidoriBrowser* browser)
{
gboolean show_controls = katze_object_get_boolean (panel, "show-controls");
if (browser->settings)
{
g_signal_handlers_block_by_func (browser->settings,
midori_browser_settings_notify, browser);
g_object_set (browser->settings, "show-panel-controls", show_controls, NULL);
g_signal_handlers_unblock_by_func (browser->settings,
midori_browser_settings_notify, browser);
}
}
static void
midori_panel_notify_right_aligned_cb (MidoriPanel* panel,
@ -4467,7 +4452,6 @@ midori_panel_notify_right_aligned_cb (MidoriPanel* panel,
gint paned_position = gtk_paned_get_position (GTK_PANED (hpaned));
gint paned_size = hpaned->allocation.width;
if (browser->settings)
g_object_set (browser->settings, "right-align-sidepanel",
right_aligned, NULL);
@ -4592,12 +4576,9 @@ midori_browser_notebook_button_press_event_after_cb (GtkNotebook* notebook,
gint n;
GtkWidget* view;
if (browser->settings)
view = g_object_new (MIDORI_TYPE_VIEW,
"settings", browser->settings,
"net", browser->net, NULL);
else
view = midori_view_new (browser->net);
midori_view_set_uri (MIDORI_VIEW (view), "");
gtk_widget_show (view);
g_object_set_data (G_OBJECT (view), "midori-view-append", (void*)1);
@ -5821,7 +5802,6 @@ midori_browser_finalize (GObject* object)
{
MidoriBrowser* browser = MIDORI_BROWSER (object);
if (browser->settings)
g_signal_handlers_disconnect_by_func (browser->settings,
midori_browser_settings_notify,
browser);
@ -6275,17 +6255,16 @@ midori_browser_set_property (GObject* object,
_midori_browser_set_statusbar_text (browser, g_value_get_string (value));
break;
case PROP_SETTINGS:
if (browser->settings)
g_signal_handlers_disconnect_by_func (browser->settings,
midori_browser_settings_notify,
browser);
katze_object_assign (browser->settings, g_value_dup_object (value));
if (browser->settings)
{
if (!browser->settings)
browser->settings = midori_web_settings_new ();
_midori_browser_update_settings (browser);
g_signal_connect (browser->settings, "notify",
G_CALLBACK (midori_browser_settings_notify), browser);
}
gtk_container_foreach (GTK_CONTAINER (browser->notebook),
(GtkCallback) midori_view_set_settings, browser->settings);
break;
@ -6301,10 +6280,11 @@ midori_browser_set_property (GObject* object,
_midori_browser_update_actions (browser);
break;
case PROP_SEARCH_ENGINES:
{
guint i;
/* FIXME: Disconnect handlers */
katze_object_assign (browser->search_engines, g_value_dup_object (value));
if (browser->settings)
{
if (katze_object_get_boolean (browser->settings,
"search-engines-in-completion"))
midori_location_action_set_search_engines (MIDORI_LOCATION_ACTION (
@ -6312,18 +6292,12 @@ midori_browser_set_property (GObject* object,
else
midori_location_action_set_search_engines (MIDORI_LOCATION_ACTION (
_action_by_name (browser, "Location")), NULL);
}
midori_search_action_set_search_engines (MIDORI_SEARCH_ACTION (
_action_by_name (browser, "Search")), browser->search_engines);
/* FIXME: Connect to updates */
if (browser->settings)
{
guint i;
g_object_get (browser->settings, "last-web-search",
&last_web_search, NULL);
item = katze_array_get_nth_item (browser->search_engines,
last_web_search);
g_object_get (browser->settings, "last-web-search", &last_web_search, NULL);
item = katze_array_get_nth_item (browser->search_engines, last_web_search);
midori_search_action_set_current_item (MIDORI_SEARCH_ACTION (
_action_by_name (browser, "Search")), item);
@ -6335,8 +6309,8 @@ midori_browser_set_property (GObject* object,
_action_by_name (browser, "Search")), item);
break;
}
}
break;
}
case PROP_HISTORY:
midori_browser_set_history (browser, g_value_get_object (value));
break;
@ -6547,11 +6521,8 @@ midori_browser_add_uri (MidoriBrowser* browser,
g_return_val_if_fail (MIDORI_IS_BROWSER (browser), -1);
g_return_val_if_fail (uri != NULL, -1);
if (browser->settings)
view = g_object_new (MIDORI_TYPE_VIEW, "settings", browser->settings,
"net", browser->net, NULL);
else
view = midori_view_new (browser->net);
midori_view_set_uri (MIDORI_VIEW (view), uri);
gtk_widget_show (view);