diff options
author | Stephen Fisher <steve@stephen-fisher.com> | 2008-04-07 03:46:01 +0000 |
---|---|---|
committer | Stephen Fisher <steve@stephen-fisher.com> | 2008-04-07 03:46:01 +0000 |
commit | a398bebdaf691ceeaec536d8c657505d45906451 (patch) | |
tree | efcad19ed10aefd15f38131bcd29eabcc6b08486 /gtk | |
parent | 0a381cca292a228b851e0300a4a428d9c5792a33 (diff) |
Remove GTK1 code and change ugly version checking statements into
GTK_CHECK_VERSION().
svn path=/trunk/; revision=24826
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/airpcap_dlg.c | 5 | ||||
-rw-r--r-- | gtk/conversations_table.c | 30 | ||||
-rw-r--r-- | gtk/dlg_utils.c | 2 | ||||
-rw-r--r-- | gtk/hostlist_table.c | 30 | ||||
-rw-r--r-- | gtk/proto_draw.c | 8 | ||||
-rw-r--r-- | gtk/proto_hier_stats_dlg.c | 2 | ||||
-rw-r--r-- | gtk/webbrowser.c | 22 |
7 files changed, 9 insertions, 90 deletions
diff --git a/gtk/airpcap_dlg.c b/gtk/airpcap_dlg.c index 93c1c59593..8999d70f92 100644 --- a/gtk/airpcap_dlg.c +++ b/gtk/airpcap_dlg.c @@ -2168,11 +2168,8 @@ display_airpcap_advanced_cb(GtkWidget *w, gpointer data) gtk_widget_set_name (capture_type_en, "capture_type_en"); gtk_widget_show (capture_type_en); -#if GTK_VERSION >= 2 - fcs_ck = gtk_check_button_new_with_mnemonic ("Include 802.11 FCS in Frames"); -#else fcs_ck = gtk_check_button_new_with_label ("Include 802.11 FCS in Frames"); -#endif + gtk_widget_set_name (fcs_ck, "fcs_ck"); /* Fcs Presence check box */ diff --git a/gtk/conversations_table.c b/gtk/conversations_table.c index adddcab07c..cca452029e 100644 --- a/gtk/conversations_table.c +++ b/gtk/conversations_table.c @@ -1253,7 +1253,6 @@ draw_ct_table_data_cb(void *arg) draw_ct_table_data(arg); } -#if (GTK_MAJOR_VERSION >= 2) static void copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_) { @@ -1292,7 +1291,6 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_) gtk_clipboard_set_text(cb, CSV_str->str, -1); /* Copy the CSV data into the clipboard */ g_string_free(CSV_str, TRUE); /* Free the memory */ } -#endif static gboolean @@ -1409,10 +1407,8 @@ init_conversation_table(gboolean hide_ports, const char *table_name, const char GtkWidget *bbox; GtkWidget *close_bt, *help_bt; gboolean ret; -#if (GTK_MAJOR_VERSION >= 2) GtkWidget *copy_bt; GtkTooltips *tooltips = gtk_tooltips_new(); -#endif conversations=g_malloc(sizeof(conversations_table)); @@ -1437,31 +1433,22 @@ init_conversation_table(gboolean hide_ports, const char *table_name, const char /* Button row. */ /* XXX - maybe we want to have a "Copy as CSV" stock button here? */ /*copy_bt = gtk_button_new_with_label ("Copy content to clipboard as CSV");*/ -#if (GTK_MAJOR_VERSION >= 2) if(topic_available(HELP_STATS_CONVERSATIONS_DIALOG)) { bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, GTK_STOCK_HELP, NULL); } else { bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, NULL); } -#else - if(topic_available(HELP_STATS_CONVERSATIONS_DIALOG)) { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL); - } else { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - } -#endif + gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); window_set_cancel_button(conversations->win, close_bt, window_cancel_button_cb); -#if (GTK_MAJOR_VERSION >= 2) copy_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_COPY); gtk_tooltips_set_tip(tooltips, copy_bt, "Copy all statistical values of this page to the clipboard in CSV (Comma Separated Values) format.", NULL); OBJECT_SET_DATA(copy_bt, CONV_PTR_KEY, conversations); SIGNAL_CONNECT(copy_bt, "clicked", copy_as_csv_cb, NULL); -#endif if(topic_available(HELP_STATS_CONVERSATIONS_DIALOG)) { help_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_HELP); @@ -1487,7 +1474,6 @@ init_conversation_table(gboolean hide_ports, const char *table_name, const char -#if (GTK_MAJOR_VERSION >= 2) static void ct_nb_switch_page_cb(GtkNotebook *nb, GtkNotebookPage *pg _U_, guint page, gpointer data) { @@ -1500,7 +1486,6 @@ ct_nb_switch_page_cb(GtkNotebook *nb, GtkNotebookPage *pg _U_, guint page, gpoin OBJECT_SET_DATA(copy_bt, CONV_PTR_KEY, pages[page]); } } -#endif static void ct_win_destroy_notebook_cb(GtkWindow *win _U_, gpointer data) @@ -1638,9 +1623,7 @@ init_conversation_notebook_cb(GtkWidget *w _U_, gpointer d _U_) GSList *current_table; register_ct_t *registered; GtkTooltips *tooltips = gtk_tooltips_new(); -#if (GTK_MAJOR_VERSION >= 2) GtkWidget *copy_bt; -#endif pages = g_malloc(sizeof(void *) * (g_slist_length(registered_ct_tables) + 1)); @@ -1696,25 +1679,17 @@ init_conversation_notebook_cb(GtkWidget *w _U_, gpointer d _U_) /* Button row. */ /* XXX - maybe we want to have a "Copy as CSV" stock button here? */ /*copy_bt = gtk_button_new_with_label ("Copy content to clipboard as CSV");*/ -#if (GTK_MAJOR_VERSION >= 2) if(topic_available(HELP_STATS_CONVERSATIONS_DIALOG)) { bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, GTK_STOCK_HELP, NULL); } else { bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, NULL); } -#else - if(topic_available(HELP_STATS_CONVERSATIONS_DIALOG)) { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL); - } else { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - } -#endif + gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); window_set_cancel_button(win, close_bt, window_cancel_button_cb); -#if (GTK_MAJOR_VERSION >= 2) copy_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_COPY); gtk_tooltips_set_tip(tooltips, copy_bt, "Copy all statistical values of this page to the clipboard in CSV (Comma Separated Values) format.", NULL); @@ -1722,7 +1697,6 @@ init_conversation_notebook_cb(GtkWidget *w _U_, gpointer d _U_) OBJECT_SET_DATA(copy_bt, CONV_PTR_KEY, pages[page]); SIGNAL_CONNECT(nb, "switch-page", ct_nb_switch_page_cb, copy_bt); -#endif if(topic_available(HELP_STATS_CONVERSATIONS_DIALOG)) { help_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_HELP); diff --git a/gtk/dlg_utils.c b/gtk/dlg_utils.c index e2f868cccd..89ef24e5d9 100644 --- a/gtk/dlg_utils.c +++ b/gtk/dlg_utils.c @@ -363,7 +363,7 @@ dlg_button_row_new(const gchar *stock_id_first, ...) /* this is called, when a dialog was closed */ static void dlg_destroy_cb(GtkWidget *dialog _U_, gpointer data _U_) { -#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 4 +#if !GTK_CHECK_VERSION(2,4,0) if(top_level) { /* bring main window back to front (workaround for a bug in win32 GTK2.x) XXX - do this only on Windows? */ diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c index a9324a0021..ba66d71513 100644 --- a/gtk/hostlist_table.c +++ b/gtk/hostlist_table.c @@ -630,7 +630,6 @@ draw_hostlist_table_data_cb(void *arg) draw_hostlist_table_data(arg); } -#if (GTK_MAJOR_VERSION >= 2) static void copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_) { @@ -669,7 +668,6 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_) gtk_clipboard_set_text(cb, CSV_str->str, -1); /* Copy the CSV data into the clipboard */ g_string_free(CSV_str, TRUE); /* Free the memory */ } -#endif static gboolean @@ -774,10 +772,8 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap GtkWidget *bbox; GtkWidget *close_bt, *help_bt; gboolean ret; -#if (GTK_MAJOR_VERSION >= 2) GtkWidget *copy_bt; GtkTooltips *tooltips = gtk_tooltips_new(); -#endif hosttable=g_malloc(sizeof(hostlist_table)); @@ -803,31 +799,22 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap /* Button row. */ /* XXX - maybe we want to have a "Copy as CSV" stock button here? */ /*copy_bt = gtk_button_new_with_label ("Copy content to clipboard as CSV");*/ -#if (GTK_MAJOR_VERSION >= 2) if(topic_available(HELP_STATS_CONVERSATIONS_DIALOG)) { bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, GTK_STOCK_HELP, NULL); } else { bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, NULL); } -#else - if(topic_available(HELP_STATS_ENDPOINTS_DIALOG)) { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL); - } else { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - } -#endif + gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); window_set_cancel_button(hosttable->win, close_bt, window_cancel_button_cb); -#if (GTK_MAJOR_VERSION >= 2) copy_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_COPY); gtk_tooltips_set_tip(tooltips, copy_bt, "Copy all statistical values of this page to the clipboard in CSV (Comma Seperated Values) format.", NULL); OBJECT_SET_DATA(copy_bt, HOST_PTR_KEY, hosttable); SIGNAL_CONNECT(copy_bt, "clicked", copy_as_csv_cb, NULL); -#endif if(topic_available(HELP_STATS_ENDPOINTS_DIALOG)) { help_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_HELP); @@ -852,7 +839,6 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap } -#if (GTK_MAJOR_VERSION >= 2) static void ct_nb_switch_page_cb(GtkNotebook *nb, GtkNotebookPage *pg _U_, guint page, gpointer data) { @@ -865,7 +851,6 @@ ct_nb_switch_page_cb(GtkNotebook *nb, GtkNotebookPage *pg _U_, guint page, gpoin OBJECT_SET_DATA(copy_bt, HOST_PTR_KEY, pages[page]); } } -#endif static void @@ -1006,9 +991,7 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) GSList *current_table; register_hostlist_t *registered; GtkTooltips *tooltips = gtk_tooltips_new(); -#if (GTK_MAJOR_VERSION >= 2) GtkWidget *copy_bt; -#endif pages = g_malloc(sizeof(void *) * (g_slist_length(registered_hostlist_tables) + 1)); @@ -1064,25 +1047,17 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) SIGNAL_CONNECT(filter_cb, "toggled", hostlist_filter_toggle_dest, pages); /* Button row. */ -#if (GTK_MAJOR_VERSION >= 2) if(topic_available(HELP_STATS_CONVERSATIONS_DIALOG)) { bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, GTK_STOCK_HELP, NULL); } else { bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, NULL); } -#else - if(topic_available(HELP_STATS_ENDPOINTS_DIALOG)) { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL); - } else { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - } -#endif + gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); window_set_cancel_button(win, close_bt, window_cancel_button_cb); -#if (GTK_MAJOR_VERSION >= 2) copy_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_COPY); gtk_tooltips_set_tip(tooltips, copy_bt, "Copy all statistical values of this page to the clipboard in CSV (Comma Separated Values) format.", NULL); @@ -1090,7 +1065,6 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) OBJECT_SET_DATA(copy_bt, HOST_PTR_KEY, pages[page]); SIGNAL_CONNECT(nb, "switch-page", ct_nb_switch_page_cb, copy_bt); -#endif if(topic_available(HELP_STATS_ENDPOINTS_DIALOG)) { help_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_HELP); diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index 72deb424b0..ab1830c810 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -889,7 +889,7 @@ savehex_save_clicked_cb(GtkWidget * w _U_, gpointer data _U_) const guint8 *data_p = NULL; const char *file = NULL; -#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2 +#if GTK_CHECK_VERSION(2,4,0) file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(savehex_dlg)); #else file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(savehex_dlg)); @@ -993,7 +993,7 @@ void savehex_cb(GtkWidget * w _U_, gpointer data _U_) SIGNAL_CONNECT(savehex_dlg, "destroy", savehex_dlg_destroy_cb, NULL); -#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2 +#if GTK_CHECK_VERSION(2,4,0) if (gtk_dialog_run(GTK_DIALOG(savehex_dlg)) == GTK_RESPONSE_ACCEPT) { savehex_save_clicked_cb(savehex_dlg, savehex_dlg); } else { @@ -1739,11 +1739,7 @@ proto_tree_draw_node(proto_node *node, gpointer data) proto_tree_children_foreach(node, proto_tree_draw_node, &info); path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); if (is_expanded) -/* #if GTK_MINOR_VERSION >= 2 */ gtk_tree_view_expand_to_path(info.tree_view, path); -/*#else - gtk_tree_view_expand_row(info.tree_view, path, FALSE); -#endif*/ else gtk_tree_view_collapse_row(info.tree_view, path); gtk_tree_path_free(path); diff --git a/gtk/proto_hier_stats_dlg.c b/gtk/proto_hier_stats_dlg.c index 5bb8c3bb92..707cb00d07 100644 --- a/gtk/proto_hier_stats_dlg.c +++ b/gtk/proto_hier_stats_dlg.c @@ -373,7 +373,7 @@ create_tree(GtkWidget *container, ph_stats_t *ps) "text", PROTOCOL_COLUMN, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); -#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2 +#if GTK_CHECK_VERSION(2,4,0) gtk_tree_view_column_set_expand(column, TRUE); #endif gtk_tree_view_append_column(tree_view, column); diff --git a/gtk/webbrowser.c b/gtk/webbrowser.c index abf19a88fa..bbcfd4f4df 100644 --- a/gtk/webbrowser.c +++ b/gtk/webbrowser.c @@ -65,16 +65,6 @@ #define MUST_LAUNCH_BROWSER_OURSELVES #endif -/* - * XXX - we use GLib 2.x routines to launch the browser ourselves, so we - * can't do it if we're using GLib 1.2[.x]. - */ -#ifdef MUST_LAUNCH_BROWSER_OURSELVES -#if (GLIB_MAJOR_VERSION < 2) -#undef MUST_LAUNCH_BROWSER_OURSELVES /* *can't* launch browser ourselves */ -#endif /* (GLIB_MAJOR_VERSION < 2) */ -#endif /* MUST_LAUNCH_BROWSER_OURSELVES */ - #ifdef MUST_LAUNCH_BROWSER_OURSELVES static gchar* strreplace (const gchar *string, const gchar *delimiter, @@ -201,18 +191,6 @@ browser_open_url (const gchar *url) g_strfreev (argv); return retval; - -#else - /* GLIB version 1.x doesn't support the functions used above, - so simply do nothing for now, to be able to compile. - XXX - has to be improved */ - simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK, - PRIMARY_TEXT_START "Web browser access not implemented." PRIMARY_TEXT_END - "\n\nThis Wireshark version (using the GLib 1.x toolkit) can't access web browsers. " - "\n\nYou may try to open the following URL in your web browser: \n\n" - "%s", - url); - return FALSE; #endif } |