Commit a73d1b55 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #11818: gnome: stop daemon on SIGTERM, SIGINT or SIGHUP

parent 9eca1247
......@@ -121,10 +121,12 @@ namespace {
}
}
void signal_handler(int code)
{
std::cerr << "Caught signal " << strsignal(code) << ", terminating..." << std::endl;
Manager::instance().finish();
namespace {
void signal_handler(int code)
{
std::cerr << "Caught signal " << strsignal(code) << ", terminating..." << std::endl;
Manager::instance().finish();
}
}
int main(int argc, char *argv [])
......
......@@ -143,9 +143,9 @@ status_bar_display_account()
void
sflphone_quit()
sflphone_quit(gboolean force_quit)
{
if (calllist_get_size(current_calls_tab) == 0 || main_window_ask_quit()) {
if (force_quit || calllist_get_size(current_calls_tab) == 0 || main_window_ask_quit()) {
dbus_unregister(getpid());
dbus_clean();
account_list_free();
......
......@@ -57,7 +57,7 @@ gboolean sflphone_init(GError **error);
/**
* Steps when closing the application. Will ask for confirmation if a call is in progress.
*/
void sflphone_quit();
void sflphone_quit(gboolean force_quit);
/**
* Hang up / refuse the current call
......
......@@ -43,9 +43,20 @@
#include "shortcuts.h"
#include "history.h"
static void
signal_handler(int code)
{
printf("Caught signal %s, terminating...\n", strsignal(code));
sflphone_quit(TRUE);
}
int
main(int argc, char *argv[])
{
signal(SIGINT, signal_handler);
signal(SIGHUP, signal_handler);
signal(SIGTERM, signal_handler);
GError *error = NULL;
// Handle logging
int i;
......
......@@ -116,7 +116,7 @@ on_delete(GtkWidget * widget UNUSED, gpointer data UNUSED)
gtk_widget_hide(get_main_window());
set_minimized(TRUE);
} else
sflphone_quit();
sflphone_quit(FALSE);
return TRUE;
}
......
......@@ -76,7 +76,7 @@ hide_status_hangup_icon()
void
status_quit(void * foo UNUSED)
{
sflphone_quit();
sflphone_quit(FALSE);
}
void
......
......@@ -623,7 +623,7 @@ call_new_call(void * foo UNUSED)
static void
call_quit(void * foo UNUSED)
{
sflphone_quit();
sflphone_quit(FALSE);
}
static void
......@@ -633,7 +633,7 @@ call_minimize(void * foo UNUSED)
gtk_widget_hide(get_main_window());
set_minimized(TRUE);
} else
sflphone_quit();
sflphone_quit(FALSE);
}
static void
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment