added a splash screen while Ethereal is started
svn path=/trunk/; revision=11310
This commit is contained in:
parent
466eaf20f0
commit
176646edbf
|
@ -1,6 +1,6 @@
|
|||
/* about_dlg.c
|
||||
*
|
||||
* $Id: about_dlg.c,v 1.17 2004/06/23 01:38:39 guy Exp $
|
||||
* $Id: about_dlg.c,v 1.18 2004/07/04 12:15:40 ulfl Exp $
|
||||
*
|
||||
* Ulf Lamping <ulf.lamping@web.de>
|
||||
*
|
||||
|
@ -44,6 +44,7 @@
|
|||
#include "cvsversion.h"
|
||||
|
||||
#include "../image/eicon3d64.xpm"
|
||||
#include "gtkglobals.h"
|
||||
|
||||
extern GString *comp_info_str, *runtime_info_str;
|
||||
|
||||
|
@ -63,17 +64,15 @@ static void about_ethereal_destroy_cb(GtkWidget *, gpointer);
|
|||
static GtkWidget *about_ethereal_w;
|
||||
|
||||
|
||||
static GtkWidget *
|
||||
about_ethereal_page_new(void)
|
||||
static
|
||||
about_ethereal(GtkWidget *parent, GtkWidget *main_vb, const char *title)
|
||||
{
|
||||
GtkWidget *main_vb, *msg_label, *icon;
|
||||
GtkWidget *msg_label, *icon;
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
gchar *message;
|
||||
const char title[] = "Ethereal - Network Protocol Analyzer";
|
||||
#endif
|
||||
|
||||
main_vb = gtk_vbox_new(FALSE, 6);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vb), 12);
|
||||
|
||||
icon = xpm_to_widget(eicon3d64_xpm);
|
||||
icon = xpm_to_widget_from_parent(parent, eicon3d64_xpm);
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), icon);
|
||||
|
||||
msg_label = gtk_label_new(title);
|
||||
|
@ -83,6 +82,75 @@ about_ethereal_page_new(void)
|
|||
g_free(message);
|
||||
#endif
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), msg_label);
|
||||
}
|
||||
|
||||
|
||||
|
||||
GtkWidget *splash_new(char *message)
|
||||
{
|
||||
GtkWidget *win;
|
||||
GtkWidget *main_lb;
|
||||
|
||||
GtkWidget *main_vb;
|
||||
|
||||
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(win), "Ethereal");
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
gtk_window_set_decorated(GTK_WINDOW(win), FALSE);
|
||||
#endif
|
||||
gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER);
|
||||
|
||||
main_vb = gtk_vbox_new(FALSE, 6);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vb), 12);
|
||||
gtk_container_add(GTK_CONTAINER(win), main_vb);
|
||||
|
||||
/* when calling about_ethereal(), we must have a visible window, */
|
||||
/* otherwise GTK will throw a warning */
|
||||
gtk_widget_show_all(win);
|
||||
about_ethereal(win, main_vb, "Ethereal - Network Protocol Analyzer");
|
||||
gtk_widget_hide(win);
|
||||
|
||||
main_lb = gtk_label_new(message);
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), main_lb);
|
||||
OBJECT_SET_DATA(win, "splash_label", main_lb);
|
||||
|
||||
gtk_widget_show_all(win);
|
||||
gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER);
|
||||
|
||||
splash_update(win, message);
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
void splash_update(GtkWidget *win, char *message)
|
||||
{
|
||||
GtkWidget *main_lb;
|
||||
|
||||
main_lb = OBJECT_GET_DATA(win, "splash_label");
|
||||
gtk_label_set_text(GTK_LABEL(main_lb), message);
|
||||
|
||||
/* process all pending GUI events before continue */
|
||||
while (gtk_events_pending()) gtk_main_iteration();
|
||||
}
|
||||
|
||||
guint splash_destroy(GtkWidget *win)
|
||||
{
|
||||
gtk_widget_destroy(win);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static GtkWidget *
|
||||
about_ethereal_page_new(void)
|
||||
{
|
||||
GtkWidget *main_vb, *msg_label /*, *icon*/;
|
||||
gchar *message;
|
||||
const char title[] = "Ethereal - Network Protocol Analyzer";
|
||||
|
||||
main_vb = gtk_vbox_new(FALSE, 6);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vb), 12);
|
||||
|
||||
about_ethereal(top_level, main_vb, title);
|
||||
|
||||
msg_label = gtk_label_new("Version " VERSION
|
||||
#ifdef CVSVERSION
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* about_dlg.h
|
||||
* Declarations of routines for the "About" dialog
|
||||
*
|
||||
* $Id: about_dlg.h,v 1.5 2004/06/22 16:28:27 ulfl Exp $
|
||||
* $Id: about_dlg.h,v 1.6 2004/07/04 12:15:41 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -30,6 +30,27 @@
|
|||
* @ingroup dialog_group
|
||||
*/
|
||||
|
||||
/** Create a splash screen showed when Ethereal is started.
|
||||
*
|
||||
* @param message the new message to be displayed
|
||||
* @return the newly created window handle
|
||||
*/
|
||||
extern GtkWidget *splash_new(char *message);
|
||||
|
||||
/** Update the splash screen message.
|
||||
*
|
||||
* @param win the window handle from splash_new()
|
||||
* @param message the new message to be displayed
|
||||
*/
|
||||
extern void splash_update(GtkWidget *win, char *message);
|
||||
|
||||
/** Destroy the splash screen.
|
||||
*
|
||||
* @param win the window handle from splash_new()
|
||||
* @return always FALSE, so this function can be used as a callback for gtk_timeout_add()
|
||||
*/
|
||||
extern guint splash_destroy(GtkWidget *win);
|
||||
|
||||
/** User requested the "About" dialog box by menu or toolbar.
|
||||
*
|
||||
* @param widget parent widget (unused)
|
||||
|
|
38
gtk/main.c
38
gtk/main.c
|
@ -1,6 +1,6 @@
|
|||
/* main.c
|
||||
*
|
||||
* $Id: main.c,v 1.451 2004/06/30 17:53:52 ulfl Exp $
|
||||
* $Id: main.c,v 1.452 2004/07/04 12:15:41 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -101,6 +101,7 @@
|
|||
#include "util.h"
|
||||
#include "version_info.h"
|
||||
#include "capture.h"
|
||||
#include "merge.h"
|
||||
#ifdef HAVE_LIBPCAP
|
||||
#include "pcap-util.h"
|
||||
#endif
|
||||
|
@ -131,7 +132,7 @@
|
|||
#include "recent.h"
|
||||
#include "follow_dlg.h"
|
||||
#include "font_utils.h"
|
||||
#include "merge.h"
|
||||
#include "about_dlg.h"
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1550,6 +1551,7 @@ main(int argc, char *argv[])
|
|||
char badopt;
|
||||
ethereal_tap_list *tli = NULL;
|
||||
gchar *tap_opt = NULL;
|
||||
GtkWidget *splash_win;
|
||||
|
||||
#define OPTSTRING_INIT "a:b:B:c:f:Hhi:klLm:nN:o:pP:Qr:R:Ss:t:T:w:vy:z:"
|
||||
|
||||
|
@ -1566,6 +1568,19 @@ main(int argc, char *argv[])
|
|||
char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_CHILD) - 1] =
|
||||
OPTSTRING_INIT;
|
||||
|
||||
|
||||
/* Set the current locale according to the program environment.
|
||||
* We haven't localized anything, but some GTK widgets are localized
|
||||
* (the file selection dialogue, for example).
|
||||
* This also sets the C-language locale to the native environment. */
|
||||
gtk_set_locale();
|
||||
|
||||
/* Let GTK get its args */
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
splash_win = splash_new("Loading Ethereal ...");
|
||||
|
||||
|
||||
ethereal_path = argv[0];
|
||||
|
||||
#ifdef WIN32
|
||||
|
@ -1595,6 +1610,8 @@ main(int argc, char *argv[])
|
|||
strcat(optstring, OPTSTRING_CHILD);
|
||||
#endif
|
||||
|
||||
splash_update(splash_win, "Register dissectors ...");
|
||||
|
||||
/* Register all dissectors; we must do this before checking for the
|
||||
"-G" flag, as the "-G" flag dumps information registered by the
|
||||
dissectors, and we must do it before we read the preferences, in
|
||||
|
@ -1602,10 +1619,14 @@ main(int argc, char *argv[])
|
|||
epan_init(PLUGIN_DIR,register_all_protocols,register_all_protocol_handoffs,
|
||||
failure_alert_box,open_failure_alert_box,read_failure_alert_box);
|
||||
|
||||
splash_update(splash_win, "Register tap listeners ...");
|
||||
|
||||
/* Register all tap listeners; we do this before we parse the arguments,
|
||||
as the "-z" argument can specify a registered tap. */
|
||||
register_all_tap_listeners();
|
||||
|
||||
splash_update(splash_win, "Register preferences ...");
|
||||
|
||||
/* Now register the preferences for any non-dissector modules.
|
||||
We must do that before we read the preferences as well. */
|
||||
prefs_register_modules();
|
||||
|
@ -1669,15 +1690,7 @@ main(int argc, char *argv[])
|
|||
gtk_timeout_add(750, (GtkFunction) host_name_lookup_process, NULL);
|
||||
#endif
|
||||
|
||||
|
||||
/* Set the current locale according to the program environment.
|
||||
* We haven't localized anything, but some GTK widgets are localized
|
||||
* (the file selection dialogue, for example).
|
||||
* This also sets the C-language locale to the native environment. */
|
||||
gtk_set_locale();
|
||||
|
||||
/* Let GTK get its args */
|
||||
gtk_init (&argc, &argv);
|
||||
splash_update(splash_win, "Loading configuration files ...");
|
||||
|
||||
/* Read the preference files. */
|
||||
prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
|
||||
|
@ -2342,6 +2355,9 @@ main(int argc, char *argv[])
|
|||
|
||||
font_init();
|
||||
|
||||
/* close the splash screen, as we are going to open the main window now */
|
||||
splash_destroy(splash_win);
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
/* Is this a "child" ethereal, which is only supposed to pop up a
|
||||
capture box to let us stop the capture, and run a capture
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* ui_util.c
|
||||
* UI utility routines
|
||||
*
|
||||
* $Id: ui_util.c,v 1.27 2004/05/30 11:54:37 ulfl Exp $
|
||||
* $Id: ui_util.c,v 1.28 2004/07/04 12:15:41 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -493,15 +493,15 @@ window_destroy(GtkWidget *win)
|
|||
}
|
||||
|
||||
|
||||
/* convert an xpm to a GtkWidget, using the top_level window settings */
|
||||
/* (be sure that the top_level window is already being displayed) */
|
||||
GtkWidget *xpm_to_widget(const char ** xpm) {
|
||||
/* convert an xpm to a GtkWidget, using the window settings from it's parent */
|
||||
/* (be sure that the parent window is already being displayed) */
|
||||
GtkWidget *xpm_to_widget_from_parent(GtkWidget *parent, const char ** xpm) {
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
GdkPixmap *icon;
|
||||
GdkBitmap * mask;
|
||||
|
||||
|
||||
icon = gdk_pixmap_create_from_xpm_d(top_level->window, &mask, &top_level->style->white, (char **) xpm);
|
||||
icon = gdk_pixmap_create_from_xpm_d(parent->window, &mask, &parent->style->white, (char **) xpm);
|
||||
return gtk_pixmap_new(icon, mask);
|
||||
#else
|
||||
GdkPixbuf * pixbuf;
|
||||
|
@ -510,13 +510,20 @@ GtkWidget *xpm_to_widget(const char ** xpm) {
|
|||
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_xpm_data(xpm);
|
||||
gdk_pixbuf_render_pixmap_and_mask_for_colormap (pixbuf, gtk_widget_get_colormap(top_level), &pixmap, &bitmap, 128);
|
||||
gdk_pixbuf_render_pixmap_and_mask_for_colormap (pixbuf, gtk_widget_get_colormap(parent), &pixmap, &bitmap, 128);
|
||||
|
||||
return gtk_image_new_from_pixmap (pixmap, bitmap);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* convert an xpm to a GtkWidget, using the top_level window settings */
|
||||
/* (be sure that the top_level window is already being displayed) */
|
||||
GtkWidget *xpm_to_widget(const char ** xpm) {
|
||||
return xpm_to_widget_from_parent(top_level, xpm);
|
||||
}
|
||||
|
||||
|
||||
/* Set the name of the top-level window and its icon to the specified
|
||||
string. */
|
||||
void
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* ui_util.h
|
||||
* Definitions for UI utility routines
|
||||
*
|
||||
* $Id: ui_util.h,v 1.14 2004/06/04 17:16:58 ulfl Exp $
|
||||
* $Id: ui_util.h,v 1.15 2004/07/04 12:15:41 ulfl Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -206,7 +206,7 @@ extern void window_geom_recent_read_pair(const char *name, const char *key, cons
|
|||
*
|
||||
* @param win the window from window_new() to be reactivated
|
||||
*/
|
||||
void reactivate_window(GtkWidget *win);
|
||||
extern void reactivate_window(GtkWidget *win);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -217,12 +217,12 @@ void reactivate_window(GtkWidget *win);
|
|||
* @param vadjustment vertical adjustment
|
||||
* @return the new scrolled window
|
||||
*/
|
||||
GtkWidget *scrolled_window_new(GtkAdjustment *hadjustment,
|
||||
extern GtkWidget *scrolled_window_new(GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
/** Set the scrollbar placement of all scrolled windows based on user
|
||||
preference. */
|
||||
void set_scrollbar_placement_all(void);
|
||||
extern void set_scrollbar_placement_all(void);
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
/** Create a GtkCTree, give it the right styles, and remember it.
|
||||
|
@ -231,7 +231,7 @@ void set_scrollbar_placement_all(void);
|
|||
* @param tree_column which column has the tree graphic
|
||||
* @return the newly created GtkCTree
|
||||
*/
|
||||
GtkWidget *ctree_new(gint columns, gint tree_column);
|
||||
extern GtkWidget *ctree_new(gint columns, gint tree_column);
|
||||
/** Create a GtkCTree, give it the right styles, and remember it.
|
||||
*
|
||||
* @param columns the number of columns
|
||||
|
@ -239,14 +239,14 @@ GtkWidget *ctree_new(gint columns, gint tree_column);
|
|||
* @param titles the titles of all columns
|
||||
* @return the newly created GtkCTree
|
||||
*/
|
||||
GtkWidget *ctree_new_with_titles(gint columns, gint tree_column,
|
||||
extern GtkWidget *ctree_new_with_titles(gint columns, gint tree_column,
|
||||
gchar *titles[]);
|
||||
#else
|
||||
/** Create a GtkTreeView, give it the right styles, and remember it.
|
||||
*
|
||||
* @param model the model (the data) of this tree view
|
||||
*/
|
||||
GtkWidget *tree_view_new(GtkTreeModel *model);
|
||||
extern GtkWidget *tree_view_new(GtkTreeModel *model);
|
||||
#endif
|
||||
|
||||
/** Create a simple list widget.
|
||||
|
@ -266,7 +266,7 @@ extern void simple_list_append(GtkWidget *list, ...);
|
|||
|
||||
|
||||
/** Set the styles of all Trees based upon user preferences. */
|
||||
void set_tree_styles_all(void);
|
||||
extern void set_tree_styles_all(void);
|
||||
|
||||
/** Convert an xpm picture into a GtkWidget showing it.
|
||||
* Beware: Ethereal's main window must already be visible!
|
||||
|
@ -274,6 +274,15 @@ void set_tree_styles_all(void);
|
|||
* @param xpm the character array containing the picture
|
||||
* @return a newly created GtkWidget showing the picture
|
||||
*/
|
||||
GtkWidget *xpm_to_widget(const char ** xpm);
|
||||
extern GtkWidget *xpm_to_widget(const char ** xpm);
|
||||
|
||||
/** Convert an xpm picture into a GtkWidget showing it.
|
||||
* Beware: the given parent window must already be visible!
|
||||
*
|
||||
* @param parent the parent window of to widget to be generated
|
||||
* @param xpm the character array containing the picture
|
||||
* @return a newly created GtkWidget showing the picture
|
||||
*/
|
||||
extern GtkWidget *xpm_to_widget_from_parent(GtkWidget *parent, const char ** xpm);
|
||||
|
||||
#endif /* __GTKGUIUI_UTIL_H__ */
|
||||
|
|
Loading…
Reference in New Issue