Use function to access browser settings an panel

This commit is contained in:
Christian Dywan 2010-11-01 16:47:32 +01:00
parent 6ea63d2f70
commit ed6d44df5f
8 changed files with 12 additions and 27 deletions

View file

@ -293,7 +293,7 @@ midori_addons_open_in_editor_clicked_cb (GtkWidget* toolitem,
gchar* text_editor;
browser = midori_browser_get_for_widget (GTK_WIDGET (addons->treeview));
settings = katze_object_get_object (browser, "settings");
settings = midori_browser_get_settings (browser);
gtk_tree_model_get (model, &iter, 0, &element, -1);

View file

@ -334,15 +334,11 @@ feed_panel_row_activated_cb (GtkTreeView* treeview,
MidoriWebSettings* settings;
MidoriBrowser* browser;
gint n;
browser = midori_browser_get_for_widget (GTK_WIDGET (panel));
n = midori_browser_add_item (browser, item);
settings = katze_object_get_object (browser, "settings");
settings = midori_browser_get_settings (browser);
if (!katze_object_get_boolean (settings, "open-tabs-in-the-background"))
midori_browser_set_current_page (browser, n);
g_object_unref (settings);
}
g_object_unref (item);
}
@ -485,11 +481,9 @@ feed_panel_open_in_tab_activate_cb (GtkWidget* menuitem,
browser = midori_browser_get_for_widget (GTK_WIDGET (panel));
n = midori_browser_add_item (browser, item);
settings = katze_object_get_object (browser, "settings");
settings = midori_browser_get_settings (browser);
if (!katze_object_get_boolean (settings, "open-tabs-in-the-background"))
midori_browser_set_current_page (browser, n);
g_object_unref (settings);
}
}
@ -584,10 +578,9 @@ feed_panel_button_release_event_cb (GtkWidget* widget,
browser = midori_browser_get_for_widget (GTK_WIDGET (panel));
n = midori_browser_add_item (browser, item);
settings = katze_object_get_object (browser, "settings");
settings = midori_browser_get_settings (browser);
if (!katze_object_get_boolean (settings, "open-tabs-in-the-background"))
midori_browser_set_current_page (browser, n);
g_object_unref (settings);
}
}
else

View file

@ -28,9 +28,8 @@ page_holder_notebook_append_view (GtkWidget* notebook)
view = midori_view_new (NULL);
browser = midori_browser_get_for_widget (notebook);
settings = katze_object_get_object (browser, "settings");
settings = midori_browser_get_settings (browser);
midori_view_set_settings (MIDORI_VIEW (view), settings);
g_object_unref (settings);
gtk_widget_show (view);
label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view));
return gtk_notebook_append_page (GTK_NOTEBOOK (notebook), view, label);

View file

@ -79,7 +79,7 @@ statusbar_features_app_add_browser_cb (MidoriApp* app,
statusbar = katze_object_get_object (browser, "statusbar");
bbox = gtk_hbox_new (FALSE, 0);
settings = katze_object_get_object (browser, "settings");
settings = midori_browser_get_settings (browser);
toolbar = katze_object_get_object (browser, "navigationbar");
button = katze_property_proxy (settings, "auto-load-images", "toggle");
g_object_set_data (G_OBJECT (button), "feature-label", _("Images"));
@ -112,7 +112,6 @@ statusbar_features_app_add_browser_cb (MidoriApp* app,
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2);
gtk_widget_show_all (bbox);
gtk_box_pack_start (GTK_BOX (statusbar), bbox, FALSE, FALSE, 3);
g_object_unref (settings);
g_object_unref (statusbar);
g_signal_connect (extension, "deactivate",

View file

@ -396,7 +396,7 @@ tab_panel_browser_add_tab_cb (MidoriBrowser* browser,
{
GtkWidget* notebook = katze_object_get_object (browser, "notebook");
gint page = gtk_notebook_page_num (GTK_NOTEBOOK (notebook), view);
MidoriWebSettings* settings = katze_object_get_object (browser, "settings");
MidoriWebSettings* settings = midori_browser_get_settings (browser);
gboolean minimized = katze_object_get_boolean (view, "minimized");
GdkPixbuf* icon = midori_view_get_icon (MIDORI_VIEW (view));
const gchar* title = midori_view_get_display_title (MIDORI_VIEW (view));
@ -444,7 +444,6 @@ tab_panel_browser_add_tab_cb (MidoriBrowser* browser,
}
g_object_unref (notebook);
g_object_unref (settings);
}
static void

View file

@ -119,9 +119,8 @@ static GSList *tb_editor_parse_active_items(MidoriBrowser *browser)
GSList *list = NULL;
MidoriWebSettings *settings;
settings = katze_object_get_object(browser, "settings");
settings = midori_browser_get_settings(browser);
g_object_get(settings, "toolbar-items", &items, NULL);
g_object_unref(settings);
names = g_strsplit(items ? items : "", ",", 0);
list = tb_editor_array_to_list((const gchar **) names);
@ -356,9 +355,8 @@ static void tb_editor_update_toolbar(TBEditorWidget *tbw)
gtk_tree_model_foreach(GTK_TREE_MODEL(tbw->store_used), tb_editor_foreach_used, str);
settings = katze_object_get_object(tbw->browser, "settings");
settings = midori_browser_get_settings(tbw->browser);
g_object_set(settings, "toolbar-items", str->str, NULL);
g_object_unref(settings);
g_string_free(str, TRUE);
}

View file

@ -134,7 +134,6 @@ settings_and_accels_new (const gchar* config,
GEnumClass* enum_class = G_ENUM_CLASS (
g_type_class_peek (pspec->value_type));
GEnumValue* enum_value;
str = g_key_file_get_string (key_file, "settings", property, NULL);
enum_value = g_enum_get_value_by_name (enum_class, str);
if (enum_value)
@ -142,9 +141,7 @@ settings_and_accels_new (const gchar* config,
else
g_warning (_("Value '%s' is invalid for %s"),
str, property);
g_free (str);
g_type_class_unref (enum_class);
}
else
g_warning (_("Invalid configuration value '%s'"), property);
@ -230,7 +227,7 @@ settings_save_to_file (MidoriWebSettings* settings,
else if (type == G_TYPE_PARAM_ENUM)
{
GEnumClass* enum_class = G_ENUM_CLASS (
g_type_class_ref (pspec->value_type));
g_type_class_peek (pspec->value_type));
gint integer;
GEnumValue* enum_value;
g_object_get (settings, property, &integer, NULL);
@ -1858,7 +1855,7 @@ main (int argc,
}
else
{
settings = katze_object_get_object (browser, "settings");
settings = g_object_ref (midori_browser_get_settings (browser));
g_object_set (settings,
"show-menubar", FALSE,
"show-navigationbar", FALSE,

View file

@ -4584,7 +4584,7 @@ midori_panel_notify_page_cb (MidoriPanel* panel,
GParamSpec* pspec,
MidoriBrowser* browser)
{
gint page = katze_object_get_boolean (panel, "page");
gint page = midori_panel_get_current_page (panel);
if (page > -1)
g_object_set (browser->settings, "last-panel-page", page, NULL);
}