From: Christian Dywan Date: Mon, 1 Nov 2010 15:47:32 +0000 (+0100) Subject: Use function to access browser settings an panel X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed6d44df5fa6be7fad547d32ea82e4a52ae2222c;p=midori Use function to access browser settings an panel --- diff --git a/extensions/addons.c b/extensions/addons.c index 9242686c..13947bf3 100644 --- a/extensions/addons.c +++ b/extensions/addons.c @@ -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); diff --git a/extensions/feed-panel/feed-panel.c b/extensions/feed-panel/feed-panel.c index 2241ad70..efc881c9 100644 --- a/extensions/feed-panel/feed-panel.c +++ b/extensions/feed-panel/feed-panel.c @@ -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 diff --git a/extensions/page-holder.c b/extensions/page-holder.c index b3374421..76d6ca66 100644 --- a/extensions/page-holder.c +++ b/extensions/page-holder.c @@ -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); diff --git a/extensions/statusbar-features.c b/extensions/statusbar-features.c index 43b9d331..eca46138 100644 --- a/extensions/statusbar-features.c +++ b/extensions/statusbar-features.c @@ -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", diff --git a/extensions/tab-panel.c b/extensions/tab-panel.c index 8f265965..07629c5d 100644 --- a/extensions/tab-panel.c +++ b/extensions/tab-panel.c @@ -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 diff --git a/extensions/toolbar-editor.c b/extensions/toolbar-editor.c index d5f1ea85..e7d9da66 100644 --- a/extensions/toolbar-editor.c +++ b/extensions/toolbar-editor.c @@ -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); } diff --git a/midori/main.c b/midori/main.c index 74adc156..b276b5f7 100644 --- a/midori/main.c +++ b/midori/main.c @@ -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, diff --git a/midori/midori-browser.c b/midori/midori-browser.c index c3440c81..22bf2c2f 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -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); }