And even more -DGSEAL_ENABLE cleanup for GTK+ 3.0 preparation...

svn path=/trunk/; revision=35849
This commit is contained in:
Stephen Fisher 2011-02-07 18:41:38 +00:00
parent 88ea7649d5
commit 9d3586b4f5
13 changed files with 137 additions and 24 deletions

View File

@ -475,23 +475,33 @@ color_sel_win_new(color_filter_t *colorf, gboolean is_bg)
#endif
}
color_sel_ok = GTK_COLOR_SELECTION_DIALOG (color_sel_win)->ok_button;
g_object_get(color_sel_win, "ok-button", color_sel_ok, NULL);
g_object_set_data(G_OBJECT(color_sel_win), "color_sel_ok", color_sel_ok);
#if GTK_CHECK_VERSION(2,18,0)
gtk_widget_set_can_default(color_sel_ok, TRUE);
#else
GTK_WIDGET_SET_FLAGS (color_sel_ok, GTK_CAN_DEFAULT);
#endif
color_sel_cancel = GTK_COLOR_SELECTION_DIALOG (color_sel_win)->cancel_button;
g_object_get(color_sel_win, "cancel-button", color_sel_cancel, NULL);
g_object_set_data(G_OBJECT(color_sel_win), "color_sel_cancel", color_sel_cancel);
#if GTK_CHECK_VERSION(2,18,0)
gtk_widget_set_can_default(color_sel_cancel, TRUE);
#else
GTK_WIDGET_SET_FLAGS (color_sel_cancel, GTK_CAN_DEFAULT);
#endif
window_set_cancel_button(color_sel_win, color_sel_cancel, NULL); /* ensure esc does req'd local cxl action. */
/* esc as handled by the */
/* gtk_color_selection_dialog widget */
/* doesn't result in this happening. */
color_sel_help = GTK_COLOR_SELECTION_DIALOG (color_sel_win)->help_button;
g_object_get(color_sel_win, "help-button", color_sel_help, NULL);
g_object_set_data(G_OBJECT(color_sel_win), "color_sel_help", color_sel_help);
#if GTK_CHECK_VERSION(2,18,0)
gtk_widget_set_can_default(color_sel_help, TRUE);
#else
GTK_WIDGET_SET_FLAGS (color_sel_help, GTK_CAN_DEFAULT);
#endif
g_signal_connect(color_sel_ok, "clicked", G_CALLBACK(color_sel_ok_cb), color_sel_win);
g_signal_connect(color_sel_cancel, "clicked", G_CALLBACK(color_sel_cancel_cb), color_sel_win);
@ -540,8 +550,11 @@ color_sel_ok_cb (GtkButton *button _U_,
color_dialog = (GtkWidget *)user_data;
gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(
GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &new_color);
#if GTK_CHECK_VERSION(2,14,0)
gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog))), &new_color);
#else
gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &new_color);
#endif
if ( ! get_color(&new_color) ){
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,

View File

@ -2583,8 +2583,11 @@ init_conversation_table(gboolean hide_ports, const char *table_name, const char
window_present(conversations->win);
cf_retap_packets(&cfile);
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_raise(gtk_widget_get_window(conversations->win));
#else
gdk_window_raise(conversations->win->window);
#endif
}
@ -2724,7 +2727,11 @@ ct_filter_toggle_dest(GtkWidget *widget, gpointer data)
cf_retap_packets(&cfile);
if (conversations) {
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_raise(gtk_widget_get_window(conversations->win));
#else
gdk_window_raise(conversations->win->window);
#endif
}
}
@ -2840,8 +2847,11 @@ init_conversation_notebook_cb(GtkWidget *w _U_, gpointer d _U_)
window_present(win);
cf_retap_packets(&cfile);
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_raise(gtk_widget_get_window(win));
#else
gdk_window_raise(win->window);
#endif
}
typedef struct _key {

View File

@ -48,7 +48,11 @@ dlg_button_new(GtkWidget *hbox, GtkWidget *button_hbox, const gchar *stock_id)
GtkWidget *button;
button = gtk_button_new_from_stock(stock_id);
#if GTK_CHECK_VERSION(2,18,0)
gtk_widget_set_can_default(button, TRUE);
#else
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
#endif
g_object_set_data(G_OBJECT(hbox), stock_id, button);
gtk_box_pack_end(GTK_BOX(button_hbox), button, FALSE, FALSE, 0);
gtk_widget_show(button);
@ -230,7 +234,11 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
/* do we have a help button? -> special handling for it */
if (help) {
button = gtk_button_new_from_stock(help);
#if GTK_CHECK_VERSION(2,18,0)
gtk_widget_set_can_default(button, TRUE);
#else
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
#endif
g_object_set_data(G_OBJECT(hbox), help, button);
gtk_box_pack_start(GTK_BOX(help_hbox), button, FALSE, FALSE, 0);
gtk_widget_show(button);
@ -240,7 +248,11 @@ dlg_button_row_new(const gchar *stock_id_first, ...)
/* do we have a copy button? -> special handling for it */
if (copy) {
button = gtk_button_new_from_stock(copy);
#if GTK_CHECK_VERSION(2,18,0)
gtk_widget_set_can_default(button, TRUE);
#else
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
#endif
g_object_set_data(G_OBJECT(hbox), copy, button);
gtk_box_pack_start(GTK_BOX(help_hbox), button, FALSE, FALSE, 0);
gtk_widget_show(button);

View File

@ -313,6 +313,8 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin
{
gpointer dialog;
gchar *cf_names_freeme;
const guchar *sel_data_data;
gint sel_data_len;
if (info == DND_TARGET_URL) {
/* Usually we block incoming events by disabling the corresponding menu/toolbar items.
@ -342,11 +344,18 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin
return;
}
/* the selection_data will soon be gone, make a copy first */
/* the data string is not zero terminated -> make a zero terminated "copy" of it */
cf_names_freeme = g_malloc(selection_data->length + 1);
memcpy(cf_names_freeme, selection_data->data, selection_data->length);
cf_names_freeme[selection_data->length] = '\0';
/* the selection_data will soon be gone, make a copy first */
/* the data string is not zero terminated -> make a zero terminated "copy" of it */
#if GTK_CHECK_VERSION(2,14,0)
sel_data_len = gtk_selection_data_get_length(selection_data);
sel_data_data = gtk_selection_data_get_data(selection_data);
#else
sel_data_len = selection_data->length;
sel_data_data = selection_data->data;
#endif
cf_names_freeme = g_malloc(sel_data_len + 1);
memcpy(cf_names_freeme, sel_data_data, sel_data_len);
cf_names_freeme[sel_data_len] = '\0';
/* ask the user to save it's current capture file first */
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {

View File

@ -278,7 +278,11 @@ error_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint call
case ACTION_MATCH:
gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), str);
main_filter_packets(&cfile, str, FALSE);
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_raise(gtk_widget_get_window(top_level));
#else
gdk_window_raise(top_level->window);
#endif
break;
case ACTION_PREPARE:
gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), str);

View File

@ -638,7 +638,11 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te,
if(construct_args->modal_and_transient) {
parent = gtk_widget_get_parent_window(parent_filter_te);
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_set_transient_for(gtk_widget_get_window(main_w), parent);
#else
gdk_window_set_transient_for(main_w->window, parent);
#endif
gtk_window_set_modal(GTK_WINDOW(main_w), TRUE);
}

View File

@ -83,7 +83,11 @@ apply_selected_filter (guint callback_action, char *filter)
case ACTION_MATCH:
gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), str);
main_filter_packets(&cfile, str, FALSE);
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_raise(gtk_widget_get_window(top_level));
#else
gdk_window_raise(top_level->window);
#endif
break;
case ACTION_PREPARE:
gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), str);

