fprintf(pf, "# Ex: mozilla %%s\n");
fprintf(pf, PRS_GUI_WEBBROWSER ": %s\n", prefs.gui_webbrowser);
- fprintf(pf, "\n# Custom window title. (Prepended to existing titles.)\n");
+ fprintf(pf, "\n# Custom window title. (Appended to existing titles.)\n");
fprintf(pf, PRS_GUI_WINDOW_TITLE ": %s\n",
prefs.gui_window_title);
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, "\n# Show version in the start page and main screen's title bar.\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");
#include "image/wsicon16.xpm"
+#include "../version_info.h"
+
#ifdef _WIN32
#include <windows.h>
#endif
*/
#define MAIN_WINDOW_NAME_KEY "main_window_name"
-/* Set the name of the top-level window and its icon to the specified
- string. */
+/* Set the name of the top level main_window_name with the specified string and call
+ update_main_window_title() to construct the full title and display it in the main window
+ and its icon title. */
void
set_main_window_name(const gchar *window_name)
{
g_free(old_window_name);
g_object_set_data(G_OBJECT(top_level), MAIN_WINDOW_NAME_KEY, g_strdup(window_name));
- update_main_window_name();
+ update_main_window_title();
}
-/* Update the name of the main window if the user-specified decoration
- changed. */
+/* Construct the main window's title with the current main_window_name, optionally appended
+ with the user-specified title and/or wireshark version. Display the result in the main
+ window title bar and in its icon title.
+ NOTE: The name was changed from '_name' to '_title' because main_window_name is actually
+ set in set_main_window_name() and is only one of the components of the title. */
void
-update_main_window_name(void)
+update_main_window_title(void)
{
gchar *window_name;
gchar *title;
+ /* Get the current filename or other title set in set_main_window_name */
window_name = g_object_get_data(G_OBJECT(top_level), MAIN_WINDOW_NAME_KEY);
if (window_name != NULL) {
- /* use user-defined window title if preference is set */
- title = create_user_window_title(window_name);
- gtk_window_set_title(GTK_WINDOW(top_level), title);
- gdk_window_set_icon_name(top_level->window, title);
- g_free(title);
- }
+
+ /* Optionally append the user-defined window title */
+ title = create_user_window_title(window_name);
+
+ /* Optionally append the version */
+ if (prefs.gui_version_in_start_page) {
+ title = g_strdup_printf("%s [Wireshark %s %s]", title, VERSION, wireshark_svnversion);
+ }
+ gtk_window_set_title(GTK_WINDOW(top_level), title);
+ gdk_window_set_icon_name(top_level->window, title);
+ g_free(title);
+ }
}
/* update the main window */
if ((prefs.gui_window_title == NULL) || (*prefs.gui_window_title == '\0'))
return g_strdup(caption);
- return g_strdup_printf("%s %s", prefs.gui_window_title, caption);
+ return g_strdup_printf("%s [%s]", caption, prefs.gui_window_title);
}
/* XXX move toggle_tree over from proto_draw.c to handle GTK+ 1 */
*/
extern gchar *create_user_window_title(const gchar *caption);
+/** Construct the main window's title with the current main_window_name optionally appended
+ * with the user-specified title and/or wireshark version.
+ * Display the result in the main window's title bar and in its icon title
+ */
+extern void update_main_window_title(void);
+
/** Renders a float with two decimals precission, called from gtk_tree_view_column_set_cell_data_func().
* the user data must be the colum number.
* Present floats with two decimals
}
-/* Set the file name in the name for the main window and in the name for the main window's icon. */
-static void
+/* Set main_window_name and it's icon title to the capture filename */
+void
set_display_filename(capture_file *cf)
{
- gchar *win_name;
+ gchar *window_name;
- if (!cf->is_tempfile && cf->filename) {
- /* Add this filename to the list of recent files in the "Recent Files" submenu */
- add_menu_recent_capture_file(cf->filename);
+ if (cf->filename) {
+ window_name = g_strdup_printf("%s", cf_get_display_name(cf));
+ } else {
+ window_name = "The Wireshark Network Analyzer";
}
-
- /* window title */
- win_name = g_strdup_printf("%s - Wireshark", cf_get_display_name(cf));
- set_main_window_name(win_name);
- g_free(win_name);
+ set_main_window_name(window_name);
+ g_free(window_name);
}
GtkWidget *close_dlg = NULL;
static void
main_cf_cb_file_read_finished(capture_file *cf)
{
- set_display_filename(cf);
+ if (!cf->is_tempfile && cf->filename) {
+ /* Add this filename to the list of recent files in the "Recent Files" submenu */
+ add_menu_recent_capture_file(cf->filename);
+ }
+ set_display_filename(cf);
/* Enable menu items that make sense if you have a capture file you've
finished reading. */
if(capture_opts->iface) {
g_string_append_printf(title, "from %s ", cf_get_tempfile_source(capture_opts->cf));
}
- g_string_append(title, "- Wireshark");
-
set_main_window_name(title->str);
g_string_free(title, TRUE);
}
capture_file *cf = capture_opts->cf;
static GList *icon_list = NULL;
- set_display_filename(cf);
+ if (!cf->is_tempfile && cf->filename) {
+ /* Add this filename to the list of recent files in the "Recent Files" submenu */
+ add_menu_recent_capture_file(cf->filename);
+ }
+ set_display_filename(cf);
/* Enable menu items that make sense if you're not currently running
a capture. */
create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs_p)
{
GtkAccelGroup *accel;
- gchar *title;
- /* use user-defined title if preference is set */
- title = create_user_window_title("The Wireshark Network Analyzer");
-
- /* Main window */
- top_level = window_new(GTK_WINDOW_TOPLEVEL, title);
- g_free(title);
+ /* Main window */
+ top_level = window_new(GTK_WINDOW_TOPLEVEL, "");
+ set_main_window_name("The Wireshark Network Analyzer");
gtk_widget_set_name(top_level, "main window");
g_signal_connect(top_level, "delete_event", G_CALLBACK(main_window_delete_event_cb),
prefs_apply_all();
/* Update window view and redraw the toolbar */
- update_main_window_name();
+ update_main_window_title();
toolbar_redraw_all();
/* Enable all protocols and disable from the disabled list */
/* Show version in welcome screen */
show_version_cb = create_preference_check_button(main_tb, pos++,
- "Welcome screen shows version:",
- "Whether version should be shown in the start page or not.",
+ "Welcome screen and title bar shows version:",
+ "Whether version should be shown in the start page and main screen's title bar.",
prefs.gui_version_in_start_page );
g_object_set_data(G_OBJECT(main_vb), GUI_SHOW_VERSION_KEY, show_version_cb);
redraw_packet_bytes_all();
}
+ /* Redisplay the main window's title */
+ update_main_window_title();
+
/* Redraw the help window(s). */
supported_redraw();
help_redraw();
/* Window title */
window_title_te = create_preference_entry(main_tb, pos++,
- "Custom window title (prepended to existing titles):",
- "Enter the text to be prepended to the window title.",
+ "Custom window title (appended to existing titles):",
+ "Enter the text to be appended to the window title.",
prefs.gui_window_title);
gtk_entry_set_text(GTK_ENTRY(window_title_te), prefs.gui_window_title);
g_object_set_data(G_OBJECT(main_vb), GUI_WINDOW_TITLE_KEY, window_title_te);
void
layout_prefs_apply(GtkWidget *w _U_)
{
- update_main_window_name();
+ update_main_window_title();
main_widgets_rearrange();
}
void set_main_window_name(const gchar *);
/* Update the name of the main window if the user-specified decoration
changed. */
-void update_main_window_name(void);
+void update_main_window_title(void);
/* update the main window */
extern void main_window_update(void);
/* exit the main window */