Optimizations in main and MidoriApp

This commit is contained in:
Christian Dywan 2008-12-30 03:00:08 +01:00
parent e30b30d37d
commit 4e1deaee05
3 changed files with 19 additions and 19 deletions

View file

@ -1208,7 +1208,7 @@ parse_cookie (gchar* line,
SoupCookie *cookie = NULL; SoupCookie *cookie = NULL;
gboolean http_only; gboolean http_only;
time_t max_age; 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_")) if (g_str_has_prefix (line, "#HttpOnly_"))
{ {
@ -1231,7 +1231,7 @@ parse_cookie (gchar* line,
goto out; goto out;
host = result[0]; host = result[0];
is_domain = result[1]; /* is_domain = result[1]; */
path = result[2]; path = result[2];
secure = result[3]; secure = result[3];
@ -1689,7 +1689,6 @@ midori_load_extensions (gpointer data)
MidoriApp* app = MIDORI_APP (data); MidoriApp* app = MIDORI_APP (data);
KatzeArray* extensions; KatzeArray* extensions;
gchar* extension_path; gchar* extension_path;
GDir* extension_dir;
const gchar* filename; const gchar* filename;
MidoriExtension* extension; MidoriExtension* extension;
guint n, i; guint n, i;
@ -1698,11 +1697,9 @@ midori_load_extensions (gpointer data)
extensions = katze_array_new (MIDORI_TYPE_EXTENSION); extensions = katze_array_new (MIDORI_TYPE_EXTENSION);
extension_path = g_build_filename (LIBDIR, PACKAGE_NAME, NULL); extension_path = g_build_filename (LIBDIR, PACKAGE_NAME, NULL);
if (g_module_supported ()) 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))) while ((filename = g_dir_read_name (extension_dir)))
{ {
gchar* fullname; gchar* fullname;
@ -1715,14 +1712,16 @@ midori_load_extensions (gpointer data)
g_free (fullname); g_free (fullname);
if (module && g_module_symbol (module, "extension_init", if (module && g_module_symbol (module, "extension_init",
(gpointer) &extension_init)) (gpointer) &extension_init))
extension = extension_init (); extension = extension_init ();
else else
{
extension = g_object_new (MIDORI_TYPE_EXTENSION, extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", filename, "name", filename,
"description", g_module_error (), "description", g_module_error (),
NULL); NULL);
g_warning ("%s", g_module_error ()); g_warning ("%s", g_module_error ());
}
katze_array_add_item (extensions, extension); katze_array_add_item (extensions, extension);
g_object_unref (extension); g_object_unref (extension);
} }

View file

@ -160,8 +160,7 @@ _midori_app_add_browser (MidoriApp* app,
app->browsers = g_list_prepend (app->browsers, browser); app->browsers = g_list_prepend (app->browsers, browser);
#if HAVE_UNIQUE #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 #endif
} }
@ -369,7 +368,7 @@ midori_app_init (MidoriApp* app)
app->accel_group = gtk_accel_group_new (); app->accel_group = gtk_accel_group_new ();
app->settings = midori_web_settings_new (); app->settings = NULL;
app->bookmarks = NULL; app->bookmarks = NULL;
app->trash = NULL; app->trash = NULL;
app->search_engines = NULL; app->search_engines = NULL;
@ -552,7 +551,7 @@ midori_app_instance_send_activate (MidoriApp* app)
UniqueResponse response; UniqueResponse response;
#endif #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 (midori_app_instance_is_running (app), FALSE);
#if HAVE_UNIQUE #if HAVE_UNIQUE
@ -579,7 +578,7 @@ midori_app_instance_send_new_browser (MidoriApp* app)
UniqueResponse response; UniqueResponse response;
#endif #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 (midori_app_instance_is_running (app), FALSE);
#if HAVE_UNIQUE #if HAVE_UNIQUE
@ -611,7 +610,7 @@ midori_app_instance_send_uris (MidoriApp* app,
UniqueResponse response; UniqueResponse response;
#endif #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 (midori_app_instance_is_running (app), FALSE);
g_return_val_if_fail (uris != NULL, FALSE); g_return_val_if_fail (uris != NULL, FALSE);

View file

@ -177,10 +177,11 @@ midori_extensions_add_item_cb (KatzeArray* array,
MidoriExtensions* extensions) MidoriExtensions* extensions)
{ {
GtkTreeIter iter; GtkTreeIter iter;
GtkListStore* liststore = GTK_LIST_STORE (gtk_tree_view_get_model ( GtkTreeModel* model;
GTK_TREE_VIEW (extensions->treeview)));
gtk_list_store_append (liststore, &iter); model = gtk_tree_view_get_model (GTK_TREE_VIEW (extensions->treeview));
gtk_list_store_set (liststore, &iter, 0, extension, -1); gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, extension, -1);
} }
static void static void
@ -198,6 +199,7 @@ midori_extensions_set_property (GObject* object,
KatzeArray* array; KatzeArray* array;
guint i, n; guint i, n;
/* FIXME: Handle NULL and subsequent assignments */
extensions->app = g_value_get_object (value); extensions->app = g_value_get_object (value);
array = katze_object_get_object (extensions->app, "extensions"); array = katze_object_get_object (extensions->app, "extensions");
g_signal_connect (array, "add-item", g_signal_connect (array, "add-item",