View File

@ -644,7 +644,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
*/
g_free(cfile.sfilter);
cfile.sfilter = g_strdup(filter_text);
cfile.dir = GTK_TOGGLE_BUTTON (up_rb)->active ? SD_BACKWARD : SD_FORWARD;
cfile.dir = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (up_rb)) ? SD_BACKWARD : SD_FORWARD;
cfile.hex = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (hex_rb));
cfile.string = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (string_rb));
cfile.scs_type = scs_type;

View File

@ -192,7 +192,7 @@ follow_charset_toggle_cb(GtkWidget * w _U_, gpointer data)
* delivered. We only want to reprocess the display once,
* so we do it only when the button goes on.
*/
if (GTK_TOGGLE_BUTTON(w)->active) {
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
if (w == follow_info->ebcdic_bt)
follow_info->show_type = SHOW_EBCDIC;
else if (w == follow_info->hexdump_bt)

View File

@ -116,12 +116,22 @@ window_icon_realize_cb (GtkWidget *win, gpointer data _U_)
style = gtk_widget_get_style (win);
if (icon_pmap == NULL) {
#if GTK_CHECK_VERSION(2,14,0)
icon_pmap = gdk_pixmap_create_from_xpm_d (gtk_widget_get_window(win),
&icon_mask, &style->bg[GTK_STATE_NORMAL],
(gchar **) wsicon16_xpm);
#else
icon_pmap = gdk_pixmap_create_from_xpm_d (win->window,
&icon_mask, &style->bg[GTK_STATE_NORMAL],
(gchar **) wsicon16_xpm);
#endif
}
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_set_icon (gtk_widget_get_window(win), NULL, icon_pmap, icon_mask);
#else /* GTK_CHECK_VERSION(2,14,0) */
gdk_window_set_icon (win->window, NULL, icon_pmap, icon_mask);
#endif /* GTK_CHECK_VERSION(2,14,0) */
#endif
}
@ -287,6 +297,7 @@ window_get_geometry(GtkWidget *widget, window_geometry_t *geom)
{
gint desk_x, desk_y;
GdkWindowState state;
GdkWindow *widget_window;
/* Try to grab our geometry.
@ -304,10 +315,16 @@ window_get_geometry(GtkWidget *widget, window_geometry_t *geom)
http://www.gtk.org/faq/#AEN606
*/
gdk_window_get_root_origin(widget->window,
#if GTK_CHECK_VERSION(2,14,0)
widget_window = gtk_widget_get_window(widget);
#else
widget_window = widget_window;
#endif
gdk_window_get_root_origin(widget_window,
&geom->x,
&geom->y);
if (gdk_window_get_deskrelative_origin(widget->window,
if (gdk_window_get_deskrelative_origin(widget_window,
&desk_x, &desk_y)) {
if (desk_x <= geom->x &&
desk_y <= geom->y)
@ -318,11 +335,11 @@ window_get_geometry(GtkWidget *widget, window_geometry_t *geom)
}
/* XXX - Is this the "approved" method? */
gdk_window_get_size(widget->window,
gdk_window_get_size(widget_window,
&geom->width,
&geom->height);
state = gdk_window_get_state(widget->window);
state = gdk_window_get_state(widget_window);
geom->maximized = (state == GDK_WINDOW_STATE_MAXIMIZED);
}
@ -372,11 +389,20 @@ window_set_geometry(GtkWidget *widget, window_geometry_t *geom)
}
if(geom->set_maximized) {
#if GTK_CHECK_VERSION(2,14,0)
if (geom->maximized) {
gdk_window_maximize(gtk_widget_get_window(widget));
} else {
gdk_window_unmaximize(gtk_widget_get_window(widget));
}
#else
if (geom->maximized) {
gdk_window_maximize(widget->window);
} else {
gdk_window_unmaximize(widget->window);
}
#endif
}
}
@ -813,8 +839,16 @@ void pipe_input_set_handler(gint source, gpointer user_data, int *child_process,
void
reactivate_window(GtkWidget *win)
{
gdk_window_show(win->window);
gdk_window_raise(win->window);
GdkWindow *win_window;
#if GTK_CHECK_VERSION(2,14,0)
win_window = gtk_widget_get_window(win);
#else
win_window = win->window;
#endif
gdk_window_show(win_window);
gdk_window_raise(win_window);
}
/* List of all GtkScrolledWindows, so we can globally set the scrollbar

View File

@ -1406,7 +1406,11 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap
window_present(hosttable->win);
cf_retap_packets(&cfile);
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_raise(gtk_widget_get_window(hosttable->win));
#else
gdk_window_raise(hosttable->win->window);
#endif
}
@ -1552,7 +1556,11 @@ hostlist_filter_toggle_dest(GtkWidget *widget, gpointer data)
cf_retap_packets(&cfile);
if (hosttable) {
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_raise(gtk_widget_get_window(hosttable->win));
#else
gdk_window_raise(hosttable->win->window);
#endif
}
}
@ -1675,7 +1683,11 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_)
window_present(win);
cf_retap_packets(&cfile);
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_raise(gtk_widget_get_window(win));
#else
gdk_window_raise(win->window);
#endif
}
/*

View File

@ -1374,10 +1374,17 @@ resolv_update_cb(gpointer data _U_)
{
/* Anything new show up? */
if (host_name_lookup_process(NULL)) {
#if GTK_CHECK_VERSION(2,14,0)
if (gtk_widget_get_window(pkt_scrollw))
gdk_window_invalidate_rect(gtk_widget_get_window(pkt_scrollw), NULL, TRUE);
if (gtk_widget_get_window(tv_scrollw))
gdk_window_invalidate_rect(gtk_widget_get_window(tv_scrollw), NULL, TRUE);
#else
if (pkt_scrollw->window)
gdk_window_invalidate_rect(pkt_scrollw->window, NULL, TRUE);
if (tv_scrollw->window)
gdk_window_invalidate_rect(tv_scrollw->window, NULL, TRUE);
#endif
}
/* Always check. Even if we don't do async lookups we could still get
@ -3667,7 +3674,11 @@ show_main_window(gboolean doing_work)
display_queued_messages();
/* Move the main window to the front, in case it isn't already there */
#if GTK_CHECK_VERSION(2,14,0)
gdk_window_raise(gtk_widget_get_window(top_level));
#else
gdk_window_raise(top_level->window);
#endif
#ifdef HAVE_AIRPCAP
airpcap_toolbar_show(airpcap_tb);

View File

@ -108,7 +108,7 @@ get_notebook_bv_ptr(GtkWidget *nb_ptr)
num = gtk_notebook_get_current_page(GTK_NOTEBOOK(nb_ptr));
bv_page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb_ptr), num);
if (bv_page)
return GTK_BIN(bv_page)->child;
return gtk_bin_get_child(GTK_BIN(bv_page));
else
return NULL;
}
@ -146,7 +146,7 @@ set_notebook_page(GtkWidget *nb_ptr, tvbuff_t *tvb)
for (num = 0;
(bv_page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb_ptr), num)) != NULL;
num++) {
bv = GTK_BIN(bv_page)->child;
bv = gtk_bin_get_child(GTK_BIN(bv_page));
bv_tvb = g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_TVBUFF_KEY);
if (bv_tvb == tvb) {
/* Found it. */