merge_all_tap_menus() has been moved to menus.c.
[obnox/wireshark/wip.git] / gtk / about_dlg.c
index 81de4c7315aebabeee0e17438de6f2c6f6b5f26f..a41fa8c4053344714aedb6937855aa304ecb2b05 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Wireshark - Network traffic analyzer
  * By Gerald Combs <gerald@wireshark.org>
- * Copyright 2000 Gerald Combs
+ * Copyright 1998 Gerald Combs
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -28,6 +28,7 @@
 #endif
 
 #include <gtk/gtk.h>
+
 #include <string.h>
 
 #include <epan/filesystem.h>
@@ -39,7 +40,6 @@
 #include <epan/geoip_db.h>
 #endif
 
-#include "../globals.h"
 #include "../log.h"
 #include "../version_info.h"
 
 #include "../image/wssplash-dev.xpm"
 #include "webbrowser.h"
 
+/*
+ * Update frequence for the splash screen, given in milliseconds.
+ */
+int info_update_freq = 100;
+
 static void about_wireshark_destroy_cb(GtkWidget *, gpointer);
 
 
@@ -68,13 +73,15 @@ static GtkWidget *about_wireshark_w;
 
 
 static void
-about_wireshark(GtkWidget *parent, GtkWidget *main_vb)
+about_wireshark(GtkWidget *parent _U_, GtkWidget *main_vb)
 {
   GtkWidget   *msg_label, *icon;
   gchar       *message;
   const char  *title = "Network Protocol Analyzer";
 
-  icon = xpm_to_widget_from_parent(parent, wssplash_xpm);
+  /*icon = xpm_to_widget_from_parent(parent, wssplash_xpm);*/
+  icon = xpm_to_widget(wssplash_xpm);
+
   gtk_container_add(GTK_CONTAINER(main_vb), icon);
 
   msg_label = gtk_label_new(title);
@@ -151,8 +158,6 @@ splash_new(const char *message)
     return win;
 }
 
