diff options
-rw-r--r-- | gtk/layout_prefs.c | 72 | ||||
-rw-r--r-- | gtk/main_welcome.c | 54 | ||||
-rw-r--r-- | gtk/menu.c | 20 | ||||
-rw-r--r-- | gtk/packet_win.c | 71 | ||||
-rw-r--r-- | gtk/plugins_dlg.c | 2 | ||||
-rw-r--r-- | gtk/prefs_dlg.c | 151 | ||||
-rw-r--r-- | gtk/print_dlg.c | 34 | ||||
-rw-r--r-- | gtk/profile_dlg.c | 6 | ||||
-rw-r--r-- | gtk/progress_dlg.c | 7 | ||||
-rw-r--r-- | gtk/proto_dlg.c | 109 | ||||
-rw-r--r-- | gtk/proto_draw.c | 478 | ||||
-rw-r--r-- | gtk/proto_hier_stats_dlg.c | 81 | ||||
-rw-r--r-- | gtk/range_utils.c | 7 | ||||
-rw-r--r-- | gtk/recent.c | 6 | ||||
-rw-r--r-- | gtk/rtp_analysis.c | 116 | ||||
-rw-r--r-- | gtk/rtp_player.c | 3 | ||||
-rw-r--r-- | gtk/rtp_stream_dlg.c | 8 | ||||
-rw-r--r-- | gtk/sctp_byte_graph_dlg.c | 106 | ||||
-rw-r--r-- | gtk/sctp_graph_dlg.c | 103 |
19 files changed, 16 insertions, 1418 deletions
diff --git a/gtk/layout_prefs.c b/gtk/layout_prefs.c index e9f5141344..0d67c821d3 100644 --- a/gtk/layout_prefs.c +++ b/gtk/layout_prefs.c @@ -246,52 +246,25 @@ layout_defaults_cb (GtkWidget * w _U_, gpointer data _U_) } #define SCROLLBAR_PLACEMENT_KEY "scrollbar_placement" -#if GTK_MAJOR_VERSION < 2 -#define PTREE_LINE_STYLE_KEY "ptree_line_style" -#define PTREE_EXPANDER_STYLE_KEY "ptree_expander_style" -#else #define ALTERN_COLORS_KEY "altern_colors" -#endif #define HEX_DUMP_HIGHLIGHT_STYLE_KEY "hex_dump_highlight_style" #define FILTER_TOOLBAR_PLACEMENT_KEY "filter_toolbar_show_in_statusbar" #define GUI_TOOLBAR_STYLE_KEY "toolbar_style" #define GUI_WINDOW_TITLE_KEY "window_title" -#if GTK_MAJOR_VERSION < 2 -#define GUI_TABLE_ROWS 6 -#else #define GUI_TABLE_ROWS 5 -#endif static const enum_val_t scrollbar_placement_vals[] = { { "FALSE", "Left", FALSE }, { "TRUE", "Right", TRUE }, { NULL, NULL, 0 } }; -#if GTK_MAJOR_VERSION < 2 -static const enum_val_t line_style_vals[] = { - { "NONE", "None", 0 }, - { "SOLID", "Solid", 1 }, - { "DOTTED", "Dotted", 2 }, - { "TABBED", "Tabbed", 3 }, - { NULL, NULL, 0 } -}; - -static const enum_val_t expander_style_vals[] = { - { "NONE", "None", 0 }, - { "SQUARE", "Square", 1 }, - { "TRIANGLE", "Triangle", 2 }, - { "CIRCULAR", "Circular", 3 }, - { NULL, NULL, 0 } -}; -#else static const enum_val_t altern_colors_vals[] = { { "FALSE", "No", FALSE }, { "TRUE", "Yes", TRUE }, { NULL, NULL, 0 } }; -#endif static const enum_val_t highlight_style_vals[] = { { "FALSE", "Bold", FALSE }, { "TRUE", "Inverse", TRUE }, @@ -312,21 +285,13 @@ static const enum_val_t toolbar_style_vals[] = { GtkWidget* layout_prefs_show(void) { -#if GTK_MAJOR_VERSION < 2 - GtkAccelGroup *accel_group; -#endif - GtkWidget *main_vb, *button_hb, *type_tb; GtkWidget *pane_fr, *pane_vb; GtkWidget *radio_hb, *radio_vb; GtkWidget *default_vb, *default_bt; GtkWidget *main_tb, *hbox; GtkWidget *scrollbar_om; -#if GTK_MAJOR_VERSION < 2 - GtkWidget *expander_style_om, *line_style_om; -#else GtkWidget *altern_colors_om; -#endif GtkWidget *highlight_style_om; GtkWidget *toolbar_style_om; GtkWidget *filter_toolbar_placement_om; @@ -347,14 +312,6 @@ layout_prefs_show(void) main_vb = gtk_vbox_new(FALSE, 7); gtk_container_set_border_width(GTK_CONTAINER(main_vb), 5); -#if GTK_MAJOR_VERSION < 2 - /* Accelerator group for the accelerators (or, as they're called in - Windows and, I think, in Motif, "mnemonics"; Alt+<key> is a mnemonic, - Ctrl+<key> is an accelerator). */ - accel_group = gtk_accel_group_new(); - /*gtk_window_add_accel_group(GTK_WINDOW(main_win), accel_group);*/ -#endif - /* pane frame */ pane_fr = gtk_frame_new("Panes"); gtk_box_pack_start(GTK_BOX(main_vb), pane_fr, FALSE, FALSE, 0); @@ -435,27 +392,6 @@ layout_prefs_show(void) "will be displayed in the panes.", NULL); OBJECT_SET_DATA(main_vb, SCROLLBAR_PLACEMENT_KEY, scrollbar_om); -#if GTK_MAJOR_VERSION < 2 - /* Tree line style */ - line_style_om = create_preference_option_menu(main_tb, pos++, - "Tree line style:", NULL, line_style_vals, - prefs.gui_ptree_line_style); - gtk_tooltips_set_tip(tooltips, line_style_om, - "Select the style in which trees " - "will be displayed in the packet " - "detail pane.", NULL); - OBJECT_SET_DATA(main_vb, PTREE_LINE_STYLE_KEY, line_style_om); - - /* Tree expander style */ - expander_style_om = create_preference_option_menu(main_tb, pos++, - "Tree expander style:", NULL, expander_style_vals, - prefs.gui_ptree_expander_style); - gtk_tooltips_set_tip(tooltips, expander_style_om, - "Select the style in which the " - "expander will be displayed in " - "the panes displayed.", NULL); - OBJECT_SET_DATA(main_vb, PTREE_EXPANDER_STYLE_KEY, expander_style_om); -#else /* Alternating row colors in list and tree views */ altern_colors_om = create_preference_option_menu(main_tb, pos++, "Alternating row colors in lists and trees:", NULL, @@ -464,7 +400,6 @@ layout_prefs_show(void) "Select whether or not the rows of " "lists and trees have alternating color.", NULL); OBJECT_SET_DATA(main_vb, ALTERN_COLORS_KEY, altern_colors_om); -#endif /* Hex Dump highlight style */ highlight_style_om = create_preference_option_menu(main_tb, pos++, @@ -531,15 +466,8 @@ layout_prefs_fetch(GtkWidget *w) OBJECT_GET_DATA(w, SCROLLBAR_PLACEMENT_KEY), scrollbar_placement_vals); -#if GTK_MAJOR_VERSION < 2 - prefs.gui_ptree_line_style = fetch_enum_value( - OBJECT_GET_DATA(w, PTREE_LINE_STYLE_KEY), line_style_vals); - prefs.gui_ptree_expander_style = fetch_enum_value( - OBJECT_GET_DATA(w, PTREE_EXPANDER_STYLE_KEY), expander_style_vals); -#else prefs.gui_altern_colors = fetch_enum_value( OBJECT_GET_DATA(w, ALTERN_COLORS_KEY), altern_colors_vals); -#endif prefs.filter_toolbar_show_in_statusbar = fetch_enum_value( OBJECT_GET_DATA(w, FILTER_TOOLBAR_PLACEMENT_KEY), filter_toolbar_placement_vals); prefs.gui_hex_dump_highlight_style = fetch_enum_value( diff --git a/gtk/main_welcome.c b/gtk/main_welcome.c index cc413e69b8..c6782c0e29 100644 --- a/gtk/main_welcome.c +++ b/gtk/main_welcome.c @@ -44,31 +44,25 @@ welcome_item(const gchar *stock_item, const gchar * label, const gchar * message GtkSignalFunc callback, void *callback_data) { GtkWidget *w, *item_hb; -#if GTK_MAJOR_VERSION >= 2 gchar *formatted_message; GtkTooltips *tooltips; tooltips = gtk_tooltips_new(); -#endif item_hb = gtk_hbox_new(FALSE, 1); w = BUTTON_NEW_FROM_STOCK(stock_item); WIDGET_SET_SIZE(w, 80, 40); -#if GTK_MAJOR_VERSION >= 2 gtk_button_set_label(GTK_BUTTON(w), label); gtk_tooltips_set_tip(tooltips, w, tooltip, NULL); -#endif gtk_box_pack_start(GTK_BOX(item_hb), w, FALSE, FALSE, 0); SIGNAL_CONNECT(w, "clicked", callback, callback_data); w = gtk_label_new(message); gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.5); -#if GTK_MAJOR_VERSION >= 2 formatted_message = g_strdup_printf("<span weight=\"bold\" size=\"x-large\">%s</span>", message); gtk_label_set_markup(GTK_LABEL(w), formatted_message); g_free(formatted_message); -#endif gtk_box_pack_start(GTK_BOX(item_hb), w, FALSE, FALSE, 10); @@ -100,9 +94,7 @@ welcome_header_new(void) get_color(&bg); eb = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eb), item_vb); -#if GTK_MAJOR_VERSION >= 2 gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &bg); -#endif item_hb = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(item_vb), item_hb, FALSE, FALSE, 10); @@ -111,15 +103,9 @@ welcome_header_new(void) /*icon = xpm_to_widget_from_parent(top_level, wsicon64_xpm);*/ gtk_box_pack_start(GTK_BOX(item_hb), icon, FALSE, FALSE, 10); -#if GTK_MAJOR_VERSION < 2 - message = "The World's Most Popular Network Protocol Analyzer"; -#else message = "<span weight=\"bold\" size=\"x-large\">" "The World's Most Popular Network Protocol Analyzer" "</span>"; -#endif w = gtk_label_new(message); -#if GTK_MAJOR_VERSION >= 2 gtk_label_set_markup(GTK_LABEL(w), message); -#endif gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.5); gtk_box_pack_start(GTK_BOX(item_hb), w, TRUE, TRUE, 5); @@ -134,17 +120,13 @@ welcome_topic_header_new(const char *header) GtkWidget *w; GdkColor bg; GtkWidget *eb; -#if GTK_MAJOR_VERSION >= 2 gchar *formatted_message; -#endif w = gtk_label_new(header); -#if GTK_MAJOR_VERSION >= 2 formatted_message = g_strdup_printf("<span weight=\"bold\" size=\"x-large\">%s</span>", header); gtk_label_set_markup(GTK_LABEL(w), formatted_message); g_free(formatted_message); -#endif /* topic header background color */ bg.pixel = 0; @@ -156,9 +138,7 @@ welcome_topic_header_new(const char *header) get_color(&bg); eb = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eb), w); -#if GTK_MAJOR_VERSION >= 2 gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &bg); -#endif return eb; } @@ -192,16 +172,13 @@ welcome_topic_new(const char *header, GtkWidget **to_fill) get_color(&bg); topic_eb = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(topic_eb), topic_vb); -#if GTK_MAJOR_VERSION >= 2 gtk_widget_modify_bg(topic_eb, GTK_STATE_NORMAL, &bg); -#endif *to_fill = layout_vb; return topic_eb; } -#if GTK_MAJOR_VERSION >= 2 static gboolean welcome_link_enter_cb(GtkWidget *widget _U_, GdkEventCrossing *event _U_, gpointer user_data) { @@ -209,9 +186,7 @@ welcome_link_enter_cb(GtkWidget *widget _U_, GdkEventCrossing *event _U_, gpoint GtkWidget *w = user_data; message = g_strdup_printf("<span foreground='blue' underline='single'>%s</span>", OBJECT_GET_DATA(w,"TEXT")); -#if GTK_MAJOR_VERSION >= 2 gtk_label_set_markup(GTK_LABEL(w), message); -#endif g_free(message); return FALSE; @@ -224,14 +199,11 @@ welcome_link_leave_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer user_ GtkWidget *w = user_data; message = g_strdup_printf("<span foreground='blue'>%s</span>", OBJECT_GET_DATA(w,"TEXT")); -#if GTK_MAJOR_VERSION >= 2 gtk_label_set_markup(GTK_LABEL(w), message); -#endif g_free(message); return FALSE; } -#endif static gboolean @@ -249,26 +221,18 @@ welcome_link_new(const gchar *text, GtkWidget **label /*, void *callback, void * GtkWidget *w; GtkWidget *eb; -#if GTK_MAJOR_VERSION < 2 - message = g_strdup(text); -#else message = g_strdup_printf("<span foreground='blue'>%s</span>", text); -#endif w = gtk_label_new(message); *label = w; -#if GTK_MAJOR_VERSION >= 2 gtk_label_set_markup(GTK_LABEL(w), message); -#endif g_free(message); /* event box */ eb = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eb), w); -#if GTK_MAJOR_VERSION >= 2 SIGNAL_CONNECT(eb, "enter-notify-event", welcome_link_enter_cb, w); SIGNAL_CONNECT(eb, "leave-notify-event", welcome_link_leave_cb, w); -#endif SIGNAL_CONNECT(eb, "button-press-event", welcome_link_press_cb, w); /* XXX - memleak */ @@ -316,25 +280,19 @@ welcome_if_new(const char *if_name, GdkColor *topic_bg, gboolean active) w = welcome_link_new("START", &label); gtk_tooltips_set_tip(tooltips, w, "Immediately start a capture on this interface", NULL); -#if GTK_MAJOR_VERSION >= 2 gtk_widget_modify_bg(w, GTK_STATE_NORMAL, topic_bg); -#endif gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(interface_hb), w, FALSE, FALSE, 0); w = welcome_link_new("OPTIONS", &label); gtk_tooltips_set_tip(tooltips, w, "Show the capture options of this interface", NULL); -#if GTK_MAJOR_VERSION >= 2 gtk_widget_modify_bg(w, GTK_STATE_NORMAL, topic_bg); -#endif gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(interface_hb), w, FALSE, FALSE, 0); w = welcome_link_new("DETAILS", &label); gtk_tooltips_set_tip(tooltips, w, "Show detailed information about this interface", NULL); -#if GTK_MAJOR_VERSION >= 2 gtk_widget_modify_bg(w, GTK_STATE_NORMAL, topic_bg); -#endif gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(interface_hb), w, FALSE, FALSE, 0); @@ -345,17 +303,13 @@ welcome_if_new(const char *if_name, GdkColor *topic_bg, gboolean active) g_string_truncate(message, 35); g_string_append (message, " ..."); } -#if GTK_MAJOR_VERSION >= 2 /* if this is the "active" interface, display it bold */ if(active) { g_string_prepend(message, "<span weight=\"bold\">"); g_string_append (message, "</span>"); } -#endif w = gtk_label_new(message->str); -#if GTK_MAJOR_VERSION >= 2 gtk_label_set_markup(GTK_LABEL(w), message->str); -#endif g_string_free(message, TRUE); gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.0); @@ -482,25 +436,19 @@ welcome_new(void) gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 5); w = welcome_link_new("C:\\Testfiles\\hello.pcap", &label); -#if GTK_MAJOR_VERSION >= 2 gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_bg); -#endif gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); w = welcome_filename_link_new("C:\\Testfiles\\hello2.pcap", &label); -#if GTK_MAJOR_VERSION >= 2 gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_bg); -#endif gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); w = welcome_filename_link_new( "C:\\Testfiles\\to avoid screen garbage\\Unfortunately this is a very long filename which had to be truncated.pcap", &label); -#if GTK_MAJOR_VERSION >= 2 gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_bg); -#endif gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); @@ -516,7 +464,6 @@ welcome_new(void) topic_vb = welcome_topic_new("Online", &topic_to_fill); gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0); -#if (GLIB_MAJOR_VERSION >= 2) item_hb = welcome_item(WIRESHARK_STOCK_WEB_SUPPORT, "Help", "Show the User's Guide", @@ -530,7 +477,6 @@ welcome_new(void) "Visit www.wireshark.org, the project's home page", GTK_SIGNAL_FUNC(topic_cb), GINT_TO_POINTER(ONLINEPAGE_HOME)); gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5); -#endif /* topic updates */ topic_vb = welcome_topic_new("Updates", &topic_to_fill); diff --git a/gtk/menu.c b/gtk/menu.c index 4b7dafb3fd..c1919b83d2 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -87,9 +87,7 @@ #include "u3.h" #include "macros_dlg.h" -#if GTK_MAJOR_VERSION >= 2 #include "export_object.h" -#endif #ifdef NEED_G_ASCII_STRCASECMP_H #include "../epan/g_ascii_strcasecmp.h" @@ -457,7 +455,7 @@ static GtkItemFactoryEntry menu_items[] = ITEM_FACTORY_STOCK_ENTRY("/File/File Set/Previous File", NULL, fileset_previous_cb, 0, WIRESHARK_STOCK_FILE_SET_PREVIOUS), ITEM_FACTORY_ENTRY("/File/<separator>", NULL, NULL, 0, "<Separator>", NULL), ITEM_FACTORY_ENTRY("/File/_Export", NULL, NULL, 0, "<Branch>", NULL), -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 ITEM_FACTORY_ENTRY("/File/Export/File...", NULL, export_text_cmd_cb, 0, NULL, NULL), #else @@ -523,9 +521,7 @@ static GtkItemFactoryEntry menu_items[] = ITEM_FACTORY_ENTRY("/Edit/Find Next Reference", NULL, reftime_frame_cb, REFTIME_FIND_NEXT, NULL, NULL), ITEM_FACTORY_ENTRY("/Edit/Find Previous Reference", NULL, reftime_frame_cb, REFTIME_FIND_PREV, NULL, NULL), ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL), -#if GTK_MAJOR_VERSION >= 2 ITEM_FACTORY_ENTRY("/Edit/_Configuration Profiles...", "<shift><control>A", profile_dialog_cb, 0, NULL, NULL), -#endif ITEM_FACTORY_STOCK_ENTRY("/Edit/_Preferences...", "<shift><control>P", prefs_cb, 0, GTK_STOCK_PREFERENCES), ITEM_FACTORY_ENTRY("/_View", NULL, NULL, 0, "<Branch>", NULL), @@ -723,7 +719,6 @@ static GtkItemFactoryEntry menu_items[] = ITEM_FACTORY_ENTRY("/_Help", NULL, NULL, 0, "<Branch>", NULL), ITEM_FACTORY_STOCK_ENTRY("/Help/_Contents", "F1", topic_menu_cb, HELP_CONTENT, GTK_STOCK_HELP), ITEM_FACTORY_ENTRY("/Help/_Supported Protocols", NULL, supported_cb, 0, NULL, NULL), -#if (GLIB_MAJOR_VERSION >= 2) ITEM_FACTORY_ENTRY("/Help/Manual Pages", NULL, NULL, 0, "<Branch>", NULL), ITEM_FACTORY_ENTRY("/Help/Manual Pages/Wireshark", NULL, topic_menu_cb, LOCALPAGE_MAN_WIRESHARK, NULL, NULL), ITEM_FACTORY_ENTRY("/Help/Manual Pages/Wireshark Filter", NULL, topic_menu_cb, LOCALPAGE_MAN_WIRESHARK_FILTER, NULL, NULL), @@ -741,7 +736,6 @@ static GtkItemFactoryEntry menu_items[] = ITEM_FACTORY_ENTRY("/Help/Wireshark Online/FAQ's", NULL, topic_menu_cb, ONLINEPAGE_FAQ, NULL, NULL), ITEM_FACTORY_ENTRY("/Help/Wireshark Online/Downloads", NULL, topic_menu_cb, ONLINEPAGE_DOWNLOAD, NULL, NULL), ITEM_FACTORY_ENTRY("/Help/Wireshark Online/Example Files", NULL, topic_menu_cb, ONLINEPAGE_SAMPLE_FILES, NULL, NULL), -#endif ITEM_FACTORY_ENTRY("/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL), ITEM_FACTORY_STOCK_ENTRY("/Help/_About Wireshark", NULL, about_wireshark_cb, 0, WIRESHARK_STOCK_ABOUT) @@ -953,9 +947,7 @@ static GtkItemFactoryEntry packet_list_menu_items[] = ITEM_FACTORY_ENTRY("/Copy/Bytes (Printable Text Only)", NULL, copy_hex_cb, CD_TEXTONLY, NULL, NULL), ITEM_FACTORY_ENTRY("/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL), ITEM_FACTORY_ENTRY("/Copy/Bytes (Hex Stream)", NULL, copy_hex_cb, CD_HEX, NULL, NULL), -#if GTK_MAJOR_VERSION >= 2 ITEM_FACTORY_ENTRY("/Copy/Bytes (Binary Stream)", NULL, copy_hex_cb, CD_BINARY, NULL, NULL), -#endif ITEM_FACTORY_ENTRY("/Export Selected Packet Bytes...", NULL, savehex_cb, 0, NULL, NULL), @@ -1038,9 +1030,7 @@ static GtkItemFactoryEntry tree_view_menu_items[] = ITEM_FACTORY_ENTRY("/Copy/Bytes (Printable Text Only)", NULL, copy_hex_cb, CD_TEXTONLY | CD_FLAGS_SELECTEDONLY, NULL, NULL), ITEM_FACTORY_ENTRY("/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL), ITEM_FACTORY_ENTRY("/Copy/Bytes (Hex Stream)", NULL, copy_hex_cb, CD_HEX | CD_FLAGS_SELECTEDONLY, NULL, NULL), -#if GTK_MAJOR_VERSION >= 2 ITEM_FACTORY_ENTRY("/Copy/Bytes (Binary Stream)", NULL, copy_hex_cb, CD_BINARY | CD_FLAGS_SELECTEDONLY, NULL, NULL), -#endif ITEM_FACTORY_ENTRY("/Export Selected Packet Bytes...", NULL, savehex_cb, 0, NULL, NULL), @@ -1401,7 +1391,6 @@ static guint merge_tap_menus_layered(GList *node, gint group) { entry = g_malloc0(sizeof (GtkItemFactoryEntry)); entry->path = node_data->name; entry->callback = node_data->callback; -#if GTK_MAJOR_VERSION >= 2 switch(group) { case(REGISTER_STAT_GROUP_NONE): break; @@ -1434,7 +1423,6 @@ static guint merge_tap_menus_layered(GList *node, gint group) { default: g_assert_not_reached(); } -#endif gtk_item_factory_create_item(main_menu_factory, entry, node_data->callback_data, /* callback_type */ 2); set_menu_sensitivity(main_menu_factory, node_data->name, FALSE); /* no capture file yet */ added++; @@ -1798,11 +1786,7 @@ add_menu_recent_capture_file_absolute(gchar *cf_name) { gtk_widget_show (menu_item); /* add new "clear list" item at last position */ -#if GTK_MAJOR_VERSION < 2 - menu_item = gtk_menu_item_new_with_label("<Clear File List>"); -#else menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR, NULL); -#endif gtk_menu_append (GTK_MENU(submenu_recent_files), menu_item); SIGNAL_CONNECT_OBJECT(GTK_OBJECT(menu_item), "activate", clear_menu_recent_capture_file_cmd_cb, (GtkObject *) menu_item); @@ -2377,7 +2361,6 @@ popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data) return TRUE; } } -#if GTK_MAJOR_VERSION >= 2 /* GDK_2BUTTON_PRESS is a doubleclick -> expand/collapse tree row */ /* GTK version 1 seems to be doing this automatically */ if (widget == tree_view && event->type == GDK_2BUTTON_PRESS) { @@ -2396,7 +2379,6 @@ popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data) gtk_tree_path_free(path); } } -#endif return FALSE; } diff --git a/gtk/packet_win.c b/gtk/packet_win.c index 1324ca76ea..36d02293a4 100644 --- a/gtk/packet_win.c +++ b/gtk/packet_win.c @@ -84,17 +84,9 @@ struct PacketWinData { /* List of all the packet-detail windows popped up. */ static GList *detail_windows; -#if GTK_MAJOR_VERSION < 2 -static void new_tree_view_select_row_cb(GtkCTree *ctree, GList *node, - gint column, gpointer user_data); - -static void new_tree_view_unselect_row_cb( GtkCTree *ctree, GList *node, - gint column, gpointer user_data); -#else static void new_tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data); -#endif static void destroy_new_window(GtkObject *object, gpointer user_data); @@ -169,16 +161,8 @@ void new_window_cb(GtkWidget *w _U_) detail_windows = g_list_append(detail_windows, DataPtr); /* load callback handlers */ -#if GTK_MAJOR_VERSION < 2 - SIGNAL_CONNECT(tree_view, "tree-select-row", new_tree_view_select_row_cb, - DataPtr); - - SIGNAL_CONNECT(tree_view, "tree-unselect-row", new_tree_view_unselect_row_cb, - DataPtr); -#else SIGNAL_CONNECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)), "changed", new_tree_view_selection_changed_cb, DataPtr); -#endif SIGNAL_CONNECT(main_w, "destroy", destroy_new_window, DataPtr); @@ -201,60 +185,6 @@ destroy_new_window(GtkObject *object _U_, gpointer user_data) g_free(DataPtr); } -#if GTK_MAJOR_VERSION < 2 -/* called when a tree row is selected in the popup packet window */ -static void -new_tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column _U_, - gpointer user_data) -{ - field_info *finfo; - GtkWidget *byte_view; - const guint8 *data; - guint len; - - struct PacketWinData *DataPtr = (struct PacketWinData*)user_data; - - g_assert(node); - finfo = gtk_ctree_node_get_row_data( ctree, GTK_CTREE_NODE(node) ); - if (!finfo) return; - - set_notebook_page(DataPtr->bv_nb_ptr, finfo->ds_tvb); - byte_view = get_notebook_bv_ptr(DataPtr->bv_nb_ptr); - if ( !byte_view) /* exit if no hex window to write in */ - return; - - data = get_byte_view_data_and_length(byte_view, &len); - if (data == NULL) { - data = DataPtr->pd; - len = DataPtr->frame->cap_len; - } - - DataPtr->finfo_selected = finfo; - packet_hex_print(byte_view, data, DataPtr->frame, finfo, len); -} - -/* called when a tree row is unselected in the popup packet window */ -static void -new_tree_view_unselect_row_cb(GtkCTree *ctree _U_, GList *node _U_, - gint column _U_, gpointer user_data) -{ - GtkWidget* byte_view; - const guint8* data; - guint len; - - struct PacketWinData *DataPtr = (struct PacketWinData*)user_data; - - DataPtr->finfo_selected = NULL; - - byte_view = get_notebook_bv_ptr(DataPtr->bv_nb_ptr); - if ( !byte_view) /* exit if no hex window to write in */ - return; - - data = get_byte_view_data_and_length(byte_view, &len); - g_assert(data != NULL); - packet_hex_reprint(byte_view); -} -#else /* called when a tree row is (un)selected in the popup packet window */ static void new_tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data) @@ -301,7 +231,6 @@ new_tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data) packet_hex_reprint(byte_view); } } -#endif /* Functions called from elsewhere to act on all popup packet windows. */ diff --git a/gtk/plugins_dlg.c b/gtk/plugins_dlg.c index 23dfad4028..680367c883 100644 --- a/gtk/plugins_dlg.c +++ b/gtk/plugins_dlg.c @@ -89,10 +89,8 @@ about_plugins_page_new(void) scrolledwindow = scrolled_window_new(NULL, NULL); -#if GTK_MAJOR_VERSION >= 2 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_SHADOW_IN); -#endif plugins_list = simple_list_new(3 , titles); plugins_scan(plugins_list); diff --git a/gtk/prefs_dlg.c b/gtk/prefs_dlg.c index c64babc10c..3c1e9c15bd 100644 --- a/gtk/prefs_dlg.c +++ b/gtk/prefs_dlg.c @@ -78,12 +78,7 @@ static void prefs_main_save_cb(GtkWidget *, gpointer); static void prefs_main_cancel_cb(GtkWidget *, gpointer); static gboolean prefs_main_delete_event_cb(GtkWidget *, GdkEvent *, gpointer); static void prefs_main_destroy_cb(GtkWidget *, gpointer); -#if GTK_MAJOR_VERSION < 2 -static void prefs_tree_select_cb(GtkCTree *, GtkCTreeNode *, gint, - gpointer); -#else static void prefs_tree_select_cb(GtkTreeSelection *, gpointer); -#endif #define E_PREFSW_SCROLLW_KEY "prefsw_scrollw" @@ -123,11 +118,7 @@ struct ct_struct { GtkWidget *main_vb; GtkWidget *notebook; GtkWidget *tree; -#if GTK_MAJOR_VERSION < 2 - GtkCTreeNode *node; -#else GtkTreeIter iter; -#endif GtkTooltips *tooltips; gint page; gboolean is_protocol; @@ -276,13 +267,8 @@ module_prefs_show(module_t *module, gpointer user_data) struct ct_struct child_cts; GtkWidget *main_vb, *main_tb, *frame, *main_sw; gchar label_str[MAX_TREE_NODE_NAME_LEN]; -#if GTK_MAJOR_VERSION < 2 - gchar *label_ptr = label_str; - GtkCTreeNode *ct_node; -#else GtkTreeStore *model; GtkTreeIter iter; -#endif /* * Is this module a subtree, with modules underneath it? @@ -307,17 +293,11 @@ module_prefs_show(module_t *module, gpointer user_data) * Add this module to the tree. */ g_strlcpy(label_str, module->title, MAX_TREE_NODE_NAME_LEN); -#if GTK_MAJOR_VERSION < 2 - ct_node = gtk_ctree_insert_node(GTK_CTREE(cts->tree), cts->node, NULL, - &label_ptr, 5, NULL, NULL, NULL, NULL, !prefs_module_has_submodules(module), - FALSE); -#else model = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(cts->tree))); if (prefs_module_has_submodules(module) && !cts->iter.stamp) gtk_tree_store_append(model, &iter, NULL); else gtk_tree_store_append(model, &iter, &cts->iter); -#endif /* * Is this a subtree? @@ -327,22 +307,13 @@ module_prefs_show(module_t *module, gpointer user_data) * Yes. */ -#if GTK_MAJOR_VERSION < 2 - gtk_ctree_node_set_row_data(GTK_CTREE(cts->tree), ct_node, - GINT_TO_POINTER(-1)); -#else gtk_tree_store_set(model, &iter, 0, label_str, 1, -1, -1); -#endif /* * Walk the subtree and attach stuff to it. */ child_cts = *cts; -#if GTK_MAJOR_VERSION < 2 - child_cts.node = ct_node; -#else child_cts.iter = iter; -#endif if (module == protocols_module) child_cts.is_protocol = TRUE; prefs_modules_foreach_submodules(module, module_prefs_show, &child_cts); @@ -388,14 +359,8 @@ module_prefs_show(module_t *module, gpointer user_data) gtk_notebook_append_page(GTK_NOTEBOOK(cts->notebook), main_sw, NULL); /* Attach the page to the tree item */ -#if GTK_MAJOR_VERSION < 2 - gtk_ctree_node_set_row_data(GTK_CTREE(cts->tree), ct_node, - GINT_TO_POINTER(cts->page)); - OBJECT_SET_DATA(frame, E_PAGE_ITER_KEY, ct_node); -#else gtk_tree_store_set(model, &iter, 0, label_str, 1, cts->page, -1); OBJECT_SET_DATA(frame, E_PAGE_ITER_KEY, gtk_tree_iter_copy(&iter)); -#endif cts->page++; @@ -404,13 +369,7 @@ module_prefs_show(module_t *module, gpointer user_data) } else { /* show the blank page */ -#if GTK_MAJOR_VERSION < 2 - gtk_ctree_node_set_row_data(GTK_CTREE(cts->tree), ct_node, - GINT_TO_POINTER(blank_page)); -#else - gtk_tree_store_set(model, &iter, 0, label_str, 1, blank_page, -1); -#endif - + gtk_tree_store_set(model, &iter, 0, label_str, 1, blank_page, -1); } @@ -418,36 +377,19 @@ module_prefs_show(module_t *module, gpointer user_data) } -#if GTK_MAJOR_VERSION < 2 -#define prefs_tree_iter GtkCTreeNode * -#else #define prefs_tree_iter GtkTreeIter -#endif /* add a page to the tree */ static prefs_tree_iter prefs_tree_page_add(const gchar *title, gint page_nr, gpointer store, prefs_tree_iter *parent_iter, gboolean has_child -#if GTK_MAJOR_VERSION >= 2 - _U_ -#endif - ) + _U_) { -#if GTK_MAJOR_VERSION < 2 - const gchar *label_ptr = title; -#endif prefs_tree_iter iter; -#if GTK_MAJOR_VERSION < 2 - iter = gtk_ctree_insert_node(GTK_CTREE(store), parent_iter ? *parent_iter : NULL, NULL, - (gchar **) &label_ptr, 5, NULL, NULL, NULL, NULL, !has_child, TRUE); - gtk_ctree_node_set_row_data(GTK_CTREE(store), iter, - GINT_TO_POINTER(page_nr)); -#else gtk_tree_store_append(store, &iter, parent_iter); gtk_tree_store_set(store, &iter, 0, title, 1, page_nr, -1); -#endif return iter; } @@ -478,16 +420,11 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_) GtkWidget *gui_font_pg; gchar label_str[MAX_TREE_NODE_NAME_LEN]; struct ct_struct cts; -#if GTK_MAJOR_VERSION < 2 - gpointer store = NULL; - static gchar *fixedwidths[] = { "c", "m", NULL }; -#else GtkTreeStore *store; GtkTreeSelection *selection; GtkCellRenderer *renderer; GtkTreeViewColumn *column; gint col_offset; -#endif prefs_tree_iter gui_iter; @@ -524,10 +461,8 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_) /* scrolled window on the left for the categories tree */ ct_sb = scrolled_window_new(NULL, NULL); -#if GTK_MAJOR_VERSION >= 2 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ct_sb), GTK_SHADOW_IN); -#endif gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ct_sb), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(top_hb), ct_sb); @@ -535,14 +470,6 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_) OBJECT_SET_DATA(prefs_w, E_PREFSW_SCROLLW_KEY, ct_sb); /* categories tree */ -#if GTK_MAJOR_VERSION < 2 - cts.tree = ctree_new(1, 0); - store = cts.tree; - cts.node = NULL; - gtk_clist_set_column_auto_resize(GTK_CLIST(cts.tree), 0, TRUE); - SIGNAL_CONNECT(cts.tree, "tree-select-row", prefs_tree_select_cb, NULL); - OBJECT_SET_DATA(prefs_w, E_PREFSW_TREE_KEY, cts.tree); -#else store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_INT); cts.tree = tree_view_new(GTK_TREE_MODEL(store)); cts.iter.stamp = 0; /* mark this as the toplevel */ @@ -559,7 +486,6 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_) gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), GTK_TREE_VIEW_COLUMN_AUTOSIZE); SIGNAL_CONNECT(selection, "changed", prefs_tree_select_cb, NULL); -#endif gtk_container_add(GTK_CONTAINER(ct_sb), cts.tree); gtk_widget_show(cts.tree); @@ -622,20 +548,6 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_) gtk_font_selection_set_font_name( GTK_FONT_SELECTION(gui_font_pg), prefs.PREFS_GUI_FONT_NAME); -#if GTK_MAJOR_VERSION < 2 - /* Set its filter to show only fixed_width fonts. */ - gtk_font_selection_set_filter( - GTK_FONT_SELECTION(gui_font_pg), - GTK_FONT_FILTER_BASE, /* user can't change the filter */ - GTK_FONT_ALL, /* bitmap or scalable are fine */ - NULL, /* all foundries are OK */ - NULL, /* all weights are OK (XXX - normal only?) */ - NULL, /* all slants are OK (XXX - Roman only?) */ - NULL, /* all setwidths are OK */ - fixedwidths, /* ONLY fixed-width fonts */ - NULL); /* all charsets are OK (XXX - ISO 8859/1 only?) */ -#endif - /* GUI Colors prefs */ g_strlcpy(label_str, "Colors", MAX_TREE_NODE_NAME_LEN); prefs_nb_page_add(prefs_nb, label_str, stream_prefs_show(), E_GUI_COLORS_PAGE_KEY); @@ -643,13 +555,9 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_) cts.page++; /* select the main GUI page as the default page and expand it's children */ -#if GTK_MAJOR_VERSION < 2 - gtk_ctree_select(GTK_CTREE(cts.tree), gui_iter); -#else gtk_tree_selection_select_iter(selection, &gui_iter); /* (expand will only take effect, when at least one child exists) */ gtk_tree_view_expand_all(GTK_TREE_VIEW(cts.tree)); -#endif #ifdef HAVE_LIBPCAP #ifdef _WIN32 @@ -679,14 +587,12 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_) cts.page++; #ifdef HAVE_LIBPORTAUDIO -#if GTK_MAJOR_VERSION >= 2 /* RTP player prefs */ g_strlcpy(label_str, "RTP Player", MAX_TREE_NODE_NAME_LEN); prefs_nb_page_add(prefs_nb, label_str, rtp_player_prefs_show(), E_RTP_PLAYER_PAGE_KEY); prefs_tree_page_add(label_str, cts.page, store, NULL, FALSE); cts.page++; #endif -#endif /* Registered prefs */ cts.notebook = prefs_nb; @@ -736,9 +642,7 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_) window_present(prefs_w); -#if GTK_MAJOR_VERSION >= 2 g_object_unref(G_OBJECT(store)); -#endif } static void @@ -1361,10 +1265,8 @@ prefs_main_fetch_all(GtkWidget *dlg, gboolean *must_redissect) printer_prefs_fetch(OBJECT_GET_DATA(dlg, E_PRINT_PAGE_KEY)); nameres_prefs_fetch(OBJECT_GET_DATA(dlg, E_NAMERES_PAGE_KEY)); #ifdef HAVE_LIBPORTAUDIO -#if GTK_MAJOR_VERSION >= 2 rtp_player_prefs_fetch(OBJECT_GET_DATA(dlg, E_RTP_PLAYER_PAGE_KEY)); #endif -#endif prefs_modules_foreach(module_prefs_fetch, must_redissect); return TRUE; @@ -1401,10 +1303,8 @@ prefs_main_apply_all(GtkWidget *dlg, gboolean redissect) printer_prefs_apply(OBJECT_GET_DATA(dlg, E_PRINT_PAGE_KEY)); nameres_prefs_apply(OBJECT_GET_DATA(dlg, E_NAMERES_PAGE_KEY)); #ifdef HAVE_LIBPORTAUDIO -#if GTK_MAJOR_VERSION >= 2 rtp_player_prefs_apply(OBJECT_GET_DATA(dlg, E_RTP_PLAYER_PAGE_KEY)); #endif -#endif /* show/hide the Save button - depending on setting */ save_bt = OBJECT_GET_DATA(prefs_w, E_PREFSW_SAVE_BT_KEY); @@ -1420,7 +1320,6 @@ prefs_main_apply_all(GtkWidget *dlg, gboolean redissect) static void prefs_main_destroy_all(GtkWidget *dlg) { -#if GTK_MAJOR_VERSION >= 2 int page_num; GtkWidget *frame; @@ -1430,7 +1329,6 @@ prefs_main_destroy_all(GtkWidget *dlg) if(OBJECT_GET_DATA(frame, E_PAGE_ITER_KEY)) gtk_tree_iter_free(OBJECT_GET_DATA(frame, E_PAGE_ITER_KEY)); } -#endif gui_prefs_destroy(OBJECT_GET_DATA(dlg, E_GUI_PAGE_KEY)); layout_prefs_destroy(OBJECT_GET_DATA(dlg, E_GUI_LAYOUT_PAGE_KEY)); @@ -1450,10 +1348,8 @@ prefs_main_destroy_all(GtkWidget *dlg) printer_prefs_destroy(OBJECT_GET_DATA(dlg, E_PRINT_PAGE_KEY)); nameres_prefs_destroy(OBJECT_GET_DATA(dlg, E_NAMERES_PAGE_KEY)); #ifdef HAVE_LIBPORTAUDIO -#if GTK_MAJOR_VERSION >= 2 rtp_player_prefs_destroy(OBJECT_GET_DATA(dlg, E_RTP_PLAYER_PAGE_KEY)); #endif -#endif /* Free up the saved preferences (both for "prefs" and for registered preferences). */ @@ -1734,7 +1630,6 @@ module_search_properties(module_t *module, gpointer user_data) return 0; } -#if GTK_MAJOR_VERSION >= 2 static void tree_expand_row(GtkTreeModel *model, GtkTreeView *tree_view, GtkTreeIter *iter) { @@ -1751,7 +1646,6 @@ tree_expand_row(GtkTreeModel *model, GtkTreeView *tree_view, GtkTreeIter *iter) gtk_tree_path_free(path); } -#endif /* select a node in the tree view */ /* XXX - this is almost 100% copied from byte_view_select() in proto_draw.c, @@ -1759,36 +1653,11 @@ tree_expand_row(GtkTreeModel *model, GtkTreeView *tree_view, GtkTreeIter *iter) void tree_select_node(GtkWidget *tree, prefs_tree_iter *iter) { -#if GTK_MAJOR_VERSION < 2 - GtkCTree *ctree = GTK_CTREE(tree); - GtkCTreeNode *node = (GtkCTreeNode *) iter; - GtkCTreeNode *parent; -#else GtkTreeIter local_iter = *iter; GtkTreeView *tree_view = GTK_TREE_VIEW(tree); GtkTreeModel *model; GtkTreePath *first_path; -#endif -#if GTK_MAJOR_VERSION < 2 - /* Expand and select our field's row */ - gtk_ctree_expand(ctree, node); - gtk_ctree_select(ctree, node); - /*expand_tree(ctree, node, NULL);*/ - - /* ... and its parents */ - parent = GTK_CTREE_ROW(node)->parent; - while (parent) { - gtk_ctree_expand(ctree, parent); - /*expand_tree(ctree, parent, NULL);*/ - parent = GTK_CTREE_ROW(parent)->parent; - } - - /* And position the window so the selection is visible. - * Position the selection in the middle of the viewable - * pane. */ - gtk_ctree_node_moveto(ctree, node, 0, .5, 0); -#else model = gtk_tree_view_get_model(tree_view); /* Expand our field's row */ @@ -1807,7 +1676,6 @@ tree_select_node(GtkWidget *tree, prefs_tree_iter *iter) gtk_tree_view_scroll_to_cell(tree_view, first_path, NULL, TRUE, 0.5, 0.0); gtk_tree_path_free(first_path); -#endif } @@ -1879,32 +1747,17 @@ properties_cb(GtkWidget *w, gpointer dummy) /* Prefs tree selection callback. The node data has been loaded with the proper notebook page to load. */ -#if GTK_MAJOR_VERSION < 2 -static void -prefs_tree_select_cb(GtkCTree *ct, GtkCTreeNode *node, gint col _U_, - gpointer dummy _U_) -#else static void prefs_tree_select_cb(GtkTreeSelection *sel, gpointer dummy _U_) -#endif { gint page; -#if GTK_MAJOR_VERSION >= 2 GtkTreeModel *model; GtkTreeIter iter; -#endif -#if GTK_MAJOR_VERSION < 2 - page = GPOINTER_TO_INT(gtk_ctree_node_get_row_data(ct, node)); - - if (page >= 0) - gtk_notebook_set_page(OBJECT_GET_DATA(prefs_w, E_PREFSW_NOTEBOOK_KEY), page); -#else if (gtk_tree_selection_get_selected(sel, &model, &iter)) { gtk_tree_model_get(model, &iter, 1, &page, -1); if (page >= 0) gtk_notebook_set_page(OBJECT_GET_DATA(prefs_w, E_PREFSW_NOTEBOOK_KEY), page); } -#endif } diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c index 6c988b39b8..b57d46202b 100644 --- a/gtk/print_dlg.c +++ b/gtk/print_dlg.c @@ -54,7 +54,7 @@ #include "tempfile.h" #include "util.h" -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 #include <gdk/gdkwin32.h> #include <windows.h> #include "win32-file-dlg.h" @@ -188,7 +188,7 @@ export_text_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) { print_args_t *args = &export_text_args; -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 win32_export_file(GDK_WINDOW_HWND(top_level->window), export_type_text); return; #endif @@ -237,7 +237,7 @@ export_ps_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) { print_args_t *args = &export_ps_args; -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 win32_export_file(GDK_WINDOW_HWND(top_level->window), export_type_ps); return; #endif @@ -286,7 +286,7 @@ export_psml_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) { print_args_t *args = &export_psml_args; -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 win32_export_file(GDK_WINDOW_HWND(top_level->window), export_type_psml); return; #endif @@ -335,7 +335,7 @@ export_pdml_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) { print_args_t *args = &export_pdml_args; -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 win32_export_file(GDK_WINDOW_HWND(top_level->window), export_type_pdml); return; #endif @@ -382,7 +382,7 @@ export_csv_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) { print_args_t *args = &export_csv_args; -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 win32_export_file(GDK_WINDOW_HWND(top_level->window), export_type_csv); return; #endif @@ -429,7 +429,7 @@ export_carrays_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) { print_args_t *args = &export_carrays_args; -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 win32_export_file(GDK_WINDOW_HWND(top_level->window), export_type_carrays); return; #endif @@ -474,10 +474,6 @@ print_browse_file_cb(GtkWidget *file_bt, GtkWidget *file_te) static GtkWidget * open_print_dialog(const char *title, output_action_e action, print_args_t *args) { -#if GTK_MAJOR_VERSION < 2 - GtkAccelGroup *accel_group; -#endif - GtkWidget *main_win; GtkWidget *main_vb; @@ -513,14 +509,6 @@ open_print_dialog(const char *title, output_action_e action, print_args_t *args) /* Enable tooltips */ tooltips = gtk_tooltips_new(); -#if GTK_MAJOR_VERSION < 2 - /* Accelerator group for the accelerators (or, as they're called in - Windows and, I think, in Motif, "mnemonics"; Alt+<key> is a mnemonic, - Ctrl+<key> is an accelerator). */ - accel_group = gtk_accel_group_new(); - gtk_window_add_accel_group(GTK_WINDOW(main_win), accel_group); -#endif - /* Vertical enclosing container for each row of widgets */ main_vb = gtk_vbox_new(FALSE, 5); gtk_container_border_width(GTK_CONTAINER(main_vb), 5); @@ -677,11 +665,7 @@ open_print_dialog(const char *title, output_action_e action, print_args_t *args) gtk_box_pack_start(GTK_BOX(packet_hb), range_fr, FALSE, FALSE, 0); gtk_widget_show(range_fr); - range_tb = range_new(&args->range -#if GTK_MAJOR_VERSION < 2 - , accel_group -#endif - ); + range_tb = range_new(&args->range); gtk_container_add(GTK_CONTAINER(range_fr), range_tb); gtk_widget_show(range_tb); @@ -829,7 +813,7 @@ open_print_dialog(const char *title, output_action_e action, print_args_t *args) SIGNAL_CONNECT(help_bt, "clicked", topic_cb, HELP_PRINT_DIALOG); } } else { -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 if(topic_available(HELP_EXPORT_FILE_WIN32_DIALOG)) { help_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_HELP); SIGNAL_CONNECT(help_bt, "clicked", topic_cb, HELP_EXPORT_FILE_WIN32_DIALOG); diff --git a/gtk/profile_dlg.c b/gtk/profile_dlg.c index 8004920a3c..80fb20219d 100644 --- a/gtk/profile_dlg.c +++ b/gtk/profile_dlg.c @@ -45,8 +45,6 @@ #include "help_dlg.h" #include <epan/prefs.h> -#if GTK_MAJOR_VERSION >= 2 - #define E_PROF_PROFILE_L_KEY "profile_profile_l" #define E_PROF_COPY_BT_KEY "profile_copy_bt" #define E_PROF_DEL_BT_KEY "profile_del_bt" @@ -841,15 +839,12 @@ profile_dialog_new(void) return main_w; } -#endif - /* Create a profile dialog for editing display profiles; this is to be used as a callback for menu items, toolbars, etc.. */ void profile_dialog_cb(GtkWidget *w _U_) { -#if GTK_MAJOR_VERSION >= 2 /* Has a profiles dialog box already been opened */ if (global_profile_w != NULL) { /* Yes. Just reactivate it. */ @@ -857,6 +852,5 @@ profile_dialog_cb(GtkWidget *w _U_) } else { global_profile_w = profile_dialog_new (); } -#endif } diff --git a/gtk/progress_dlg.c b/gtk/progress_dlg.c index 81942bb99b..6975ae0c79 100644 --- a/gtk/progress_dlg.c +++ b/gtk/progress_dlg.c @@ -177,9 +177,6 @@ create_progress_dlg(const gchar *task_title, const gchar *item_title, gtk_box_pack_start(GTK_BOX(dynamic_vb), percentage_hb, FALSE, TRUE, 3); prog_bar = gtk_progress_bar_new(); -#if GTK_MAJOR_VERSION < 2 - gtk_progress_set_activity_mode(GTK_PROGRESS(prog_bar), FALSE); -#endif gtk_box_pack_start(GTK_BOX(percentage_hb), prog_bar, FALSE, TRUE, 3); percentage_lb = gtk_label_new(" 0%"); @@ -392,11 +389,7 @@ update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *status) /* update progress bar */ prog_bar = OBJECT_GET_DATA(dlg_w, PROG_BAR_KEY); -#if GTK_MAJOR_VERSION < 2 - gtk_progress_bar_update(GTK_PROGRESS_BAR(prog_bar), percentage); -#else gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(prog_bar), percentage); -#endif /* * Flush out the update and process any input events. diff --git a/gtk/proto_dlg.c b/gtk/proto_dlg.c index b49f16e4cb..0341343a45 100644 --- a/gtk/proto_dlg.c +++ b/gtk/proto_dlg.c @@ -51,25 +51,14 @@ static void proto_save_cb(GtkWidget *, gpointer); static void proto_cancel_cb(GtkWidget *, gpointer); static void proto_destroy_cb(GtkWidget *, gpointer); -#if GTK_MAJOR_VERSION < 2 -static void show_proto_selection(GtkCList *proto_list); -#else static void show_proto_selection(GtkListStore *proto_store); -#endif static gboolean set_proto_selection(GtkWidget *); static gboolean revert_proto_selection(void); static void toggle_all_cb(GtkWidget *button, gpointer parent_w); static void enable_all_cb(GtkWidget *button, gpointer parent_w); static void disable_all_cb(GtkWidget *button, gpointer parent_w); -#if GTK_MAJOR_VERSION < 2 -static void proto_list_select_cb(GtkCList *proto_list, gint row, gint col, - GdkEventButton *ev, gpointer gp); -static gboolean proto_list_keypress_cb(GtkWidget *pl, GdkEventKey *ev, - gpointer gp); -#else static void status_toggled(GtkCellRendererToggle *, gchar *, gpointer); -#endif static GtkWidget *proto_w = NULL; @@ -82,11 +71,7 @@ typedef struct protocol_data { int hfinfo_index; gboolean enabled; gboolean was_enabled; -#if GTK_MAJOR_VERSION < 2 - gint row; -#else GtkTreeIter iter; -#endif } protocol_data_t; #define DISABLED "Disabled" @@ -99,13 +84,9 @@ proto_cb(GtkWidget *w _U_, gpointer data _U_) GtkWidget *main_vb, *bbox, *proto_list, *label, *proto_sw, *proto_frame, *proto_vb, *button, *ok_bt, *apply_bt, *save_bt, *cancel_bt, *help_bt; const gchar *titles[] = { "Status", "Protocol", "Description" }; -#if GTK_MAJOR_VERSION < 2 - gint width; -#else GtkListStore *proto_store; GtkCellRenderer *proto_rend; GtkTreeViewColumn *proto_col; -#endif if (proto_w != NULL) { @@ -137,28 +118,11 @@ proto_cb(GtkWidget *w _U_, gpointer data _U_) gtk_widget_show(proto_vb); proto_sw = scrolled_window_new(NULL, NULL); -#if GTK_MAJOR_VERSION >= 2 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(proto_sw), GTK_SHADOW_IN); -#endif gtk_box_pack_start(GTK_BOX(proto_vb), proto_sw, TRUE, TRUE, 0); gtk_widget_show(proto_sw); -#if GTK_MAJOR_VERSION < 2 - proto_list = gtk_clist_new_with_titles(3, (gchar **) titles); - gtk_container_add(GTK_CONTAINER(proto_sw), proto_list); - gtk_clist_set_selection_mode(GTK_CLIST(proto_list), GTK_SELECTION_BROWSE); - gtk_clist_column_titles_passive(GTK_CLIST(proto_list)); - gtk_clist_column_titles_show(GTK_CLIST(proto_list)); - gtk_clist_set_column_auto_resize(GTK_CLIST(proto_list), 0, FALSE); - gtk_clist_set_column_auto_resize(GTK_CLIST(proto_list), 1, TRUE); - gtk_clist_set_column_auto_resize(GTK_CLIST(proto_list), 2, TRUE); - width = gdk_string_width(proto_list->style->font, DISABLED); - gtk_clist_set_column_width(GTK_CLIST(proto_list), 0, width); - SIGNAL_CONNECT(proto_list, "select-row", proto_list_select_cb, NULL); - SIGNAL_CONNECT(proto_list, "key-press-event", proto_list_keypress_cb, NULL); - show_proto_selection(GTK_CLIST(proto_list)); -#else proto_store = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); show_proto_selection(proto_store); @@ -186,7 +150,6 @@ proto_cb(GtkWidget *w _U_, gpointer data _U_) gtk_tree_view_set_search_column(GTK_TREE_VIEW(proto_list), 1); /* col 1 in the *model* */ g_object_unref(G_OBJECT(proto_store)); -#endif gtk_widget_show(proto_list); label = gtk_label_new("Disabling a protocol prevents higher " @@ -263,34 +226,6 @@ proto_cb(GtkWidget *w _U_, gpointer data _U_) window_present(proto_w); } /* proto_cb */ -#if GTK_MAJOR_VERSION < 2 -static void -proto_list_select_cb(GtkCList *proto_list, gint row, gint col, - GdkEventButton *ev _U_, gpointer gp _U_) { - protocol_data_t *p = gtk_clist_get_row_data(proto_list, row); - - if (row < 0 || col < 0) - return; - - if (p->enabled) - p->enabled = FALSE; - else - p->enabled = TRUE; - - gtk_clist_set_text(proto_list, row, 0, STATUS_TXT(p->enabled) ); -} /* proto_list_select_cb */ - -static gboolean -proto_list_keypress_cb(GtkWidget *pl, GdkEventKey *ev, gpointer gp _U_) { - GtkCList *proto_list = GTK_CLIST(pl); - - if (ev->keyval == GDK_space) { - proto_list_select_cb(proto_list, proto_list->focus_row, 0, NULL, gp); - } - return TRUE; -} - -#else static void status_toggled(GtkCellRendererToggle *cell _U_, gchar *path_str, gpointer data) { @@ -311,7 +246,6 @@ status_toggled(GtkCellRendererToggle *cell _U_, gchar *path_str, gpointer data) gtk_tree_path_free(path); } /* status toggled */ -#endif /* XXX - We need callbacks for Gtk2 */ @@ -321,11 +255,7 @@ static void toggle_all_cb(GtkWidget *button _U_, gpointer pl) { GSList *entry; -#if GTK_MAJOR_VERSION < 2 - GtkCList *proto_list = GTK_CLIST(pl); -#else GtkListStore *s = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pl))); -#endif for (entry = protocol_list; entry != NULL; entry = g_slist_next(entry)) { protocol_data_t *p = entry->data; @@ -335,11 +265,7 @@ toggle_all_cb(GtkWidget *button _U_, gpointer pl) else p->enabled = TRUE; -#if GTK_MAJOR_VERSION < 2 - gtk_clist_set_text(proto_list, p->row, 0, STATUS_TXT(p->enabled) ); -#else gtk_list_store_set(s, &p->iter, 0, p->enabled, -1); -#endif } } @@ -347,30 +273,15 @@ toggle_all_cb(GtkWidget *button _U_, gpointer pl) static void set_active_all(GtkWidget *w, gboolean new_state) { - -#if GTK_MAJOR_VERSION < 2 - GtkCList *proto_list = GTK_CLIST(w); -#else GtkListStore *s = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(w))); -#endif GSList *entry; -#if GTK_MAJOR_VERSION < 2 - gtk_clist_freeze(proto_list); -#endif for (entry = protocol_list; entry != NULL; entry = g_slist_next(entry)) { protocol_data_t *p = entry->data; p->enabled = new_state; -#if GTK_MAJOR_VERSION < 2 - gtk_clist_set_text(proto_list, p->row, 0, STATUS_TXT(new_state) ); -#else gtk_list_store_set(s, &p->iter, 0, new_state, -1); -#endif } -#if GTK_MAJOR_VERSION < 2 - gtk_clist_thaw(proto_list); -#endif } /* Enable All */ @@ -579,17 +490,10 @@ create_protocol_list(void) } static void -#if GTK_MAJOR_VERSION < 2 -show_proto_selection(GtkCList *proto_list) -#else show_proto_selection(GtkListStore *proto_store) -#endif { GSList *entry; protocol_data_t *p; -#if GTK_MAJOR_VERSION < 2 - const gchar *proto_text[3]; -#endif if (protocol_list == NULL) create_protocol_list(); @@ -597,18 +501,6 @@ show_proto_selection(GtkListStore *proto_store) for (entry = protocol_list; entry != NULL; entry = g_slist_next(entry)) { p = entry->data; -#if GTK_MAJOR_VERSION < 2 - /* XXX - The preferred way to do this would be to have a check box - * in the first column. GtkClists don't let us put arbitrary widgets - * in a cell, so we use the word "Disabled" instead. We should be - * able to use check boxes in Gtk2, however. - */ - proto_text[0] = STATUS_TXT (p->enabled); - proto_text[1] = p->abbrev; - proto_text[2] = p->name; - p->row = gtk_clist_append(proto_list, (gchar **) proto_text); - gtk_clist_set_row_data(proto_list, p->row, p); -#else gtk_list_store_append(proto_store, &p->iter); gtk_list_store_set(proto_store, &p->iter, 0, p->enabled, @@ -616,7 +508,6 @@ show_proto_selection(GtkListStore *proto_store) 2, p->name, 3, p, -1); -#endif } } /* show_proto_selection */ diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index 33a45b2bae..72deb424b0 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -75,7 +75,7 @@ #include "file_util.h" #include "webbrowser.h" -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 #include <gdk/gdkwin32.h> #include <windows.h> #include "win32-file-dlg.h" @@ -95,10 +95,6 @@ #define E_BYTE_VIEW_ENCODE_KEY "byte_view_encode" -#if GTK_MAJOR_VERSION < 2 -GtkStyle *item_style = NULL; -#endif - /* gtk_tree_view_expand_to_path doesn't exist in gtk+ v2.0 so we must include it * when building with this version (taken from gtk+ v2.2.4) */ #if GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION == 0 @@ -229,7 +225,6 @@ redraw_hex_dump_all(void) redraw_hex_dump_packet_wins(); -#if GTK_MAJOR_VERSION >= 2 /* XXX - this is a hack, to workaround a bug in GTK2.x! when changing the font size, even refilling of the corresponding gtk_text_buffer doesn't seem to trigger an update. @@ -237,27 +232,17 @@ redraw_hex_dump_all(void) existing notebook tabs and "restart" the whole byte view again. */ if (cfile.current_frame != NULL) cf_goto_frame(&cfile, cfile.current_frame->num); -#endif } -#if GTK_MAJOR_VERSION < 2 -static void -expand_tree(GtkCTree *ctree, GtkCTreeNode *node, gpointer user_data _U_) -#else static void expand_tree(GtkTreeView *tree_view, GtkTreeIter *iter, GtkTreePath *path _U_, gpointer user_data _U_) -#endif { field_info *finfo; -#if GTK_MAJOR_VERSION >= 2 GtkTreeModel *model; model = gtk_tree_view_get_model(tree_view); gtk_tree_model_get(model, iter, 1, &finfo, -1); -#else - finfo = gtk_ctree_node_get_row_data( ctree, node); -#endif g_assert(finfo); /* @@ -271,24 +256,15 @@ expand_tree(GtkTreeView *tree_view, GtkTreeIter *iter, } } -#if GTK_MAJOR_VERSION < 2 -static void -collapse_tree(GtkCTree *ctree, GtkCTreeNode *node, gpointer user_data _U_) -#else static void collapse_tree(GtkTreeView *tree_view, GtkTreeIter *iter, GtkTreePath *path _U_, gpointer user_data _U_) -#endif { field_info *finfo; -#if GTK_MAJOR_VERSION >= 2 GtkTreeModel *model; model = gtk_tree_view_get_model(tree_view); gtk_tree_model_get(model, iter, 1, &finfo, -1); -#else - finfo = gtk_ctree_node_get_row_data( ctree, node); -#endif g_assert(finfo); /* @@ -302,16 +278,6 @@ collapse_tree(GtkTreeView *tree_view, GtkTreeIter *iter, } } -#if GTK_MAJOR_VERSION < 2 -static void -toggle_tree(GtkCTree *ctree, GdkEventKey *event, gpointer user_data _U_) -{ - if (event->keyval != GDK_Return) - return; - gtk_ctree_toggle_expansion(ctree, GTK_CTREE_NODE(ctree->clist.selection->data)); -} -#endif - #define MAX_OFFSET_LEN 8 /* max length of hex offset of bytes */ #define BYTES_PER_LINE 16 /* max byte values in a line */ #define HEX_DUMP_LEN (BYTES_PER_LINE*3 + 1) @@ -339,7 +305,6 @@ byte_num(int offset, int start_point) return (offset - start_point) / 3; } -#if GTK_MAJOR_VERSION >= 2 struct field_lookup_info { field_info *fi; GtkTreeIter iter; @@ -373,8 +338,6 @@ GtkTreePath *tree_find_by_field_info(GtkTreeView *tree_view, field_info *finfo) return gtk_tree_model_get_path(model, &fli.iter); } -#endif - /* If the user selected a certain byte in the byte view, try to find * the item in the GUI proto_tree that corresponds to that byte, and: * @@ -384,16 +347,10 @@ gboolean byte_view_select(GtkWidget *widget, GdkEventButton *event) { proto_tree *tree; -#if GTK_MAJOR_VERSION < 2 - GtkCTree *ctree; - /*GtkCTreeNode *node, *parent;*/ - GtkText *bv = GTK_TEXT(widget); -#else GtkTreeView *tree_view; GtkTextView *bv = GTK_TEXT_VIEW(widget); gint x, y; GtkTextIter iter; -#endif int row, column; int byte; tvbuff_t *tvb; @@ -487,22 +444,9 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event) */ return FALSE; } -#if GTK_MAJOR_VERSION < 2 - ctree = GTK_CTREE(OBJECT_GET_DATA(widget, E_BYTE_VIEW_TREE_VIEW_PTR)); -#else tree_view = GTK_TREE_VIEW(OBJECT_GET_DATA(widget, E_BYTE_VIEW_TREE_VIEW_PTR)); -#endif -#if GTK_MAJOR_VERSION < 2 - /* Given the mouse (x,y) and the current GtkText (h,v) - * adjustments, and the size of the font, figure out - * which text column/row the user selected. This could be off - * if the bold version of the font is bigger than the - * regular version of the font. */ - column = (int) ((bv->hadj->value + event->x) / user_font_get_regular_width()); - row = (int) ((bv->vadj->value + event->y) / user_font_get_regular_height()); -#else /* get the row/column selected */ gtk_text_view_window_to_buffer_coords(bv, gtk_text_view_get_window_type(bv, event->window), @@ -510,7 +454,6 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event) gtk_text_view_get_iter_at_location(bv, &iter, x, y); row = gtk_text_iter_get_line(&iter); column = gtk_text_iter_get_line_offset(&iter); -#endif /* Given the column and row, determine which byte offset * the user clicked on. */ @@ -545,32 +488,18 @@ byte_view_select(GtkWidget *widget, GdkEventButton *event) /* Get the data source tvbuff */ tvb = OBJECT_GET_DATA(widget, E_BYTE_VIEW_TVBUFF_KEY); -#if GTK_MAJOR_VERSION < 2 - return highlight_field(tvb, byte, ctree, tree); -#else return highlight_field(tvb, byte, tree_view, tree); -#endif } /* This highlights the field in the proto tree that is at position byte */ -#if GTK_MAJOR_VERSION < 2 -gboolean -highlight_field(tvbuff_t *tvb, gint byte, GtkCTree *ctree, - proto_tree *tree) -#else gboolean highlight_field(tvbuff_t *tvb, gint byte, GtkTreeView *tree_view, proto_tree *tree) -#endif { -#if GTK_MAJOR_VERSION < 2 - GtkCTreeNode *node, *parent; -#else GtkTreeModel *model; GtkTreePath *first_path, *path; GtkTreeIter parent; struct field_lookup_info fli; -#endif field_info *finfo; /* Find the finfo that corresponds to our byte. */ @@ -580,30 +509,6 @@ highlight_field(tvbuff_t *tvb, gint byte, GtkTreeView *tree_view, return FALSE; } -#if GTK_MAJOR_VERSION < 2 - node = gtk_ctree_find_by_row_data(ctree, NULL, finfo); - g_assert(node); - - /* Expand and select our field's row */ - gtk_ctree_expand(ctree, node); - gtk_ctree_select(ctree, node); - expand_tree(ctree, node, NULL); - - /* ... and its parents */ - parent = GTK_CTREE_ROW(node)->parent; - while (parent) { - gtk_ctree_expand(ctree, parent); - expand_tree(ctree, parent, NULL); - parent = GTK_CTREE_ROW(parent)->parent; - } - - /* And position the window so the selection is visible. - * Position the selection in the middle of the viewable - * pane. */ - gtk_ctree_node_moveto(ctree, node, 0, .5, 0); - - return FALSE; -#else model = gtk_tree_view_get_model(tree_view); fli.fi = finfo; gtk_tree_model_foreach(model, lookup_finfo, &fli); @@ -634,7 +539,6 @@ highlight_field(tvbuff_t *tvb, gint byte, GtkTreeView *tree_view, gtk_tree_path_free(first_path); return TRUE; -#endif } /* Calls functions for different mouse-button presses. */ @@ -709,37 +613,19 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb, proto_tree *tree, GtkWidget *tree_view) { GtkWidget *byte_view, *byte_scrollw, *label; -#if GTK_MAJOR_VERSION >= 2 GtkTextBuffer *buf; GtkStyle *style; -#endif /* Byte view. Create a scrolled window for the text. */ byte_scrollw = scrolled_window_new(NULL, NULL); -#if GTK_MAJOR_VERSION < 2 - /* The horizontal scrollbar of the scroll-window doesn't seem - * to affect the GtkText widget at all, even when line wrapping - * is turned off in the GtkText widget and there is indeed more - * horizontal data. */ - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(byte_scrollw), - /* Horizontal */GTK_POLICY_NEVER, - /* Vertical*/ GTK_POLICY_ALWAYS); -#else gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(byte_scrollw), GTK_SHADOW_IN); -#endif /* Add scrolled pane to tabbed window */ label = gtk_label_new(name); gtk_notebook_append_page(GTK_NOTEBOOK(byte_nb), byte_scrollw, label); gtk_widget_show(byte_scrollw); -#if GTK_MAJOR_VERSION < 2 - byte_view = gtk_text_new(NULL, NULL); - gtk_text_set_editable(GTK_TEXT(byte_view), FALSE); - gtk_text_set_word_wrap(GTK_TEXT(byte_view), FALSE); - gtk_text_set_line_wrap(GTK_TEXT(byte_view), FALSE); -#else byte_view = gtk_text_view_new(); gtk_text_view_set_editable(GTK_TEXT_VIEW(byte_view), FALSE); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(byte_view), FALSE); @@ -752,7 +638,6 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb, "background-gdk", &style->base[GTK_STATE_SELECTED], NULL); gtk_text_buffer_create_tag(buf, "bold", "font-desc", user_font_get_bold(), NULL); -#endif OBJECT_SET_DATA(byte_view, E_BYTE_VIEW_TVBUFF_KEY, tvb); gtk_container_add(GTK_CONTAINER(byte_scrollw), byte_view); @@ -961,12 +846,10 @@ copy_hex_cb(GtkWidget * w _U_, gpointer data _U_, copy_data_type data_type) /* This could be done incrementally, but it is easier to mingle with the code for CD_ALLINFO */ copy_hex_all_info(copy_buffer, data_p, len, FALSE); break; -#if (GTK_MAJOR_VERSION >= 2) case(CD_BINARY): /* Completely different logic to text copies - leave copy buffer alone */ copy_binary_to_clipboard(data_p,len); break; -#endif default: /* Incrementally write to text buffer in various formats */ while (len > 0){ @@ -1068,7 +951,7 @@ void savehex_cb(GtkWidget * w _U_, gpointer data _U_) GtkWidget *bv; GtkWidget *dlg_lb; -#if GTK_MAJOR_VERSION >= 2 && _WIN32 +#if _WIN32 win32_export_raw_file(GDK_WINDOW_HWND(top_level->window)); return; #endif @@ -1165,17 +1048,11 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, guchar c = '\0'; unsigned int use_digits; gboolean reverse, newreverse; -#if GTK_MAJOR_VERSION < 2 - GdkFont *cur_font, *new_font; - GdkColor *fg, *bg; - GtkText *bv_text = GTK_TEXT(bv); -#else GtkTextView *bv_text_view = GTK_TEXT_VIEW(bv); GtkTextBuffer *buf = gtk_text_view_get_buffer(bv_text_view); GtkTextIter iter; const char *revstyle; GtkTextMark *mark = NULL; -#endif progdlg_t *progbar = NULL; float progbar_val; @@ -1185,24 +1062,10 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, int progbar_nextstep; int progbar_quantum; -#if GTK_MAJOR_VERSION < 2 - /* Freeze the text for faster display */ - gtk_text_freeze(bv_text); - - /* Clear out the text */ - gtk_text_set_point(bv_text, 0); - /* Keep GTK+ 1.2.3 through 1.2.6 from dumping core - see - http://www.ethereal.com/lists/ethereal-dev/199912/msg00312.html and - http://www.gnome.org/mailing-lists/archives/gtk-devel-list/1999-October/0051.shtml - for more information */ - gtk_adjustment_set_value(bv_text->vadj, 0.0); - gtk_text_forward_delete(bv_text, gtk_text_get_length(bv_text)); -#else gtk_text_buffer_set_text(buf, "", 0); gtk_text_buffer_get_start_iter(buf, &iter); g_object_ref(buf); gtk_text_view_set_buffer( bv_text_view, NULL); -#endif /* * How many of the leading digits of the offset will we supply? @@ -1287,173 +1150,6 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, line[cur++] = ' '; /* Display with inverse video ? */ -#if GTK_MAJOR_VERSION < 2 - if (prefs.gui_hex_dump_highlight_style) { - gtk_text_insert(bv_text, user_font_get_regular(), &BLACK, &WHITE, line, cur); - /* Do we start in reverse? */ - reverse = (i >= bstart && i < bend) || (i >= astart && i < aend); - fg = reverse ? &WHITE : &BLACK; - bg = reverse ? &BLACK : &WHITE; - j = i; - k = i + BYTE_VIEW_WIDTH; - cur = 0; - /* Print the hex bit */ - while (i < k) { - if (i < len) { - line[cur++] = hexchars[(pd[i] & 0xf0) >> 4]; - line[cur++] = hexchars[pd[i] & 0x0f]; - } else { - line[cur++] = ' '; line[cur++] = ' '; - } - i++; - newreverse = (i >= bstart && i < bend) || (i >= astart && i < aend); - /* Have we gone from reverse to plain? */ - if (reverse && (reverse != newreverse)) { - gtk_text_insert(bv_text, user_font_get_regular(), fg, bg, line, cur); - fg = &BLACK; - bg = &WHITE; - cur = 0; - } - /* Inter byte space if not at end of line */ - if (i < k) { - line[cur++] = ' '; - /* insert a space every BYTE_VIEW_SEP bytes */ - if( ( i % BYTE_VIEW_SEP ) == 0 ) { - line[cur++] = ' '; - } - } - /* Have we gone from plain to reversed? */ - if (!reverse && (reverse != newreverse)) { - gtk_text_insert(bv_text, user_font_get_regular(), fg, bg, line, cur); - fg = &WHITE; - bg = &BLACK; - cur = 0; - } - reverse = newreverse; - } - /* Print remaining part of line */ - gtk_text_insert(bv_text, user_font_get_regular(), fg, bg, line, cur); - cur = 0; - /* Print some space at the end of the line */ - line[cur++] = ' '; line[cur++] = ' '; line[cur++] = ' '; - gtk_text_insert(bv_text, user_font_get_regular(), &BLACK, &WHITE, line, cur); - cur = 0; - - /* Print the ASCII bit */ - i = j; - /* Do we start in reverse? */ - reverse = (i >= bstart && i < bend) || (i >= astart && i < aend); - fg = reverse ? &WHITE : &BLACK; - bg = reverse ? &BLACK : &WHITE; - while (i < k) { - if (i < len) { - if (encoding == CHAR_ASCII) { - c = pd[i]; - } - else if (encoding == CHAR_EBCDIC) { - c = EBCDIC_to_ASCII1(pd[i]); - } - else { - g_assert_not_reached(); - } - line[cur++] = isprint(c) ? c : '.'; - } else { - line[cur++] = ' '; - } - i++; - newreverse = (i >= bstart && i < bend) || (i >= astart && i < aend); - /* Have we gone from reverse to plain? */ - if (reverse && (reverse != newreverse)) { - gtk_text_insert(bv_text, user_font_get_regular(), fg, bg, line, cur); - fg = &BLACK; - bg = &WHITE; - cur = 0; - } - if (i < k) { - /* insert a space every BYTE_VIEW_SEP bytes */ - if( ( i % BYTE_VIEW_SEP ) == 0 ) { - line[cur++] = ' '; - } - } - /* Have we gone from plain to reversed? */ - if (!reverse && (reverse != newreverse)) { - gtk_text_insert(bv_text, user_font_get_regular(), fg, bg, line, cur); - fg = &WHITE; - bg = &BLACK; - cur = 0; - } - reverse = newreverse; - } - /* Print remaining part of line */ - line[cur++] = '\n'; - gtk_text_insert(bv_text, user_font_get_regular(), fg, bg, line, cur); - cur = 0; - } - else { - gtk_text_insert(bv_text, user_font_get_regular(), NULL, NULL, line, cur); - /* Do we start in bold? */ - cur_font = ((i >= bstart && i < bend) || (i >= astart && i < aend)) ? user_font_get_bold() : user_font_get_regular(); - j = i; - k = i + BYTE_VIEW_WIDTH; - cur = 0; - /* Print the hex bit */ - while (i < k) { - if (i < len) { - line[cur++] = hexchars[(pd[i] & 0xf0) >> 4]; - line[cur++] = hexchars[pd[i] & 0x0f]; - } else { - line[cur++] = ' '; line[cur++] = ' '; - } - line[cur++] = ' '; - i++; - /* insert a space every BYTE_VIEW_SEP bytes */ - if( ( i % BYTE_VIEW_SEP ) == 0 ) line[cur++] = ' '; - /* Did we cross a bold/plain boundary? */ - new_font = ((i >= bstart && i < bend) || (i >= astart && i < aend)) ? user_font_get_bold() : user_font_get_regular(); - if (cur_font != new_font) { - gtk_text_insert(bv_text, cur_font, NULL, NULL, line, cur); - cur_font = new_font; - cur = 0; - } - } - line[cur++] = ' '; - gtk_text_insert(bv_text, cur_font, NULL, NULL, line, cur); - - cur = 0; - i = j; - /* Print the ASCII bit */ - cur_font = ((i >= bstart && i < bend) || (i >= astart && i < aend)) ? user_font_get_bold() : user_font_get_regular(); - while (i < k) { - if (i < len) { - if (encoding == CHAR_ASCII) { - c = pd[i]; - } - else if (encoding == CHAR_EBCDIC) { - c = EBCDIC_to_ASCII1(pd[i]); - } - else { - g_assert_not_reached(); - } - line[cur++] = isprint(c) ? c : '.'; - } else { - line[cur++] = ' '; - } - i++; - /* insert a space every BYTE_VIEW_SEP bytes */ - if( ( i % BYTE_VIEW_SEP ) == 0 ) line[cur++] = ' '; - /* Did we cross a bold/plain boundary? */ - new_font = ((i >= bstart && i < bend) || (i >= astart && i < aend)) ? user_font_get_bold() : user_font_get_regular(); - if (cur_font != new_font) { - gtk_text_insert(bv_text, cur_font, NULL, NULL, line, cur); - cur_font = new_font; - cur = 0; - } - } - line[cur++] = '\n'; - gtk_text_insert(bv_text, cur_font, NULL, NULL, line, cur); - cur = 0; - } -#else if (prefs.gui_hex_dump_highlight_style) revstyle = "reverse"; else @@ -1571,7 +1267,6 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, "plain", NULL); cur = 0; } -#endif } /* We're done printing the packets; destroy the progress bar if @@ -1580,19 +1275,6 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, destroy_progress_dlg(progbar); /* scroll text into position */ -#if GTK_MAJOR_VERSION < 2 - gtk_text_thaw(bv_text); /* must thaw before adjusting scroll bars */ - if ( bstart > 0 ) { - int linenum; - float scrollval; - - linenum = bstart / BYTE_VIEW_WIDTH; - scrollval = MIN(linenum * user_font_get_regular_height(), - bv_text->vadj->upper - bv_text->vadj->page_size); - - gtk_adjustment_set_value(bv_text->vadj, scrollval); - } -#else if (cur) { gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur, "plain", NULL); @@ -1604,7 +1286,6 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, gtk_text_buffer_delete_mark(buf, mark); } g_object_unref(buf); -#endif } void @@ -1693,29 +1374,17 @@ forget_ptree_widget(GtkWidget *ptreew, gpointer data _U_) static void set_ptree_sel_browse(GtkWidget *tree, gboolean val) { -#if GTK_MAJOR_VERSION >= 2 GtkTreeSelection *selection; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); -#endif /* Yeah, GTK uses "browse" in the case where we do not, but oh well. I think "browse" in Wireshark makes more sense than "SINGLE" in GTK+ */ if (val) { -#if GTK_MAJOR_VERSION < 2 - gtk_clist_set_selection_mode(GTK_CLIST(tree), - GTK_SELECTION_SINGLE); -#else gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); -#endif } else { -#if GTK_MAJOR_VERSION < 2 - gtk_clist_set_selection_mode(GTK_CLIST(tree), - GTK_SELECTION_BROWSE); -#else gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE); -#endif } } @@ -1732,40 +1401,17 @@ set_ptree_sel_browse_all(gboolean val) g_list_foreach(ptree_widgets, set_ptree_sel_browse_cb, &val); } -#if GTK_MAJOR_VERSION < 2 -static void -set_ptree_style_cb(gpointer data, gpointer user_data) -{ - gtk_widget_set_style((GtkWidget *)data, (GtkStyle *)user_data); -} -#else static void set_ptree_font_cb(gpointer data, gpointer user_data) { gtk_widget_modify_font((GtkWidget *)data, (PangoFontDescription *)user_data); } -#endif void set_ptree_font_all(FONT_TYPE *font) { -#if GTK_MAJOR_VERSION < 2 - GtkStyle *style; - - style = gtk_style_new(); - gdk_font_unref(style->font); - style->font = font; - gdk_font_ref(font); - - g_list_foreach(ptree_widgets, set_ptree_style_cb, style); - - /* Now nuke the old style and replace it with the new one. */ - gtk_style_unref(item_style); - item_style = style; -#else g_list_foreach(ptree_widgets, set_ptree_font_cb, font); -#endif } @@ -1790,7 +1436,6 @@ void proto_draw_colors_init(void) } -#if GTK_MAJOR_VERSION >= 2 static void tree_cell_renderer(GtkTreeViewColumn *tree_column _U_, GtkCellRenderer *cell, GtkTreeModel *tree_model, @@ -1881,35 +1526,21 @@ static void tree_cell_renderer(GtkTreeViewColumn *tree_column _U_, } } } -#endif GtkWidget * main_tree_view_new(e_prefs *prefs, GtkWidget **tree_view_p) { GtkWidget *tv_scrollw, *tree_view; -#if GTK_MAJOR_VERSION >= 2 GtkTreeStore *store; GtkCellRenderer *renderer; GtkTreeViewColumn *column; gint col_offset; -#endif /* Tree view */ tv_scrollw = scrolled_window_new(NULL, NULL); -#if GTK_MAJOR_VERSION >= 2 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(tv_scrollw), GTK_SHADOW_IN); -#endif -#if GTK_MAJOR_VERSION < 2 - tree_view = ctree_new(1, 0); - SIGNAL_CONNECT(tree_view, "key-press-event", toggle_tree, NULL ); - SIGNAL_CONNECT(tree_view, "tree-expand", expand_tree, NULL ); - SIGNAL_CONNECT(tree_view, "tree-collapse", collapse_tree, NULL ); - /* I need this next line to make the widget work correctly with hidden - * column titles and GTK_SELECTION_BROWSE */ - gtk_clist_set_column_auto_resize( GTK_CLIST(tree_view), 0, TRUE ); -#else store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); tree_view = tree_view_new(GTK_TREE_MODEL(store)); g_object_unref(G_OBJECT(store)); @@ -1931,20 +1562,9 @@ main_tree_view_new(e_prefs *prefs, GtkWidget **tree_view_p) GTK_TREE_VIEW_COLUMN_AUTOSIZE); SIGNAL_CONNECT(tree_view, "row-expanded", expand_tree, NULL); SIGNAL_CONNECT(tree_view, "row-collapsed", collapse_tree, NULL); -#endif gtk_container_add( GTK_CONTAINER(tv_scrollw), tree_view ); set_ptree_sel_browse(tree_view, prefs->gui_ptree_sel_browse); -#if GTK_MAJOR_VERSION < 2 - if(item_style == NULL) { - item_style = gtk_style_new(); - gdk_font_unref(item_style->font); - item_style->font = user_font_get_regular(); - } - - gtk_widget_set_style(tree_view, item_style); -#else gtk_widget_modify_font(tree_view, user_font_get_regular()); -#endif remember_ptree_widget(tree_view); *tree_view_p = tree_view; @@ -1952,50 +1572,28 @@ main_tree_view_new(e_prefs *prefs, GtkWidget **tree_view_p) return tv_scrollw; } -#if GTK_MAJOR_VERSION < 2 -void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) -#else void expand_all_tree(proto_tree *protocol_tree _U_, GtkWidget *tree_view) -#endif { int i; for(i=0; i < num_tree_types; i++) { tree_is_expanded[i] = TRUE; } -#if GTK_MAJOR_VERSION < 2 - proto_tree_draw(protocol_tree, tree_view); - gtk_ctree_expand_recursive(GTK_CTREE(tree_view), NULL); -#else gtk_tree_view_expand_all(GTK_TREE_VIEW(tree_view)); -#endif } -#if GTK_MAJOR_VERSION < 2 -void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view) -#else void collapse_all_tree(proto_tree *protocol_tree _U_, GtkWidget *tree_view) -#endif { int i; for(i=0; i < num_tree_types; i++) { tree_is_expanded[i] = FALSE; } -#if GTK_MAJOR_VERSION < 2 - proto_tree_draw(protocol_tree, tree_view); -#else gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree_view)); -#endif } struct proto_tree_draw_info { -#if GTK_MAJOR_VERSION < 2 - GtkCTree *ctree; - GtkCTreeNode *ctree_node; -#else GtkTreeView *tree_view; GtkTreeIter *iter; -#endif }; void @@ -2027,37 +1625,6 @@ tree_view_follow_link(field_info *fi) gboolean tree_view_select(GtkWidget *widget, GdkEventButton *event) { -#if GTK_MAJOR_VERSION < 2 - GtkCTree *ctree; - GtkCTreeNode *node; - gint row; - gint column; - field_info *fi; - - - if(gtk_clist_get_selection_info(GTK_CLIST(widget), - (gint) (((GdkEventButton *)event)->x), - (gint) (((GdkEventButton *)event)->y), - &row, &column)) - { - ctree = GTK_CTREE(widget); - - node = gtk_ctree_node_nth(ctree, row); - g_assert(node); - - /* if that's a doubleclick, try to follow the link */ - if(event->type == GDK_2BUTTON_PRESS) { - fi = gtk_ctree_node_get_row_data(ctree, node); - tree_view_follow_link(fi); - } - else if (((GdkEventButton *)event)->button != 1) { - /* if button == 1 gtk_ctree_select is already (or will be) called by the widget */ - gtk_ctree_select(ctree, node); - } - } else { - return FALSE; - } -#else GtkTreeSelection *sel; GtkTreePath *path; @@ -2086,7 +1653,6 @@ tree_view_select(GtkWidget *widget, GdkEventButton *event) } else { return FALSE; } -#endif return TRUE; } @@ -2094,39 +1660,22 @@ tree_view_select(GtkWidget *widget, GdkEventButton *event) void proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view) { -#if GTK_MAJOR_VERSION >= 2 GtkTreeStore *store; -#endif struct proto_tree_draw_info info; -#if GTK_MAJOR_VERSION < 2 - info.ctree = GTK_CTREE(tree_view); - info.ctree_node = NULL; - - gtk_clist_freeze(GTK_CLIST(tree_view)); -#else info.tree_view = GTK_TREE_VIEW(tree_view); info.iter = NULL; store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view))); -#endif /* * Clear out any crud left over in the display of the protocol * tree, by removing all nodes from the tree. * This is how it's done in testgtk.c in GTK+. */ -#if GTK_MAJOR_VERSION < 2 - gtk_clist_clear(GTK_CLIST(tree_view)); -#else gtk_tree_store_clear(store); -#endif proto_tree_children_foreach(protocol_tree, proto_tree_draw_node, &info); - -#if GTK_MAJOR_VERSION < 2 - gtk_clist_thaw(GTK_CLIST(tree_view)); -#endif } @@ -2141,13 +1690,9 @@ proto_tree_draw_node(proto_node *node, gpointer data) gchar label_str[ITEM_LABEL_LENGTH]; gchar *label_ptr; gboolean is_leaf, is_expanded; -#if GTK_MAJOR_VERSION < 2 - GtkCTreeNode *parent; -#else GtkTreeStore *store; GtkTreeIter iter; GtkTreePath *path; -#endif if (PROTO_ITEM_IS_HIDDEN(node)) return; @@ -2180,32 +1725,18 @@ proto_tree_draw_node(proto_node *node, gpointer data) label_ptr = g_strdup_printf("[%s]", label_ptr); } -#if GTK_MAJOR_VERSION < 2 - info.ctree = parent_info->ctree; - parent = gtk_ctree_insert_node ( info.ctree, parent_info->ctree_node, NULL, - &label_ptr, 5, NULL, NULL, NULL, NULL, - is_leaf, is_expanded ); - - gtk_ctree_node_set_row_data( GTK_CTREE(info.ctree), parent, fi ); -#else info.tree_view = parent_info->tree_view; store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(info.tree_view))); gtk_tree_store_append(store, &iter, parent_info->iter); gtk_tree_store_set(store, &iter, 0, label_ptr, 1, fi, -1); -#endif if(PROTO_ITEM_IS_GENERATED(node)) { g_free(label_ptr); } if (!is_leaf) { -#if GTK_MAJOR_VERSION < 2 - info.ctree_node = parent; -#else info.iter = &iter; -#endif proto_tree_children_foreach(node, proto_tree_draw_node, &info); -#if GTK_MAJOR_VERSION >= 2 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); if (is_expanded) /* #if GTK_MINOR_VERSION >= 2 */ @@ -2216,7 +1747,6 @@ proto_tree_draw_node(proto_node *node, gpointer data) else gtk_tree_view_collapse_row(info.tree_view, path); gtk_tree_path_free(path); -#endif } } @@ -2236,10 +1766,6 @@ clear_tree_and_hex_views(void) /* Clear the protocol tree by removing all nodes in the ctree. This is how it's done in testgtk.c in GTK+ */ -#if GTK_MAJOR_VERSION < 2 - gtk_clist_clear(GTK_CLIST(tree_view)); -#else gtk_tree_store_clear(GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view)))); -#endif } diff --git a/gtk/proto_hier_stats_dlg.c b/gtk/proto_hier_stats_dlg.c index 063a861a57..5bb8c3bb92 100644 --- a/gtk/proto_hier_stats_dlg.c +++ b/gtk/proto_hier_stats_dlg.c @@ -45,9 +45,6 @@ #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a)) -#if GTK_MAJOR_VERSION < 2 -#define NUM_STAT_COLUMNS 8 -#else enum { PROTOCOL_COLUMN, PRCT_PKTS_COLUMN, @@ -60,16 +57,10 @@ enum { FILTER_NAME, NUM_STAT_COLUMNS /* must be the last */ }; -#endif typedef struct { -#if GTK_MAJOR_VERSION < 2 - GtkCTree *tree; - GtkCTreeNode *parent; -#else GtkTreeView *tree_view; GtkTreeIter *iter; -#endif ph_stats_t *ps; } draw_info_t; @@ -78,8 +69,6 @@ static GtkWidget *tree; #define PCT(x,y) (100.0 * (float)(x) / (float)(y)) #define BANDWITDH(bytes,secs) ((bytes) * 8.0 / ((secs) * 1000.0 * 1000.0)) -#if GTK_MAJOR_VERSION >= 2 - /* Filter actions */ #define ACTION_MATCH 0 #define ACTION_PREPARE 1 @@ -238,7 +227,6 @@ static GtkItemFactoryEntry proto_hier_list_menu_items[] = proto_hier_select_filter_cb, CALLBACK_COLORIZE(ACTYPE_SELECTED), NULL, NULL), }; -#endif static void fill_in_tree_node(GNode *node, gpointer data) @@ -250,16 +238,10 @@ fill_in_tree_node(GNode *node, gpointer data) draw_info_t child_di; double seconds; gchar *text[NUM_STAT_COLUMNS]; -#if GTK_MAJOR_VERSION < 2 - GtkCTree *tree = di->tree; - GtkCTreeNode *parent = di->parent; - GtkCTreeNode *new_node; -#else GtkTreeView *tree_view = di->tree_view; GtkTreeIter *iter = di->iter; GtkTreeStore *store; GtkTreeIter new_iter; -#endif if (g_node_n_children(node) > 0) { is_leaf = FALSE; @@ -290,11 +272,6 @@ fill_in_tree_node(GNode *node, gpointer data) text[7] = "n.c."; } -#if GTK_MAJOR_VERSION < 2 - new_node = gtk_ctree_insert_node(tree, parent, NULL, text, - 7, NULL, NULL, NULL, NULL, - is_leaf, TRUE); -#else store = GTK_TREE_STORE(gtk_tree_view_get_model(tree_view)); gtk_tree_store_append(store, &new_iter, iter); gtk_tree_store_set(store, &new_iter, @@ -308,7 +285,6 @@ fill_in_tree_node(GNode *node, gpointer data) END_BANDWIDTH_COLUMN, text[7], FILTER_NAME, stats->hfinfo->abbrev, -1); -#endif g_free(text[1]); g_free(text[2]); @@ -318,13 +294,8 @@ fill_in_tree_node(GNode *node, gpointer data) g_free(text[6]); if (seconds > 0.0) g_free(text[7]); -#if GTK_MAJOR_VERSION < 2 - child_di.tree = tree; - child_di.parent = new_node; -#else child_di.tree_view = tree_view; child_di.iter = &new_iter; -#endif child_di.ps = ps; g_node_children_foreach(node, G_TRAVERSE_ALL, @@ -336,20 +307,14 @@ fill_in_tree(GtkWidget *tree, ph_stats_t *ps) { draw_info_t di; -#if GTK_MAJOR_VERSION < 2 - di.tree = GTK_CTREE(tree); - di.parent = NULL; -#else di.tree_view = GTK_TREE_VIEW(tree); di.iter = NULL; -#endif di.ps = ps; g_node_children_foreach(ps->stats_tree, G_TRAVERSE_ALL, fill_in_tree_node, &di); } -#if GTK_MAJOR_VERSION >= 2 static GtkWidget *popup_menu_object; static gint @@ -376,7 +341,6 @@ proto_hier_create_popup_menu(void) popup_menu_object = gtk_item_factory_get_widget (item_factory, "<main>"); SIGNAL_CONNECT(tree, "button_press_event", proto_hier_show_popup_menu_cb, NULL); } -#endif #define MAX_DLG_HEIGHT 450 #define DEF_DLG_WIDTH 700 @@ -384,53 +348,17 @@ static void create_tree(GtkWidget *container, ph_stats_t *ps) { GtkWidget *sw; -#if GTK_MAJOR_VERSION < 2 - int i, height; - const gchar *column_titles[NUM_STAT_COLUMNS] = { - "Protocol", - "% Packets", - "Packets", - "Bytes", - "Mbit/s", - "End Packets", - "End Bytes", - "End Mbit/s" - }; -#else GtkTreeView *tree_view; GtkTreeStore *store; GtkCellRenderer *renderer; GtkTreeViewColumn *column; -#endif /* Scrolled Window */ sw = scrolled_window_new(NULL, NULL); -#if GTK_MAJOR_VERSION >= 2 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); -#endif gtk_container_add(GTK_CONTAINER(container), sw); -#if GTK_MAJOR_VERSION < 2 - tree = ctree_new_with_titles(NUM_STAT_COLUMNS, 0, column_titles); - - /* XXX - get 'pos' to set vertical scroll-bar placement. */ - - /* The title bars do nothing. */ - gtk_clist_column_titles_passive(GTK_CLIST(tree)); - - /* Auto Resize all columns */ - for (i = 0; i < NUM_STAT_COLUMNS; i++) { - gtk_clist_set_column_auto_resize(GTK_CLIST(tree), i, TRUE); - } - - - /* Right justify numeric columns */ - for (i = 1; i < NUM_STAT_COLUMNS; i++) { - gtk_clist_set_column_justification(GTK_CLIST(tree), i, - GTK_JUSTIFY_RIGHT); - } -#else store = gtk_tree_store_new(NUM_STAT_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, @@ -500,23 +428,14 @@ create_tree(GtkWidget *container, ph_stats_t *ps) g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_append_column(tree_view, column); -#endif /* Fill in the data. */ fill_in_tree(tree, ps); -#if GTK_MAJOR_VERSION < 2 - height = GTK_CLIST(tree)->rows * (GTK_CLIST(tree)->row_height + 5); - height = MIN(height, MAX_DLG_HEIGHT); - WIDGET_SET_SIZE(tree, DEF_DLG_WIDTH, height); -#else WIDGET_SET_SIZE(tree, DEF_DLG_WIDTH, MAX_DLG_HEIGHT); gtk_tree_view_expand_all(tree_view); -#endif -#if GTK_MAJOR_VERSION >= 2 proto_hier_create_popup_menu (); -#endif gtk_container_add(GTK_CONTAINER(sw), tree); } diff --git a/gtk/range_utils.c b/gtk/range_utils.c index 49eb2b7e30..2f3658f43e 100644 --- a/gtk/range_utils.c +++ b/gtk/range_utils.c @@ -377,11 +377,8 @@ range_entry_in_event(GtkWidget *widget _U_, GdkEventFocus *event _U_, gpointer u /* create a new range "widget" */ -GtkWidget *range_new(packet_range_t *range -#if GTK_MAJOR_VERSION < 2 -, GtkAccelGroup *accel_group -#endif -) { +GtkWidget *range_new(packet_range_t *range) +{ GtkWidget *range_tb; GtkWidget *captured_bt; GtkWidget *displayed_bt; diff --git a/gtk/recent.c b/gtk/recent.c index f339949872..0e482b93f0 100644 --- a/gtk/recent.c +++ b/gtk/recent.c @@ -602,15 +602,9 @@ recent_read_static(char **rf_path_return, int *rf_errno_return) /* the following are only used if GTK2 is used (as GTK1 cannot read these geometry values) */ /* or if set through command line */ -#if GTK_MAJOR_VERSION >= 2 recent.has_gui_geometry_main_upper_pane = TRUE; recent.has_gui_geometry_main_lower_pane = TRUE; recent.has_gui_geometry_status_pane = TRUE; -#else - recent.has_gui_geometry_main_upper_pane = FALSE; - recent.has_gui_geometry_main_lower_pane = FALSE; - recent.has_gui_geometry_status_pane = FALSE; -#endif recent.privs_warn_if_elevated = TRUE; recent.privs_warn_if_no_npf = TRUE; diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c index 6817425aa7..3966a7838c 100644 --- a/gtk/rtp_analysis.c +++ b/gtk/rtp_analysis.c @@ -197,11 +197,6 @@ typedef enum { TAP_RTP_NO_DATA } error_type_t; -#if GTK_MAJOR_VERSION < 2 -GtkRcStyle *rc_style; -GdkColormap *colormap; -#endif - typedef struct _tap_rtp_save_info_t { FILE *fp; guint32 count; @@ -965,11 +960,7 @@ static void dialog_graph_draw(user_data_t* user_data) guint32 right_x_border; guint32 top_y_border; guint32 bottom_y_border; -#if GTK_MAJOR_VERSION < 2 - GdkFont *font; -#else PangoLayout *layout; -#endif int label_width, label_height; guint32 draw_width, draw_height; char label_string[15]; @@ -979,9 +970,6 @@ static void dialog_graph_draw(user_data_t* user_data) guint32 max_value; /* max value of seen data */ guint32 max_y; /* max value of the Y scale */ -#if GTK_MAJOR_VERSION <2 - font = user_data->dlg.dialog_graph.draw_area->style->font; -#endif if(!user_data->dlg.dialog_graph.needs_redraw){ return; } @@ -1058,13 +1046,8 @@ static void dialog_graph_draw(user_data_t* user_data) * top y scale label will be the widest one */ print_time_scale_string(label_string, 15, max_y); -#if GTK_MAJOR_VERSION < 2 - label_width=gdk_string_width(font, label_string); - label_height=gdk_string_height(font, label_string); -#else layout = gtk_widget_create_pango_layout(user_data->dlg.dialog_graph.draw_area, label_string); pango_layout_get_pixel_size(layout, &label_width, &label_height); -#endif left_x_border=10; right_x_border=label_width+20; top_y_border=10; @@ -1104,15 +1087,6 @@ static void dialog_graph_draw(user_data_t* user_data) /* draw the labels */ if(i==0){ print_time_scale_string(label_string, 15, (max_y*i/10)); -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(user_data->dlg.dialog_graph.pixmap, - font, - user_data->dlg.dialog_graph.draw_area->style->black_gc, - user_data->dlg.dialog_graph.pixmap_width-right_x_border+15+label_width-lwidth, - user_data->dlg.dialog_graph.pixmap_height-bottom_y_border-draw_height*i/10+label_height/2, - label_string); -#else pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); gdk_draw_layout(user_data->dlg.dialog_graph.pixmap, @@ -1120,19 +1094,9 @@ static void dialog_graph_draw(user_data_t* user_data) user_data->dlg.dialog_graph.pixmap_width-right_x_border+15+label_width-lwidth, user_data->dlg.dialog_graph.pixmap_height-bottom_y_border-draw_height*i/10-label_height/2, layout); -#endif } if(i==5){ print_time_scale_string(label_string, 15, (max_y*i/10)); -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(user_data->dlg.dialog_graph.pixmap, - font, - user_data->dlg.dialog_graph.draw_area->style->black_gc, - user_data->dlg.dialog_graph.pixmap_width-right_x_border+15+label_width-lwidth, - user_data->dlg.dialog_graph.pixmap_height-bottom_y_border-draw_height*i/10+label_height/2, - label_string); -#else pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); gdk_draw_layout(user_data->dlg.dialog_graph.pixmap, @@ -1140,19 +1104,9 @@ static void dialog_graph_draw(user_data_t* user_data) user_data->dlg.dialog_graph.pixmap_width-right_x_border+15+label_width-lwidth, user_data->dlg.dialog_graph.pixmap_height-bottom_y_border-draw_height*i/10-label_height/2, layout); -#endif } if(i==10){ print_time_scale_string(label_string, 15, (max_y*i/10)); -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(user_data->dlg.dialog_graph.pixmap, - font, - user_data->dlg.dialog_graph.draw_area->style->black_gc, - user_data->dlg.dialog_graph.pixmap_width-right_x_border+15+label_width-lwidth, - user_data->dlg.dialog_graph.pixmap_height-bottom_y_border-draw_height*i/10+label_height/2, - label_string); -#else pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); gdk_draw_layout(user_data->dlg.dialog_graph.pixmap, @@ -1160,7 +1114,6 @@ static void dialog_graph_draw(user_data_t* user_data) user_data->dlg.dialog_graph.pixmap_width-right_x_border+15+label_width-lwidth, user_data->dlg.dialog_graph.pixmap_height-bottom_y_border-draw_height*i/10-label_height/2, layout); -#endif } } @@ -1236,15 +1189,6 @@ static void dialog_graph_draw(user_data_t* user_data) } else { g_snprintf(label_string, 15, "%d.%3ds", current_interval/1000,current_interval%1000); } -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(user_data->dlg.dialog_graph.pixmap, - font, - user_data->dlg.dialog_graph.draw_area->style->black_gc, - x-1-user_data->dlg.dialog_graph.pixels_per_tick/2-lwidth/2, - user_data->dlg.dialog_graph.pixmap_height-bottom_y_border+20+label_height, - label_string); -#else pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); gdk_draw_layout(user_data->dlg.dialog_graph.pixmap, @@ -1252,7 +1196,6 @@ static void dialog_graph_draw(user_data_t* user_data) x-1-user_data->dlg.dialog_graph.pixels_per_tick/2-lwidth/2, user_data->dlg.dialog_graph.pixmap_height-bottom_y_border+20, layout); -#endif } } @@ -1267,15 +1210,6 @@ static void dialog_graph_draw(user_data_t* user_data) */ /* Draw the labels Fwd and Rev */ g_strlcpy(label_string,"<-Fwd",15); -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(user_data->dlg.dialog_graph.pixmap, - font, - user_data->dlg.dialog_graph.draw_area->style->black_gc, - user_data->dlg.dialog_graph.pixmap_width-right_x_border+33-lwidth, - user_data->dlg.dialog_graph.pixmap_height-bottom_y_border+3+label_height, - label_string); -#else pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); gdk_draw_layout(user_data->dlg.dialog_graph.pixmap, @@ -1283,17 +1217,7 @@ static void dialog_graph_draw(user_data_t* user_data) user_data->dlg.dialog_graph.pixmap_width-right_x_border+33-lwidth, user_data->dlg.dialog_graph.pixmap_height-bottom_y_border+3, layout); -#endif g_strlcpy(label_string,"<-Rev",15); -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(user_data->dlg.dialog_graph.pixmap, - font, - user_data->dlg.dialog_graph.draw_area->style->black_gc, - user_data->dlg.dialog_graph.pixmap_width-right_x_border+33-lwidth, - user_data->dlg.dialog_graph.pixmap_height-bottom_y_border+3+9+label_height, - label_string); -#else pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); gdk_draw_layout(user_data->dlg.dialog_graph.pixmap, @@ -1301,7 +1225,6 @@ static void dialog_graph_draw(user_data_t* user_data) user_data->dlg.dialog_graph.pixmap_width-right_x_border+33-lwidth, user_data->dlg.dialog_graph.pixmap_height-bottom_y_border+3+9, layout); -#endif /* Draw the marks */ for(i=MAX_GRAPHS-1;i>=0;i--){ @@ -1326,15 +1249,6 @@ static void dialog_graph_draw(user_data_t* user_data) g_strlcpy(label_string,"m",15); } -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(user_data->dlg.dialog_graph.pixmap, - font, - user_data->dlg.dialog_graph.draw_area->style->black_gc, - x_pos-1-lwidth/2, - user_data->dlg.dialog_graph.pixmap_height-bottom_y_border+3+7*(i/2)+label_height, - label_string); -#else pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); gdk_draw_layout(user_data->dlg.dialog_graph.pixmap, @@ -1342,17 +1256,13 @@ static void dialog_graph_draw(user_data_t* user_data) x_pos-1-lwidth/2, user_data->dlg.dialog_graph.pixmap_height-bottom_y_border+3+7*(i/2), layout); -#endif } prev_x_pos=x_pos; } } -#if GTK_MAJOR_VERSION >= 2 g_object_unref(G_OBJECT(layout)); -#endif - /* * Loop over all graphs and draw them @@ -1494,16 +1404,7 @@ static gint configure_event(GtkWidget *widget, GdkEventConfigure *event _U_) /* set up the colors and the GC structs for this pixmap */ for(i=0;i<MAX_GRAPHS;i++){ user_data->dlg.dialog_graph.graph[i].gc=gdk_gc_new(user_data->dlg.dialog_graph.pixmap); -#if GTK_MAJOR_VERSION < 2 - colormap = gtk_widget_get_colormap (widget); - if (!gdk_color_alloc (colormap, &user_data->dlg.dialog_graph.graph[i].color)){ - g_warning ("Couldn't allocate color"); - } - - gdk_gc_set_foreground(user_data->dlg.dialog_graph.graph[i].gc, &user_data->dlg.dialog_graph.graph[i].color); -#else gdk_gc_set_rgb_fg_color(user_data->dlg.dialog_graph.graph[i].gc, &user_data->dlg.dialog_graph.graph[i].color); -#endif } dialog_graph_redraw(user_data); @@ -1605,28 +1506,11 @@ static void create_filter_box(dialog_graph_graph_t *dgg, GtkWidget *box, int num gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); -#if GTK_MAJOR_VERSION < 2 - /* setting the color of the display button doesn't work */ - rc_style = gtk_rc_style_new (); - rc_style->fg[GTK_STATE_NORMAL] = dgg->color; - rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG; - rc_style->fg[GTK_STATE_ACTIVE] = dgg->color; - rc_style->color_flags[GTK_STATE_ACTIVE] |= GTK_RC_FG; - rc_style->fg[GTK_STATE_PRELIGHT] = dgg->color; - rc_style->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_FG; - rc_style->fg[GTK_STATE_SELECTED] = dgg->color; - rc_style->color_flags[GTK_STATE_SELECTED] |= GTK_RC_FG; - rc_style->fg[GTK_STATE_INSENSITIVE] = dgg->color; - rc_style->color_flags[GTK_STATE_INSENSITIVE] |= GTK_RC_FG; - gtk_widget_modify_style (label, rc_style); - gtk_rc_style_unref (rc_style); -#else gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &dgg->color); gtk_widget_modify_fg(label, GTK_STATE_ACTIVE, &dgg->color); gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &dgg->color); gtk_widget_modify_fg(label, GTK_STATE_SELECTED, &dgg->color); gtk_widget_modify_fg(label, GTK_STATE_INSENSITIVE, &dgg->color); -#endif return; } diff --git a/gtk/rtp_player.c b/gtk/rtp_player.c index 96a1cbe264..0de334aab5 100644 --- a/gtk/rtp_player.c +++ b/gtk/rtp_player.c @@ -58,7 +58,6 @@ #ifdef HAVE_LIBPORTAUDIO /* TODO: The RTP Player it is only supported for GTK >=2 */ #include <gtk/gtk.h> -#if GTK_MAJOR_VERSION >= 2 #include <epan/stats_tree.h> #include <epan/addr_resolv.h> @@ -1996,6 +1995,4 @@ rtp_player_init(voip_calls_tapinfo_t *voip_calls_tap) } -#endif /* GTK_MAJOR_VERSION >= 2 */ - #endif /* HAVE_LIBPORTAUDIO */ diff --git a/gtk/rtp_stream_dlg.c b/gtk/rtp_stream_dlg.c index 39ea993d61..cc2da94e8b 100644 --- a/gtk/rtp_stream_dlg.c +++ b/gtk/rtp_stream_dlg.c @@ -432,7 +432,6 @@ rtpstream_on_filter (GtkButton *button _U_, /****************************************************************************/ -#if (GTK_MAJOR_VERSION >= 2) static void rtpstream_on_copy_as_csv(GtkWindow *win _U_, gpointer data _U_) { @@ -464,7 +463,6 @@ rtpstream_on_copy_as_csv(GtkWindow *win _U_, gpointer data _U_) gtk_clipboard_set_text(cb, CSV_str->str, CSV_str->len); g_string_free(CSV_str, TRUE); } -#endif /****************************************************************************/ static void @@ -664,9 +662,7 @@ static void rtpstream_dlg_create (void) GtkWidget *bt_filter; GtkWidget *bt_analyze; GtkWidget *bt_close; -#if (GTK_MAJOR_VERSION >= 2) GtkWidget *bt_copy; -#endif GtkTooltips *tooltips = gtk_tooltips_new(); column_arrows *col_arrows; @@ -782,14 +778,12 @@ static void rtpstream_dlg_create (void) gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_filter); gtk_tooltips_set_tip (tooltips, bt_filter, "Prepare a display filter of the selected stream(s)", NULL); -#if (GTK_MAJOR_VERSION >= 2) /* XXX - maybe we want to have a "Copy as CSV" stock button here? */ /*bt_copy = gtk_button_new_with_label ("Copy content to clipboard as CSV");*/ bt_copy = BUTTON_NEW_FROM_STOCK(GTK_STOCK_COPY); gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_copy); gtk_tooltips_set_tip(tooltips, bt_copy, "Copy all statistical values of this page to the clipboard in CSV (Comma Seperated Values) format.", NULL); -#endif bt_analyze = gtk_button_new_with_label ("Analyze"); gtk_container_add (GTK_CONTAINER (hbuttonbox), bt_analyze); @@ -809,9 +803,7 @@ static void rtpstream_dlg_create (void) SIGNAL_CONNECT(bt_save, "clicked", rtpstream_on_save, NULL); SIGNAL_CONNECT(bt_mark, "clicked", rtpstream_on_mark, NULL); SIGNAL_CONNECT(bt_filter, "clicked", rtpstream_on_filter, NULL); -#if (GTK_MAJOR_VERSION >= 2) SIGNAL_CONNECT(bt_copy, "clicked", rtpstream_on_copy_as_csv, NULL); -#endif SIGNAL_CONNECT(bt_analyze, "clicked", rtpstream_on_analyse, NULL); window_set_cancel_button(rtpstream_dlg_w, bt_close, window_cancel_button_cb); diff --git a/gtk/sctp_byte_graph_dlg.c b/gtk/sctp_byte_graph_dlg.c index 1f8a1da60c..e11c09f795 100644 --- a/gtk/sctp_byte_graph_dlg.c +++ b/gtk/sctp_byte_graph_dlg.c @@ -124,35 +124,11 @@ static void draw_sack_graph(struct sctp_udata *u_data) gboolean more = FALSE; gint width; -#if GTK_MAJOR_VERSION < 2 - GdkColormap *colormap; -#endif - red_gc = gdk_gc_new(u_data->io->draw_area->window); -#if GTK_MAJOR_VERSION < 2 - colormap = gtk_widget_get_colormap (u_data->io->draw_area); - if (!gdk_color_alloc (colormap, &red_color)) - { - g_warning ("Couldn't allocate color"); - } - - gdk_gc_set_foreground(red_gc, &red_color); -#else gdk_gc_set_rgb_fg_color(red_gc, &red_color); -#endif green_gc = gdk_gc_new(u_data->io->draw_area->window); -#if GTK_MAJOR_VERSION < 2 - colormap = gtk_widget_get_colormap (u_data->io->draw_area); - if (!gdk_color_alloc (colormap, &green_color)) - { - g_warning ("Couldn't allocate color"); - } - - gdk_gc_set_foreground(green_gc, &green_color); -#else gdk_gc_set_rgb_fg_color(green_gc, &green_color); -#endif if (u_data->dir == 1) { @@ -219,10 +195,8 @@ static void draw_sack_graph(struct sctp_udata *u_data) } } -#if GTK_MAJOR_VERSION >= 2 g_object_unref(G_OBJECT(red_gc)); g_object_unref(G_OBJECT(green_gc)); -#endif } @@ -293,11 +267,7 @@ static void sctp_graph_draw(struct sctp_udata *u_data) gfloat dis; gboolean write_label = FALSE; -#if GTK_MAJOR_VERSION < 2 - GdkFont *font; -#else PangoLayout *layout; -#endif if (u_data->io->x1_tmp_sec == 0 && u_data->io->x1_tmp_usec == 0) u_data->io->offset = 0; @@ -388,21 +358,11 @@ static void sctp_graph_draw(struct sctp_udata *u_data) else distance = 5; -#if GTK_MAJOR_VERSION < 2 - font = u_data->io->draw_area->style->font; -#endif - -#if GTK_MAJOR_VERSION < 2 - label_width = gdk_string_width(font, label_string); - label_height = gdk_string_height(font, label_string); -#else g_snprintf(label_string, 15, "%d", 0); memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); layout = gtk_widget_create_pango_layout(u_data->io->draw_area, label_string); pango_layout_get_pixel_size(layout, &label_width, &label_height); -#endif - if (u_data->io->x1_tmp_usec == 0) sec = u_data->io->x1_tmp_sec; else @@ -411,13 +371,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) if (u_data->io->offset != 0) { g_snprintf(label_string, 15, "%u", u_data->io->x1_tmp_sec); -#if GTK_MAJOR_VERSION < 2 - lwidth = gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font,u_data->io->draw_area->style->black_gc, - LEFT_BORDER - 25, - u_data->io->pixmap_height - BOTTOM_BORDER + 20, - label_string); -#else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -426,7 +379,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) LEFT_BORDER - 25, u_data->io->pixmap_height - BOTTOM_BORDER + 20, layout); -#endif } w = (guint32)(500 / (guint32)(distance * u_data->io->x_interval)); if (w == 0) @@ -481,13 +433,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) { length = 10; - #if GTK_MAJOR_VERSION < 2 - lwidth = gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font,u_data->io->draw_area->style->black_gc, - (guint32)(LEFT_BORDER + u_data->io->offset + (i-u_data->io->min_x) * u_data->io->x_interval - lwidth / 2), - u_data->io->pixmap_height - BOTTOM_BORDER + 10, - label_string); - #else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -496,8 +441,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) (guint32)(LEFT_BORDER + u_data->io->offset + (i - u_data->io->min_x) * u_data->io->x_interval - lwidth / 2), u_data->io->pixmap_height - BOTTOM_BORDER + 10, layout); - #endif - } gdk_draw_line(u_data->io->pixmap, u_data->io->draw_area->style->black_gc, @@ -532,13 +475,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) u_data->io->pixmap_height - BOTTOM_BORDER + 10); g_snprintf(label_string, 15, "%d", sec); -#if GTK_MAJOR_VERSION < 2 - lwidth = gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font,u_data->io->draw_area->style->black_gc, - (guint32)(LEFT_BORDER + u_data->io->offset + (i - u_data->io->min_x) * u_data->io->x_interval-10), - u_data->io->pixmap_height - BOTTOM_BORDER + 20, - label_string); -#else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -547,22 +483,12 @@ static void sctp_graph_draw(struct sctp_udata *u_data) (guint32)(LEFT_BORDER + u_data->io->offset + (i - u_data->io->min_x) * u_data->io->x_interval-10), u_data->io->pixmap_height - BOTTOM_BORDER + 20, layout); -#endif write_label = FALSE; } } g_strlcpy(label_string, "sec", 15); -#if GTK_MAJOR_VERSION < 2 - lwidth = gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap, - font, - u_data->io->draw_area->style->black_gc, - u_data->io->pixmap_width - RIGHT_BORDER - 10, - u_data->io->pixmap_height - BOTTOM_BORDER + 30, - label_string); -#else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -571,8 +497,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) u_data->io->pixmap_width - RIGHT_BORDER - 10, u_data->io->pixmap_height - BOTTOM_BORDER + 30, layout); -#endif - distance = 5; /* y-axis */ @@ -625,14 +549,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) { length = 10; -#if GTK_MAJOR_VERSION < 2 - lwidth = gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font, - u_data->io->draw_area->style->black_gc, - LEFT_BORDER - length - lwidth - 5, - (guint32)(u_data->io->pixmap_height - BOTTOM_BORDER - u_data->io->offset - (i - u_data->io->min_y) * u_data->io->y_interval - 3), - label_string); -#else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -640,7 +556,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) LEFT_BORDER - length - lwidth - 5, (guint32)(u_data->io->pixmap_height - BOTTOM_BORDER - u_data->io->offset - (i - u_data->io->min_y) * u_data->io->y_interval - 3), layout); -#endif } gdk_draw_line(u_data->io->pixmap,u_data->io->draw_area->style->black_gc, LEFT_BORDER - length, @@ -949,26 +864,13 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda GdkGC *text_color; GList *tsnlist=NULL; tsn_t *tsn, *tmptsn; - #if GTK_MAJOR_VERSION < 2 - GdkFont *font; -#else PangoLayout *layout; -#endif -#if GTK_MAJOR_VERSION < 2 - font = u_data->io->draw_area->style->font; -#endif - -#if GTK_MAJOR_VERSION < 2 - label_width=gdk_string_width(font, label_string); - label_height=gdk_string_height(font, label_string); -#else g_snprintf(label_string, 15, "%d", 0); memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); layout = gtk_widget_create_pango_layout(u_data->io->draw_area, label_string); pango_layout_get_pixel_size(layout, &label_width, &label_height); -#endif if (event->y > u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset) event->y = u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset; if (event->x < LEFT_BORDER+u_data->io->offset) @@ -1108,13 +1010,6 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda else position = event->x + 5; -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font,text_color, - (gint)(position), - (gint)(event->y-10), - label_string); -#else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -1123,7 +1018,6 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda (gint)(position), (gint)(event->y-10), layout); -#endif ios=(sctp_graph_t *)OBJECT_GET_DATA(u_data->io->draw_area, "sctp_graph_t"); if(!ios){ diff --git a/gtk/sctp_graph_dlg.c b/gtk/sctp_graph_dlg.c index 8abedf1286..0de5e39120 100644 --- a/gtk/sctp_graph_dlg.c +++ b/gtk/sctp_graph_dlg.c @@ -131,35 +131,12 @@ static void draw_sack_graph(struct sctp_udata *u_data) struct sack_chunk_header *sack_header; struct gaps *gap; guint32 max_num, diff; -#if GTK_MAJOR_VERSION < 2 - GdkColormap *colormap; -#endif red_gc = gdk_gc_new(u_data->io->draw_area->window); -#if GTK_MAJOR_VERSION < 2 - colormap = gtk_widget_get_colormap (u_data->io->draw_area); - if (!gdk_color_alloc (colormap, &red_color)) - { - g_warning ("Couldn't allocate color"); - } - - gdk_gc_set_foreground(red_gc, &red_color); -#else gdk_gc_set_rgb_fg_color(red_gc, &red_color); -#endif green_gc = gdk_gc_new(u_data->io->draw_area->window); -#if GTK_MAJOR_VERSION < 2 - colormap = gtk_widget_get_colormap (u_data->io->draw_area); - if (!gdk_color_alloc (colormap, &green_color)) - { - g_warning ("Couldn't allocate color"); - } - - gdk_gc_set_foreground(green_gc, &green_color); -#else gdk_gc_set_rgb_fg_color(green_gc, &green_color); -#endif if (u_data->dir==2) { @@ -261,10 +238,8 @@ static void draw_sack_graph(struct sctp_udata *u_data) } list = g_list_previous(list); } -#if GTK_MAJOR_VERSION >= 2 g_object_unref(G_OBJECT(red_gc)); g_object_unref(G_OBJECT(green_gc)); -#endif } @@ -348,11 +323,7 @@ static void sctp_graph_draw(struct sctp_udata *u_data) gfloat dis; gboolean write_label = FALSE; -#if GTK_MAJOR_VERSION < 2 - GdkFont *font; -#else PangoLayout *layout; -#endif if (u_data->io->x1_tmp_sec==0 && u_data->io->x1_tmp_usec==0) u_data->io->offset=0; @@ -444,21 +415,11 @@ static void sctp_graph_draw(struct sctp_udata *u_data) else distance=5; -#if GTK_MAJOR_VERSION < 2 - font = u_data->io->draw_area->style->font; -#endif - -#if GTK_MAJOR_VERSION < 2 - label_width=gdk_string_width(font, label_string); - label_height=gdk_string_height(font, label_string); -#else g_snprintf(label_string, 15, "%d", 0); memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); layout = gtk_widget_create_pango_layout(u_data->io->draw_area, label_string); pango_layout_get_pixel_size(layout, &label_width, &label_height); -#endif - if (u_data->io->x1_tmp_usec==0) sec=u_data->io->x1_tmp_sec; else @@ -469,13 +430,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) { g_snprintf(label_string, 15, "%u", u_data->io->x1_tmp_sec); -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font,u_data->io->draw_area->style->black_gc, - LEFT_BORDER-25, - u_data->io->pixmap_height-BOTTOM_BORDER+20, - label_string); -#else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -484,7 +438,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) LEFT_BORDER-25, u_data->io->pixmap_height-BOTTOM_BORDER+20, layout); -#endif } w=(guint32)(500/(guint32)(distance*u_data->io->x_interval)); /*there will be a label for every w_th tic*/ @@ -542,13 +495,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) { length=10; - #if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font,u_data->io->draw_area->style->black_gc, - (guint32)(LEFT_BORDER+u_data->io->offset+(i-u_data->io->min_x)*u_data->io->x_interval-lwidth/2), - u_data->io->pixmap_height-BOTTOM_BORDER+10, - label_string); - #else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -556,7 +502,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) (guint32)(LEFT_BORDER+u_data->io->offset+(i-u_data->io->min_x)*u_data->io->x_interval-lwidth/2), u_data->io->pixmap_height-BOTTOM_BORDER+10, layout); - #endif } gdk_draw_line(u_data->io->pixmap,u_data->io->draw_area->style->black_gc, (guint32)(LEFT_BORDER+u_data->io->offset+(i-u_data->io->min_x)*u_data->io->x_interval), @@ -590,13 +535,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) u_data->io->pixmap_height-BOTTOM_BORDER+10); g_snprintf(label_string, 15, "%d", sec); - #if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font,u_data->io->draw_area->style->black_gc, - (guint32)(LEFT_BORDER+u_data->io->offset+(i-u_data->io->min_x)*u_data->io->x_interval-10), - u_data->io->pixmap_height-BOTTOM_BORDER+20, - label_string); - #else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -605,7 +543,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) (guint32)(LEFT_BORDER+u_data->io->offset+(i-u_data->io->min_x)*u_data->io->x_interval-10), u_data->io->pixmap_height-BOTTOM_BORDER+20, layout); - #endif write_label = FALSE; } @@ -613,15 +550,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) g_strlcpy(label_string, "sec", 15); -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap, - font, - u_data->io->draw_area->style->black_gc, - u_data->io->pixmap_width-RIGHT_BORDER-10, - u_data->io->pixmap_height-BOTTOM_BORDER+30, - label_string); -#else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -630,7 +558,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) u_data->io->pixmap_width-RIGHT_BORDER-10, u_data->io->pixmap_height-BOTTOM_BORDER+30, layout); -#endif distance=5; @@ -669,13 +596,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) { length=10; -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font,u_data->io->draw_area->style->black_gc, - LEFT_BORDER-length-lwidth-5, - (guint32)(u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset-(i-u_data->io->min_y)*u_data->io->y_interval-POINT_SIZE), - label_string); -#else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -683,7 +603,6 @@ static void sctp_graph_draw(struct sctp_udata *u_data) LEFT_BORDER-length-lwidth-5, (guint32)(u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset-(i-u_data->io->min_y)*u_data->io->y_interval-POINT_SIZE), layout); -#endif } gdk_draw_line(u_data->io->pixmap,u_data->io->draw_area->style->black_gc,LEFT_BORDER-length, (guint32)(u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset-(i-u_data->io->min_y)*u_data->io->y_interval), @@ -995,27 +914,13 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda struct tsn_sort *tsn, *sack=NULL; gboolean sack_found = FALSE; - #if GTK_MAJOR_VERSION < 2 - GdkFont *font; -#else PangoLayout *layout; -#endif - -#if GTK_MAJOR_VERSION < 2 - font = u_data->io->draw_area->style->font; -#endif -#if GTK_MAJOR_VERSION < 2 - label_width=gdk_string_width(font, label_string); - label_height=gdk_string_height(font, label_string); -#else g_snprintf(label_string, 15, "%d", 0); memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); layout = gtk_widget_create_pango_layout(u_data->io->draw_area, label_string); pango_layout_get_pixel_size(layout, &label_width, &label_height); -#endif - if (event->y>u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset) event->y = u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset; if (event->x < LEFT_BORDER+u_data->io->offset) @@ -1179,13 +1084,6 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda position = event->x + 5; -#if GTK_MAJOR_VERSION < 2 - lwidth=gdk_string_width(font, label_string); - gdk_draw_string(u_data->io->pixmap,font,text_color, - (gint)position, - (gint)(event->y-10), - label_string); -#else memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &lwidth, NULL); @@ -1194,7 +1092,6 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda (gint)position, (gint)(event->y-10), layout); - #endif ios=(sctp_graph_t *)OBJECT_GET_DATA(u_data->io->draw_area, "sctp_graph_t"); |