diff --git a/tumbler/tumbler-error.h b/tumbler/tumbler-error.h index 63e8424..3a6d3fe 100644 --- a/tumbler/tumbler-error.h +++ b/tumbler/tumbler-error.h @@ -48,6 +48,7 @@ typedef enum /*< enum >*/ TUMBLER_ERROR_UNSUPPORTED_FLAVOR, TUMBLER_ERROR_NO_CONTENT, TUMBLER_ERROR_SHUTTING_DOWN, + TUMBLER_ERROR_ALREADY_RUNNING } TumblerErrorEnum; G_END_DECLS diff --git a/tumblerd/main.c b/tumblerd/main.c index f2de4f0..cef384e 100644 --- a/tumblerd/main.c +++ b/tumblerd/main.c @@ -105,6 +105,11 @@ main (int argc, /* try to start the service and exit if that fails */ if (!tumbler_cache_service_start (cache_service, &error)) { + gboolean is_failure = TRUE; + + if (error->domain == TUMBLER_ERROR && error->code == TUMBLER_ERROR_ALREADY_RUNNING) + is_failure = FALSE; + g_warning (_("Failed to start the thumbnail cache service: %s"), error->message); g_error_free (error); @@ -112,7 +117,7 @@ main (int argc, dbus_g_connection_unref (connection); - return EXIT_FAILURE; + return is_failure; } /* create the thumbnailer registry */ @@ -173,6 +178,11 @@ main (int argc, /* try to start the service and exit if that fails */ if (!tumbler_manager_start (manager, &error)) { + gboolean is_failure = TRUE; + + if (error->domain == TUMBLER_ERROR && error->code == TUMBLER_ERROR_ALREADY_RUNNING) + is_failure = FALSE; + g_warning (_("Failed to start the thumbnailer manager: %s"), error->message); g_error_free (error); @@ -182,7 +192,7 @@ main (int argc, dbus_g_connection_unref (connection); - return EXIT_FAILURE; + return is_failure; } /* create the generic thumbnailer service */ @@ -191,6 +201,11 @@ main (int argc, /* try to start the service and exit if that fails */ if (!tumbler_service_start (service, &error)) { + gboolean is_failure = TRUE; + + if (error->domain == TUMBLER_ERROR && error->code == TUMBLER_ERROR_ALREADY_RUNNING) + is_failure = FALSE; + g_warning (_("Failed to start the thumbnailer service: %s"), error->message); g_error_free (error); @@ -201,7 +216,7 @@ main (int argc, dbus_g_connection_unref (connection); - return EXIT_FAILURE; + return is_failure; } /* create a new main loop */ diff --git a/tumblerd/tumbler-cache-service.c b/tumblerd/tumbler-cache-service.c index f13177c..c74c437 100644 --- a/tumblerd/tumbler-cache-service.c +++ b/tumblerd/tumbler-cache-service.c @@ -412,7 +412,7 @@ tumbler_cache_service_start (TumblerCacheService *service, } else if (error != NULL) { - g_set_error (error, DBUS_GERROR, DBUS_GERROR_FAILED, + g_set_error (error, TUMBLER_ERROR, TUMBLER_ERROR_ALREADY_RUNNING, _("Another thumbnail cache service is already running")); } diff --git a/tumblerd/tumbler-manager.c b/tumblerd/tumbler-manager.c index 73e6778..ecccc8e 100644 --- a/tumblerd/tumbler-manager.c +++ b/tumblerd/tumbler-manager.c @@ -1850,7 +1850,7 @@ tumbler_manager_start (TumblerManager *manager, } else if (error != NULL) { - g_set_error (error, DBUS_GERROR, DBUS_GERROR_FAILED, + g_set_error (error, TUMBLER_ERROR, TUMBLER_ERROR_ALREADY_RUNNING, _("Another thumbnailer manager is already running")); } diff --git a/tumblerd/tumbler-service.c b/tumblerd/tumbler-service.c index 92ab7ac..11791d0 100644 --- a/tumblerd/tumbler-service.c +++ b/tumblerd/tumbler-service.c @@ -756,7 +756,7 @@ tumbler_service_start (TumblerService *service, } else if (error != NULL) { - g_set_error (error, DBUS_GERROR, DBUS_GERROR_FAILED, + g_set_error (error, TUMBLER_ERROR, TUMBLER_ERROR_ALREADY_RUNNING, _("Another generic thumbnailer is already running")); }