Skip to content
Snippets Groups Projects
Commit a73d1b55 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

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

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