diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2013-02-25 23:38:01 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-02-25 13:56:22 -0800 |
commit | aa5f1f0ce24307d6f1a8f0cf125766cb5ae00b68 (patch) | |
tree | 4a31d8fa35f1fdf8f095a9b6c518e2922b5dcfc9 /gtk-gui.c | |
parent | 31b2a6ffa839ad107706516e166f13b0b88bae08 (diff) | |
download | subsurface-aa5f1f0ce24307d6f1a8f0cf125766cb5ae00b68.tar.gz |
Show a "No Events" label when there are no events in the filter dialog
Uses profile.c:evn_foreach() to retrieve the number of events, which
if zero, no table is added in the dialog and the label is added instead.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r-- | gtk-gui.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -952,7 +952,7 @@ static void create_toggle(const char* label, int *on, void *_data) static void selectevents_dialog(GtkWidget *w, gpointer data) { int result; - GtkWidget *dialog, *frame, *vbox, *table; + GtkWidget *dialog, *frame, *vbox, *table, *label; dialog = gtk_dialog_new_with_buttons(_("Select Events"), GTK_WINDOW(main_window), @@ -968,9 +968,13 @@ static void selectevents_dialog(GtkWidget *w, gpointer data) gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5); table = gtk_table_new(1, 4, TRUE); - gtk_container_add(GTK_CONTAINER(frame), table); - - evn_foreach(&create_toggle, table); + if (!evn_foreach(&create_toggle, table)) { + g_object_ref_sink(G_OBJECT(table)); + label = gtk_label_new(_("\nNo Events\n")); + gtk_container_add(GTK_CONTAINER(frame), label); + } else { + gtk_container_add(GTK_CONTAINER(frame), table); + } gtk_widget_show_all(dialog); result = gtk_dialog_run(GTK_DIALOG(dialog)); |