diff options
author | Stephen Fisher <steve@stephen-fisher.com> | 2008-04-27 07:01:58 +0000 |
---|---|---|
committer | Stephen Fisher <steve@stephen-fisher.com> | 2008-04-27 07:01:58 +0000 |
commit | bbf7ec011a409a7ef4841fe07f7f2379a3ee8ad8 (patch) | |
tree | dcda86376eaa6d357473b1674e5449c265339935 /gtk/capture_file_dlg.c | |
parent | a63ad85c78d4f767a3ec0130a0fc3e3f4b3919c1 (diff) | |
download | wireshark-bbf7ec011a409a7ef4841fe07f7f2379a3ee8ad8.tar.gz |
Remove all GTK+ < 2.4 code and minimum version checks.
svn path=/trunk/; revision=25182
Diffstat (limited to 'gtk/capture_file_dlg.c')
-rw-r--r-- | gtk/capture_file_dlg.c | 224 |
1 files changed, 10 insertions, 214 deletions
diff --git a/gtk/capture_file_dlg.c b/gtk/capture_file_dlg.c index 1aa8923578..fa09b9f70e 100644 --- a/gtk/capture_file_dlg.c +++ b/gtk/capture_file_dlg.c @@ -298,7 +298,6 @@ preview_do(GtkWidget *prev, wtap *wth) #if 0 /* as the dialog layout will look very ugly when using the file chooser preview mechanism, simply use the same layout as in GTK2.0 */ -/* GTK_CHECK_VERSION(2,4,0) */ static void update_preview_cb (GtkFileChooser *file_chooser, gpointer data) { @@ -328,11 +327,7 @@ file_open_entry_changed(GtkWidget *w _U_, gpointer file_sel) wtap *wth; /* get the filename */ -#if GTK_CHECK_VERSION(2,4,0) cf_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_sel)); -#else - cf_name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(file_sel)); -#endif /* set the filename to the preview */ wth = preview_set_filename(prev, cf_name); @@ -342,11 +337,8 @@ file_open_entry_changed(GtkWidget *w _U_, gpointer file_sel) gtk_widget_set_sensitive(prev, have_preview); /* make the open/save/... dialog button sensitive */ -#if GTK_CHECK_VERSION(2,4,0) + gtk_dialog_set_response_sensitive(file_sel, GTK_RESPONSE_ACCEPT, have_preview); -#else - gtk_widget_set_sensitive(GTK_FILE_SELECTION(file_sel)->ok_button, have_preview); -#endif /* do the actual preview */ if(have_preview) @@ -453,13 +445,9 @@ file_open_cmd(GtkWidget *w) file_open_w = file_selection_new("Wireshark: Open Capture File", FILE_SELECTION_OPEN); -#if GTK_CHECK_VERSION(2,4,0) /* it's annoying, that the file chooser dialog is already shown here, so we cannot use the correct gtk_window_set_default_size() to resize it */ gtk_widget_set_size_request(file_open_w, DEF_WIDTH, DEF_HEIGHT); -#else - gtk_window_set_default_size(GTK_WINDOW(file_open_w), DEF_WIDTH, DEF_HEIGHT); -#endif switch (prefs.gui_fileopen_style) { @@ -516,25 +504,15 @@ file_open_cmd(GtkWidget *w) gtk_widget_show(filter_te); gtk_tooltips_set_tip(tooltips, filter_te, "Enter a display filter.", NULL); -#if GTK_CHECK_VERSION(2,4,0) g_object_set_data(G_OBJECT(file_open_w), E_RFILTER_TE_KEY, filter_te); -#else - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_open_w)->ok_button), - E_RFILTER_TE_KEY, filter_te); -#endif /* resolve buttons */ m_resolv_cb = gtk_check_button_new_with_mnemonic("Enable _MAC name resolution"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_resolv_cb), g_resolv_flags & RESOLV_MAC); gtk_box_pack_start(GTK_BOX(main_vb), m_resolv_cb, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION(2,4,0) g_object_set_data(G_OBJECT(file_open_w), E_FILE_M_RESOLVE_KEY, m_resolv_cb); -#else - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_open_w)->ok_button), - E_FILE_M_RESOLVE_KEY, m_resolv_cb); -#endif gtk_widget_show(m_resolv_cb); n_resolv_cb = gtk_check_button_new_with_mnemonic("Enable _network name resolution"); @@ -542,25 +520,13 @@ file_open_cmd(GtkWidget *w) g_resolv_flags & RESOLV_NETWORK); gtk_box_pack_start(GTK_BOX(main_vb), n_resolv_cb, FALSE, FALSE, 0); gtk_widget_show(n_resolv_cb); -#if GTK_CHECK_VERSION(2,4,0) g_object_set_data(G_OBJECT(file_open_w), E_FILE_N_RESOLVE_KEY, n_resolv_cb); -#else - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_open_w)->ok_button), - E_FILE_N_RESOLVE_KEY, n_resolv_cb); -#endif - t_resolv_cb = gtk_check_button_new_with_mnemonic("Enable _transport name resolution"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(t_resolv_cb), g_resolv_flags & RESOLV_TRANSPORT); gtk_box_pack_start(GTK_BOX(main_vb), t_resolv_cb, FALSE, FALSE, 0); gtk_widget_show(t_resolv_cb); -#if GTK_CHECK_VERSION(2,4,0) g_object_set_data(G_OBJECT(file_open_w), E_FILE_T_RESOLVE_KEY, t_resolv_cb); -#else - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_open_w)->ok_button), - E_FILE_T_RESOLVE_KEY, t_resolv_cb); -#endif - g_signal_connect(file_open_w, "destroy", G_CALLBACK(file_open_destroy_cb), NULL); @@ -571,7 +537,6 @@ file_open_cmd(GtkWidget *w) gtk_widget_show_all(prev); gtk_box_pack_start(GTK_BOX(main_hb), prev, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION(2,4,0) g_signal_connect(GTK_FILE_CHOOSER(file_open_w), "selection-changed", G_CALLBACK(file_open_entry_changed), file_open_w); file_open_entry_changed(file_open_w, file_open_w); @@ -583,28 +548,6 @@ file_open_cmd(GtkWidget *w) file_open_ok_cb(file_open_w, file_open_w); } else window_destroy(file_open_w); -#else /* GTK_CHECK_VERSION(2,4,0) */ - g_signal_connect(GTK_FILE_SELECTION(file_open_w)->selection_entry, "changed", - G_CALLBACK(file_open_entry_changed), file_open_w); - - /* Connect the ok_button to file_open_ok_cb function and pass along a - pointer to the file selection box widget */ - g_signal_connect(GTK_FILE_SELECTION(file_open_w)->ok_button, "clicked", - G_CALLBACK(file_open_ok_cb), file_open_w); - - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_open_w)->ok_button), - E_DFILTER_TE_KEY, g_object_get_data(G_OBJECT(w), E_DFILTER_TE_KEY)); - - /* Connect the cancel_button to destroy the widget */ - window_set_cancel_button(file_open_w, - GTK_FILE_SELECTION(file_open_w)->cancel_button, window_cancel_button_cb); - - g_signal_connect(file_open_w, "delete_event", - G_CALLBACK(window_delete_event_cb), NULL); - - gtk_widget_show(file_open_w); - window_present(file_open_w); -#endif /* GTK_CHECK_VERSION(2,4,0) */ #endif /* _WIN32 */ } @@ -652,11 +595,7 @@ file_open_ok_cb(GtkWidget *w, gpointer fs) { dfilter_t *rfcode = NULL; int err; -#if GTK_CHECK_VERSION(2,4,0) cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs))); -#else - cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs))); -#endif filter_te = g_object_get_data(G_OBJECT(w), E_RFILTER_TE_KEY); rfilter = gtk_entry_get_text(GTK_ENTRY(filter_te)); if (!dfilter_compile(rfilter, &rfcode)) { @@ -685,13 +624,13 @@ file_open_ok_cb(GtkWidget *w, gpointer fs) { if (rfcode != NULL) dfilter_free(rfcode); g_free(cf_name); -#if GTK_CHECK_VERSION(2,4,0) + /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), * as this will prevent the user from closing the now existing error * message, simply close the dialog (this is the best we can do here). */ if (file_open_w) window_destroy(file_open_w); -#endif + return; } @@ -797,13 +736,9 @@ file_merge_cmd(GtkWidget *w) file_merge_w = file_selection_new("Wireshark: Merge with Capture File", FILE_SELECTION_OPEN); -#if GTK_CHECK_VERSION(2,4,0) /* it's annoying, that the file chooser dialog is already shown here, so we cannot use the correct gtk_window_set_default_size() to resize it */ gtk_widget_set_size_request(file_merge_w, DEF_WIDTH, DEF_HEIGHT); -#else - gtk_window_set_default_size(GTK_WINDOW(file_merge_w), DEF_WIDTH, DEF_HEIGHT); -#endif switch (prefs.gui_fileopen_style) { @@ -875,12 +810,7 @@ file_merge_cmd(GtkWidget *w) gtk_widget_show(filter_te); gtk_tooltips_set_tip(tooltips, filter_te, "Enter a display filter.", NULL); -#if GTK_CHECK_VERSION(2,4,0) g_object_set_data(G_OBJECT(file_merge_w), E_RFILTER_TE_KEY, filter_te); -#else - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_merge_w)->ok_button), - E_RFILTER_TE_KEY, filter_te); -#endif prepend_rb = gtk_radio_button_new_with_mnemonic_from_widget(NULL, "Prepend packets to existing file"); @@ -888,13 +818,8 @@ file_merge_cmd(GtkWidget *w) "The resulting file contains the packets from the selected, followed by the packets from the currently loaded file," " the packet timestamps will be ignored.", NULL); gtk_box_pack_start(GTK_BOX(main_vb), prepend_rb, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION(2,4,0) g_object_set_data(G_OBJECT(file_merge_w), E_MERGE_PREPEND_KEY, prepend_rb); -#else - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_merge_w)->ok_button), - E_MERGE_PREPEND_KEY, prepend_rb); -#endif gtk_widget_show(prepend_rb); chrono_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(prepend_rb), "Merge packets chronologically"); @@ -904,12 +829,7 @@ file_merge_cmd(GtkWidget *w) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chrono_rb), TRUE); gtk_box_pack_start(GTK_BOX(main_vb), chrono_rb, FALSE, FALSE, 0); gtk_widget_show(chrono_rb); -#if GTK_CHECK_VERSION(2,4,0) g_object_set_data(G_OBJECT(file_merge_w), E_MERGE_CHRONO_KEY, chrono_rb); -#else - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_merge_w)->ok_button), - E_MERGE_CHRONO_KEY, chrono_rb); -#endif append_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(prepend_rb), "Append packets to existing file"); gtk_tooltips_set_tip(tooltips, append_rb, @@ -919,13 +839,7 @@ file_merge_cmd(GtkWidget *w) g_resolv_flags & RESOLV_TRANSPORT); gtk_box_pack_start(GTK_BOX(main_vb), append_rb, FALSE, FALSE, 0); gtk_widget_show(append_rb); -#if GTK_CHECK_VERSION(2,4,0) g_object_set_data(G_OBJECT(file_merge_w), E_MERGE_APPEND_KEY, append_rb); -#else - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_merge_w)->ok_button), - E_MERGE_APPEND_KEY, append_rb); -#endif - g_signal_connect(file_merge_w, "destroy", G_CALLBACK(file_merge_destroy_cb), NULL); @@ -936,7 +850,6 @@ file_merge_cmd(GtkWidget *w) gtk_widget_show_all(prev); gtk_box_pack_start(GTK_BOX(main_hb), prev, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION(2,4,0) g_signal_connect(GTK_FILE_CHOOSER(file_merge_w), "selection-changed", G_CALLBACK(file_open_entry_changed), file_merge_w); file_open_entry_changed(file_merge_w, file_merge_w); @@ -948,28 +861,6 @@ file_merge_cmd(GtkWidget *w) file_merge_ok_cb(file_merge_w, file_merge_w); } else window_destroy(file_merge_w); -#else /* GTK_CHECK_VERSION(2,4,0) */ - g_signal_connect(GTK_FILE_SELECTION(file_merge_w)->selection_entry, "changed", - G_CALLBACK(file_open_entry_changed), file_merge_w); - - /* Connect the ok_button to file_merge_ok_cb function and pass along a - pointer to the file selection box widget */ - g_signal_connect(GTK_FILE_SELECTION(file_merge_w)->ok_button, "clicked", - G_CALLBACK(file_merge_ok_cb), file_merge_w); - - g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(file_merge_w)->ok_button), - E_DFILTER_TE_KEY, g_object_get_data(G_OBJECT(w), E_DFILTER_TE_KEY)); - - /* Connect the cancel_button to destroy the widget */ - window_set_cancel_button(file_merge_w, - GTK_FILE_SELECTION(file_merge_w)->cancel_button, window_cancel_button_cb); - - g_signal_connect(file_merge_w, "delete_event", - G_CALLBACK(window_delete_event_cb), NULL); - - gtk_widget_show(file_merge_w); - window_present(file_merge_w); -#endif /* GTK_CHECK_VERSION(2,4,0) */ #endif /* _WIN32 */ } @@ -1016,11 +907,7 @@ file_merge_ok_cb(GtkWidget *w, gpointer fs) { char *in_filenames[2]; char *tmpname; -#if GTK_CHECK_VERSION(2,4,0) cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs))); -#else - cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs))); -#endif filter_te = g_object_get_data(G_OBJECT(w), E_RFILTER_TE_KEY); rfilter = gtk_entry_get_text(GTK_ENTRY(filter_te)); if (!dfilter_compile(rfilter, &rfcode)) { @@ -1088,13 +975,11 @@ file_merge_ok_cb(GtkWidget *w, gpointer fs) { if (rfcode != NULL) dfilter_free(rfcode); g_free(tmpname); -#if GTK_CHECK_VERSION(2,4,0) /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), * as this will prevent the user from closing the now existing error * message, simply close the dialog (this is the best we can do here). */ if (file_open_w) window_destroy(file_open_w); -#endif return; } g_free(tmpname); @@ -1363,27 +1248,11 @@ file_save_as_cmd(action_after_save_e action_after_save, gpointer action_after_sa g_signal_connect(file_save_as_w, "destroy", G_CALLBACK(file_save_as_destroy_cb), NULL); -#if GTK_CHECK_VERSION(2,4,0) if (gtk_dialog_run(GTK_DIALOG(file_save_as_w)) == GTK_RESPONSE_ACCEPT) { file_save_as_ok_cb(file_save_as_w, file_save_as_w); } else { window_destroy(file_save_as_w); } -#else /* GTK_CHECK_VERSION(2,4,0) */ - /* Connect the ok_button to file_save_as_ok_cb function and pass along a - pointer to the file selection box widget */ - g_signal_connect(GTK_FILE_SELECTION (file_save_as_w)->ok_button, "clicked", - G_CALLBACK(file_save_as_ok_cb), file_save_as_w); - - window_set_cancel_button(file_save_as_w, - GTK_FILE_SELECTION(file_save_as_w)->cancel_button, window_cancel_button_cb); - - g_signal_connect(file_save_as_w, "delete_event", - G_CALLBACK( window_delete_event_cb), NULL); - - gtk_widget_show(file_save_as_w); - window_present(file_save_as_w); -#endif /* GTK_CHECK_VERSION(2,4,0) */ #endif /* _WIN32 */ } @@ -1403,11 +1272,7 @@ file_save_as_cb(GtkWidget *w _U_, gpointer fs) { GtkWidget *compressed_cb; -#if GTK_CHECK_VERSION(2,4,0) cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs))); -#else - cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs))); -#endif compressed_cb = g_object_get_data(G_OBJECT(file_save_as_w), "compressed"); @@ -1423,15 +1288,11 @@ file_save_as_cb(GtkWidget *w _U_, gpointer fs) { just leave it around so that the user can, after they dismiss the alert box popped up for the error, try again. */ g_free(cf_name); -#if GTK_CHECK_VERSION(2,4,0) /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), * as this will prevent the user from closing the now existing error * message, simply close the dialog (this is the best we can do here). */ if (file_save_as_w) window_destroy(GTK_WIDGET (fs)); -#else - gtk_widget_show(GTK_WIDGET (fs)); -#endif return; } @@ -1484,11 +1345,7 @@ static void file_save_as_exists_answered_cb(gpointer dialog _U_, gint btn, gpoin { gchar *cf_name; -#if GTK_CHECK_VERSION(2,4,0) cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(data))); -#else - cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(data))); -#endif switch(btn) { case(ESD_BTN_OK): @@ -1497,15 +1354,11 @@ static void file_save_as_exists_answered_cb(gpointer dialog _U_, gint btn, gpoin file_save_as_cb(NULL, data); break; case(ESD_BTN_CANCEL): -#if GTK_CHECK_VERSION(2,4,0) /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), * as this will prevent the user from closing the now existing error * message, simply close the dialog (this is the best we can do here). */ if (file_save_as_w) window_destroy(file_save_as_w); -#else - gtk_widget_show(file_save_as_w); -#endif break; default: g_assert_not_reached(); @@ -1519,11 +1372,7 @@ file_save_as_ok_cb(GtkWidget *w _U_, gpointer fs) { gchar *cf_name; gpointer dialog; -#if GTK_CHECK_VERSION(2,4,0) cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs))); -#else - cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs))); -#endif /* Perhaps the user specified a directory instead of a file. Check whether they did. */ @@ -1542,15 +1391,12 @@ file_save_as_ok_cb(GtkWidget *w _U_, gpointer fs) { just leave it around so that the user can, after they dismiss the alert box popped up for the error, try again. */ g_free(cf_name); -#if GTK_CHECK_VERSION(2,4,0) /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), * as this will prevent the user from closing the now existing error * message, simply close the dialog (this is the best we can do here). */ if (file_save_as_w) window_destroy(GTK_WIDGET (fs)); -#else - gtk_widget_show(GTK_WIDGET (fs)); -#endif + return; } @@ -1567,15 +1413,12 @@ file_save_as_ok_cb(GtkWidget *w _U_, gpointer fs) { "Please choose a different filename.", simple_dialog_primary_start(), cf_name, simple_dialog_primary_end()); g_free(cf_name); -#if GTK_CHECK_VERSION(2,4,0) /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), * as this will prevent the user from closing the now existing error * message, simply close the dialog (this is the best we can do here). */ if (file_save_as_w) window_destroy(GTK_WIDGET (fs)); -#else - gtk_widget_show(GTK_WIDGET (fs)); -#endif + return; } @@ -1640,11 +1483,8 @@ color_global_cb(GtkWidget *widget _U_, gpointer data) /* decide what file to open (from dfilter code) */ path = get_datafile_path("colorfilters"); -#if GTK_CHECK_VERSION(2,4,0) gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(fs_widget), path); -#else - file_selection_set_current_folder(fs_widget, path); -#endif + g_free((gchar *)path); } @@ -1685,29 +1525,12 @@ file_color_import_cmd_cb(GtkWidget *color_filters, gpointer filter_list _U_) g_signal_connect(file_color_import_w, "destroy", G_CALLBACK(file_color_import_destroy_cb), NULL); -#if GTK_CHECK_VERSION(2,4,0) if (gtk_dialog_run(GTK_DIALOG(file_color_import_w)) == GTK_RESPONSE_ACCEPT) { file_color_import_ok_cb(file_color_import_w, color_filters); } else window_destroy(file_color_import_w); -#else /* GTK_CHECK_VERSION(2,4,0) */ - /* Connect the ok_button to file_open_ok_cb function and pass along a - pointer to the file selection box widget */ - g_signal_connect(GTK_FILE_SELECTION(file_color_import_w)->ok_button, "clicked", - G_CALLBACK(file_color_import_ok_cb), color_filters); - - window_set_cancel_button(file_color_import_w, - GTK_FILE_SELECTION(file_color_import_w)->cancel_button, window_cancel_button_cb); - - g_signal_connect(file_color_import_w, "delete_event", - G_CALLBACK(window_delete_event_cb), NULL); - - - gtk_widget_show(file_color_import_w); - window_present(file_color_import_w); -#endif /* GTK_CHECK_VERSION(2,4,0) */ #endif /* _WIN32 */ } @@ -1716,11 +1539,8 @@ file_color_import_ok_cb(GtkWidget *w, gpointer color_filters) { gchar *cf_name, *s; GtkWidget *fs = gtk_widget_get_toplevel(w); -#if GTK_CHECK_VERSION(2,4,0) cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs))); -#else - cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs))); -#endif + /* Perhaps the user specified a directory instead of a file. Check whether they did. */ if (test_for_directory(cf_name) == EISDIR) { @@ -1740,13 +1560,12 @@ file_color_import_ok_cb(GtkWidget *w, gpointer color_filters) { dismiss the alert box popped up for the open error, try again. */ g_free(cf_name); -#if GTK_CHECK_VERSION(2,4,0) /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), * as this will prevent the user from closing the now existing error * message, simply close the dialog (this is the best we can do here). */ if (file_save_as_w) window_destroy(GTK_WIDGET (fs)); -#endif + return; } @@ -1849,30 +1668,11 @@ file_color_export_cmd_cb(GtkWidget *w _U_, gpointer filter_list) g_signal_connect(file_color_export_w, "destroy", G_CALLBACK(file_color_export_destroy_cb), NULL); -#if GTK_CHECK_VERSION(2,4,0) if (gtk_dialog_run(GTK_DIALOG(file_color_export_w)) == GTK_RESPONSE_ACCEPT) { file_color_export_ok_cb(file_color_export_w, filter_list); } else window_destroy(file_color_export_w); -#else /* GTK_CHECK_VERSION(2,4,0) */ - /* Connect the ok_button to file_export_ok_cb function and pass along a - pointer to the file selection box widget */ - g_signal_connect(GTK_FILE_SELECTION (file_color_export_w)->ok_button, "clicked", - G_CALLBACK(file_color_export_ok_cb), filter_list); - - window_set_cancel_button(file_color_export_w, - GTK_FILE_SELECTION(file_color_export_w)->cancel_button, window_cancel_button_cb); - - g_signal_connect(file_color_export_w, "delete_event", - G_CALLBACK(window_delete_event_cb), NULL); - - - gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_color_export_w), ""); - - gtk_widget_show(file_color_export_w); - window_present(file_color_export_w); -#endif /* GTK_CHECK_VERSION(2,4,0) */ #endif /* _WIN32 */ } @@ -1882,11 +1682,7 @@ file_color_export_ok_cb(GtkWidget *w, gpointer filter_list) { gchar *dirname; GtkWidget *fs = gtk_widget_get_toplevel(w); -#if GTK_CHECK_VERSION(2,4,0) cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs))); -#else - cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs))); -#endif /* Perhaps the user specified a directory instead of a file. Check whether they did. */ @@ -1908,13 +1704,13 @@ file_color_export_ok_cb(GtkWidget *w, gpointer filter_list) { just leave it around so that the user can, after they dismiss the alert box popped up for the error, try again. */ g_free(cf_name); -#if GTK_CHECK_VERSION(2,4,0) + /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), * as this will prevent the user from closing the now existing error * message, simply close the dialog (this is the best we can do here). */ if (file_save_as_w) window_destroy(GTK_WIDGET (fs)); -#endif + return; } |