merge_all_tap_menus() has been moved to menus.c.
[obnox/wireshark/wip.git] / gtk / export_object.c
index fd1b13c36d1fe702977b6fde05326d1f47571851..b4b05261ecb386be8c93de247997a36e96d46509 100644 (file)
@@ -64,6 +64,8 @@ enum {
        EO_NUM_COLUMNS /* must be last */
 };
 
+static eo_protocoldata_reset_cb eo_protocoldata_reset = NULL;
+
 
 static void
 eo_remember_this_row(GtkTreeModel *model _U_, GtkTreePath *path,
@@ -121,6 +123,9 @@ eo_win_destroy_cb(GtkWindow *win _U_, gpointer data)
        /* Free the GSList elements */
        g_slist_free(object_list->entries);
        g_free(object_list);
+
+       /* Free the private export_object_xxx data */
+       if (eo_protocoldata_reset != NULL) eo_protocoldata_reset();
 }
 
 static gboolean
@@ -250,7 +255,7 @@ static GString *eo_rename(GString *gstr, gchar dup)
 }
 
 static GString *
-eo_massage_str(const gchar *in_str, guint maxlen, gchar dup)
+eo_massage_str(const gchar *in_str, gsize maxlen, gchar dup)
 {
        gchar *tmp_ptr;
        /* The characters in "reject" come from:
@@ -350,6 +355,8 @@ eo_reset(void *tapdata)
        object_list->entries = NULL;
        object_list->iter = NULL;
        object_list->row_selected = -1;
+
+       if (eo_protocoldata_reset != NULL) eo_protocoldata_reset();
 }
 
 static void
@@ -386,18 +393,20 @@ eo_draw(void *tapdata)
 }
 
 void
-export_object_window(const gchar *tapname, const gchar *name, tap_packet_cb tap_packet)
+export_object_window(const gchar *tapname, const gchar *name, tap_packet_cb tap_packet, eo_protocoldata_reset_cb eo_protocoldata_resetfn)
 {
        GtkWidget *sw;
        GtkCellRenderer *renderer;
        GtkTreeViewColumn *column;
        GtkTreeSelection *selection;
        GtkWidget *vbox, *bbox, *help_bt, *cancel_bt, *save_bt, *save_all_bt;
-       GtkTooltips *button_bar_tips;
        GString *error_msg;
        export_object_list_t *object_list;
        gchar *window_title;
 
+       /* Initialize the pointer to the private data clearing function */
+       eo_protocoldata_reset = eo_protocoldata_resetfn;
+
        /* Initialize our object list structure */
        object_list = g_malloc0(sizeof(export_object_list_t));
 
@@ -411,12 +420,11 @@ export_object_window(const gchar *tapname, const gchar *name, tap_packet_cb tap_
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                              "Can't register %s tap: %s\n", name, error_msg->str);
                g_string_free(error_msg, TRUE);
+               g_free(object_list);
                return;
        }
 
        /* Setup our GUI window */
-       button_bar_tips = gtk_tooltips_new();
-
        window_title = g_strdup_printf("Wireshark: %s object list", name);
        object_list->dlg = dlg_window_new(window_title);
        g_free(window_title);
@@ -502,29 +510,22 @@ export_object_window(const gchar *tapname, const gchar *name, tap_packet_cb tap_
        /* Help button */
        help_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP);
        g_signal_connect(help_bt, "clicked", G_CALLBACK(topic_cb), (gpointer)HELP_EXPORT_OBJECT_LIST);
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(button_bar_tips), help_bt,
-                            "Show help for this dialog.", NULL);
+       gtk_widget_set_tooltip_text(help_bt, "Show help for this dialog.");
 
        /* Save All button */
        save_all_bt = g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_SAVE_ALL);
        g_signal_connect(save_all_bt, "clicked", G_CALLBACK(eo_save_all_clicked_cb),
                       object_list);
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(button_bar_tips), save_all_bt,
-                            "Save all listed objects with their displayed "
-                            "filenames.", NULL);
+       gtk_widget_set_tooltip_text(save_all_bt, "Save all listed objects with their displayed filenames.");
 
        /* Save As button */
        save_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_SAVE_AS);
        g_signal_connect(save_bt, "clicked", G_CALLBACK(eo_save_clicked_cb), object_list);
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(button_bar_tips), save_bt,
-                            "Saves the currently selected content to a file.",
-                            NULL);
+       gtk_widget_set_tooltip_text(save_bt, "Saves the currently selected content to a file.");
 
        /* Cancel button */
        cancel_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(button_bar_tips), cancel_bt,
-                            "Cancel this dialog.", NULL);
-
+       gtk_widget_set_tooltip_text(cancel_bt, "Cancel this dialog.");
 
        /* Pack the buttons into the "button box" */
        gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);