From 4e1deaee05758226dc5e49cfeaf30f53689629b3 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 30 Dec 2008 03:00:08 +0100 Subject: [PATCH] Optimizations in main and MidoriApp --- midori/main.c | 17 ++++++++--------- midori/midori-app.c | 11 +++++------ panels/midori-extensions.c | 10 ++++++---- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/midori/main.c b/midori/main.c index 3a01d7a7..d04f76ce 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1208,7 +1208,7 @@ parse_cookie (gchar* line, SoupCookie *cookie = NULL; gboolean http_only; time_t max_age; - gchar* host, *is_domain, *path, *secure, *expires, *name, *value; + gchar* host/*, *is_domain*/, *path, *secure, *expires, *name, *value; if (g_str_has_prefix (line, "#HttpOnly_")) { @@ -1231,7 +1231,7 @@ parse_cookie (gchar* line, goto out; host = result[0]; - is_domain = result[1]; + /* is_domain = result[1]; */ path = result[2]; secure = result[3]; @@ -1689,7 +1689,6 @@ midori_load_extensions (gpointer data) MidoriApp* app = MIDORI_APP (data); KatzeArray* extensions; gchar* extension_path; - GDir* extension_dir; const gchar* filename; MidoriExtension* extension; guint n, i; @@ -1698,11 +1697,9 @@ midori_load_extensions (gpointer data) extensions = katze_array_new (MIDORI_TYPE_EXTENSION); extension_path = g_build_filename (LIBDIR, PACKAGE_NAME, NULL); if (g_module_supported ()) - extension_dir = g_dir_open (extension_path, 0, NULL); - else - extension_dir = NULL; - if (extension_dir) { + GDir* extension_dir = g_dir_open (extension_path, 0, NULL); + while ((filename = g_dir_read_name (extension_dir))) { gchar* fullname; @@ -1715,14 +1712,16 @@ midori_load_extensions (gpointer data) g_free (fullname); if (module && g_module_symbol (module, "extension_init", - (gpointer) &extension_init)) + (gpointer) &extension_init)) extension = extension_init (); else + { extension = g_object_new (MIDORI_TYPE_EXTENSION, "name", filename, "description", g_module_error (), NULL); - g_warning ("%s", g_module_error ()); + g_warning ("%s", g_module_error ()); + } katze_array_add_item (extensions, extension); g_object_unref (extension); } diff --git a/midori/midori-app.c b/midori/midori-app.c index fe091136..11a9f895 100644 --- a/midori/midori-app.c +++ b/midori/midori-app.c @@ -160,8 +160,7 @@ _midori_app_add_browser (MidoriApp* app, app->browsers = g_list_prepend (app->browsers, browser); #if HAVE_UNIQUE - if (app->instance) - unique_app_watch_window (app->instance, GTK_WINDOW (browser)); + unique_app_watch_window (app->instance, GTK_WINDOW (browser)); #endif } @@ -369,7 +368,7 @@ midori_app_init (MidoriApp* app) app->accel_group = gtk_accel_group_new (); - app->settings = midori_web_settings_new (); + app->settings = NULL; app->bookmarks = NULL; app->trash = NULL; app->search_engines = NULL; @@ -552,7 +551,7 @@ midori_app_instance_send_activate (MidoriApp* app) UniqueResponse response; #endif - g_return_val_if_fail (MIDORI_IS_APP (app), FALSE); + /* g_return_val_if_fail (MIDORI_IS_APP (app), FALSE); */ g_return_val_if_fail (midori_app_instance_is_running (app), FALSE); #if HAVE_UNIQUE @@ -579,7 +578,7 @@ midori_app_instance_send_new_browser (MidoriApp* app) UniqueResponse response; #endif - g_return_val_if_fail (MIDORI_IS_APP (app), FALSE); + /* g_return_val_if_fail (MIDORI_IS_APP (app), FALSE); */ g_return_val_if_fail (midori_app_instance_is_running (app), FALSE); #if HAVE_UNIQUE @@ -611,7 +610,7 @@ midori_app_instance_send_uris (MidoriApp* app, UniqueResponse response; #endif - g_return_val_if_fail (MIDORI_IS_APP (app), FALSE); + /* g_return_val_if_fail (MIDORI_IS_APP (app), FALSE); */ g_return_val_if_fail (midori_app_instance_is_running (app), FALSE); g_return_val_if_fail (uris != NULL, FALSE); diff --git a/panels/midori-extensions.c b/panels/midori-extensions.c index b7887850..c615c0d7 100644 --- a/panels/midori-extensions.c +++ b/panels/midori-extensions.c @@ -177,10 +177,11 @@ midori_extensions_add_item_cb (KatzeArray* array, MidoriExtensions* extensions) { GtkTreeIter iter; - GtkListStore* liststore = GTK_LIST_STORE (gtk_tree_view_get_model ( - GTK_TREE_VIEW (extensions->treeview))); - gtk_list_store_append (liststore, &iter); - gtk_list_store_set (liststore, &iter, 0, extension, -1); + GtkTreeModel* model; + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (extensions->treeview)); + gtk_list_store_append (GTK_LIST_STORE (model), &iter); + gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, extension, -1); } static void @@ -198,6 +199,7 @@ midori_extensions_set_property (GObject* object, KatzeArray* array; guint i, n; + /* FIXME: Handle NULL and subsequent assignments */ extensions->app = g_value_get_object (value); array = katze_object_get_object (extensions->app, "extensions"); g_signal_connect (array, "add-item", -- 2.39.5