[ghex] Fix build with GSEAL enabled
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ghex] Fix build with GSEAL enabled
- Date: Thu, 28 Jul 2011 00:21:05 +0000 (UTC)
commit e2868ca295c638b4c57f9ed7282fab57c5d33bc5
Author: Adrian ZgorzaÅek <a zgorzalek gmail com>
Date: Wed Jul 27 16:18:40 2011 +0200
Fix build with GSEAL enabled
https://bugzilla.gnome.org/show_bug.cgi?id=612693
src/accessiblegtkhex.c | 16 ++--
src/converter.c | 6 +-
src/findreplace.c | 86 ++++++++++----------
src/ghex-window.c | 20 +++---
src/gtkhex.c | 199 +++++++++++++++++++++++++++++-------------------
src/hex-document-ui.c | 8 +-
src/preferences.c | 8 +-
src/ui.c | 6 +-
8 files changed, 194 insertions(+), 155 deletions(-)
---
diff --git a/src/accessiblegtkhex.c b/src/accessiblegtkhex.c
index e3d349a..42688bf 100644
--- a/src/accessiblegtkhex.c
+++ b/src/accessiblegtkhex.c
@@ -208,7 +208,7 @@ accessible_gtk_hex_real_initialize (AtkObject *obj,
accessible = GTK_ACCESSIBLE (obj);
g_return_if_fail (accessible != NULL);
- accessible->widget = GTK_WIDGET (gtk_hex);
+ gtk_accessible_set_widget (accessible, GTK_WIDGET (gtk_hex));
accessible_gtk_hex->textutil = gail_text_util_new();
@@ -281,7 +281,7 @@ accessible_gtk_hex_get_text (AtkText *text,
GtkHex *gtk_hex ;
gchar *str = NULL, *utf8;
- widget = GTK_ACCESSIBLE (text)->widget;
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
access_gtk_hex = ACCESSIBLE_GTK_HEX (text);
g_return_val_if_fail (access_gtk_hex->textutil, NULL);
@@ -359,7 +359,7 @@ accessible_gtk_hex_get_character_count (AtkText *text)
GtkWidget *widget;
GtkHex *gtk_hex ;
- widget = GTK_ACCESSIBLE (text)->widget;
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
gtk_hex = GTK_HEX (widget);
@@ -376,7 +376,7 @@ accessible_gtk_hex_get_character_at_offset (AtkText *text,
gchar str[2];
gunichar c = '.';
- widget = GTK_ACCESSIBLE (text)->widget;
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
gtk_hex = GTK_HEX (widget);
if (gtk_hex->active_view == VIEW_ASCII) {
@@ -397,7 +397,7 @@ accessible_gtk_hex_get_caret_offset (AtkText *text)
GtkHex *gtk_hex;
GtkWidget *widget;
- widget = GTK_ACCESSIBLE (text)->widget;
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
g_return_val_if_fail (widget != NULL, 0);
gtk_hex = GTK_HEX (widget);
@@ -422,7 +422,7 @@ accessible_gtk_hex_set_text_contents (AtkEditableText *text,
GtkWidget *widget;
gint len;
- widget = GTK_ACCESSIBLE (text)->widget;
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
g_return_if_fail (widget != NULL);
gtkhex = GTK_HEX (widget);
@@ -441,7 +441,7 @@ accessible_gtk_hex_insert_text (AtkEditableText *text,
GtkHex *gtkhex;
GtkWidget *widget;
- widget = GTK_ACCESSIBLE (text)->widget;
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
g_return_if_fail (widget != NULL);
gtkhex = GTK_HEX (widget);
@@ -459,7 +459,7 @@ accessible_gtk_hex_delete_text (AtkEditableText *text,
GtkHex *gtkhex;
GtkWidget *widget;
- widget = GTK_ACCESSIBLE (text)->widget;
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
g_return_if_fail (widget != NULL);
diff --git a/src/converter.c b/src/converter.c
index e13ffa5..aaf99bd 100644
--- a/src/converter.c
+++ b/src/converter.c
@@ -238,11 +238,11 @@ create_converter()
table = gtk_table_new(6, 2, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(table), 4);
gtk_table_set_col_spacings(GTK_TABLE(table), 4);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(conv->window)->vbox), table,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(conv->window))), table,
TRUE, TRUE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(conv->window)->vbox),
+ gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(conv->window))),
4);
- gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(conv->window)->vbox), 2);
+ gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(conv->window))), 2);
gtk_widget_show(table);
accel_group = gtk_accel_group_new();
diff --git a/src/findreplace.c b/src/findreplace.c
index e0ad802..4f8ff0e 100644
--- a/src/findreplace.c
+++ b/src/findreplace.c
@@ -99,7 +99,7 @@ FindDialog *create_find_dialog()
dialog->f_gh = create_hex_view(dialog->f_doc);
frame = gtk_frame_new(_("Find String"));
gtk_container_add(GTK_CONTAINER(frame), dialog->f_gh);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->vbox), frame,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), frame,
TRUE, TRUE, 0);
gtk_widget_show(frame);
gtk_widget_show(dialog->f_gh);
@@ -107,31 +107,31 @@ FindDialog *create_find_dialog()
dialog->f_next = create_button(dialog->window, GTK_STOCK_GO_FORWARD, _("Find _Next"));
g_signal_connect (G_OBJECT (dialog->f_next), "clicked",
G_CALLBACK(find_next_cb), dialog);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), dialog->f_next,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), dialog->f_next,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->f_next, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->f_next, TRUE);
gtk_widget_show(dialog->f_next);
dialog->f_prev = create_button(dialog->window, GTK_STOCK_GO_BACK, _("Find _Previous"));
g_signal_connect (G_OBJECT (dialog->f_prev), "clicked",
G_CALLBACK(find_prev_cb), dialog);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), dialog->f_prev,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), dialog->f_prev,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->f_prev, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->f_prev, TRUE);
gtk_widget_show(dialog->f_prev);
dialog->f_close = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
g_signal_connect (G_OBJECT (dialog->f_close),
"clicked", G_CALLBACK(find_cancel_cb),
dialog);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), dialog->f_close,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), dialog->f_close,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->f_close, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->f_close, TRUE);
gtk_widget_show(dialog->f_close);
- gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog->window)->vbox), 2);
- gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog->window)->vbox), 2);
+ gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), 2);
+ gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), 2);
if (GTK_IS_ACCESSIBLE (gtk_widget_get_accessible (dialog->f_gh))) {
add_atk_namedesc (dialog->f_gh, _("Find Data"), _("Enter the hex data or ASCII data to search for"));
@@ -159,38 +159,38 @@ static AdvancedFind_AddDialog *create_advanced_find_add_dialog(AdvancedFindDialo
dialog->f_gh = create_hex_view(dialog->f_doc);
frame = gtk_frame_new(_("Find String"));
gtk_container_add(GTK_CONTAINER(frame), dialog->f_gh);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->vbox), frame,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), frame,
TRUE, TRUE, 0);
gtk_widget_show(frame);
gtk_widget_show(dialog->f_gh);
sep = gtk_hseparator_new();
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->vbox), sep,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), sep,
FALSE, FALSE, 0);
dialog->colour = gtk_color_selection_new();
gtk_color_selection_set_has_opacity_control(GTK_COLOR_SELECTION(dialog->colour),
FALSE);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->vbox),
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))),
dialog->colour, FALSE, FALSE, 0);
gtk_widget_show(dialog->colour);
button = create_button(dialog->window, GTK_STOCK_ADD, _("Add"));
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), button,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), button,
TRUE, TRUE, 0);
g_signal_connect (G_OBJECT (button),
"clicked", G_CALLBACK(advanced_find_add_add_cb),
dialog);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
g_signal_connect (G_OBJECT (button),
"clicked", G_CALLBACK(cancel_cb),
dialog->window);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), button,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), button,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
return dialog;
@@ -220,7 +220,7 @@ AdvancedFindDialog *create_advanced_find_dialog(GHexWindow *parent)
create_dialog_title(dialog->window, _("GHex (%s): Find Data"));
dialog->hbox = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->vbox),
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))),
dialog->hbox, TRUE, TRUE, 4);
gtk_widget_show(dialog->hbox);
@@ -260,7 +260,7 @@ AdvancedFindDialog *create_advanced_find_dialog(GHexWindow *parent)
g_signal_connect (G_OBJECT (dialog->f_next),
"clicked", G_CALLBACK(advanced_find_next_cb),
dialog);
- GTK_WIDGET_SET_FLAGS(dialog->f_next, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->f_next, TRUE);
gtk_widget_show(dialog->f_next);
dialog->f_prev = create_button(dialog->window, GTK_STOCK_GO_BACK, _("Find _Previous"));
@@ -269,7 +269,7 @@ AdvancedFindDialog *create_advanced_find_dialog(GHexWindow *parent)
g_signal_connect (G_OBJECT (dialog->f_prev),
"clicked", G_CALLBACK(advanced_find_prev_cb),
dialog);
- GTK_WIDGET_SET_FLAGS(dialog->f_prev, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->f_prev, TRUE);
gtk_widget_show(dialog->f_prev);
sep = gtk_hseparator_new();
@@ -282,7 +282,7 @@ AdvancedFindDialog *create_advanced_find_dialog(GHexWindow *parent)
g_signal_connect (G_OBJECT (dialog->f_new),
"clicked", G_CALLBACK(advanced_find_add_cb),
dialog);
- GTK_WIDGET_SET_FLAGS(dialog->f_new, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->f_new, TRUE);
gtk_widget_show(dialog->f_new);
dialog->f_remove = create_button(dialog->window, GTK_STOCK_REMOVE, _("_Remove Selected"));
@@ -291,16 +291,16 @@ AdvancedFindDialog *create_advanced_find_dialog(GHexWindow *parent)
g_signal_connect (G_OBJECT (dialog->f_remove),
"clicked", G_CALLBACK(advanced_find_delete_cb),
dialog);
- GTK_WIDGET_SET_FLAGS(dialog->f_remove, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->f_remove, TRUE);
gtk_widget_show(dialog->f_remove);
dialog->f_close = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
g_signal_connect(G_OBJECT(dialog->f_close),
"clicked", G_CALLBACK(advanced_find_close_cb),
dialog);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area),
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))),
dialog->f_close, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->f_close, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->f_close, TRUE);
gtk_widget_show(dialog->f_close);
if (GTK_IS_ACCESSIBLE (gtk_widget_get_accessible (dialog->f_close)))
@@ -357,7 +357,7 @@ ReplaceDialog *create_replace_dialog()
dialog->f_gh = create_hex_view(dialog->f_doc);
frame = gtk_frame_new(_("Find String"));
gtk_container_add(GTK_CONTAINER(frame), dialog->f_gh);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->vbox), frame,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), frame,
TRUE, TRUE, 0);
gtk_widget_show(frame);
gtk_widget_show(dialog->f_gh);
@@ -366,7 +366,7 @@ ReplaceDialog *create_replace_dialog()
dialog->r_gh = create_hex_view(dialog->r_doc);
frame = gtk_frame_new(_("Replace With"));
gtk_container_add(GTK_CONTAINER(frame), dialog->r_gh);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->vbox), frame,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), frame,
TRUE, TRUE, 0);
gtk_widget_show(frame);
gtk_widget_show(dialog->r_gh);
@@ -375,38 +375,38 @@ ReplaceDialog *create_replace_dialog()
g_signal_connect (G_OBJECT (dialog->next),
"clicked", G_CALLBACK(replace_next_cb),
NULL);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), dialog->next,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), dialog->next,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->next, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->next, TRUE);
gtk_widget_show(dialog->next);
dialog->replace = gtk_button_new_with_mnemonic(_("_Replace"));
g_signal_connect (G_OBJECT (dialog->replace),
"clicked", G_CALLBACK(replace_one_cb),
NULL);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), dialog->replace,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), dialog->replace,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->replace, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->replace, TRUE);
gtk_widget_show(dialog->replace);
dialog->replace_all= gtk_button_new_with_mnemonic(_("Replace _All"));
g_signal_connect (G_OBJECT (dialog->replace_all),
"clicked", G_CALLBACK(replace_all_cb),
NULL);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), dialog->replace_all,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), dialog->replace_all,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->replace_all, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->replace_all, TRUE);
gtk_widget_show(dialog->replace_all);
dialog->close = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
g_signal_connect (G_OBJECT (dialog->close),
"clicked", G_CALLBACK(cancel_cb),
dialog->window);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), dialog->close,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), dialog->close,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->close, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->close, TRUE);
gtk_widget_show(dialog->close);
- gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog->window)->vbox), 2);
- gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog->window)->vbox), 2);
+ gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), 2);
+ gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), 2);
if (GTK_IS_ACCESSIBLE(gtk_widget_get_accessible(dialog->f_gh))) {
add_atk_namedesc (dialog->f_gh, _("Find Data"), _("Enter the hex data or ASCII data to search for"));
@@ -433,7 +433,7 @@ JumpDialog *create_jump_dialog()
create_dialog_title(dialog->window, _("GHex (%s): Jump To Byte"));
dialog->int_entry = gtk_entry_new();
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->vbox), dialog->int_entry,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), dialog->int_entry,
TRUE, TRUE, 0);
gtk_widget_show(dialog->int_entry);
@@ -441,23 +441,23 @@ JumpDialog *create_jump_dialog()
g_signal_connect (G_OBJECT (dialog->ok),
"clicked", G_CALLBACK(goto_byte_cb),
dialog->int_entry);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), dialog->ok,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), dialog->ok,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->ok, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->ok, TRUE);
gtk_widget_show(dialog->ok);
dialog->cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
g_signal_connect (G_OBJECT (dialog->cancel),
"clicked", G_CALLBACK(cancel_cb),
dialog->window);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->window)->action_area), dialog->cancel,
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog->window))), dialog->cancel,
TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(dialog->cancel, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(dialog->cancel, TRUE);
gtk_widget_show(dialog->cancel);
- gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog->window)->vbox), 2);
- gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog->window)->vbox), 2);
+ gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), 2);
+ gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), 2);
if (GTK_IS_ACCESSIBLE (gtk_widget_get_accessible(dialog->int_entry))) {
add_atk_namedesc (dialog->int_entry, _("Jump to byte"), _("Enter the byte to jump to"));
@@ -798,7 +798,7 @@ static void advanced_find_add_add_cb(GtkButton *button,
static void advanced_find_add_cb(GtkButton *button, AdvancedFindDialog *dialog)
{
gint ret;
- if(!GTK_WIDGET_VISIBLE(dialog->addDialog->window)) {
+ if(!gtk_widget_get_visible(dialog->addDialog->window)) {
gtk_window_set_position (GTK_WINDOW(dialog->addDialog->window), GTK_WIN_POS_MOUSE);
gtk_widget_show(dialog->addDialog->window);
}
diff --git a/src/ghex-window.c b/src/ghex-window.c
index efd5d4b..d15a0db 100644
--- a/src/ghex-window.c
+++ b/src/ghex-window.c
@@ -55,8 +55,8 @@ ghex_window_drag_data_received(GtkWidget *widget,
if (info != TARGET_URI_LIST)
return;
- win->uris_to_open = g_strsplit(selection_data->data, "\r\n", 0);
- if (context->suggested_action == GDK_ACTION_ASK) {
+ win->uris_to_open = g_strsplit(gtk_selection_data_get_data(selection_data), "\r\n", 0);
+ if (gdk_drag_context_get_suggested_action(context) == GDK_ACTION_ASK) {
GtkWidget *menu = gtk_menu_new ();
bonobo_window_add_popup (BONOBO_WINDOW (win),
@@ -415,7 +415,7 @@ ghex_window_listener (BonoboUIComponent *uic,
converter = create_converter();
if(state && atoi(state)) {
- if(!GTK_WIDGET_VISIBLE(converter->window)) {
+ if(!gtk_widget_get_visible(converter->window)) {
gtk_window_set_position(GTK_WINDOW(converter->window), GTK_WIN_POS_MOUSE);
gtk_widget_show(converter->window);
}
@@ -427,7 +427,7 @@ ghex_window_listener (BonoboUIComponent *uic,
gtk_widget_set_sensitive(converter_get, TRUE);
}
else {
- if(GTK_WIDGET_VISIBLE(converter->window))
+ if(gtk_widget_get_visible(converter->window))
gtk_widget_hide(converter->window);
}
ghex_window_sync_converter_item(win, atoi(state));
@@ -438,14 +438,14 @@ ghex_window_listener (BonoboUIComponent *uic,
char_table = create_char_table();
if(state && atoi(state)) {
- if(!GTK_WIDGET_VISIBLE(char_table)) {
+ if(!gtk_widget_get_visible(char_table)) {
gtk_window_set_position(GTK_WINDOW(char_table), GTK_WIN_POS_MOUSE);
gtk_widget_show(char_table);
}
raise_and_focus_widget(char_table);
}
else {
- if(GTK_WIDGET_VISIBLE(char_table))
+ if(gtk_widget_get_visible(char_table))
gtk_widget_hide(GTK_WIDGET(char_table));
}
ghex_window_sync_char_table_item(win, atoi(state));
@@ -456,12 +456,12 @@ ghex_window_listener (BonoboUIComponent *uic,
if (!win->dialog)
return;
if (state && atoi(state)) {
- if (!GTK_WIDGET_VISIBLE(win->dialog_widget))
+ if (!gtk_widget_get_visible(win->dialog_widget))
{
gtk_widget_show(win->dialog_widget);
}
}
- else if (GTK_WIDGET_VISIBLE(win->dialog_widget))
+ else if (gtk_widget_get_visible(win->dialog_widget))
{
gtk_widget_hide(GTK_WIDGET(win->dialog_widget));
}
@@ -528,10 +528,10 @@ ghex_window_new(void)
bonobo_ui_component_add_listener (uic, "TypeDialog",
ghex_window_listener, win);
bonobo_ui_component_set_prop (uic, "/commands/Converter", "state",
- (converter && GTK_WIDGET_VISIBLE(converter->window))?"1":"0",
+ (converter && gtk_widget_get_visible(converter->window))?"1":"0",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/CharacterTable", "state",
- (char_table && GTK_WIDGET_VISIBLE(char_table))?"1":"0",
+ (char_table && gtk_widget_get_visible(char_table))?"1":"0",
NULL);
bonobo_ui_component_set_prop (uic, "/commands/TypeDialog", "state",
"1", NULL);
diff --git a/src/gtkhex.c b/src/gtkhex.c
index f085cca..3a7e940 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -111,11 +111,11 @@ static void redraw_widget(GtkWidget *w) {
}
static gint widget_get_xt(GtkWidget *w) {
- return w->style->xthickness; /* Changed in Gtk-2.0 -- SnM */
+ return gtk_widget_get_style(w)->xthickness;
}
static gint widget_get_yt(GtkWidget *w) {
- return w->style->ythickness; /* Changed in Gtk-2.0 -- SnM */
+ return gtk_widget_get_style(w)->ythickness;
}
/*
* ?_to_pointer translates mouse coordinates in hex/ascii view
@@ -301,12 +301,12 @@ static void render_byte(GtkHex *gh, gint pos) {
format_xbyte(gh, pos, buf);
- gdk_gc_set_foreground(gh->xdisp_gc, >K_WIDGET(gh)->style->base[GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground(gh->xdisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->base[GTK_STATE_NORMAL]);
gdk_draw_rectangle(gtk_widget_get_window(gh->xdisp), gh->xdisp_gc, TRUE,
cx, cy, 2*gh->char_width, gh->char_height);
if(pos < gh->document->file_size) {
- gdk_gc_set_foreground(gh->xdisp_gc, >K_WIDGET(gh)->style->text[GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground(gh->xdisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->text[GTK_STATE_NORMAL]);
/* Changes for Gnome 2.0 */
pango_layout_set_text (gh->xlayout, buf, 2);
gdk_draw_layout (gtk_widget_get_window(gh->xdisp), gh->xdisp_gc, cx, cy, gh->xlayout);
@@ -315,11 +315,11 @@ static void render_byte(GtkHex *gh, gint pos) {
if(!get_acoords(gh, pos, &cx, &cy))
return;
- gdk_gc_set_foreground(gh->adisp_gc, >K_WIDGET(gh)->style->base[GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground(gh->adisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->base[GTK_STATE_NORMAL]);
gdk_draw_rectangle(gtk_widget_get_window(gh->adisp), gh->adisp_gc, TRUE,
cx, cy, gh->char_width, gh->char_height);
if(pos < gh->document->file_size) {
- gdk_gc_set_foreground(gh->adisp_gc, >K_WIDGET(gh)->style->text[GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground(gh->adisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->text[GTK_STATE_NORMAL]);
buf[0] = gtk_hex_get_byte(gh, pos);
if(!is_displayable((guchar)buf[0]))
buf[0] = '.';
@@ -344,7 +344,7 @@ static void render_ac(GtkHex *gh) {
if(!is_displayable(c[0]))
c[0] = '.';
- gdk_gc_set_foreground(gh->adisp_gc, >K_WIDGET(gh)->style->base[GTK_STATE_ACTIVE]);
+ gdk_gc_set_foreground(gh->adisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->base[GTK_STATE_ACTIVE]);
if(gh->active_view == VIEW_ASCII) {
gdk_draw_rectangle(gtk_widget_get_window(gh->adisp), gh->adisp_gc,
TRUE, cx, cy, gh->char_width, gh->char_height - 1);
@@ -353,7 +353,7 @@ static void render_ac(GtkHex *gh) {
gdk_draw_rectangle(gtk_widget_get_window(gh->adisp), gh->adisp_gc,
FALSE, cx, cy, gh->char_width, gh->char_height - 1);
}
- gdk_gc_set_foreground(gh->adisp_gc, &(GTK_WIDGET(gh)->style->black));
+ gdk_gc_set_foreground(gh->adisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->black);
/* Changes for Gnome 2.0 */
pango_layout_set_text (gh->alayout, c, 1);
gdk_draw_layout (gtk_widget_get_window(gh->adisp), gh->adisp_gc, cx, cy, gh->alayout);
@@ -378,7 +378,7 @@ static void render_xc(GtkHex *gh) {
i = 0;
}
- gdk_gc_set_foreground(gh->xdisp_gc, >K_WIDGET(gh)->style->base[GTK_STATE_ACTIVE]);
+ gdk_gc_set_foreground(gh->xdisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->base[GTK_STATE_ACTIVE]);
if(gh->active_view == VIEW_HEX) {
gdk_draw_rectangle(gtk_widget_get_window(GTK_WIDGET(gh->xdisp)), gh->xdisp_gc,
TRUE, cx, cy, gh->char_width, gh->char_height - 1);
@@ -387,7 +387,7 @@ static void render_xc(GtkHex *gh) {
gdk_draw_rectangle(gtk_widget_get_window(GTK_WIDGET(gh->xdisp)), gh->xdisp_gc,
FALSE, cx, cy, gh->char_width, gh->char_height - 1);
}
- gdk_gc_set_foreground(gh->xdisp_gc, &(GTK_WIDGET(gh)->style->black));
+ gdk_gc_set_foreground(gh->xdisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->black);
pango_layout_set_text (gh->xlayout, &c[i], 1);
gdk_draw_layout (gtk_widget_get_window(gh->xdisp), gh->xdisp_gc, cx, cy, gh->xlayout);
}
@@ -456,7 +456,7 @@ static void render_hex_highlights(GtkHex *gh, gint cursor_line)
if (len > 0)
gtk_paint_flat_box((curHighlight->style?
curHighlight->style :
- GTK_WIDGET(gh)->style),
+ gtk_widget_get_style(GTK_WIDGET(gh))),
gtk_widget_get_window(gh->xdisp),
state,
GTK_SHADOW_NONE,
@@ -470,7 +470,8 @@ static void render_hex_highlights(GtkHex *gh, gint cursor_line)
cursor_off = 2*(end%gh->cpl + 1) + (end%gh->cpl)/gh->group_type;
if (cursor_off > 0)
gtk_paint_flat_box((curHighlight->style ? curHighlight->style :
- GTK_WIDGET(gh)->style), gtk_widget_get_window(gh->xdisp),
+ gtk_widget_get_style(GTK_WIDGET(gh))),
+ gtk_widget_get_window(gh->xdisp),
state, GTK_SHADOW_NONE,
NULL, gh->xdisp, NULL,
0, cursor_line*gh->char_height,
@@ -479,7 +480,8 @@ static void render_hex_highlights(GtkHex *gh, gint cursor_line)
else if (cursor_line > sl && cursor_line < el)
{
gtk_paint_flat_box((curHighlight->style ? curHighlight->style :
- GTK_WIDGET(gh)->style), gtk_widget_get_window(gh->xdisp),
+ gtk_widget_get_style(GTK_WIDGET(gh))),
+ gtk_widget_get_window(gh->xdisp),
state, GTK_SHADOW_NONE,
NULL, gh->xdisp, NULL,
0, cursor_line*gh->char_height,
@@ -536,7 +538,8 @@ static void render_ascii_highlights(GtkHex *gh, gint cursor_line)
len = gh->cpl - cursor_off;
if (len > 0)
gtk_paint_flat_box((curHighlight->style ? curHighlight->style :
- GTK_WIDGET(gh)->style), gtk_widget_get_window(gh->adisp),
+ gtk_widget_get_style(GTK_WIDGET(gh))),
+ gtk_widget_get_window(gh->adisp),
state, GTK_SHADOW_NONE,
NULL, gh->adisp, NULL,
cursor_off*gh->char_width,
@@ -548,7 +551,8 @@ static void render_ascii_highlights(GtkHex *gh, gint cursor_line)
cursor_off = end % gh->cpl + 1;
if (cursor_off > 0)
gtk_paint_flat_box((curHighlight->style ? curHighlight->style :
- GTK_WIDGET(gh)->style), gtk_widget_get_window(gh->adisp),
+ gtk_widget_get_style(GTK_WIDGET(gh))),
+ gtk_widget_get_window(gh->adisp),
state, GTK_SHADOW_NONE,
NULL, gh->adisp, NULL,
0, cursor_line * gh->char_height,
@@ -557,7 +561,8 @@ static void render_ascii_highlights(GtkHex *gh, gint cursor_line)
else if (cursor_line > sl && cursor_line < el)
{
gtk_paint_flat_box((curHighlight->style ? curHighlight->style :
- GTK_WIDGET(gh)->style), gtk_widget_get_window(gh->adisp),
+ gtk_widget_get_style(GTK_WIDGET(gh))),
+ gtk_widget_get_window(gh->adisp),
state, GTK_SHADOW_NONE,
NULL, gh->adisp, NULL,
0, cursor_line * gh->char_height,
@@ -586,6 +591,7 @@ static void render_ascii_highlights(GtkHex *gh, gint cursor_line)
*/
static void render_hex_lines(GtkHex *gh, gint imin, gint imax) {
GtkWidget *w = gh->xdisp;
+ GtkAllocation allocation;
gint i, cursor_line;
gint xcpl = gh->cpl*2 + gh->cpl/gh->group_type;
gint frm_len, tmp;
@@ -595,15 +601,16 @@ static void render_hex_lines(GtkHex *gh, gint imin, gint imax) {
cursor_line = gh->cursor_pos / gh->cpl - gh->top_line;
- gdk_gc_set_foreground(gh->xdisp_gc, >K_WIDGET(gh)->style->base[GTK_STATE_NORMAL]);
+ gtk_widget_get_allocation(w, &allocation);
+ gdk_gc_set_foreground(gh->xdisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->base[GTK_STATE_NORMAL]);
gdk_draw_rectangle(gtk_widget_get_window(w), gh->xdisp_gc, TRUE,
- 0, imin*gh->char_height, w->allocation.width,
+ 0, imin*gh->char_height, allocation.width,
(imax - imin + 1)*gh->char_height);
imax = MIN(imax, gh->vis_lines);
imax = MIN(imax, gh->lines);
- gdk_gc_set_foreground(gh->xdisp_gc, >K_WIDGET(gh)->style->text[GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground(gh->xdisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->text[GTK_STATE_NORMAL]);
frm_len = format_xblock(gh, gh->disp_buffer, (gh->top_line+imin)*gh->cpl,
MIN((gh->top_line+imax+1)*gh->cpl, gh->document->file_size) );
@@ -625,6 +632,7 @@ static void render_hex_lines(GtkHex *gh, gint imin, gint imax) {
static void render_ascii_lines(GtkHex *gh, gint imin, gint imax) {
GtkWidget *w = gh->adisp;
+ GtkAllocation allocation;
gint i, tmp, frm_len;
guint cursor_line;
@@ -633,15 +641,16 @@ static void render_ascii_lines(GtkHex *gh, gint imin, gint imax) {
cursor_line = gh->cursor_pos / gh->cpl - gh->top_line;
- gdk_gc_set_foreground(gh->adisp_gc, >K_WIDGET(gh)->style->base[GTK_STATE_NORMAL]);
+ gtk_widget_get_allocation(w, &allocation);
+ gdk_gc_set_foreground(gh->adisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->base[GTK_STATE_NORMAL]);
gdk_draw_rectangle(gtk_widget_get_window(w), gh->adisp_gc, TRUE,
- 0, imin*gh->char_height, w->allocation.width,
+ 0, imin*gh->char_height, allocation.width,
(imax - imin + 1)*gh->char_height);
imax = MIN(imax, gh->vis_lines);
imax = MIN(imax, gh->lines);
- gdk_gc_set_foreground(gh->adisp_gc, >K_WIDGET(gh)->style->text[GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground(gh->adisp_gc, >k_widget_get_style(GTK_WIDGET(gh))->text[GTK_STATE_NORMAL]);
frm_len = format_ablock(gh, gh->disp_buffer, (gh->top_line+imin)*gh->cpl,
MIN((gh->top_line+imax+1)*gh->cpl, gh->document->file_size) );
@@ -664,6 +673,7 @@ static void render_ascii_lines(GtkHex *gh, gint imin, gint imax) {
static void render_offsets(GtkHex *gh, gint imin, gint imax) {
GtkWidget *w = gh->offsets;
+ GtkAllocation allocation;
gint i;
gchar offstr[9];
@@ -674,16 +684,17 @@ static void render_offsets(GtkHex *gh, gint imin, gint imax) {
gh->offsets_gc = gdk_gc_new(gtk_widget_get_window(gh->offsets));
gdk_gc_set_exposures(gh->offsets_gc, TRUE);
}
-
- gdk_gc_set_foreground(gh->offsets_gc, >K_WIDGET(gh)->style->base[GTK_STATE_INSENSITIVE]);
+
+ gtk_widget_get_allocation(w, &allocation);
+ gdk_gc_set_foreground(gh->offsets_gc, >k_widget_get_style(GTK_WIDGET(gh))->base[GTK_STATE_INSENSITIVE]);
gdk_draw_rectangle(gtk_widget_get_window(w), gh->offsets_gc, TRUE,
- 0, imin*gh->char_height, w->allocation.width,
+ 0, imin*gh->char_height, allocation.width,
(imax - imin + 1)*gh->char_height);
imax = MIN(imax, gh->vis_lines);
imax = MIN(imax, gh->lines - gh->top_line - 1);
- gdk_gc_set_foreground(gh->offsets_gc, >K_WIDGET(gh)->style->text[GTK_STATE_NORMAL]);
+ gdk_gc_set_foreground(gh->offsets_gc, >k_widget_get_style(GTK_WIDGET(gh))->text[GTK_STATE_NORMAL]);
for(i = imin; i <= imax; i++) {
sprintf(offstr, "%08X", (gh->top_line + i)*gh->cpl + gh->starting_offset);
@@ -741,31 +752,35 @@ static void offsets_expose(GtkWidget *w, GdkEventExpose *event, GtkHex *gh) {
*/
static void draw_shadow(GtkWidget *widget, GdkRectangle *area) {
GtkHex *gh = GTK_HEX(widget);
+ GtkRequisition sb_req;
+ GtkAllocation allocation;
gint border = gtk_container_get_border_width(GTK_CONTAINER(widget));
gint x;
x = border;
+ gtk_widget_get_allocation(widget, &allocation);
if(gh->show_offsets) {
- gtk_paint_shadow(widget->style, gtk_widget_get_window(widget),
+ gtk_paint_shadow(gtk_widget_get_style(widget), gtk_widget_get_window(widget),
GTK_STATE_NORMAL, GTK_SHADOW_IN,
NULL, widget, NULL,
border, border, 8*gh->char_width + 2*widget_get_xt(widget),
- widget->allocation.height - 2*border);
+ allocation.height - 2*border);
x += 8*gh->char_width + 2*widget_get_xt(widget);
}
- gtk_paint_shadow(widget->style, gtk_widget_get_window(widget),
+ gtk_paint_shadow(gtk_widget_get_style(widget), gtk_widget_get_window(widget),
GTK_STATE_NORMAL, GTK_SHADOW_IN,
NULL, widget, NULL,
x, border, gh->xdisp_width + 2*widget_get_xt(widget),
- widget->allocation.height - 2*border);
-
- gtk_paint_shadow(widget->style, gtk_widget_get_window(widget),
+ allocation.height - 2*border);
+
+ gtk_widget_get_requisition(gh->scrollbar, &sb_req);
+ gtk_paint_shadow(gtk_widget_get_style(widget), gtk_widget_get_window(widget),
GTK_STATE_NORMAL, GTK_SHADOW_IN,
NULL, widget, NULL,
- widget->allocation.width - border - gh->adisp_width - gh->scrollbar->requisition.width - 2*widget_get_xt(widget), border,
+ allocation.width - border - gh->adisp_width - sb_req.width - 2*widget_get_xt(widget), border,
gh->adisp_width + 2*widget_get_xt(widget),
- widget->allocation.height - 2*border);
+ allocation.height - 2*border);
}
/*
@@ -833,12 +848,12 @@ static void recalc_displays(GtkHex *gh, guint width, guint height) {
/* adjust the scrollbar and display position to
new sizes */
- gh->adj->value = MIN(gh->top_line*old_cpl / gh->cpl, gh->lines - gh->vis_lines);
- gh->adj->value = MAX(0, gh->adj->value);
- if((gh->cursor_pos/gh->cpl < gh->adj->value) ||
- (gh->cursor_pos/gh->cpl > gh->adj->value + gh->vis_lines - 1)) {
- gh->adj->value = MIN(gh->cursor_pos/gh->cpl, gh->lines - gh->vis_lines);
- gh->adj->value = MAX(0, gh->adj->value);
+ gtk_adjustment_set_value(gh->adj, MIN(gh->top_line*old_cpl / gh->cpl, gh->lines - gh->vis_lines));
+ gtk_adjustment_set_value(gh->adj, MAX(0, gtk_adjustment_get_value(gh->adj)));
+ if((gh->cursor_pos/gh->cpl < gtk_adjustment_get_value(gh->adj)) ||
+ (gh->cursor_pos/gh->cpl > gtk_adjustment_get_value(gh->adj) + gh->vis_lines - 1)) {
+ gtk_adjustment_set_value(gh->adj, MIN(gh->cursor_pos/gh->cpl, gh->lines - gh->vis_lines));
+ gtk_adjustment_set_value(gh->adj, MAX(0, gtk_adjustment_get_value(gh->adj)));
}
gtk_adjustment_set_lower(gh->adj, 0);
gtk_adjustment_set_upper(gh->adj, gh->lines);
@@ -857,13 +872,25 @@ static void recalc_displays(GtkHex *gh, guint width, guint height) {
* from testgtk.c ;)
*/
static void display_scrolled(GtkAdjustment *adj, GtkHex *gh) {
- gint source_min = ((gint)gtk_adjustment_get_value(adj) - gh->top_line) * gh->char_height;
- gint source_max = source_min + gh->xdisp->allocation.height;
- gint dest_min = 0;
- gint dest_max = gh->xdisp->allocation.height;
-
+ GtkAllocation xdisp_allocation;
+ GtkAllocation adisp_allocation;
+ GtkAllocation offsets_allocation;
GdkRectangle rect;
-
+ gint source_min;
+ gint source_max;
+ gint dest_min;
+ gint dest_max;
+
+ gtk_widget_get_allocation(gh->xdisp, &xdisp_allocation);
+ gtk_widget_get_allocation(gh->adisp, &adisp_allocation);
+ if(gh->offsets)
+ gtk_widget_get_allocation(gh->offsets, &offsets_allocation);
+
+ source_min = ((gint)gtk_adjustment_get_value(adj) - gh->top_line) * gh->char_height;
+ source_max = source_min + xdisp_allocation.height;
+ dest_min = 0;
+ dest_max = xdisp_allocation.height;
+
if(gh->xdisp_gc == NULL ||
gh->adisp_gc == NULL ||
(!gtk_widget_is_drawable(gh->xdisp)) ||
@@ -878,18 +905,18 @@ static void display_scrolled(GtkAdjustment *adj, GtkHex *gh) {
if (source_min < 0) {
rect.y = 0;
rect.height = -source_min;
- if (rect.height > gh->xdisp->allocation.height)
- rect.height = gh->xdisp->allocation.height;
+ if (rect.height > xdisp_allocation.height)
+ rect.height = xdisp_allocation.height;
source_min = 0;
dest_min = rect.height;
}
else {
- rect.y = 2*gh->xdisp->allocation.height - source_max;
+ rect.y = 2*xdisp_allocation.height - source_max;
if (rect.y < 0)
rect.y = 0;
- rect.height = gh->xdisp->allocation.height - rect.y;
+ rect.height = xdisp_allocation.height - rect.y;
- source_max = gh->xdisp->allocation.height;
+ source_max = xdisp_allocation.height;
dest_max = rect.y;
}
@@ -899,14 +926,14 @@ static void display_scrolled(GtkAdjustment *adj, GtkHex *gh) {
gtk_widget_get_window(gh->xdisp),
0, source_min,
0, dest_min,
- gh->xdisp->allocation.width,
+ xdisp_allocation.width,
source_max - source_min);
gdk_draw_drawable (gtk_widget_get_window(gh->adisp),
gh->adisp_gc,
gtk_widget_get_window(gh->adisp),
0, source_min,
0, dest_min,
- gh->adisp->allocation.width,
+ adisp_allocation.width,
source_max - source_min);
if(gh->offsets) {
if(gh->offsets_gc == NULL) {
@@ -918,19 +945,19 @@ static void display_scrolled(GtkAdjustment *adj, GtkHex *gh) {
gtk_widget_get_window(gh->offsets),
0, source_min,
0, dest_min,
- gh->offsets->allocation.width,
+ offsets_allocation.width,
source_max - source_min);
}
}
gtk_hex_update_all_auto_highlights(gh, TRUE, TRUE);
gtk_hex_invalidate_all_highlights(gh);
- rect.width = gh->xdisp->allocation.width;
+ rect.width = xdisp_allocation.width;
gdk_window_invalidate_rect (gtk_widget_get_window(gh->xdisp), &rect, FALSE);
- rect.width = gh->adisp->allocation.width;
+ rect.width = adisp_allocation.width;
gdk_window_invalidate_rect (gtk_widget_get_window(gh->adisp), &rect, FALSE);
if(gh->offsets) {
- rect.width = gh->offsets->allocation.width;
+ rect.width = offsets_allocation.width;
gdk_window_invalidate_rect (gtk_widget_get_window(gh->offsets), &rect, FALSE);
}
}
@@ -1006,13 +1033,15 @@ static void hex_button_cb(GtkWidget *w, GdkEventButton *event, GtkHex *gh) {
}
static void hex_motion_cb(GtkWidget *w, GdkEventMotion *event, GtkHex *gh) {
+ GtkAllocation allocation;
gint x, y;
+ gtk_widget_get_allocation(w, &allocation);
gdk_window_get_pointer(gtk_widget_get_window(w), &x, &y, NULL);
if(y < 0)
gh->scroll_dir = -1;
- else if(y >= w->allocation.height)
+ else if(y >= allocation.height)
gh->scroll_dir = 1;
else
gh->scroll_dir = 0;
@@ -1095,13 +1124,15 @@ static void ascii_button_cb(GtkWidget *w, GdkEventButton *event, GtkHex *gh) {
}
static void ascii_motion_cb(GtkWidget *w, GdkEventMotion *event, GtkHex *gh) {
+ GtkAllocation allocation;
gint x, y;
+ gtk_widget_get_allocation(w, &allocation);
gdk_window_get_pointer(gtk_widget_get_window(w), &x, &y, NULL);
if(y < 0)
gh->scroll_dir = -1;
- else if(y >= w->allocation.height)
+ else if(y >= allocation.height)
gh->scroll_dir = 1;
else
gh->scroll_dir = 0;
@@ -1186,12 +1217,12 @@ static void gtk_hex_real_data_changed(GtkHex *gh, gpointer data) {
lines++;
if(lines != gh->lines) {
gh->lines = lines;
- gh->adj->value = MIN(gh->adj->value, gh->lines - gh->vis_lines);
- gh->adj->value = MAX(0, gh->adj->value);
- if((gh->cursor_pos/gh->cpl < gh->adj->value) ||
- (gh->cursor_pos/gh->cpl > gh->adj->value + gh->vis_lines - 1)) {
- gh->adj->value = MIN(gh->cursor_pos/gh->cpl, gh->lines - gh->vis_lines);
- gh->adj->value = MAX(0, gh->adj->value);
+ gtk_adjustment_set_value(gh->adj, MIN(gtk_adjustment_get_value(gh->adj), gh->lines - gh->vis_lines));
+ gtk_adjustment_set_value(gh->adj, MAX(0, gtk_adjustment_get_value(gh->adj)));
+ if((gh->cursor_pos/gh->cpl < gtk_adjustment_get_value(gh->adj)) ||
+ (gh->cursor_pos/gh->cpl > gtk_adjustment_get_value(gh->adj) + gh->vis_lines - 1)) {
+ gtk_adjustment_set_value(gh->adj, MIN(gh->cursor_pos/gh->cpl, gh->lines - gh->vis_lines));
+ gtk_adjustment_set_value(gh->adj, MAX(0, gtk_adjustment_get_value(gh->adj)));
}
gtk_adjustment_set_lower(gh->adj, 0);
gtk_adjustment_set_upper(gh->adj, gh->lines);
@@ -1395,7 +1426,7 @@ static GtkHex_Highlight *gtk_hex_insert_highlight (GtkHex *gh,
new->start = CLAMP(MIN(start, end), 0, length);
new->end = MIN(MAX(start, end), length);
- new->style = gtk_style_copy(GTK_WIDGET(gh)->style);
+ new->style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(gh)));
g_object_ref(new->style);
new->valid = FALSE;
@@ -1808,6 +1839,7 @@ static gboolean gtk_hex_button_release(GtkWidget *w, GdkEventButton *event) {
static void gtk_hex_size_allocate(GtkWidget *w, GtkAllocation *alloc) {
GtkHex *gh;
GtkAllocation my_alloc;
+ GtkRequisition sb_req;
gint border_width, xt, yt;
gh = GTK_HEX(w);
@@ -1815,7 +1847,7 @@ static void gtk_hex_size_allocate(GtkWidget *w, GtkAllocation *alloc) {
recalc_displays(gh, alloc->width, alloc->height);
- w->allocation = *alloc;
+ gtk_widget_set_allocation(w, alloc);
if(gtk_widget_get_realized(w))
gdk_window_move_resize (gtk_widget_get_window(w),
alloc->x,
@@ -1836,11 +1868,14 @@ static void gtk_hex_size_allocate(GtkWidget *w, GtkAllocation *alloc) {
gtk_widget_queue_draw(gh->offsets);
my_alloc.x += 2*xt + my_alloc.width;
}
+
+ gtk_widget_get_requisition(gh->scrollbar, &sb_req);
+
my_alloc.width = gh->xdisp_width;
gtk_widget_size_allocate(gh->xdisp, &my_alloc);
- my_alloc.x = alloc->width - border_width - gh->scrollbar->requisition.width;
+ my_alloc.x = alloc->width - border_width - sb_req.width;
my_alloc.y = border_width;
- my_alloc.width = gh->scrollbar->requisition.width;
+ my_alloc.width = sb_req.width;
my_alloc.height = MAX(alloc->height - 2*border_width, 1);
gtk_widget_size_allocate(gh->scrollbar, &my_alloc);
my_alloc.x -= gh->adisp_width + xt;
@@ -1987,7 +2022,7 @@ static void gtk_hex_init(GtkHex *gh, gpointer klass) {
gh->char_height = PANGO_PIXELS (pango_font_metrics_get_ascent (gh->disp_font_metrics)) + PANGO_PIXELS (pango_font_metrics_get_descent (gh->disp_font_metrics)) + 2;
- GTK_WIDGET_SET_FLAGS(gh, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(GTK_WIDGET(gh), TRUE);
gtk_widget_set_events(GTK_WIDGET(gh), GDK_KEY_PRESS_MASK);
gtk_container_set_border_width(GTK_CONTAINER(gh), DISPLAY_BORDER);
@@ -2142,12 +2177,12 @@ void gtk_hex_set_cursor(GtkHex *gh, gint index) {
y = index / gh->cpl;
if(y >= gh->top_line + gh->vis_lines) {
- gh->adj->value = MIN(y - gh->vis_lines + 1, gh->lines - gh->vis_lines);
- gh->adj->value = MAX(gh->adj->value, 0);
+ gtk_adjustment_set_value(gh->adj, MIN(y - gh->vis_lines + 1, gh->lines - gh->vis_lines));
+ gtk_adjustment_set_value(gh->adj, MAX(gtk_adjustment_get_value(gh->adj), 0));
g_signal_emit_by_name(G_OBJECT(gh->adj), "value_changed");
}
else if (y < gh->top_line) {
- gh->adj->value = y;
+ gtk_adjustment_set_value(gh->adj, y);
g_signal_emit_by_name(G_OBJECT(gh->adj), "value_changed");
}
@@ -2196,12 +2231,12 @@ void gtk_hex_set_cursor_xy(GtkHex *gh, gint x, gint y) {
gh->cursor_pos = cp;
if(y >= gh->top_line + gh->vis_lines) {
- gh->adj->value = MIN(y - gh->vis_lines + 1, gh->lines - gh->vis_lines);
- gh->adj->value = MAX(0, gh->adj->value);
+ gtk_adjustment_set_value(gh->adj, MIN(y - gh->vis_lines + 1, gh->lines - gh->vis_lines));
+ gtk_adjustment_set_value(gh->adj, MAX(0, gtk_adjustment_get_value(gh->adj)));
g_signal_emit_by_name(G_OBJECT(gh->adj), "value_changed");
}
else if (y < gh->top_line) {
- gh->adj->value = y;
+ gtk_adjustment_set_value(gh->adj, y);
g_signal_emit_by_name(G_OBJECT(gh->adj), "value_changed");
}
@@ -2249,12 +2284,15 @@ guchar gtk_hex_get_byte(GtkHex *gh, guint offset) {
* sets data group type (see GROUP_* defines in gtkhex.h)
*/
void gtk_hex_set_group_type(GtkHex *gh, guint gt) {
+ GtkAllocation allocation;
+
g_return_if_fail(gh != NULL);
g_return_if_fail(GTK_IS_HEX(gh));
hide_cursor(gh);
gh->group_type = gt;
- recalc_displays(gh, GTK_WIDGET(gh)->allocation.width, GTK_WIDGET(gh)->allocation.height);
+ gtk_widget_get_allocation(GTK_WIDGET(gh), &allocation);
+ recalc_displays(gh, allocation.width, allocation.height);
gtk_widget_queue_resize(GTK_WIDGET(gh));
show_cursor(gh);
}
@@ -2263,6 +2301,8 @@ void gtk_hex_set_group_type(GtkHex *gh, guint gt) {
* sets font for displaying data
*/
void gtk_hex_set_font(GtkHex *gh, PangoFontMetrics *font_metrics, const PangoFontDescription *font_desc) {
+ GtkAllocation allocation;
+
g_return_if_fail(gh != NULL);
g_return_if_fail(GTK_IS_HEX(gh));
@@ -2287,7 +2327,8 @@ void gtk_hex_set_font(GtkHex *gh, PangoFontMetrics *font_metrics, const PangoFon
gh->char_width = get_max_char_width(gh, gh->disp_font_metrics);
gh->char_height = PANGO_PIXELS (pango_font_metrics_get_ascent (gh->disp_font_metrics)) + PANGO_PIXELS (pango_font_metrics_get_descent (gh->disp_font_metrics)) + 2;
- recalc_displays(gh, GTK_WIDGET(gh)->allocation.width, GTK_WIDGET(gh)->allocation.height);
+ gtk_widget_get_allocation(GTK_WIDGET(gh), &allocation);
+ recalc_displays(gh, allocation.width, allocation.height);
redraw_widget(GTK_WIDGET(gh));
}
@@ -2455,5 +2496,3 @@ void add_atk_relation (GtkWidget *obj1, GtkWidget *obj2, AtkRelationType type)
g_object_unref (G_OBJECT (relation));
}
-
-
diff --git a/src/hex-document-ui.c b/src/hex-document-ui.c
index 0c4436f..b4e4f0a 100644
--- a/src/hex-document-ui.c
+++ b/src/hex-document-ui.c
@@ -78,7 +78,7 @@ find_cb (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname)
if(!find_dialog)
find_dialog = create_find_dialog();
- if(!GTK_WIDGET_VISIBLE(find_dialog->window)) {
+ if(!gtk_widget_get_visible(find_dialog->window)) {
gtk_window_set_position (GTK_WINDOW(find_dialog->window), GTK_WIN_POS_MOUSE);
gtk_window_set_default(GTK_WINDOW(find_dialog->window), find_dialog->f_next);
gtk_widget_show(find_dialog->window);
@@ -93,7 +93,7 @@ advanced_find_cb (BonoboUIComponent *uic, gpointer user_data, const gchar* verbn
if (!win->advanced_find_dialog)
win->advanced_find_dialog = create_advanced_find_dialog(win);
- if(!GTK_WIDGET_VISIBLE(win->advanced_find_dialog->window)) {
+ if(!gtk_widget_get_visible(win->advanced_find_dialog->window)) {
gtk_window_set_position (GTK_WINDOW(win->advanced_find_dialog->window), GTK_WIN_POS_MOUSE);
gtk_window_set_default(GTK_WINDOW(win->advanced_find_dialog->window),
win->advanced_find_dialog->f_close);
@@ -109,7 +109,7 @@ replace_cb (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname)
if(!replace_dialog)
replace_dialog = create_replace_dialog();
- if(!GTK_WIDGET_VISIBLE(replace_dialog->window)) {
+ if(!gtk_widget_get_visible(replace_dialog->window)) {
gtk_window_set_position (GTK_WINDOW(replace_dialog->window), GTK_WIN_POS_MOUSE);
gtk_window_set_default(GTK_WINDOW(replace_dialog->window), replace_dialog->next);
gtk_widget_show(replace_dialog->window);
@@ -123,7 +123,7 @@ jump_cb (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname)
if(!jump_dialog)
jump_dialog = create_jump_dialog();
- if(!GTK_WIDGET_VISIBLE(jump_dialog->window)) {
+ if(!gtk_widget_get_visible(jump_dialog->window)) {
gtk_window_set_position (GTK_WINDOW(jump_dialog->window), GTK_WIN_POS_MOUSE);
gtk_window_set_default(GTK_WINDOW(jump_dialog->window), jump_dialog->ok);
gtk_widget_show(jump_dialog->window);
diff --git a/src/preferences.c b/src/preferences.c
index 0769b2b..3ba6051 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -85,7 +85,7 @@ create_prefs_dialog()
notebook = gtk_notebook_new();
gtk_widget_show(notebook);
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(pui->pbox)->vbox), notebook);
+ gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(pui->pbox))), notebook);
/* editing page */
vbox = gtk_vbox_new(FALSE, 0);
@@ -388,7 +388,7 @@ void set_current_prefs(PropertyUI *pui) {
static void
max_undo_changed_cb(GtkAdjustment *adj, PropertyUI *pui)
{
- if((guint)adj->value != max_undo_depth) {
+ if((guint)gtk_adjustment_get_value(adj) != max_undo_depth) {
max_undo_depth = gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(pui->undo_spin));
gconf_client_set_int (gconf_client,
@@ -401,7 +401,7 @@ max_undo_changed_cb(GtkAdjustment *adj, PropertyUI *pui)
static void
box_size_changed_cb(GtkAdjustment *adj, PropertyUI *pui)
{
- if((guint)adj->value != shaded_box_size) {
+ if((guint)gtk_adjustment_get_value(adj) != shaded_box_size) {
shaded_box_size = gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(pui->box_size_spin));
gconf_client_set_int (gconf_client,
@@ -428,7 +428,7 @@ group_type_cb(GtkRadioButton *rd, PropertyUI *pui)
int i;
for(i = 0; i < 3; i++)
- if(GTK_TOGGLE_BUTTON(pui->group_type[i])->active) {
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pui->group_type[i]))) {
def_group_type = group_type[i];
break;
}
diff --git a/src/ui.c b/src/ui.c
index f4a8222..b171f10 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -634,7 +634,7 @@ close_cb (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname)
void
raise_and_focus_widget (GtkWidget *widget)
{
- if(!GTK_WIDGET_REALIZED (widget))
+ if(!gtk_widget_get_realized (widget))
return;
gtk_window_present(GTK_WINDOW(widget));
@@ -673,7 +673,7 @@ void prefs_cb (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname
if(ghex_window_get_active() != NULL)
gtk_window_set_transient_for(GTK_WINDOW(prefs_ui->pbox),
GTK_WINDOW(ghex_window_get_active()));
- if(!GTK_WIDGET_VISIBLE(prefs_ui->pbox)) {
+ if(!gtk_widget_get_visible(prefs_ui->pbox)) {
gtk_window_set_position (GTK_WINDOW(prefs_ui->pbox), GTK_WIN_POS_MOUSE);
gtk_widget_show(GTK_WIDGET(prefs_ui->pbox));
}
@@ -805,7 +805,7 @@ ghex_print_document_real(GHexPrintJobInfo *pji, gboolean preview)
_("Printing file..."));
progress_bar = gtk_progress_bar_new();
gtk_widget_show(progress_bar);
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(progress_dialog)->vbox),
+ gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(progress_dialog))),
progress_bar);
gtk_widget_show(progress_dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]