Commit b4558a88 authored by Rafaël Carré's avatar Rafaël Carré

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

Fix a deadlock when closing the error dialog
Remove unused functions
parent e32ac62f
......@@ -503,17 +503,30 @@ sip_call_state_cb (DBusGProxy *proxy UNUSED, const gchar* callID,
static void
error_alert (DBusGProxy *proxy UNUSED, int err, void * foo UNUSED)
{
const gchar *msg;
switch (err) {
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;
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;
case PULSEAUDIO_NOT_RUNNING:
main_window_error_message(_("Pulseaudio notification\n\nPulseaudio is not running"));
msg = _("Pulseaudio notification\n\nPulseaudio is not running");
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
......
......@@ -92,15 +92,18 @@ main (int argc, char *argv[])
if (!sflphone_init (&error)) {
ERROR (error->message);
gchar *markup = g_markup_printf_escaped (
_ ("Unable to initialize.\nMake sure the daemon is running.\nError: %s"),
error->message);
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,
"Unable to initialize.\nMake sure the daemon is running.\nError: %s",
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);
goto OUT;
}
......
......@@ -344,39 +344,6 @@ get_main_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
main_window_dialpad (gboolean state)
{
......
......@@ -74,24 +74,6 @@ void main_window_dialpad (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
* @param left_hand_message The message to display on the left side
......
Markdown is supported
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