Add text import capability, like text2pcap, directly into the GUI.
[obnox/wireshark/wip.git] / gtk / dlg_utils.c
index 85d115f6b226f3bd6a79b3bec73ab2afb57daefc..c5936d4ba2da7814bced2601892c926a6a99e25d 100644 (file)
@@ -129,6 +129,10 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
     const gchar *save_all     = NULL;
     const gchar *stop         = NULL;
     const gchar *yes          = NULL;
+#ifdef HAVE_GEOIP    
+    const gchar *map          = NULL;
+#endif /* HAVE_GEOIP */
+    const gchar *follow_stream = NULL;
 
 
     va_start(stock_id_list, stock_id_first);
@@ -148,7 +152,9 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
         } else if (strcmp(stock_id, WIRESHARK_STOCK_SAVE_ALL) == 0) {
             save_all = stock_id;
         } else if (strcmp(stock_id, WIRESHARK_STOCK_DONT_SAVE) == 0) {
-               dont_save = stock_id;
+            dont_save = stock_id;
+        } else if (strcmp(stock_id, WIRESHARK_STOCK_QUIT_DONT_SAVE) == 0) {
+                   dont_save = stock_id;
         } else if (strcmp(stock_id, GTK_STOCK_CANCEL) == 0) {
             cancel = stock_id;
         } else if (strcmp(stock_id, GTK_STOCK_CLOSE) == 0) {
@@ -161,6 +167,12 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
         } else if (strcmp(stock_id, WIRESHARK_STOCK_CAPTURE_STOP) == 0) {
             cap_stop = stock_id;
 #endif /* HAVE_LIBPCAP */
+#ifdef HAVE_GEOIP
+        } else if (strcmp(stock_id, WIRESHARK_STOCK_MAP) == 0) {
+            map = stock_id;
+#endif /* HAVE_GEOIP */
+        } else if (strcmp(stock_id, WIRESHARK_STOCK_FOLLOW_STREAM) == 0) {
+            follow_stream = stock_id;
         } else if (strcmp(stock_id, GTK_STOCK_STOP) == 0) {
             stop = stock_id;
         } else if (strcmp(stock_id, GTK_STOCK_HELP) == 0) {
@@ -197,12 +209,12 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
     gtk_box_pack_end(GTK_BOX(hbox), button_hbox, TRUE, TRUE, 0);
     g_object_set_data(G_OBJECT(hbox), BUTTON_HBOX_KEY, button_hbox);
     gtk_widget_show(button_hbox);
-    gtk_button_box_set_spacing(GTK_BUTTON_BOX(button_hbox), 5);
+    gtk_box_set_spacing(GTK_BOX(button_hbox), 5);
 
     help_hbox = gtk_hbutton_box_new();
     gtk_box_pack_end(GTK_BOX(hbox), help_hbox, FALSE, FALSE, 0);
     gtk_widget_show(help_hbox);
-    gtk_button_box_set_spacing(GTK_BUTTON_BOX(help_hbox), 5);
+    gtk_box_set_spacing(GTK_BOX(help_hbox), 5);
 
     if (buttons == 0) {
         /* if no buttons wanted, simply do nothing */
@@ -235,11 +247,22 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
         buttons--;
     }
 
+#ifdef HAVE_GEOIP
+    /* do we have a map button? -> special handling for it */
+    if (map) {
+        button = gtk_button_new_from_stock(map);
+        GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+        g_object_set_data(G_OBJECT(hbox), map, button);
+        gtk_box_pack_start(GTK_BOX(help_hbox), button, FALSE, FALSE, 0);
+        gtk_widget_show(button);
+        buttons--;
+    }
+#endif /* HAVE_GEOIP */
+
     /* if more than one button, sort buttons from left to right */
     /* (the whole button cluster will then be right aligned) */
     gtk_button_box_set_layout (GTK_BUTTON_BOX(button_hbox), GTK_BUTTONBOX_END);
 
-/* GTK+ 1.3 and later - on Win32, we use 1.3[.x] or 2.x, not 1.2[.x] */
 #if !defined(_WIN32)
     /* beware: sequence of buttons are important! */
 
@@ -370,6 +393,7 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
     if (stop    != NULL) dlg_button_new(hbox, button_hbox, stop);
     if (clear   != NULL) dlg_button_new(hbox, button_hbox, clear);
     if (filter_stream!= NULL) dlg_button_new(hbox, button_hbox, filter_stream);
+    if (follow_stream != NULL) dlg_button_new(hbox, button_hbox, follow_stream);
     if (close   != NULL) dlg_button_new(hbox, button_hbox, close);
     if (cancel  != NULL) dlg_button_new(hbox, button_hbox, cancel);
 
@@ -399,9 +423,16 @@ dlg_window_new(const gchar *title)
    * to capture, and might also simplify the job of having the GUI main
    * loop wait both for user input and packet arrival.
    */
+  /*
+   * On Windows, making the dialogs transient to top_level behaves strangely.
+   * It is not possible any more to bring the top level window to front easily.
+   * So we don't do this on Windows.
+   */
+#ifndef _WIN32
   if (top_level) {
     gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(top_level));
   }
+#endif /*_WIN32*/
 
   return win;
 }