Don't connect to a monitor that wasn't created in the first place

This commit is contained in:
Adrian Bunk 2009-09-15 21:04:29 +02:00 committed by Christian Dywan
parent 8ed02c1f88
commit e5812d0478

View file

@ -917,14 +917,15 @@ midori_addons_new (MidoriAddonKind kind,
monitor = g_file_monitor_directory (directory,
G_FILE_MONITOR_NONE,
NULL, &error);
if (!monitor)
if (monitor)
g_signal_connect (monitor, "changed",
G_CALLBACK (midori_addons_directory_monitor_changed), addons);
else
{
g_warning ("could not monitor %s: %s", g_file_get_parse_name (directory),
error->message);
g_warning (_("Can't monitor folder '%s': %s"),
g_file_get_parse_name (directory), error->message);
g_error_free (error);
}
g_signal_connect (monitor, "changed",
G_CALLBACK (midori_addons_directory_monitor_changed), addons);
g_object_unref (directory);
}
g_slist_free (list);