Fix some compile errors when building with real gtk-3.

svn path=/trunk/; revision=38178
This commit is contained in:
Jörg Mayer 2011-07-24 07:59:34 +00:00
parent 7271b2d213
commit dd02027e9b
4 changed files with 27 additions and 14 deletions

View File

@ -23,6 +23,7 @@ There are two ways to make the Wireshark code gtk3 ready:
Gtk2 offers several compile time flags, so if you run a sufficiently new
version of gtk2 and turn on one or more of these flags, you can find many
things that are not gtk3 compatible yet.
This is a subset of what breaks when compiling with Gtk3/Gdk3.
Some statistics (as of rev 38150)

View File

@ -747,9 +747,9 @@ static struct iftype_info iftype[] = {
static void
iftype_combo_box_add_remote_separators (GtkWidget *iftype_cbx)
{
gtk_combo_box_append_text(GTK_COMBO_BOX(iftype_cbx), REMOTE_HOST_SEPARATOR);
gtk_combo_box_append_text(GTK_COMBO_BOX(iftype_cbx), REMOTE_HOST_SEPARATOR);
gtk_combo_box_append_text(GTK_COMBO_BOX(iftype_cbx), "Clear list");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(iftype_cbx), REMOTE_HOST_SEPARATOR);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(iftype_cbx), REMOTE_HOST_SEPARATOR);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(iftype_cbx), "Clear list");
}
static void
@ -768,7 +768,7 @@ iftype_combo_box_add (GtkWidget *iftype_cbx)
if (g_hash_table_size (remote_host_list) == 0) {
iftype_combo_box_add_remote_separators (iftype_cbx);
}
gtk_combo_box_insert_text(GTK_COMBO_BOX(iftype_cbx), pos, g_array_index(global_capture_opts.ifaces, interface_options, 0).remote_host);
gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(iftype_cbx), pos, g_array_index(global_capture_opts.ifaces, interface_options, 0).remote_host);
rh->remote_host = g_strdup (g_array_index(global_capture_opts.ifaces, interface_options, 0).remote_host);
create_new = TRUE;
} else {
@ -814,7 +814,7 @@ iftype_combo_box_add (GtkWidget *iftype_cbx)
static void
iftype_combo_box_add_remote_host (gpointer key, gpointer value _U_, gpointer user_data)
{
gtk_combo_box_insert_text(GTK_COMBO_BOX(user_data), REMOTE_HOST_START, key);
gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(user_data), REMOTE_HOST_START, key);
if (g_array_index(global_capture_opts.ifaces, interface_options, 0).src_type == CAPTURE_IFREMOTE) {
/* Ensure we select the correct entry */
@ -831,10 +831,10 @@ iftype_combo_box_new(void)
GtkWidget *iftype_cbx;
unsigned int i;
iftype_cbx = gtk_combo_box_new_text();
iftype_cbx = gtk_combo_box_text_new();
for (i = 0; i < sizeof(iftype) / sizeof(iftype[0]); i++) {
gtk_combo_box_append_text(GTK_COMBO_BOX(iftype_cbx), iftype[i].name);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(iftype_cbx), iftype[i].name);
}
if (g_hash_table_size (remote_host_list) > 0) {
@ -937,16 +937,16 @@ update_interface_list(void)
/* Empty the interface combo box */
model = gtk_combo_box_get_model(GTK_COMBO_BOX(if_cb));
while (gtk_tree_model_iter_n_children(model, NULL) > 0) {
gtk_combo_box_remove_text (GTK_COMBO_BOX(if_cb), 0);
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT(if_cb), 0);
}
combo_list = build_capture_combo_list(if_list, TRUE);
for (combo_list_entry = combo_list; combo_list_entry != NULL; combo_list_entry = g_list_next(combo_list_entry)) {
gtk_combo_box_append_text(GTK_COMBO_BOX(if_cb), combo_list_entry->data);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(if_cb), combo_list_entry->data);
}
if (combo_list == NULL)
gtk_combo_box_append_text(GTK_COMBO_BOX(if_cb), "");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(if_cb), "");
gtk_combo_box_set_active(GTK_COMBO_BOX(if_cb),0);
@ -2801,11 +2801,11 @@ select_if_type_cb(GtkComboBox *iftype_cbx, gpointer data _U_)
g_hash_table_foreach_remove (remote_host_list, free_remote_host, NULL);
num_remote += 3;
while (num_remote--) /* Remove separator lines and "Clear" item */
gtk_combo_box_remove_text (iftype_cbx, 2);
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT(iftype_cbx), 2);
} else {
struct remote_host *rh;
gchar *string;
string = gtk_combo_box_get_active_text (GTK_COMBO_BOX(iftype_cbx));
string = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(iftype_cbx));
rh = g_hash_table_lookup (remote_host_list, string);
g_free (string);

View File

@ -69,6 +69,8 @@
#include "gtk/main_welcome.h"
#include "gtk/menus.h"
#include "gtk/old-gtk-compat.h"
#ifdef HAVE_AIRPCAP
#include "../image/toolbar/capture_airpcap_16.xpm"
#endif
@ -983,7 +985,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
row++;
if (row <= 10) {
/* Lets add up 10 rows of interfaces, otherwise the window may become too high */
gtk_widget_size_request(GTK_WIDGET(if_dlg_data->choose_bt), &requisition);
gtk_widget_get_preferred_size(GTK_WIDGET(if_dlg_data->choose_bt), &requisition, NULL);
height += requisition.height;
}
}
@ -1006,7 +1008,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
g_signal_connect(options_bt, "clicked", G_CALLBACK(capture_prepare_cb), if_dlg_data);
capture_bt = g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_CAPTURE_START);
g_signal_connect(capture_bt, "clicked", G_CALLBACK(capture_do_cb), if_dlg_data);
gtk_widget_size_request(GTK_WIDGET(close_bt), &requisition);
gtk_widget_get_preferred_size(GTK_WIDGET(close_bt), &requisition, NULL);
/* height + static offset + what the GTK MS Windows Engine needs in addition per interface */
height += requisition.height + 20 + ifs;
gtk_window_set_default_size(GTK_WINDOW(cap_if_w), -1, height);

View File

@ -61,9 +61,19 @@
# define GTK_COMBO_BOX_TEXT(x) GTK_COMBO_BOX(x)
# define gtk_combo_box_text_get_active_text(x) gtk_combo_box_get_active_text(x)
# define gtk_combo_box_text_new() gtk_combo_box_new_text()
# define gtk_combo_box_text_insert_text(x,y,z) gtk_combo_box_insert_text(x,y,z)
# define gtk_combo_box_text_append_text(x,y) gtk_combo_box_append_text(x,y)
# define gtk_combo_box_text_remove(x,y) gtk_combo_box_remove_text(x,y)
# define gtk_combo_box_text_new_with_entry() gtk_combo_box_entry_new_text()
# define gtk_combo_box_text_prepend_text(x,y) gtk_combo_box_prepend_text(x,y)
#endif
#if !GTK_CHECK_VERSION (3, 0, 0)
# define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
# define GtkStyleContext GtkStyle
# define gtk_widget_get_style_context(x) gtk_widget_get_style(x)
# define gtk_style_context_get_color(x,y,z) gdkcolor_to_color_t(&z, &x->text[y])
# define gtk_style_context_get_color_background(x,y,z) gdkcolor_to_color_t(&z, &x->base[y])
#endif
#endif