Commit 41bc8fdd authored by winckel's avatar winckel
Browse files

Updated dialog box to add a title.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4338 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent aacd18e7
......@@ -303,7 +303,7 @@ int ui_filters_read(const char *file_name)
if (doc == NULL)
{
g_warning("Failed to parse \"%s\"", file_name);
ui_notification_dialog (DIALOG_WARNING, "Failed to parse file \"%s\"", file_name);
ui_notification_dialog (GTK_MESSAGE_ERROR, "open filters", "Failed to parse file \"%s\"", file_name);
return RC_FAIL;
}
......@@ -312,7 +312,7 @@ int ui_filters_read(const char *file_name)
if (ret != RC_OK)
{
g_warning("Found no filter definition in \"%s\"", file_name);
ui_notification_dialog (DIALOG_WARNING, "Found no filter definition in \"%s\"", file_name);
ui_notification_dialog (GTK_MESSAGE_ERROR, "open filters", "Found no filter definitions in \"%s\"", file_name);
return RC_FAIL;
}
......
......@@ -3,7 +3,10 @@
#include "ui_notif_dlg.h"
#include "ui_main_screen.h"
int ui_notification_dialog(dialog_type_t type, const char *fmt, ...)
static const char * const title_type[] =
{"Info", "Warning", "Question", "Error", "Other"};
int ui_notification_dialog(GtkMessageType type, const char *title, const char *fmt, ...)
{
va_list args;
GtkWidget *dialogbox;
......@@ -11,13 +14,15 @@ int ui_notification_dialog(dialog_type_t type, const char *fmt, ...)
va_start(args, fmt);
vsnprintf(buffer, sizeof(buffer), fmt, args);
vsnprintf (buffer, sizeof(buffer), fmt, args);
dialogbox = gtk_message_dialog_new (GTK_WINDOW(ui_main_data.window), GTK_DIALOG_MODAL, type, GTK_BUTTONS_OK, "%s",
buffer);
dialogbox = gtk_message_dialog_new(GTK_WINDOW(ui_main_data.window),
GTK_DIALOG_MODAL, type,
GTK_BUTTONS_OK, "%s", buffer);
snprintf (buffer, sizeof(buffer), "%s: %s", title_type[type], title);
gtk_window_set_title (GTK_WINDOW(dialogbox), buffer);
gtk_dialog_run(GTK_DIALOG (dialogbox));
gtk_dialog_run (GTK_DIALOG (dialogbox));
gtk_widget_destroy (dialogbox);
......
......@@ -3,15 +3,6 @@
#ifndef UI_NOTIF_DLG_H_
#define UI_NOTIF_DLG_H_
typedef enum dialog_type_e {
DIALOG_INFO,
DIALOG_WARNING,
DIALOG_QUESTION,
DIALOG_ERROR,
DIALOG_OTHER,
DIALOG_MAX
} dialog_type_t;
extern int ui_notification_dialog(dialog_type_t type, const char *fmt, ...);
extern int ui_notification_dialog(GtkMessageType type, const char *title, const char *fmt, ...);
#endif /* UI_NOTIF_DLG_H_ */
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