Skip to content
Snippets Groups Projects
Commit b4558a88 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

gnome GUI: don't block in DBus signal errorAlert()

Fix a deadlock when closing the error dialog
Remove unused functions
parent e32ac62f
Branches
No related tags found
No related merge requests found
...@@ -503,17 +503,30 @@ sip_call_state_cb (DBusGProxy *proxy UNUSED, const gchar* callID, ...@@ -503,17 +503,30 @@ sip_call_state_cb (DBusGProxy *proxy UNUSED, const gchar* callID,
static void static void
error_alert (DBusGProxy *proxy UNUSED, int err, void * foo UNUSED) error_alert (DBusGProxy *proxy UNUSED, int err, void * foo UNUSED)
{ {
const gchar *msg;
switch (err) { switch (err) {
case ALSA_PLAYBACK_DEVICE: case ALSA_PLAYBACK_DEVICE:
main_window_error_message(_("ALSA notification\n\nError while opening playback device")); msg = _("ALSA notification\n\nError while opening playback device");
break; break;
case ALSA_CAPTURE_DEVICE: case ALSA_CAPTURE_DEVICE:
main_window_error_message(_("ALSA notification\n\nError while opening capture device")); msg = _("ALSA notification\n\nError while opening capture device");
break; break;
case PULSEAUDIO_NOT_RUNNING: case PULSEAUDIO_NOT_RUNNING:
main_window_error_message(_("Pulseaudio notification\n\nPulseaudio is not running")); msg = _("Pulseaudio notification\n\nPulseaudio is not running");
break; break;
default:
return;
} }
GtkWidget * dialog = gtk_message_dialog_new(
GTK_WINDOW (get_main_window()),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, "%s", msg);
gtk_window_set_title (GTK_WINDOW (dialog), _ ("SFLphone Error"));
g_signal_connect(dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show(dialog);
} }
gboolean gboolean
......
...@@ -92,15 +92,18 @@ main (int argc, char *argv[]) ...@@ -92,15 +92,18 @@ main (int argc, char *argv[])
if (!sflphone_init (&error)) { if (!sflphone_init (&error)) {
ERROR (error->message); ERROR (error->message);
gchar *markup = g_markup_printf_escaped ( GtkWidget *dialog = gtk_message_dialog_new(
_ ("Unable to initialize.\nMake sure the daemon is running.\nError: %s"), GTK_WINDOW (get_main_window()),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
"Unable to initialize.\nMake sure the daemon is running.\nError: %s",
error->message); error->message);
main_window_error_message (markup); gtk_window_set_title (GTK_WINDOW (dialog), _ ("SFLphone Error"));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (markup);
g_error_free (error); g_error_free (error);
goto OUT; goto OUT;
} }
......
...@@ -344,39 +344,6 @@ get_main_window () ...@@ -344,39 +344,6 @@ get_main_window ()
return window; return window;
} }
void
main_window_message (GtkMessageType type, const gchar * const markup)
{
GtkWidget * dialog = gtk_message_dialog_new(
GTK_WINDOW (get_main_window()), GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT, type, GTK_BUTTONS_CLOSE, NULL);
gtk_window_set_title (GTK_WINDOW (dialog), _ ("SFLphone Error"));
gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), markup);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
void
main_window_error_message (const gchar * const markup)
{
main_window_message (GTK_MESSAGE_ERROR, markup);
}
void
main_window_warning_message (const gchar * const markup)
{
main_window_message (GTK_MESSAGE_WARNING, markup);
}
void
main_window_info_message (const gchar * const markup)
{
main_window_message (GTK_MESSAGE_INFO, markup);
}
void void
main_window_dialpad (gboolean state) main_window_dialpad (gboolean state)
{ {
......
...@@ -74,24 +74,6 @@ void main_window_dialpad (gboolean state); ...@@ -74,24 +74,6 @@ void main_window_dialpad (gboolean state);
*/ */
void main_window_volume_controls (gboolean state); void main_window_volume_controls (gboolean state);
/**
* Display an error message
* @param markup The error message
*/
void main_window_error_message (const gchar * const markup);
/**
* Display a warning message
* @param markup The warning message
*/
void main_window_warning_message (const gchar * const markup);
/**
* Display an info message
* @param markup The info message
*/
void main_window_info_message (const gchar * const markup);
/** /**
* Push a message on the statusbar stack * Push a message on the statusbar stack
* @param left_hand_message The message to display on the left side * @param left_hand_message The message to display on the left side
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment