From 80128d931546cb1629df6a7c813b3f0621daec4d Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 30 Oct 2008 02:21:19 +0100 Subject: [PATCH] Apply some cleanup with regard to referencing and more --- midori/midori-app.c | 32 +++++++++++--------------------- midori/midori-panel.c | 2 +- midori/midori-preferences.c | 1 + midori/midori-view.c | 18 +++++++++++------- po/wscript_build | 8 +++++--- 5 files changed, 29 insertions(+), 32 deletions(-) diff --git a/midori/midori-app.c b/midori/midori-app.c index 2ce8d656..9264ae07 100644 --- a/midori/midori-app.c +++ b/midori/midori-app.c @@ -337,19 +337,13 @@ midori_app_finalize (GObject* object) g_list_free (app->browsers); g_object_unref (app->accel_group); - if (app->settings) - g_object_unref (app->settings); - if (app->bookmarks) - g_object_unref (app->bookmarks); - if (app->trash) - g_object_unref (app->trash); - if (app->search_engines) - g_object_unref (app->search_engines); - if (app->history) - g_object_unref (app->history); + katze_object_assign (app->settings, NULL); + katze_object_assign (app->bookmarks, NULL); + katze_object_assign (app->trash, NULL); + katze_object_assign (app->search_engines, NULL); + katze_object_assign (app->history, NULL); - if (app->instance) - g_object_unref (app->instance); + katze_object_assign (app->instance, NULL); G_OBJECT_CLASS (midori_app_parent_class)->finalize (object); } @@ -365,27 +359,23 @@ midori_app_set_property (GObject* object, switch (prop_id) { case PROP_SETTINGS: - katze_object_assign (app->settings, g_value_get_object (value)); - g_object_ref (app->settings); + katze_object_assign (app->settings, g_value_dup_object (value)); /* FIXME: Propagate settings to all browsers */ break; case PROP_BOOKMARKS: - katze_object_assign (app->bookmarks, g_value_get_object (value)); - g_object_ref (app->bookmarks); + katze_object_assign (app->bookmarks, g_value_dup_object (value)); /* FIXME: Propagate bookmarks to all browsers */ break; case PROP_TRASH: - katze_object_assign (app->trash, g_value_get_object (value)); - g_object_ref (app->trash); + katze_object_assign (app->trash, g_value_dup_object (value)); /* FIXME: Propagate trash to all browsers */ break; case PROP_SEARCH_ENGINES: - katze_object_assign (app->search_engines, g_value_get_object (value)); - g_object_ref (app->search_engines); + katze_object_assign (app->search_engines, g_value_dup_object (value)); /* FIXME: Propagate search engines to all browsers */ break; case PROP_HISTORY: - katze_object_assign (app->history, g_value_get_object (value)); + katze_object_assign (app->history, g_value_dup_object (value)); /* FIXME: Propagate history to all browsers */ break; default: diff --git a/midori/midori-panel.c b/midori/midori-panel.c index 9f62f86b..c4fd41be 100644 --- a/midori/midori-panel.c +++ b/midori/midori-panel.c @@ -261,7 +261,7 @@ midori_panel_set_property (GObject* object, g_value_get_enum (value)); break; case PROP_MENU: - katze_object_assign (panel->menu, g_value_get_object (value)); + katze_object_assign (panel->menu, g_value_dup_object (value)); /* FIXME: Move existing items to the new menu */ break; case PROP_PAGE: diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c index cf34039e..6127bc7a 100644 --- a/midori/midori-preferences.c +++ b/midori/midori-preferences.c @@ -17,6 +17,7 @@ #include "sokoke.h" +#include #include struct _MidoriPreferences diff --git a/midori/midori-view.c b/midori/midori-view.c index 2fa72822..c073fce2 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -946,6 +946,14 @@ webkit_web_view_window_object_cleared_cb (GtkWidget* web_view, web_frame, js_context, js_window); } +static void +webkit_web_view_destroy_cb (GtkWidget* web_view, + WebKitWebFrame* web_frame) +{ + g_signal_handlers_disconnect_by_func (web_frame, + webkit_web_frame_load_done_cb, gtk_widget_get_parent (web_view)); +} + static void midori_view_init (MidoriView* view) { @@ -982,7 +990,6 @@ static void midori_view_finalize (GObject* object) { MidoriView* view; - /* WebKitWebFrame* web_frame; */ view = MIDORI_VIEW (object); @@ -1003,11 +1010,6 @@ midori_view_finalize (GObject* object) katze_object_assign (view->net, NULL); - /* web_frame = webkit_web_view_get_main_frame - (WEBKIT_WEB_VIEW (view->web_view)); - g_signal_handlers_disconnect_by_func (web_frame, - webkit_web_frame_load_done, view); */ - G_OBJECT_CLASS (midori_view_parent_class)->finalize (object); } @@ -1045,7 +1047,7 @@ midori_view_set_property (GObject* object, katze_assign (view->statusbar_text, g_value_dup_string (value)); break; case PROP_SETTINGS: - midori_view_set_settings (view, g_value_get_object (value)); + midori_view_set_settings (view, g_value_dup_object (value)); break; case PROP_NET: katze_object_assign (view->net, g_value_dup_object (value)); @@ -1261,6 +1263,8 @@ midori_view_construct_web_view (MidoriView* view) webkit_web_view_console_message_cb, view, "signal::window-object-cleared", webkit_web_view_window_object_cleared_cb, view, + "signal::destroy", + webkit_web_view_destroy_cb, web_frame, NULL); g_object_connect (web_frame, "signal::load-done", diff --git a/po/wscript_build b/po/wscript_build index fe03f6c6..28cda9f1 100644 --- a/po/wscript_build +++ b/po/wscript_build @@ -6,15 +6,17 @@ import Params import pproc as subprocess import os +APPNAME = 'midori' + if bld.env ()['INTLTOOL_UPDATE']: os.chdir ('./po') try: try: - size_old = os.stat ('midori.pot').st_size + size_old = os.stat (APPNAME + '.pot').st_size except: size_old = 0 subprocess.call (['intltool-update', '--pot']) - size_new = os.stat ('midori.pot').st_size + size_new = os.stat (APPNAME + '.pot').st_size if size_new <> size_old: Params.pprint ('YELLOW', "Updated po template.") try: @@ -29,4 +31,4 @@ if bld.env ()['INTLTOOL_UPDATE']: os.chdir ('..') obj = bld.create_obj ('intltool_po') -obj.appname = 'midori' +obj.appname = APPNAME