diff --git a/gnome/src/dbus/dbus.c b/gnome/src/dbus/dbus.c index 5a0c8ac0593dbd0bcbe5b6c15d22f5fea6c3a9ec..4a73e51e33501e211ca23acd867dbb3c2393c179 100644 --- a/gnome/src/dbus/dbus.c +++ b/gnome/src/dbus/dbus.c @@ -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 diff --git a/gnome/src/main.c b/gnome/src/main.c index 0334a0496fa4d3ee95dcfbdf07285aec596f316c..8f5e5570e489bce307fb81d880776ad0e0e3fc44 100644 --- a/gnome/src/main.c +++ b/gnome/src/main.c @@ -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; } diff --git a/gnome/src/mainwindow.c b/gnome/src/mainwindow.c index 18f917172a01d124b41fc1977f151db8a0adb8fc..f3e3aaac850e9b06b36b1d02ed24ce896ed290c4 100644 --- a/gnome/src/mainwindow.c +++ b/gnome/src/mainwindow.c @@ -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) { diff --git a/gnome/src/mainwindow.h b/gnome/src/mainwindow.h index a9c3018826a5e2a26e77e651aab0f8f3b211f9f0..6193a94545facd49d7c0988aa2f9b1685f670b42 100644 --- a/gnome/src/mainwindow.h +++ b/gnome/src/mainwindow.h @@ -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