Add a hidden preference to show the version in the welcome page.

svn path=/trunk/; revision=26371
This commit is contained in:
Stig Bjørlykke 2008-10-07 15:18:40 +00:00
parent 66f160728f
commit 7e3514c200
3 changed files with 29 additions and 23 deletions

View File

@ -1170,6 +1170,7 @@ init_prefs(void) {
prefs.gui_webbrowser = g_strdup(HTML_VIEWER " %s");
prefs.gui_window_title = g_strdup("");
prefs.gui_start_title = g_strdup("The World's Most Popular Network Protocol Analyzer");
prefs.gui_version_in_start_page = FALSE;
prefs.gui_layout_type = layout_type_5;
prefs.gui_layout_content_1 = layout_pane_content_plist;
prefs.gui_layout_content_2 = layout_pane_content_pdetails;
@ -1649,6 +1650,7 @@ prefs_is_capture_device_hidden(const char *name)
#define PRS_GUI_WEBBROWSER "gui.webbrowser"
#define PRS_GUI_WINDOW_TITLE "gui.window_title"
#define PRS_GUI_START_TITLE "gui.start_title"
#define PRS_GUI_VERSION_IN_START_PAGE "gui.version_in_start_page"
#define PRS_GUI_LAYOUT_TYPE "gui.layout_type"
#define PRS_GUI_LAYOUT_CONTENT_1 "gui.layout_content_1"
#define PRS_GUI_LAYOUT_CONTENT_2 "gui.layout_content_2"
@ -2031,6 +2033,12 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_)
if (prefs.gui_start_title != NULL)
g_free(prefs.gui_start_title);
prefs.gui_start_title = g_strdup(value);
} else if (strcmp(pref_name, PRS_GUI_VERSION_IN_START_PAGE) == 0) {
if (g_ascii_strcasecmp(value, "true") == 0) {
prefs.gui_version_in_start_page = TRUE;
} else {
prefs.gui_version_in_start_page = FALSE;
}
} else if (strcmp(pref_name, PRS_GUI_LAYOUT_TYPE) == 0) {
prefs.gui_layout_type = strtoul(value, NULL, 10);
if (prefs.gui_layout_type == layout_unused ||
@ -2764,6 +2772,11 @@ write_prefs(char **pf_path_return)
fprintf(pf, PRS_GUI_START_TITLE ": %s\n",
prefs.gui_start_title);
fprintf(pf, "\n# Show version in start page, can be useful in custom builds.\n");
fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(pf, PRS_GUI_VERSION_IN_START_PAGE ": %s\n",
prefs.gui_version_in_start_page == TRUE ? "TRUE" : "FALSE");
fprintf (pf, "\n######## User Interface: Layout ########\n");
fprintf(pf, "\n# Layout type (1-6).\n");
@ -3025,6 +3038,7 @@ copy_prefs(e_prefs *dest, e_prefs *src)
dest->gui_webbrowser = g_strdup(src->gui_webbrowser);
dest->gui_window_title = g_strdup(src->gui_window_title);
dest->gui_start_title = g_strdup(src->gui_start_title);
dest->gui_version_in_start_page = src->gui_version_in_start_page;
dest->console_log_level = src->console_log_level;
/* values for the capture dialog box */
dest->capture_device = g_strdup(src->capture_device);

View File

@ -135,6 +135,7 @@ typedef struct _e_prefs {
gchar *gui_webbrowser;
gchar *gui_window_title;
gchar *gui_start_title;
gboolean gui_version_in_start_page;
layout_type_e gui_layout_type;
layout_pane_content_e gui_layout_content_1;
layout_pane_content_e gui_layout_content_2;

View File

@ -21,9 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Put version in Welcome screen, can be useful in custom builds.
#define VERSION_IN_WELCOME_PAGE 1
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@ -58,9 +55,7 @@
#include "gtk/stock_icons.h"
#include "gtk/capture_globals.h"
#include "../image/wssplash-dev.xpm"
#ifdef VERSION_IN_WELCOME_PAGE
#include "../version_info.h"
#endif
/* XXX */
@ -253,7 +248,7 @@ welcome_header_new(void)
GtkWidget *item_hb;
GtkWidget *eb;
GtkWidget *icon;
gchar *message;
GString *message;
GtkWidget *w;
time_t secs = time(NULL);
struct tm *now = localtime(&secs);
@ -271,26 +266,22 @@ welcome_header_new(void)
icon = xpm_to_widget_from_parent(top_level, wssplash_xpm);
gtk_box_pack_start(GTK_BOX(item_hb), icon, FALSE, FALSE, 10);
message = g_string_new("<span weight=\"bold\" size=\"x-large\" foreground=\"black\">");
if ((now->tm_mon == 3 && now->tm_mday == 1) || (now->tm_mon == 6 && now->tm_mday == 14)) {
message = g_strdup_printf(
"<span weight=\"bold\" size=\"x-large\" foreground=\"black\">"
"Sniffing the glue that holds the Internet together"
"</span>");
g_string_append(message, "Sniffing the glue that holds the Internet together");
} else {
message = g_strdup_printf(
"<span weight=\"bold\" size=\"x-large\" foreground=\"black\">"
"%s"
#ifdef VERSION_IN_WELCOME_PAGE
"</span>\n<span size=\"large\">"
"Version " VERSION "%s</span>",
prefs.gui_start_title, wireshark_svnversion);
#else
"</span>", prefs.gui_start_title);
#endif
g_string_append(message, prefs.gui_start_title);
}
w = gtk_label_new(message);
gtk_label_set_markup(GTK_LABEL(w), message);
g_free(message);
g_string_append(message, "</span>");
if (prefs.gui_version_in_start_page) {
g_string_append_printf(message, "\n<span size=\"large\">Version " VERSION "%s</span>",
wireshark_svnversion);
}
w = gtk_label_new(message->str);
gtk_label_set_markup(GTK_LABEL(w), message->str);
g_string_free(message, TRUE);
gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.5);
gtk_box_pack_start(GTK_BOX(item_hb), w, TRUE, TRUE, 5);