]> spindle.queued.net Git - midori/commitdiff
Apply some cleanup with regard to referencing and more
authorChristian Dywan <christian@twotoasts.de>
Thu, 30 Oct 2008 01:21:19 +0000 (02:21 +0100)
committerChristian Dywan <christian@twotoasts.de>
Thu, 30 Oct 2008 01:21:19 +0000 (02:21 +0100)
midori/midori-app.c
midori/midori-panel.c
midori/midori-preferences.c
midori/midori-view.c
po/wscript_build

index 2ce8d6569afd88624fb2c92745c0af8a89dea41e..9264ae074bcad85d5a14ae4f0de818652a477885 100644 (file)
@@ -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:
index 9f62f86b83a45ca6a8504734deeae9b5d8a8fa6a..c4fd41be983a432fc29e0dc11ba7f64a253d372d 100644 (file)
@@ -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:
index cf34039e9d97b0b3d7802c6741932213c84f5d14..6127bc7a4bf460e33555ec287662f251761014fe 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "sokoke.h"
 
+#include <string.h>
 #include <glib/gi18n.h>
 
 struct _MidoriPreferences
index 2fa728224f92aa7927ec48692e6d0a7cd20d0e92..c073fce2f66731e52189f22692d45c052cc519b6 100644 (file)
@@ -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",
index fe03f6c6f3b10b04c5d132141c40063f709871ad..28cda9f11ddd2c361132c97150e2ea2e935110fe 100644 (file)
@@ -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