From 63d51b566ea270b45b5b34b1feab37b8faa28232 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 9 May 2004 23:20:43 +0000 Subject: main fieryfilter work git-svn-id: file:///home/lennart/svn/public/fieryfilter/fieryfilter@31 79e6afc9-17da-0310-ae3c-b873bff394f4 --- client/mainwin.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 client/mainwin.c (limited to 'client/mainwin.c') diff --git a/client/mainwin.c b/client/mainwin.c new file mode 100644 index 0000000..e8189ef --- /dev/null +++ b/client/mainwin.c @@ -0,0 +1,52 @@ +#include +#include + +#include "mainwin.h" +#include "interface.h" +#include "support.h" +#include "connection.h" +#include "log.h" +#include "ruleset.h" +#include "format.h" +#include "advancedwin.h" + +GtkWidget* get_main_window(void) { + static GtkWidget *mw = NULL; + + if (!mw) { + GdkColor color; + mw = create_main_window(); + gdk_color_parse ("black", &color); + gtk_widget_modify_bg(lookup_widget(mw, "title_eventbox"), GTK_STATE_NORMAL, &color); + log_widget_init(); + ruleset_widget_init(); + + gtk_label_set_label(GTK_LABEL(lookup_widget(mw, "version_label")), "Version "VERSION""); + } + + return mw; +} + +void mainwin_show() { + gtk_widget_show_all(get_main_window()); +} + +void mainwin_update_status_bar() { + GtkStatusbar *s; + static guint ctx = (guint) -1; + static gchar txt[256]; + + s = GTK_STATUSBAR(lookup_widget(get_main_window(), "statusbar")); + + if (ctx == (guint) -1) + ctx = gtk_statusbar_get_context_id(s, "Recieved packets"); + else + gtk_statusbar_pop(s, ctx); + + if (queued_conn_count || conn_current) + snprintf(txt, sizeof(txt), "Recieved %u packets, %u oustanding", total_conn_count, queued_conn_count + (conn_current ? 1 : 0)); + else + snprintf(txt, sizeof(txt), "Recieved %u packets", total_conn_count); + + gtk_statusbar_push(s, ctx, txt); +} -- cgit