-#define REGISTER_FREQ 100 /* Milliseconds */
-
 void
 splash_update(register_action_e action, const char *message, gpointer client_data)
 {
@@ -179,12 +184,12 @@ splash_update(register_action_e action, const char *message, gpointer client_dat
 
     g_get_current_time(&cur_tv);
     if (cur_tv.tv_sec <= next_tv.tv_sec && cur_tv.tv_usec <= next_tv.tv_usec && ul_sofar < ul_count - 1) {
-      /* Only update every REGISTER_FREQ milliseconds */
+      /* Only update every splash_register_freq milliseconds */
       ul_sofar++;
       return;
     }
     memcpy(&next_tv, &cur_tv, sizeof(next_tv));
-    next_tv.tv_usec += REGISTER_FREQ * 1000;
+    next_tv.tv_usec += info_update_freq * 1000;
     if (next_tv.tv_usec >= 1000000) {
         next_tv.tv_sec++;
         next_tv.tv_usec -= 1000000;
@@ -263,16 +268,16 @@ splash_update(register_action_e action, const char *message, gpointer client_dat
 
 }
 
-guint
+gboolean
 splash_destroy(GtkWidget *win)
 {
-    if (win == NULL) return FALSE;
+    if (win == NULL)
+        return FALSE;
 
     gtk_widget_destroy(win);
     return FALSE;
 }
 
-
 static GtkWidget *
 about_wireshark_page_new(void)
 {
@@ -282,10 +287,8 @@ about_wireshark_page_new(void)
   main_vb = gtk_vbox_new(FALSE, 6);
   gtk_container_set_border_width(GTK_CONTAINER(main_vb), 12);
 
-#if GTK_CHECK_VERSION(2,9,0)
   g_object_set(gtk_widget_get_settings(main_vb),
     "gtk-label-select-on-focus", FALSE, NULL);
-#endif
 
   about_wireshark(top_level, main_vb);
 
@@ -326,7 +329,7 @@ about_authors_page_new(void)
   return page;
 }
 
-static gint about_folders_callback(GtkWidget *widget, GdkEventButton *event, gint id _U_)
+static gboolean about_folders_callback(GtkWidget *widget, GdkEventButton *event, gint id _U_)
 {
   GtkTreeSelection *tree_selection;
   GtkTreeModel *model;
@@ -345,6 +348,7 @@ static gint about_folders_callback(GtkWidget *widget, GdkEventButton *event, gin
   if(gtk_tree_selection_get_selected (tree_selection, &model, &iter)) {
     gtk_tree_model_get(model, &iter, 1, &path, -1);
     filemanager_open_directory(path);
+    g_free(path);
   }
 
   return TRUE;
@@ -356,7 +360,6 @@ about_folders_row(GtkWidget *table, const char *label, const char *dir, const ch
   simple_list_append(table, 0, label, 1, dir, 2, tip, -1);
 }
 
-
 static GtkWidget *
 about_folders_page_new(void)
 {
@@ -391,13 +394,13 @@ about_folders_page_new(void)
   path = get_tempfile_path("");
   about_folders_row(table, "Temp", path,
       "untitled capture files");
-  g_free((void *) path);
+  g_free(path);
 
   /* pers conf */
   path = get_persconffile_path("", FALSE, FALSE);
   about_folders_row(table, "Personal configuration", path,
       "\"dfilters\", \"preferences\", \"ethers\", ...");
-  g_free((void *) path);
+  g_free(path);
 
   /* global conf */
   constpath = get_datafile_dir();
@@ -416,50 +419,48 @@ about_folders_page_new(void)
   about_folders_row(table, "Program", constpath,
       "program files");
 
-#ifdef HAVE_PLUGINS
+#if defined(HAVE_PLUGINS) || defined(HAVE_LUA_5_1)
   /* pers plugins */
   path = get_plugins_pers_dir();
   about_folders_row(table, "Personal Plugins", path,
       "dissector plugins");
-  g_free((void *) path);
+  g_free(path);
 
   /* global plugins */
   about_folders_row(table, "Global Plugins", get_plugin_dir(),
       "dissector plugins");
 #endif
 
+#ifdef HAVE_PYTHON
+  /* global python bindings */
+  about_folders_row(table, "Python Bindings", get_wspython_dir(),
+      "python bindings");
+#endif
+
 #ifdef HAVE_GEOIP
   /* GeoIP */
   path = geoip_db_get_paths();
 
-#ifdef _WIN32
-  resultArray = g_strsplit(path, ";", 10);
-#else
-  resultArray = g_strsplit(path, ":", 10);
-#endif
+  resultArray = g_strsplit(path, G_SEARCHPATH_SEPARATOR_S, 10);
 
   for(i = 0; resultArray[i]; i++)
     about_folders_row(table, "GeoIP path", g_strstrip(resultArray[i]),
                      "GeoIP database search path");
   g_strfreev(resultArray);
-  g_free((void *) path);
+  g_free(path);
 #endif
 
 #ifdef HAVE_LIBSMI
   /* SMI MIBs/PIBs */
   path = oid_get_default_mib_path();
 
-#ifdef _WIN32
-  resultArray = g_strsplit(path, ";", 10);
-#else
-  resultArray = g_strsplit(path, ":", 10);
-#endif
+  resultArray = g_strsplit(path, G_SEARCHPATH_SEPARATOR_S, 10);
 
   for(i = 0; resultArray[i]; i++)
     about_folders_row(table, "MIB/PIB path", g_strstrip(resultArray[i]),
                      "SMI MIB/PIB search path");
   g_strfreev(resultArray);
-  g_free((void *) path);
+  g_free(path);
 #endif
 
   gtk_container_add(GTK_CONTAINER(scrolledwindow), table);
@@ -473,7 +474,11 @@ about_license_page_new(void)
   GtkWidget   *page;
   char *absolute_path;
 
+#if defined(_WIN32)
+  absolute_path = get_datafile_path("COPYING.txt");
+#else
   absolute_path = get_datafile_path("COPYING");
+#endif
   page = text_page_new(absolute_path);
 
   return page;
@@ -485,7 +490,7 @@ about_wireshark_cb( GtkWidget *w _U_, gpointer data _U_ )
   GtkWidget   *main_vb, *main_nb, *bbox, *ok_btn;
   GtkWidget   *page_lb, *about_page, *folders_page;
 
-#ifdef HAVE_PLUGINS
+#if defined(HAVE_PLUGINS) || defined(HAVE_LUA_5_1)
   GtkWidget   *plugins_page;
 #endif
 
@@ -529,7 +534,7 @@ about_wireshark_cb( GtkWidget *w _U_, gpointer data _U_ )
   page_lb = gtk_label_new("Folders");
   gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), folders_page, page_lb);
 
-#ifdef HAVE_PLUGINS
+#if defined(HAVE_PLUGINS) || defined(HAVE_LUA_5_1)
   plugins_page = about_plugins_page_new();
   page_lb = gtk_label_new("Plugins");
   gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), plugins_page, page_lb);
@@ -563,5 +568,3 @@ about_wireshark_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
   /* Note that we no longer have an "About Wireshark" dialog box. */
   about_wireshark_w = NULL;
 }
-
-