[gnome-commander: 1/2] Replace direct access to GTK struct members with accessor functions
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander: 1/2] Replace direct access to GTK struct members with accessor functions
- Date: Wed, 24 Aug 2022 20:50:17 +0000 (UTC)
commit 32cd729d0b12734f4a823187912bc96a0a95f04e
Author: Roman Pauer <roman pauer gmail com>
Date: Sun Aug 21 12:21:23 2022 +0200
Replace direct access to GTK struct members with accessor functions
libgcmd/libgcmd-widget-factory.h | 5 +
plugins/fileroller/file-roller-plugin.cc | 4 +-
src/dialogs/gnome-cmd-advrename-dialog.cc | 10 +-
src/dialogs/gnome-cmd-con-dialog.cc | 26 ++--
src/dialogs/gnome-cmd-delete-dialog.cc | 2 +-
src/dialogs/gnome-cmd-file-props-dialog.cc | 8 +-
src/dialogs/gnome-cmd-key-shortcuts-dialog.cc | 12 +-
src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc | 8 +-
src/dialogs/gnome-cmd-manage-profiles-dialog.h | 6 +-
src/dialogs/gnome-cmd-options-dialog.cc | 29 +++--
src/dialogs/gnome-cmd-remote-dialog.cc | 6 +-
src/dialogs/gnome-cmd-rename-dialog.cc | 6 +-
src/eggcellrendererkeys.cc | 17 +--
src/gnome-cmd-about-plugin.cc | 18 +--
src/gnome-cmd-advrename-profile-component.cc | 22 ++--
src/gnome-cmd-clist.cc | 24 ++--
src/gnome-cmd-cmdline.cc | 4 +-
src/gnome-cmd-combo.cc | 75 +++++++-----
src/gnome-cmd-dir-indicator.cc | 26 ++--
src/gnome-cmd-file-list.cc | 20 ++--
src/gnome-cmd-file-selector.cc | 4 +-
src/gnome-cmd-file.cc | 2 +-
src/gnome-cmd-main-menu.cc | 8 +-
src/gnome-cmd-main-win.cc | 50 +++++---
src/gnome-cmd-notebook.cc | 21 ++--
src/gnome-cmd-quicksearch-popup.cc | 10 +-
src/gnome-cmd-user-actions.cc | 32 ++---
src/gnome-cmd-xfer-progress-win.cc | 2 +-
src/intviewer/image-render.cc | 92 +++++++-------
src/intviewer/search-dlg.cc | 4 +-
src/intviewer/search-progress-dlg.cc | 6 +-
src/intviewer/text-render.cc | 146 ++++++++++++-----------
src/intviewer/viewer-window.cc | 23 ++--
src/utils.cc | 2 +-
34 files changed, 403 insertions(+), 327 deletions(-)
---
diff --git a/libgcmd/libgcmd-widget-factory.h b/libgcmd/libgcmd-widget-factory.h
index 698a52d3..6da996fe 100644
--- a/libgcmd/libgcmd-widget-factory.h
+++ b/libgcmd/libgcmd-widget-factory.h
@@ -171,4 +171,9 @@ inline void gtk_progress_bar_set_show_text (GtkProgressBar *pbar, gboolean show_
gtk_progress_bar_set_text (pbar, nullptr);
pbar->progress.show_text = show_text;
}
+
+inline GtkWidget *gtk_tree_view_column_get_button (GtkTreeViewColumn *tree_column)
+{
+ return tree_column->button;
+}
#endif
diff --git a/plugins/fileroller/file-roller-plugin.cc b/plugins/fileroller/file-roller-plugin.cc
index 00375acc..13dfefaa 100644
--- a/plugins/fileroller/file-roller-plugin.cc
+++ b/plugins/fileroller/file-roller-plugin.cc
@@ -383,7 +383,7 @@ static void on_add_to_archive (GtkMenuItem *item, FileRollerPlugin *plugin)
hbox = gtk_hbox_new (FALSE, 6);
g_object_ref (hbox);
gtk_widget_show (hbox);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, TRUE, 6);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, TRUE,
6);
entry = gtk_entry_new ();
g_object_ref (entry);
@@ -415,7 +415,7 @@ static void on_add_to_archive (GtkMenuItem *item, FileRollerPlugin *plugin)
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char**)file_roller_xpm);
- gtk_image_set_from_pixbuf (GTK_IMAGE (GTK_MESSAGE_DIALOG (dialog)->image), pixbuf);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (gtk_message_dialog_get_image (GTK_MESSAGE_DIALOG (dialog))),
pixbuf);
g_object_unref (pixbuf);
ret = gtk_dialog_run (GTK_DIALOG (dialog));
diff --git a/src/dialogs/gnome-cmd-advrename-dialog.cc b/src/dialogs/gnome-cmd-advrename-dialog.cc
index 3238af63..03b4a107 100644
--- a/src/dialogs/gnome-cmd-advrename-dialog.cc
+++ b/src/dialogs/gnome-cmd-advrename-dialog.cc
@@ -1,4 +1,4 @@
-/**
+/**
* @file gnome-cmd-advrename-dialog.cc
* @copyright (C) 2001-2006 Marcus Bjurman\n
* @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -605,25 +605,25 @@ inline GtkWidget *create_files_view ()
g_object_set (renderer, "foreground", "red", "style", PANGO_STYLE_ITALIC, NULL);
gtk_tree_view_column_add_attribute (col, renderer, "foreground-set",
GnomeCmdAdvrenameDialog::COL_RENAME_FAILED);
gtk_tree_view_column_add_attribute (col, renderer, "style-set",
GnomeCmdAdvrenameDialog::COL_RENAME_FAILED);
- gtk_widget_set_tooltip_text (col->button, _("Current file name"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Current file name"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer,
GnomeCmdAdvrenameDialog::COL_NEW_NAME, _("New name"));
g_object_set (renderer, "foreground", "red", "style", PANGO_STYLE_ITALIC, NULL);
gtk_tree_view_column_add_attribute (col, renderer, "foreground-set",
GnomeCmdAdvrenameDialog::COL_RENAME_FAILED);
gtk_tree_view_column_add_attribute (col, renderer, "style-set",
GnomeCmdAdvrenameDialog::COL_RENAME_FAILED);
- gtk_widget_set_tooltip_text (col->button, _("New file name"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("New file name"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer,
GnomeCmdAdvrenameDialog::COL_SIZE, _("Size"));
g_object_set (renderer, "xalign", 1.0, "foreground", "red", "style", PANGO_STYLE_ITALIC, NULL);
gtk_tree_view_column_add_attribute (col, renderer, "foreground-set",
GnomeCmdAdvrenameDialog::COL_RENAME_FAILED);
gtk_tree_view_column_add_attribute (col, renderer, "style-set",
GnomeCmdAdvrenameDialog::COL_RENAME_FAILED);
- gtk_widget_set_tooltip_text (col->button, _("File size"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("File size"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer,
GnomeCmdAdvrenameDialog::COL_DATE, _("Date"));
g_object_set (renderer, "foreground", "red", "style", PANGO_STYLE_ITALIC, NULL);
gtk_tree_view_column_add_attribute (col, renderer, "foreground-set",
GnomeCmdAdvrenameDialog::COL_RENAME_FAILED);
gtk_tree_view_column_add_attribute (col, renderer, "style-set",
GnomeCmdAdvrenameDialog::COL_RENAME_FAILED);
- gtk_widget_set_tooltip_text (col->button, _("File modification date"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("File modification date"));
return view;
}
diff --git a/src/dialogs/gnome-cmd-con-dialog.cc b/src/dialogs/gnome-cmd-con-dialog.cc
index 63176e5f..6358fc47 100644
--- a/src/dialogs/gnome-cmd-con-dialog.cc
+++ b/src/dialogs/gnome-cmd-con-dialog.cc
@@ -125,22 +125,22 @@ void GnomeCmdConnectDialog::Private::setup_for_type()
{
gint type = gtk_combo_box_get_active (GTK_COMBO_BOX (type_combo));
- if (alias_entry->parent)
+ if (gtk_widget_get_parent (alias_entry))
gtk_container_remove (GTK_CONTAINER (required_table), alias_entry);
- if (uri_entry->parent)
+ if (gtk_widget_get_parent (uri_entry))
gtk_container_remove (GTK_CONTAINER (required_table), uri_entry);
- if (server_entry->parent)
+ if (gtk_widget_get_parent (server_entry))
gtk_container_remove (GTK_CONTAINER (required_table), server_entry);
- if (port_entry->parent)
+ if (gtk_widget_get_parent (port_entry))
gtk_container_remove (GTK_CONTAINER (optional_table), port_entry);
- if (folder_entry->parent)
+ if (gtk_widget_get_parent (folder_entry))
gtk_container_remove (GTK_CONTAINER (optional_table), folder_entry);
- if (domain_entry->parent)
+ if (gtk_widget_get_parent (domain_entry))
gtk_container_remove (GTK_CONTAINER (optional_table), domain_entry);
// Destroy all labels
@@ -250,19 +250,19 @@ gboolean GnomeCmdConnectDialog::verify_uri()
string folder;
string domain;
- if (priv->uri_entry->parent)
+ if (gtk_widget_get_parent (priv->uri_entry))
stringify (uri, gtk_editable_get_chars (GTK_EDITABLE (priv->uri_entry), 0, -1));
- if (priv->server_entry->parent)
+ if (gtk_widget_get_parent (priv->server_entry))
stringify (server, gtk_editable_get_chars (GTK_EDITABLE (priv->server_entry), 0, -1));
- if (priv->port_entry->parent)
+ if (gtk_widget_get_parent (priv->port_entry))
stringify (port, gtk_editable_get_chars (GTK_EDITABLE (priv->port_entry), 0, -1));
- if (priv->folder_entry->parent)
+ if (gtk_widget_get_parent (priv->folder_entry))
stringify (folder, gtk_editable_get_chars (GTK_EDITABLE (priv->folder_entry), 0, -1));
- if (priv->domain_entry->parent)
+ if (gtk_widget_get_parent (priv->domain_entry))
stringify (domain, gtk_editable_get_chars (GTK_EDITABLE (priv->domain_entry), 0, -1));
int type = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->type_combo));
@@ -380,12 +380,12 @@ static void gnome_cmd_connect_dialog_init (GnomeCmdConnectDialog *dialog)
gtk_window_set_title (*dialog, _("Remote Server"));
gtk_dialog_set_has_separator (*dialog, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
gtk_window_set_resizable (*dialog, FALSE);
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox, FALSE, TRUE, 0);
gtk_widget_show (vbox);
hbox = gtk_hbox_new (FALSE, 6);
diff --git a/src/dialogs/gnome-cmd-delete-dialog.cc b/src/dialogs/gnome-cmd-delete-dialog.cc
index 4f5de785..262d2da1 100644
--- a/src/dialogs/gnome-cmd-delete-dialog.cc
+++ b/src/dialogs/gnome-cmd-delete-dialog.cc
@@ -129,7 +129,7 @@ inline void create_delete_progress_win (DeleteData *deleteData)
gtk_container_add (GTK_CONTAINER (vbox), bbox);
button = create_stock_button_with_data (deleteData->progwin, GTK_STOCK_CANCEL, GTK_SIGNAL_FUNC
(on_cancel), deleteData);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_container_add (GTK_CONTAINER (bbox), button);
g_object_ref (deleteData->progwin);
diff --git a/src/dialogs/gnome-cmd-file-props-dialog.cc b/src/dialogs/gnome-cmd-file-props-dialog.cc
index 616b6232..fa6ec0cc 100644
--- a/src/dialogs/gnome-cmd-file-props-dialog.cc
+++ b/src/dialogs/gnome-cmd-file-props-dialog.cc
@@ -592,7 +592,7 @@ static GtkWidget *create_view_and_model (GnomeCmdFile *f)
GtkTreeViewColumn *col = nullptr;
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_TYPE, _("Type"));
- gtk_widget_set_tooltip_text (col->button, _("Metadata namespace"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Metadata namespace"));
g_object_set (renderer,
"weight-set", TRUE,
@@ -600,13 +600,13 @@ static GtkWidget *create_view_and_model (GnomeCmdFile *f)
nullptr);
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), COL_NAME, _("Name"));
- gtk_widget_set_tooltip_text (col->button, _("Tag name"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Tag name"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), COL_VALUE, _("Value"));
- gtk_widget_set_tooltip_text (col->button, _("Tag value"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Tag value"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_DESC,
_("Description"));
- gtk_widget_set_tooltip_text (col->button, _("Metadata tag description"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Metadata tag description"));
g_object_set (renderer,
"foreground-set", TRUE,
diff --git a/src/dialogs/gnome-cmd-key-shortcuts-dialog.cc b/src/dialogs/gnome-cmd-key-shortcuts-dialog.cc
index 2f50e0d0..7f2a1053 100644
--- a/src/dialogs/gnome-cmd-key-shortcuts-dialog.cc
+++ b/src/dialogs/gnome-cmd-key-shortcuts-dialog.cc
@@ -1,4 +1,4 @@
-/**
+/**
* @file gnome-cmd-key-shortcuts-dialog.cc
* @copyright (C) 2001-2006 Marcus Bjurman\n
* @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -201,12 +201,12 @@ static void gnome_cmd_key_shortcuts_dialog_init (GnomeCmdKeyShortcutsDialog *dia
gtk_window_set_title (GTK_WINDOW (dialog), _("Keyboard Shortcuts"));
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
GtkWidget *vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox);
gtk_widget_show (vbox);
GtkWidget *hbox = gtk_hbox_new (FALSE, 12);
@@ -352,7 +352,7 @@ GtkWidget *create_view_and_model (GnomeCmdUserActions &user_actions)
GtkTreeViewColumn *col = NULL;
col = create_new_accel_column (GTK_TREE_VIEW (view), renderer, COL_ACCEL_KEY, COL_ACCEL_MASK,
_("Shortcut Key"));
- gtk_widget_set_tooltip_text (col->button, _("Keyboard shortcut for selected action"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Keyboard shortcut for selected
action"));
gtk_tree_view_column_set_sort_column_id (col, SORTID_ACCEL);
g_signal_connect (renderer, "accel-edited", G_CALLBACK (accel_edited_callback), view);
@@ -360,14 +360,14 @@ GtkWidget *create_view_and_model (GnomeCmdUserActions &user_actions)
GtkTreeModel *combo_model = gnome_cmd_user_actions_create_model ();
col = create_new_combo_column (GTK_TREE_VIEW (view), combo_model, renderer, COL_ACTION, _("Action"));
- gtk_widget_set_tooltip_text (col->button, _("User action"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("User action"));
gtk_tree_view_column_set_sort_column_id (col, SORTID_ACTION);
g_signal_connect (renderer, "edited", (GCallback) cell_edited_callback, view);
g_object_unref (combo_model); // destroy model automatically with view
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_OPTION,
_("Options"));
- gtk_widget_set_tooltip_text (col->button, _("Optional data"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Optional data"));
gtk_tree_view_column_set_sort_column_id (col, SORTID_OPTION);
g_signal_connect (renderer, "edited", (GCallback) cell_edited_callback, view);
diff --git a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
index 8e244f79..3d6b9c13 100644
--- a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
+++ b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
@@ -234,7 +234,7 @@ static GtkWidget *create_view_and_model ()
GtkTreeViewColumn *col = NULL;
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (bm_view), renderer, COL_GROUP,
_("Group"));
- gtk_widget_set_tooltip_text (col->button, _("Bookmark group"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Bookmark group"));
g_object_set (renderer,
"weight-set", TRUE,
@@ -242,10 +242,10 @@ static GtkWidget *create_view_and_model ()
NULL);
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (bm_view), renderer, COL_NAME, _("Name"));
- gtk_widget_set_tooltip_text (col->button, _("Bookmark name"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Bookmark name"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (bm_view), renderer, COL_SHORTCUT,
_("Shortcut"));
- gtk_widget_set_tooltip_text (col->button, _("Keyboard shortcut for selected bookmark"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Keyboard shortcut for selected
bookmark"));
g_object_set (renderer,
"foreground-set", TRUE,
@@ -253,7 +253,7 @@ static GtkWidget *create_view_and_model ()
NULL);
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (bm_view), renderer, COL_PATH, _("Path"));
- gtk_widget_set_tooltip_text (col->button, _("Bookmarked path"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Bookmarked path"));
g_object_set (renderer,
"foreground-set", TRUE,
diff --git a/src/dialogs/gnome-cmd-manage-profiles-dialog.h b/src/dialogs/gnome-cmd-manage-profiles-dialog.h
index 6aa159d1..fef93071 100644
--- a/src/dialogs/gnome-cmd-manage-profiles-dialog.h
+++ b/src/dialogs/gnome-cmd-manage-profiles-dialog.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file gnome-cmd-manage-profiles-dialog.h
* @copyright (C) 2001-2006 Marcus Bjurman\n
* @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -119,7 +119,7 @@ namespace GnomeCmd
GtkTreeViewColumn *col = NULL;
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_NAME,
_("Profile"));
- gtk_widget_set_tooltip_text (col->button, _("Profile name"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Profile name"));
g_signal_connect (renderer, "edited", G_CALLBACK (cell_edited_callback), view);
g_object_set (renderer,
@@ -127,7 +127,7 @@ namespace GnomeCmd
NULL);
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_TEMPLATE,
_("Template"));
- gtk_widget_set_tooltip_text (col->button, _("Template"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Template"));
g_object_set (renderer,
"foreground-set", TRUE,
diff --git a/src/dialogs/gnome-cmd-options-dialog.cc b/src/dialogs/gnome-cmd-options-dialog.cc
index 716ad683..79e63296 100644
--- a/src/dialogs/gnome-cmd-options-dialog.cc
+++ b/src/dialogs/gnome-cmd-options-dialog.cc
@@ -918,7 +918,7 @@ void store_layout_options (GtkWidget *dialog, GnomeCmdData::Options &cfg)
#endif
GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (iconquality_scale));
- cfg.icon_scale_quality = (GdkInterpType) adj->value;
+ cfg.icon_scale_quality = (GdkInterpType) gtk_adjustment_get_value (adj);
#if defined (__GNUC__)
#pragma GCC diagnostic push
@@ -1744,27 +1744,27 @@ static GtkWidget *create_programs_tab (GtkWidget *parent, GnomeCmdData::Options
gtk_box_pack_start (GTK_BOX (hbox), bbox, FALSE, TRUE, 0);
button = create_stock_button (parent, GTK_STOCK_ADD, GTK_SIGNAL_FUNC (on_app_add));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = create_stock_button (parent, GTK_STOCK_EDIT, GTK_SIGNAL_FUNC (on_app_edit));
g_object_set_data (G_OBJECT (parent), "edit_app_button", button);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_widget_set_sensitive (button, FALSE);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = create_stock_button (parent, GTK_STOCK_REMOVE, GTK_SIGNAL_FUNC (on_app_remove));
g_object_set_data (G_OBJECT (parent), "remove_app_button", button);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_widget_set_sensitive (button, FALSE);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = create_stock_button (parent, GTK_STOCK_GO_UP, GTK_SIGNAL_FUNC (on_app_move_up));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = create_stock_button (parent, GTK_STOCK_GO_DOWN, GTK_SIGNAL_FUNC (on_app_move_down));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_container_add (GTK_CONTAINER (bbox), button);
clist = (GtkWidget *) g_object_get_data (G_OBJECT (parent), "app_clist");
@@ -2122,27 +2122,27 @@ static GtkWidget *create_devices_tab (GtkWidget *parent, GnomeCmdData::Options &
gtk_box_pack_start (GTK_BOX (hbox), bbox, FALSE, TRUE, 0);
button = create_stock_button (parent, GTK_STOCK_ADD, GTK_SIGNAL_FUNC (on_device_add));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = create_stock_button (parent, GTK_STOCK_EDIT, GTK_SIGNAL_FUNC (on_device_edit));
g_object_set_data (G_OBJECT (parent), "edit_device_button", button);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_widget_set_sensitive (button, FALSE);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = create_stock_button (parent, GTK_STOCK_REMOVE, GTK_SIGNAL_FUNC (on_device_remove));
g_object_set_data (G_OBJECT (parent), "remove_device_button", button);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_widget_set_sensitive (button, FALSE);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = create_stock_button (parent, GTK_STOCK_GO_UP, GTK_SIGNAL_FUNC (on_device_move_up));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = create_stock_button (parent, GTK_STOCK_GO_DOWN, GTK_SIGNAL_FUNC (on_device_move_down));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_container_add (GTK_CONTAINER (bbox), button);
#ifdef HAVE_SAMBA
@@ -2269,8 +2269,11 @@ gboolean gnome_cmd_options_dialog (GtkWindow *parent, GnomeCmdData::Options &cfg
store_devices_options (dialog, cfg);
}
- gnome_cmd_data.opts_dialog_width = dialog->allocation.width;
- gnome_cmd_data.opts_dialog_height = dialog->allocation.height;
+ GtkAllocation dialog_allocation;
+ gtk_widget_get_allocation (dialog, &dialog_allocation);
+
+ gnome_cmd_data.opts_dialog_width = dialog_allocation.width;
+ gnome_cmd_data.opts_dialog_height = dialog_allocation.height;
// store the current active tab
activetab = notebook->get_current_page();
diff --git a/src/dialogs/gnome-cmd-remote-dialog.cc b/src/dialogs/gnome-cmd-remote-dialog.cc
index 68d790c9..6d547bc6 100644
--- a/src/dialogs/gnome-cmd-remote-dialog.cc
+++ b/src/dialogs/gnome-cmd-remote-dialog.cc
@@ -1,4 +1,4 @@
-/**
+/**
* @file gnome-cmd-remote-dialog.cc
* @copyright (C) 2001-2006 Marcus Bjurman\n
* @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -341,7 +341,7 @@ inline GtkWidget *create_view_and_model (GList *list)
// col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_AUTH);
col = gnome_cmd_treeview_create_new_pixbuf_column (GTK_TREE_VIEW (view), renderer, COL_METHOD);
- gtk_widget_set_tooltip_text (col->button, _("Network protocol"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Network protocol"));
gtk_tree_view_column_set_sort_column_id (col, SORTID_METHOD);
// col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_METHOD);
@@ -352,7 +352,7 @@ inline GtkWidget *create_view_and_model (GList *list)
// NULL);
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_NAME, _("Name"));
- gtk_widget_set_tooltip_text (col->button, _("Connection name"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Connection name"));
gtk_tree_view_column_set_sort_column_id (col, SORTID_NAME);
g_object_set (renderer,
"ellipsize-set", TRUE,
diff --git a/src/dialogs/gnome-cmd-rename-dialog.cc b/src/dialogs/gnome-cmd-rename-dialog.cc
index d7e47a1a..50e0b420 100644
--- a/src/dialogs/gnome-cmd-rename-dialog.cc
+++ b/src/dialogs/gnome-cmd-rename-dialog.cc
@@ -1,4 +1,4 @@
-/**
+/**
* @file gnome-cmd-rename-dialog.cc
* @copyright (C) 2001-2006 Marcus Bjurman\n
* @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -45,8 +45,8 @@ static gboolean on_dialog_keypressed (GtkWidget *widget, GdkEventKey *event, gpo
{
GnomeCmdRenameDialog *dialog = GNOME_CMD_RENAME_DIALOG(widget);
- if (dialog->priv->textbox->editable && event->type == GDK_KEY_PRESS)
- if (gtk_im_context_filter_keypress (dialog->priv->textbox->im_context, event))
+ if (event->type == GDK_KEY_PRESS && gtk_editable_get_editable (GTK_EDITABLE (dialog->priv->textbox)))
+ if (gtk_entry_im_context_filter_keypress (dialog->priv->textbox, event))
return TRUE;
switch (event->keyval)
diff --git a/src/eggcellrendererkeys.cc b/src/eggcellrendererkeys.cc
index e5d88a5f..a64d8e6e 100644
--- a/src/eggcellrendererkeys.cc
+++ b/src/eggcellrendererkeys.cc
@@ -1,4 +1,4 @@
-/**
+/**
* @file eggcellrendererkeys.cc
* @copyright (C) 2001-2006 Marcus Bjurman\n
* @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -613,7 +613,7 @@ egg_cell_renderer_keys_start_editing (GtkCellRenderer *cell,
GdkRectangle *cell_area,
GtkCellRendererState flags)
{
- g_return_val_if_fail (widget->window != NULL, NULL);
+ g_return_val_if_fail (gtk_widget_get_window (widget) != NULL, NULL);
GtkWidget *label;
GtkWidget *eventbox;
@@ -628,14 +628,17 @@ egg_cell_renderer_keys_start_editing (GtkCellRenderer *cell,
#pragma GCC diagnostic pop
#endif
+ gboolean celltext_editable;
+ g_object_get (celltext, "editable", &celltext_editable, NULL);
+
// If the cell isn't editable we return NULL
- if (celltext->editable == FALSE)
+ if (celltext_editable == FALSE)
return NULL;
- if (gdk_keyboard_grab (widget->window, FALSE, gdk_event_get_time (event)) != GDK_GRAB_SUCCESS)
+ if (gdk_keyboard_grab (gtk_widget_get_window (widget), FALSE, gdk_event_get_time (event)) !=
GDK_GRAB_SUCCESS)
return NULL;
- if (gdk_pointer_grab (widget->window, FALSE,
+ if (gdk_pointer_grab (gtk_widget_get_window (widget), FALSE,
GDK_BUTTON_PRESS_MASK,
NULL, NULL,
gdk_event_get_time (event)) != GDK_GRAB_SUCCESS)
@@ -655,9 +658,9 @@ egg_cell_renderer_keys_start_editing (GtkCellRenderer *cell,
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL, &widget->style->bg[GTK_STATE_SELECTED]);
+ gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL, >k_widget_get_style
(widget)->bg[GTK_STATE_SELECTED]);
- gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &widget->style->fg[GTK_STATE_SELECTED]);
+ gtk_widget_modify_fg (label, GTK_STATE_NORMAL, >k_widget_get_style(widget)->fg[GTK_STATE_SELECTED]);
gtk_label_set_text (GTK_LABEL (label), _("New accelerator…"));
diff --git a/src/gnome-cmd-about-plugin.cc b/src/gnome-cmd-about-plugin.cc
index ad56258d..15268eef 100644
--- a/src/gnome-cmd-about-plugin.cc
+++ b/src/gnome-cmd-about-plugin.cc
@@ -186,13 +186,13 @@ static void gnome_cmd_about_plugin_display_credits_dialog (GnomeCmdAboutPlugin *
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
g_signal_connect (dialog, "destroy", G_CALLBACK (gtk_widget_destroyed), &(about->priv->credits_dialog));
notebook = gtk_notebook_new ();
gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), notebook, TRUE, TRUE,
0);
if (about->priv->authors != nullptr)
{
@@ -201,7 +201,7 @@ static void gnome_cmd_about_plugin_display_credits_dialog (GnomeCmdAboutPlugin *
sw = gtk_scrolled_window_new (nullptr, nullptr);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label);
- gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE);
+ gtk_viewport_set_shadow_type (GTK_VIEWPORT (gtk_bin_get_child (GTK_BIN (sw))), GTK_SHADOW_NONE);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, gtk_label_new (_("Written by")));
gnome_cmd_about_plugin_update_authors_label (about, label);
@@ -214,7 +214,7 @@ static void gnome_cmd_about_plugin_display_credits_dialog (GnomeCmdAboutPlugin *
sw = gtk_scrolled_window_new (nullptr, nullptr);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label);
- gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE);
+ gtk_viewport_set_shadow_type (GTK_VIEWPORT (gtk_bin_get_child (GTK_BIN (sw))), GTK_SHADOW_NONE);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, gtk_label_new (_("Documented by")));
gnome_cmd_about_plugin_update_documenters_label (about, label);
@@ -227,7 +227,7 @@ static void gnome_cmd_about_plugin_display_credits_dialog (GnomeCmdAboutPlugin *
sw = gtk_scrolled_window_new (nullptr, nullptr);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), label);
- gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN (sw)->child), GTK_SHADOW_NONE);
+ gtk_viewport_set_shadow_type (GTK_VIEWPORT (gtk_bin_get_child (GTK_BIN (sw))), GTK_SHADOW_NONE);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sw, gtk_label_new (_("Translated by")));
gnome_cmd_about_plugin_update_translation_information_label (about, label);
@@ -265,13 +265,13 @@ static void gnome_cmd_about_plugin_init (GnomeCmdAboutPlugin *about)
gtk_dialog_set_has_separator (GTK_DIALOG (about), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (about), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (about)->vbox), 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (about))), 5);
// Widgets
vbox = gtk_vbox_new (FALSE, 8);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox), vbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (about))), vbox, TRUE, TRUE, 0);
priv->name_label = gtk_label_new (nullptr);
gtk_widget_show (priv->name_label);
@@ -320,7 +320,7 @@ static void gnome_cmd_about_plugin_init (GnomeCmdAboutPlugin *about)
gtk_widget_show_all (button);
gtk_dialog_add_action_widget (GTK_DIALOG (about), button, GNOME_RESPONSE_CREDITS);
- gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG (about)->action_area), button, TRUE);
+ gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (gtk_dialog_get_action_area (GTK_DIALOG (about))),
button, TRUE);
gtk_window_set_resizable (GTK_WINDOW (about), FALSE);
@@ -699,7 +699,7 @@ static void gnome_cmd_about_plugin_get_property (GObject *object, guint prop_id,
* function, @c authors is not checked to be non-NULL, so callers must
* be careful, since bad things will happen if this condition is not
* met.
- *
+ *
* @param about An existing GnomeCmdAboutPlugin instance.
* @param name The name of the application.
* @param version The version string of the application.
diff --git a/src/gnome-cmd-advrename-profile-component.cc b/src/gnome-cmd-advrename-profile-component.cc
index 0a41cb96..180316dd 100644
--- a/src/gnome-cmd-advrename-profile-component.cc
+++ b/src/gnome-cmd-advrename-profile-component.cc
@@ -1,4 +1,4 @@
-/**
+/**
* @file gnome-cmd-advrename-profile-component.cc
* @copyright (C) 2001-2006 Marcus Bjurman\n
* @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -565,7 +565,7 @@ void GnomeCmdAdvrenameProfileComponent::Private::insert_text_tag(GnomeCmdAdvrena
"%M", // 25
"%S", // 26
"$c(a)"}; // 27
-
+
g_return_if_fail (n < G_N_ELEMENTS(placeholder));
priv->insert_tag(placeholder[n]);
@@ -600,15 +600,15 @@ gchar *GnomeCmdAdvrenameProfileComponent::Private::get_selected_range (GtkWindow
// HIG defaults
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area),6);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
+ gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))),6);
GtkWidget *hbox, *label, *entry, *option;
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("_Select range:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@@ -622,9 +622,9 @@ gchar *GnomeCmdAdvrenameProfileComponent::Private::get_selected_range (GtkWindow
option = gtk_check_button_new_with_mnemonic (_("_Inverse selection"));
g_object_set_data (G_OBJECT (dialog), "inverse", option);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), option, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), option, FALSE, FALSE,
0);
- gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
+ gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
@@ -1258,17 +1258,17 @@ inline GtkWidget *create_regex_view ()
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer,
GnomeCmdAdvrenameProfileComponent::COL_PATTERN, _("Search for"));
g_object_set (renderer, "foreground", "red", NULL);
gtk_tree_view_column_add_attribute (col, renderer, "foreground-set",
GnomeCmdAdvrenameProfileComponent::COL_MALFORMED_REGEX);
- gtk_widget_set_tooltip_text (col->button, _("Regex pattern"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Regex pattern"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer,
GnomeCmdAdvrenameProfileComponent::COL_REPLACE, _("Replace with"));
g_object_set (renderer, "foreground", "red", NULL);
gtk_tree_view_column_add_attribute (col, renderer, "foreground-set",
GnomeCmdAdvrenameProfileComponent::COL_MALFORMED_REGEX);
- gtk_widget_set_tooltip_text (col->button, _("Replacement"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Replacement"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer,
GnomeCmdAdvrenameProfileComponent::COL_MATCH_CASE, _("Match case"));
g_object_set (renderer, "foreground", "red", NULL);
gtk_tree_view_column_add_attribute (col, renderer, "foreground-set",
GnomeCmdAdvrenameProfileComponent::COL_MALFORMED_REGEX);
- gtk_widget_set_tooltip_text (col->button, _("Case sensitive matching"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Case sensitive matching"));
g_object_set (renderer,
"xalign", 0.0,
diff --git a/src/gnome-cmd-clist.cc b/src/gnome-cmd-clist.cc
index b4acbb89..f0d5d785 100644
--- a/src/gnome-cmd-clist.cc
+++ b/src/gnome-cmd-clist.cc
@@ -64,7 +64,7 @@ get_cell_style (GtkCList *clist,
{
gint fg_state;
- if ((state == GTK_STATE_NORMAL) && (GTK_WIDGET (clist)->state == GTK_STATE_INSENSITIVE))
+ if ((state == GTK_STATE_NORMAL) && (gtk_widget_get_state (GTK_WIDGET (clist)) == GTK_STATE_INSENSITIVE))
fg_state = GTK_STATE_INSENSITIVE;
else
fg_state = state;
@@ -100,15 +100,15 @@ get_cell_style (GtkCList *clist,
else
{
if (style)
- *style = GTK_WIDGET (clist)->style;
+ *style = gtk_widget_get_style (GTK_WIDGET (clist));
if (fg_gc)
- *fg_gc = GTK_WIDGET (clist)->style->fg_gc[fg_state];
+ *fg_gc = gtk_widget_get_style (GTK_WIDGET (clist))->fg_gc[fg_state];
if (bg_gc)
{
if (state == GTK_STATE_SELECTED)
- *bg_gc = GTK_WIDGET (clist)->style->bg_gc[state];
+ *bg_gc = gtk_widget_get_style (GTK_WIDGET (clist))->bg_gc[state];
else
- *bg_gc = GTK_WIDGET (clist)->style->base_gc[state];
+ *bg_gc = gtk_widget_get_style (GTK_WIDGET (clist))->base_gc[state];
}
if (state != GTK_STATE_SELECTED)
@@ -223,7 +223,7 @@ static void draw_row (GtkCList *clist, GdkRectangle *area, gint row, GtkCListRow
gint state;
// bail out now if we aren't drawable yet
- if (!GTK_WIDGET_DRAWABLE (clist) || row < 0 || row >= clist->rows)
+ if (!gtk_widget_is_drawable (GTK_WIDGET (clist)) || row < 0 || row >= clist->rows)
return;
GtkWidget *widget = GTK_WIDGET (clist);
@@ -267,7 +267,7 @@ static void draw_row (GtkCList *clist, GdkRectangle *area, gint row, GtkCListRow
rect = &intersect_rectangle;
if (gdk_rectangle_intersect (area, &cell_rectangle, &intersect_rectangle))
gdk_draw_rectangle (clist->clist_window,
- widget->style->base_gc[GTK_STATE_NORMAL],
+ gtk_widget_get_style (widget)->base_gc[GTK_STATE_NORMAL],
TRUE,
intersect_rectangle.x,
intersect_rectangle.y,
@@ -281,7 +281,7 @@ static void draw_row (GtkCList *clist, GdkRectangle *area, gint row, GtkCListRow
if (gdk_rectangle_intersect (area, &cell_rectangle, &intersect_rectangle))
gdk_draw_rectangle (clist->clist_window,
- widget->style->base_gc[GTK_STATE_NORMAL],
+ gtk_widget_get_style (widget)->base_gc[GTK_STATE_NORMAL],
TRUE,
intersect_rectangle.x,
intersect_rectangle.y,
@@ -297,7 +297,7 @@ static void draw_row (GtkCList *clist, GdkRectangle *area, gint row, GtkCListRow
{
rect = &clip_rectangle;
gdk_draw_rectangle (clist->clist_window,
- widget->style->base_gc[GTK_STATE_NORMAL],
+ gtk_widget_get_style (widget)->base_gc[GTK_STATE_NORMAL],
TRUE,
cell_rectangle.x,
cell_rectangle.y,
@@ -310,7 +310,7 @@ static void draw_row (GtkCList *clist, GdkRectangle *area, gint row, GtkCListRow
cell_rectangle.y += clist->row_height + CELL_SPACING;
gdk_draw_rectangle (clist->clist_window,
- widget->style->base_gc[GTK_STATE_NORMAL],
+ gtk_widget_get_style (widget)->base_gc[GTK_STATE_NORMAL],
TRUE,
cell_rectangle.x,
cell_rectangle.y,
@@ -503,7 +503,7 @@ static void on_realize (GtkCList *clist, gpointer data)
{
for (gint i=0; i<clist->columns; i++)
if (clist->column[i].button)
- GTK_WIDGET_UNSET_FLAGS (clist->column[i].button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (clist->column[i].button, FALSE);
if (GTK_CLIST (clist)->hadjustment)
g_signal_connect_after (GTK_CLIST(clist)->hadjustment, "value-changed", GTK_SIGNAL_FUNC
(on_hadj_value_changed), clist);
@@ -609,7 +609,7 @@ gint gnome_cmd_clist_get_voffset (GnomeCmdCList *clist)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
#endif
- return GTK_ADJUSTMENT(GTK_CLIST(clist)->vadjustment)->value;
+ return gtk_adjustment_get_value (GTK_ADJUSTMENT(GTK_CLIST(clist)->vadjustment));
#if defined (__GNUC__)
#pragma GCC diagnostic pop
#endif
diff --git a/src/gnome-cmd-cmdline.cc b/src/gnome-cmd-cmdline.cc
index edf02e30..946dbb00 100644
--- a/src/gnome-cmd-cmdline.cc
+++ b/src/gnome-cmd-cmdline.cc
@@ -244,8 +244,8 @@ static void init (GnomeCmdCmdline *cmdline)
gtk_box_pack_start (GTK_BOX (cmdline), *cmdline->priv->combo, TRUE, TRUE, 2);
gtk_widget_show (*cmdline->priv->combo);
gtk_entry_set_editable (GTK_ENTRY (cmdline->priv->combo->entry), TRUE);
- GTK_WIDGET_UNSET_FLAGS (cmdline->priv->combo->button, GTK_CAN_FOCUS);
- GTK_WIDGET_SET_FLAGS (cmdline->priv->combo->entry, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (cmdline->priv->combo->button, FALSE);
+ gtk_widget_set_can_focus (cmdline->priv->combo->entry, TRUE);
g_signal_connect (cmdline->priv->combo->entry, "key-press-event", G_CALLBACK (on_key_pressed), cmdline);
g_signal_connect (cmdline->priv->combo, "item-selected", G_CALLBACK (on_combo_item_selected), cmdline);
diff --git a/src/gnome-cmd-combo.cc b/src/gnome-cmd-combo.cc
index ab7b98d1..7023dc76 100644
--- a/src/gnome-cmd-combo.cc
+++ b/src/gnome-cmd-combo.cc
@@ -1,4 +1,4 @@
-/**
+/**
* @file gnome-cmd-combo.cc
* @copyright (C) 2001-2006 Marcus Bjurman\n
* @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -83,14 +83,20 @@ static void size_allocate (GtkWidget *widget, GtkAllocation *allocation)
GnomeCmdCombo *combo = GNOME_CMD_COMBO (widget);
- if (combo->entry->allocation.height > combo->entry->requisition.height)
+ GtkRequisition entry_requisition;
+ gtk_widget_get_requisition (combo->entry, &entry_requisition);
+
+ GtkAllocation entry_allocation;
+ gtk_widget_get_allocation (combo->entry, &entry_allocation);
+
+ if (entry_allocation.height > entry_requisition.height)
{
GtkAllocation button_allocation;
- button_allocation = combo->button->allocation;
- button_allocation.height = combo->entry->requisition.height;
- button_allocation.y = combo->entry->allocation.y +
- (combo->entry->allocation.height - combo->entry->requisition.height) / 2;
+ gtk_widget_get_allocation (combo->button, &button_allocation);
+ button_allocation.height = entry_requisition.height;
+ button_allocation.y = entry_allocation.y +
+ (entry_allocation.height - entry_requisition.height) / 2;
gtk_widget_size_allocate (combo->button, &button_allocation);
}
}
@@ -103,7 +109,10 @@ inline void get_pos (GnomeCmdCombo *combo, gint *x, gint *y, gint *height, gint
GtkBin *popwin = GTK_BIN (combo->popwin);
gint real_height;
+ GtkRequisition entry_requisition;
GtkRequisition list_requisition;
+ GtkRequisition vscrollbar_requisition;
+ GtkRequisition hscrollbar_requisition;
gboolean show_hscroll = FALSE;
gboolean show_vscroll = FALSE;
gint avail_height;
@@ -112,29 +121,36 @@ inline void get_pos (GnomeCmdCombo *combo, gint *x, gint *y, gint *height, gint
gint work_height;
gint old_height;
gint old_width;
+ GtkAllocation entry_allocation;
+ GtkAllocation widget_allocation;
- gdk_window_get_origin (combo->entry->window, x, y);
- real_height = MIN (combo->entry->requisition.height, combo->entry->allocation.height);
+ gdk_window_get_origin (gtk_widget_get_window (combo->entry), x, y);
+ gtk_widget_get_requisition (combo->entry, &entry_requisition);
+ gtk_widget_get_allocation (combo->entry, &entry_allocation);
+ real_height = MIN (entry_requisition.height, entry_allocation.height);
*y += real_height;
avail_height = gdk_screen_height () - *y;
gtk_widget_size_request (combo->list, &list_requisition);
- min_height = MIN (list_requisition.height, popup->vscrollbar->requisition.height);
+ gtk_widget_get_requisition (gtk_scrolled_window_get_vscrollbar (popup), &vscrollbar_requisition);
+ min_height = MIN (list_requisition.height, vscrollbar_requisition.height);
if (!GTK_CLIST (combo->list)->rows)
list_requisition.height += EMPTY_LIST_HEIGHT;
- alloc_width = (widget->allocation.width -
- 2 * popwin->child->style->xthickness -
- 2 * GTK_CONTAINER (popwin->child)->border_width -
- 2 * GTK_CONTAINER (combo->popup)->border_width -
- 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width -
- 2 * GTK_BIN (popup)->child->style->xthickness) + 100;
+ gtk_widget_get_allocation (widget, &widget_allocation);
+
+ alloc_width = (widget_allocation.width -
+ 2 * gtk_widget_get_style (gtk_bin_get_child (popwin))->xthickness -
+ 2 * gtk_container_get_border_width (GTK_CONTAINER (gtk_bin_get_child (popwin))) -
+ 2 * gtk_container_get_border_width (GTK_CONTAINER (combo->popup)) -
+ 2 * gtk_container_get_border_width (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (popup)))) -
+ 2 * gtk_widget_get_style (gtk_bin_get_child (GTK_BIN (popup)))->xthickness) + 100;
- work_height = (2 * popwin->child->style->ythickness +
- 2 * GTK_CONTAINER (popwin->child)->border_width +
- 2 * GTK_CONTAINER (combo->popup)->border_width +
- 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width +
- 2 * GTK_BIN (popup)->child->style->xthickness)+20;
+ work_height = (2 * gtk_widget_get_style (gtk_bin_get_child (popwin))->ythickness +
+ 2 * gtk_container_get_border_width (GTK_CONTAINER (gtk_bin_get_child (popwin))) +
+ 2 * gtk_container_get_border_width (GTK_CONTAINER (combo->popup)) +
+ 2 * gtk_container_get_border_width (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (popup)))) +
+ 2 * gtk_widget_get_style (gtk_bin_get_child (GTK_BIN (popup)))->xthickness)+20;
do
{
@@ -143,7 +159,8 @@ inline void get_pos (GnomeCmdCombo *combo, gint *x, gint *y, gint *height, gint
if (!show_hscroll && alloc_width < list_requisition.width)
{
- work_height += popup->hscrollbar->requisition.height +
+ gtk_widget_get_requisition (gtk_scrolled_window_get_hscrollbar (popup), &hscrollbar_requisition);
+ work_height += hscrollbar_requisition.height +
GTK_SCROLLED_WINDOW_GET_CLASS
(combo->popup)->scrollbar_spacing;
show_hscroll = TRUE;
@@ -156,14 +173,14 @@ inline void get_pos (GnomeCmdCombo *combo, gint *x, gint *y, gint *height, gint
break;
}
alloc_width -=
- popup->vscrollbar->requisition.width +
+ vscrollbar_requisition.width +
GTK_SCROLLED_WINDOW_GET_CLASS
(combo->popup)->scrollbar_spacing;
show_vscroll = TRUE;
}
} while (old_width != alloc_width || old_height != work_height);
- *width = widget->allocation.width;
+ *width = widget_allocation.width;
if (*width < 200)
*width = 200;
@@ -183,7 +200,7 @@ void GnomeCmdCombo::popup_list()
gtk_widget_set_uposition (popwin, x, y);
gtk_widget_set_size_request (popwin, width, height);
gtk_widget_realize (popwin);
- gdk_window_resize (popwin->window, width, height);
+ gdk_window_resize (gtk_widget_get_window (popwin), width, height);
gtk_widget_show (popwin);
}
@@ -225,7 +242,7 @@ static gboolean on_popwin_button_released (GtkWidget *button, GdkEventButton *ev
// Check to see if we clicked inside the popwin
GtkWidget *child = gtk_get_event_widget ((GdkEvent *) event);
while (child && child != (combo->popwin))
- child = child->parent;
+ child = gtk_widget_get_parent (child);
if (child != combo->popwin)
{
@@ -375,7 +392,7 @@ static void init (GnomeCmdCombo *combo)
gtk_widget_show (combo->entry);
gtk_widget_set_size_request (combo->entry, 60, -1);
gtk_entry_set_editable (GTK_ENTRY (combo->entry), FALSE);
- GTK_WIDGET_UNSET_FLAGS (combo->entry, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (combo->entry, FALSE);
combo->button = gtk_button_new ();
g_object_ref (combo->button);
@@ -417,7 +434,7 @@ static void init (GnomeCmdCombo *combo)
gtk_widget_realize (event_box);
cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
- gdk_window_set_cursor (event_box->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (event_box), cursor);
gdk_cursor_unref (cursor);
frame = gtk_frame_new (NULL);
@@ -431,8 +448,8 @@ static void init (GnomeCmdCombo *combo)
g_object_ref (combo->popup);
g_object_set_data_full (*combo, "combo->popup", combo->popup, g_object_unref);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (combo->popup), GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (combo->popup)->hscrollbar, GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (combo->popup)->vscrollbar, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (gtk_scrolled_window_get_hscrollbar (GTK_SCROLLED_WINDOW (combo->popup)),
FALSE);
+ gtk_widget_set_can_focus (gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (combo->popup)),
FALSE);
gtk_container_add (GTK_CONTAINER (frame), combo->popup);
gtk_widget_show (combo->popup);
}
diff --git a/src/gnome-cmd-dir-indicator.cc b/src/gnome-cmd-dir-indicator.cc
index 2979a83d..bad100ce 100644
--- a/src/gnome-cmd-dir-indicator.cc
+++ b/src/gnome-cmd-dir-indicator.cc
@@ -316,7 +316,7 @@ static gint on_dir_indicator_motion (GnomeCmdDirIndicator *indicator, GdkEventMo
{
// underline the part that is selected
GdkCursor *cursor = gdk_cursor_new (GDK_HAND2);
- gdk_window_set_cursor (GTK_WIDGET (indicator)->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (indicator)), cursor);
gdk_cursor_unref (cursor);
update_markup (indicator, i);
@@ -326,7 +326,7 @@ static gint on_dir_indicator_motion (GnomeCmdDirIndicator *indicator, GdkEventMo
// clear underline, cursor=pointer
update_markup (indicator, -1);
- gdk_window_set_cursor (GTK_WIDGET (indicator)->window, nullptr);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (indicator)), nullptr);
}
return TRUE;
@@ -339,7 +339,7 @@ static gint on_dir_indicator_leave (GnomeCmdDirIndicator *indicator, GdkEventMot
// clear underline, cursor=pointer
update_markup (indicator, -1);
- gdk_window_set_cursor (GTK_WIDGET (indicator)->window, nullptr);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (indicator)), nullptr);
return TRUE;
}
@@ -447,7 +447,7 @@ static void get_popup_pos (GtkMenu *menu, gint *x, gint *y, gboolean push_in, Gn
GtkWidget *w = GTK_WIDGET (indicator->priv->fs->file_list());
- gdk_window_get_origin (w->window, x, y);
+ gdk_window_get_origin (gtk_widget_get_window (w), x, y);
}
@@ -499,8 +499,11 @@ void gnome_cmd_dir_indicator_show_history (GnomeCmdDirIndicator *indicator)
gint w = -1;
- if (GTK_WIDGET (indicator)->allocation.width > 100)
- w = GTK_WIDGET (indicator)->allocation.width;
+ GtkAllocation indicator_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (indicator), &indicator_allocation);
+
+ if (indicator_allocation.width > 100)
+ w = indicator_allocation.width;
gtk_widget_set_size_request (indicator->priv->dir_history_popup, w, -1);
}
@@ -554,8 +557,11 @@ void gnome_cmd_dir_indicator_show_bookmarks (GnomeCmdDirIndicator *indicator)
gint w = -1;
- if (GTK_WIDGET (indicator)->allocation.width > 100)
- w = GTK_WIDGET (indicator)->allocation.width;
+ GtkAllocation indicator_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (indicator), &indicator_allocation);
+
+ if (indicator_allocation.width > 100)
+ w = indicator_allocation.width;
gtk_widget_set_size_request (indicator->priv->bookmark_popup, w, -1);
}
@@ -588,7 +594,7 @@ static void init (GnomeCmdDirIndicator *indicator)
// create the history popup button
indicator->priv->history_button = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (indicator->priv->history_button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (indicator->priv->history_button, FALSE);
g_object_ref (indicator->priv->history_button);
gtk_button_set_relief (GTK_BUTTON (indicator->priv->history_button), GTK_RELIEF_NONE);
g_object_set_data_full (G_OBJECT (indicator), "button", indicator->priv->history_button, g_object_unref);
@@ -602,7 +608,7 @@ static void init (GnomeCmdDirIndicator *indicator)
// create the bookmark popup button
indicator->priv->bookmark_button = create_styled_pixmap_button (nullptr, IMAGE_get_gnome_cmd_pixmap
(PIXMAP_BOOKMARK));
- GTK_WIDGET_UNSET_FLAGS (indicator->priv->bookmark_button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (indicator->priv->bookmark_button, FALSE);
gtk_button_set_relief (GTK_BUTTON (indicator->priv->bookmark_button), GTK_RELIEF_NONE);
g_object_set_data_full (G_OBJECT (indicator), "button", indicator->priv->bookmark_button,
g_object_unref);
gtk_widget_show (indicator->priv->bookmark_button);
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 8f4b2ab7..5d764fd6 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2395,7 +2395,7 @@ void GnomeCmdFileList::sort()
add_file_to_clist (this, GNOME_CMD_FILE (list->data), -1);
// refocus the previously selected file if this file list has the focus
- if (selfile && GTK_WIDGET_HAS_FOCUS (this))
+ if (selfile && gtk_widget_has_focus (GTK_WIDGET (this)))
{
gint selrow = get_row_from_file(selfile);
select_row(selrow);
@@ -3075,7 +3075,7 @@ static gboolean do_scroll (GnomeCmdFileList *fl)
gint row_count;
GtkCList *clist = *fl;
- gdk_drawable_get_size (GTK_WIDGET (clist)->window, &w, &h);
+ gdk_drawable_get_size (gtk_widget_get_window (GTK_WIDGET (clist)), &w, &h);
row_count = clist->rows;
focus_row = gnome_cmd_clist_get_row (*fl, 1, fl->priv->autoscroll_y);
@@ -3107,7 +3107,7 @@ static void autoscroll_if_appropriate (GnomeCmdFileList *fl, gint x, gint y)
GtkCList *clist = *fl;
gint w, h;
- gdk_drawable_get_size (GTK_WIDGET (clist)->window, &w, &h);
+ gdk_drawable_get_size (gtk_widget_get_window (GTK_WIDGET (clist)), &w, &h);
gint smin = h/8;
gint smax = h-smin;
@@ -3152,7 +3152,7 @@ static void drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelect
{
case TARGET_URI_LIST:
case TARGET_TEXT_PLAIN:
- gtk_selection_data_set (selection_data, selection_data->target, 8, (const guchar *) data, len);
+ gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8,
(const guchar *) data, len);
break;
case TARGET_URL:
@@ -3163,7 +3163,7 @@ static void drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelect
files = g_list_append(files, gFile);
}
if (files)
- gtk_selection_data_set (selection_data, selection_data->target, 8, (const guchar *)
files->data, strlen ((const char *) files->data));
+ gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8,
(const guchar *) files->data, strlen ((const char *) files->data));
g_list_foreach (files, (GFunc) g_object_unref, nullptr);
g_strfreev(uriCharList);
break;
@@ -3207,7 +3207,7 @@ static void drag_data_received (GtkWidget *widget, GdkDragContext *context,
GtkCList *clist = *fl;
// find the row that the file was dropped on
- y -= clist->column_title_area.height - GTK_CONTAINER (clist)->border_width;
+ y -= clist->column_title_area.height - gtk_container_get_border_width (GTK_CONTAINER (clist));
if (y < 0) return;
GnomeCmdFile *f = fl->get_file_at_row (gnome_cmd_clist_get_row (*fl, x, y));
@@ -3221,7 +3221,7 @@ static void drag_data_received (GtkWidget *widget, GdkDragContext *context,
: gnome_cmd_dir_get_child (to, g_file_info_get_display_name(f->gFileInfo));
// transform the drag data to a list with GFiles
- GList *gFileGlist = uri_strings_to_gfiles ((gchar *) selection_data->data);
+ GList *gFileGlist = uri_strings_to_gfiles ((gchar *) gtk_selection_data_get_data (selection_data));
GdkModifierType mask;
@@ -3255,7 +3255,7 @@ static void drag_data_received (GtkWidget *widget, GdkDragContext *context,
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum"
#endif
- switch (context->action)
+ switch (gdk_drag_context_get_selected_action (context))
{
case GDK_ACTION_MOVE:
fl->drop_files(GnomeCmdFileList::DndMode::MOVE, G_FILE_COPY_NONE, gFileGlist, to);
@@ -3299,11 +3299,11 @@ static void drag_leave (GtkWidget *widget, GdkDragContext *context, guint time,
static gboolean drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time,
GnomeCmdFileList *fl)
{
- gdk_drag_status (context, context->suggested_action, time);
+ gdk_drag_status (context, gdk_drag_context_get_suggested_action (context), time);
GtkCList *clist = *fl;
- y -= (clist->column_title_area.height - GTK_CONTAINER (clist)->border_width);
+ y -= (clist->column_title_area.height - gtk_container_get_border_width (GTK_CONTAINER (clist)));
gint row = gnome_cmd_clist_get_row (*fl, x, y);
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index 6bb62bc9..a8c97d91 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -374,7 +374,7 @@ static void create_con_buttons (GnomeCmdFileSelector *fs)
g_object_set_data (G_OBJECT (btn), "con", con);
g_signal_connect (btn, "button-press-event", (GtkSignalFunc) on_con_btn_clicked, fs);
gtk_box_pack_start (GTK_BOX (fs->con_btns_hbox), btn, FALSE, FALSE, 0);
- GTK_WIDGET_UNSET_FLAGS (btn, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (btn, FALSE);
fs->priv->old_btns = g_list_append (fs->priv->old_btns, btn);
gtk_widget_set_tooltip_text (btn, gnome_cmd_con_get_go_text (con));
@@ -808,7 +808,7 @@ static void init (GnomeCmdFileSelector *fs)
gtk_entry_set_editable (GTK_ENTRY (fs->con_combo->entry), FALSE);
gtk_clist_set_column_width (GTK_CLIST (fs->con_combo->list), 0, 20);
gtk_clist_set_column_width (GTK_CLIST (fs->con_combo->list), 1, 60);
- GTK_WIDGET_UNSET_FLAGS (fs->con_combo->button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (fs->con_combo->button, FALSE);
// create the free space on volume label
fs->vol_label = gtk_label_new ("");
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index 97323eff..ad3d12df 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -921,7 +921,7 @@ inline void do_view_file (GnomeCmdFile *f, gint internal_viewer=-1)
case TRUE : {
GtkWidget *viewer = gviewer_window_file_view (f);
gtk_widget_show (viewer);
- gdk_window_set_icon (viewer->window, nullptr,
+ gdk_window_set_icon (gtk_widget_get_window (viewer), nullptr,
IMAGE_get_pixmap (PIXMAP_INTERNAL_VIEWER),
IMAGE_get_mask (PIXMAP_INTERNAL_VIEWER));
}
diff --git a/src/gnome-cmd-main-menu.cc b/src/gnome-cmd-main-menu.cc
index cf91f3cb..cb3ef0b2 100644
--- a/src/gnome-cmd-main-menu.cc
+++ b/src/gnome-cmd-main-menu.cc
@@ -508,7 +508,7 @@ GtkType gnome_cmd_main_menu_get_type ()
static void add_connection (GnomeCmdMainMenu *main_menu, GnomeCmdCon *con, const gchar *text, GnomeCmdPixmap
*pixmap, GtkSignalFunc func)
{
- GtkMenuShell *connections_menu = GTK_MENU_SHELL (GTK_MENU_ITEM
(main_menu->priv->connections_menu)->submenu);
+ GtkMenuShell *connections_menu = GTK_MENU_SHELL (gtk_menu_item_get_submenu (GTK_MENU_ITEM
(main_menu->priv->connections_menu)));
GtkWidget *item;
item = add_menu_item (main_menu, connections_menu, text, nullptr, pixmap?pixmap->pixmap:nullptr,
pixmap?pixmap->mask:nullptr, func, con);
@@ -521,7 +521,7 @@ void gnome_cmd_main_menu_update_connections (GnomeCmdMainMenu *main_menu)
{
g_return_if_fail (GNOME_CMD_IS_MAIN_MENU (main_menu));
- GtkMenuShell *connections_menu = GTK_MENU_SHELL (GTK_MENU_ITEM
(main_menu->priv->connections_menu)->submenu);
+ GtkMenuShell *connections_menu = GTK_MENU_SHELL (gtk_menu_item_get_submenu (GTK_MENU_ITEM
(main_menu->priv->connections_menu)));
GnomeCmdConList *con_list = gnome_cmd_con_list_get ();
GList *all_cons = gnome_cmd_con_list_get_all (con_list);
// GList *remote_cons = gnome_cmd_con_list_get_all_remote (con_list);
@@ -597,7 +597,7 @@ void gnome_cmd_main_menu_update_bookmarks (GnomeCmdMainMenu *main_menu)
{
GnomeCmdCon *con = GNOME_CMD_CON (cons->data);
GnomeCmdBookmarkGroup *group = gnome_cmd_con_get_bookmarks (con);
- GtkMenuShell *bookmarks_menu = GTK_MENU_SHELL (GTK_MENU_ITEM
(main_menu->priv->bookmarks_menu)->submenu);
+ GtkMenuShell *bookmarks_menu = GTK_MENU_SHELL (gtk_menu_item_get_submenu (GTK_MENU_ITEM
(main_menu->priv->bookmarks_menu)));
if (group && group->bookmarks)
{
// separator
@@ -631,7 +631,7 @@ static void on_plugin_menu_activate (GtkMenuItem *item, PluginData *data)
void gnome_cmd_main_menu_add_plugin_menu (GnomeCmdMainMenu *main_menu, PluginData *pluginData)
{
- gtk_menu_shell_append (GTK_MENU_SHELL (GTK_MENU_ITEM (main_menu->priv->plugins_menu)->submenu),
pluginData->menu);
+ gtk_menu_shell_append (GTK_MENU_SHELL (gtk_menu_item_get_submenu (GTK_MENU_ITEM
(main_menu->priv->plugins_menu))), pluginData->menu);
g_signal_connect (pluginData->menu, "activate", G_CALLBACK (on_plugin_menu_activate), pluginData);
}
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 848d9d6b..467bf879 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -167,7 +167,7 @@ static gint gnome_cmd_key_snooper(GtkWidget *grab_widget, GdkEventKey *event, Gn
return FALSE;
}
- if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (fs->file_list())))
+ if (!gtk_widget_has_focus (GTK_WIDGET (fs->file_list())))
{
return FALSE;
}
@@ -320,49 +320,67 @@ static void create_toolbar (GnomeCmdMainWin *mw)
static void slide_set_100_0 (GtkMenu *menu, gpointer user_data)
{
+ GtkAllocation main_win_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (main_win), &main_win_allocation);
+
gtk_paned_set_position (GTK_PANED (main_win->priv->paned),
- gnome_cmd_data.horizontal_orientation ? GTK_WIDGET (main_win)->allocation.height
:
- GTK_WIDGET (main_win)->allocation.width);
+ gnome_cmd_data.horizontal_orientation ? main_win_allocation.height :
+ main_win_allocation.width);
}
static void slide_set_80_20 (GtkMenu *menu, gpointer user_data)
{
+ GtkAllocation main_win_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (main_win), &main_win_allocation);
+
gtk_paned_set_position (GTK_PANED (main_win->priv->paned),
- gnome_cmd_data.horizontal_orientation ? (int)(GTK_WIDGET
(main_win)->allocation.height*0.8f) :
- (int)(GTK_WIDGET
(main_win)->allocation.width*0.8f));
+ gnome_cmd_data.horizontal_orientation ? (int)(main_win_allocation.height*0.8f) :
+ (int)(main_win_allocation.width*0.8f));
}
static void slide_set_60_40 (GtkMenu *menu, gpointer user_data)
{
+ GtkAllocation main_win_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (main_win), &main_win_allocation);
+
gtk_paned_set_position (GTK_PANED (main_win->priv->paned),
- gnome_cmd_data.horizontal_orientation ? (int)(GTK_WIDGET
(main_win)->allocation.height*0.6f) :
- (int)(GTK_WIDGET
(main_win)->allocation.width*0.6f));
+ gnome_cmd_data.horizontal_orientation ? (int)(main_win_allocation.height*0.6f) :
+ (int)(main_win_allocation.width*0.6f));
}
static void slide_set_50_50 (GtkMenu *menu, gpointer user_data)
{
+ GtkAllocation main_win_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (main_win), &main_win_allocation);
+
gtk_paned_set_position (GTK_PANED (main_win->priv->paned),
- gnome_cmd_data.horizontal_orientation ? (int)(GTK_WIDGET
(main_win)->allocation.height*0.5f) :
- (int)(GTK_WIDGET
(main_win)->allocation.width*0.5f));
+ gnome_cmd_data.horizontal_orientation ? (int)(main_win_allocation.height*0.5f) :
+ (int)(main_win_allocation.width*0.5f));
}
static void slide_set_40_60 (GtkMenu *menu, gpointer user_data)
{
+ GtkAllocation main_win_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (main_win), &main_win_allocation);
+
gtk_paned_set_position (GTK_PANED (main_win->priv->paned),
- gnome_cmd_data.horizontal_orientation ? (int)(GTK_WIDGET
(main_win)->allocation.height*0.4f) :
- (int)(GTK_WIDGET
(main_win)->allocation.width*0.4f));
+ gnome_cmd_data.horizontal_orientation ? (int)(main_win_allocation.height*0.4f) :
+ (int)(main_win_allocation.width*0.4f));
}
static void slide_set_20_80 (GtkMenu *menu, gpointer user_data)
{
+ GtkAllocation main_win_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (main_win), &main_win_allocation);
+
gtk_paned_set_position (GTK_PANED (main_win->priv->paned),
- gnome_cmd_data.horizontal_orientation ? (int)(GTK_WIDGET
(main_win)->allocation.height*0.2f) :
- (int)(GTK_WIDGET
(main_win)->allocation.width*0.2f));
+ gnome_cmd_data.horizontal_orientation ? (int)(main_win_allocation.height*0.2f) :
+ (int)(main_win_allocation.width*0.2f));
}
@@ -527,7 +545,7 @@ static gboolean on_slide_button_press (GtkWidget *widget, GdkEventButton *event,
GtkPaned *paned = GTK_PANED (mw->priv->paned);
// Check that the handle was clicked and not one of the children
- if (paned->handle == event->window)
+ if (gtk_paned_get_handle_window (paned) == event->window)
{
gtk_menu_popup (GTK_MENU (create_slide_popup ()), NULL, NULL, NULL, NULL, event->button,
event->time);
return TRUE;
@@ -552,7 +570,7 @@ static void on_main_win_realize (GtkWidget *widget, GnomeCmdMainWin *mw)
// g_free (dpath);
// }
- gdk_window_set_icon (GTK_WIDGET (mw)->window, NULL, IMAGE_get_pixmap (PIXMAP_LOGO), IMAGE_get_mask
(PIXMAP_LOGO));
+ gdk_window_set_icon (gtk_widget_get_window (GTK_WIDGET (mw)), NULL, IMAGE_get_pixmap (PIXMAP_LOGO),
IMAGE_get_mask (PIXMAP_LOGO));
}
@@ -765,7 +783,7 @@ static gboolean on_window_state_event (GtkWidget *mw, GdkEventWindowState *event
__attribute__ ((fallthrough));
#endif
default: // other are usable
- gdk_window_get_root_origin (mw->window, &x, &y);
+ gdk_window_get_root_origin (gtk_widget_get_window (mw), &x, &y);
gnome_cmd_data_set_main_win_pos (x, y);
}
diff --git a/src/gnome-cmd-notebook.cc b/src/gnome-cmd-notebook.cc
index f2654b96..2b2af019 100644
--- a/src/gnome-cmd-notebook.cc
+++ b/src/gnome-cmd-notebook.cc
@@ -1,4 +1,4 @@
-/**
+/**
* @file gnome-cmd-notebook.cc
* @copyright (C) 2001-2006 Marcus Bjurman\n
* @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -115,24 +115,27 @@ int GnomeCmdNotebook::find_tab_num_at_pos(gint screen_x, gint screen_y) const
g_return_val_if_fail (tab!=NULL, -1);
- if (!GTK_WIDGET_MAPPED (GTK_WIDGET (tab)))
+ if (!gtk_widget_get_mapped (GTK_WIDGET (tab)))
continue;
gint x_root, y_root;
- gdk_window_get_origin (tab->window, &x_root, &y_root);
+ gdk_window_get_origin (gtk_widget_get_window (tab), &x_root, &y_root);
+
+ GtkAllocation tab_allocation;
+ gtk_widget_get_allocation (tab, &tab_allocation);
switch (tab_pos)
{
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
{
- gint y = screen_y - y_root - tab->allocation.y;
+ gint y = screen_y - y_root - tab_allocation.y;
- if (y < 0 || y > tab->allocation.height)
+ if (y < 0 || y > tab_allocation.height)
return -1;
- if (screen_x <= x_root + tab->allocation.x + tab->allocation.width)
+ if (screen_x <= x_root + tab_allocation.x + tab_allocation.width)
return page_num;
}
break;
@@ -140,12 +143,12 @@ int GnomeCmdNotebook::find_tab_num_at_pos(gint screen_x, gint screen_y) const
case GTK_POS_LEFT:
case GTK_POS_RIGHT:
{
- gint x = screen_x - x_root - tab->allocation.x;
+ gint x = screen_x - x_root - tab_allocation.x;
- if (x < 0 || x > tab->allocation.width)
+ if (x < 0 || x > tab_allocation.width)
return -1;
- if (screen_y <= y_root + tab->allocation.y + tab->allocation.height)
+ if (screen_y <= y_root + tab_allocation.y + tab_allocation.height)
return page_num;
}
diff --git a/src/gnome-cmd-quicksearch-popup.cc b/src/gnome-cmd-quicksearch-popup.cc
index 5b1eada7..1d919c50 100644
--- a/src/gnome-cmd-quicksearch-popup.cc
+++ b/src/gnome-cmd-quicksearch-popup.cc
@@ -134,8 +134,8 @@ static void on_text_changed (GtkEntry *entry, GnomeCmdQuicksearchPopup *popup)
static gboolean on_key_pressed (GtkWidget *entry, GdkEventKey *event, GnomeCmdQuicksearchPopup *popup)
{
- if (GTK_ENTRY (entry)->editable && event->type == GDK_KEY_PRESS)
- if (gtk_im_context_filter_keypress (GTK_ENTRY (entry)->im_context, event))
+ if (event->type == GDK_KEY_PRESS && gtk_editable_get_editable (GTK_EDITABLE (entry)))
+ if (gtk_entry_im_context_filter_keypress (GTK_ENTRY (entry), event))
return TRUE;
// While in quicksearch, treat "ALT/CTRL + key" as a simple "key"
@@ -226,8 +226,8 @@ inline void set_popup_position (GnomeCmdQuicksearchPopup *popup)
gint x, y, w, h;
- gdk_window_get_origin (wid->window, &x, &y);
- gdk_drawable_get_size (wid->window, &w, &h);
+ gdk_window_get_origin (gtk_widget_get_window (wid), &x, &y);
+ gdk_drawable_get_size (gtk_widget_get_window (wid), &w, &h);
y += h;
@@ -332,7 +332,7 @@ GtkWidget *gnome_cmd_quicksearch_popup_new (GnomeCmdFileList *fl)
GnomeCmdQuicksearchPopup *popup;
popup = static_cast<GnomeCmdQuicksearchPopup*> (g_object_new (GNOME_CMD_TYPE_QUICKSEARCH_POPUP,
nullptr));
- GTK_WINDOW (popup)->type = GTK_WINDOW_POPUP;
+ g_object_set (GTK_WINDOW (popup), "type", GTK_WINDOW_POPUP, NULL);
popup->priv->fl = fl;
popup->priv->last_focused_file = nullptr;
set_popup_position (popup);
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index a4a9e9d4..98d3aba6 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -902,7 +902,7 @@ void file_advrename (GtkMenuItem *menuitem, gpointer not_used)
{
main_win->advrename_dlg->set(files);
gtk_widget_show (*main_win->advrename_dlg);
- // gdk_window_raise (GTK_WIDGET (main_win->advrename_dlg)->window); // FIXME: bring dlg to
top ???
+ // gdk_window_raise (gtk_widget_get_window (GTK_WIDGET (main_win->advrename_dlg))); //
FIXME: bring dlg to top ???
}
g_list_free (files);
@@ -1070,7 +1070,7 @@ void file_exit (GtkMenuItem *menuitem, gpointer not_used)
break;
default:
- gdk_window_get_root_origin (GTK_WIDGET (main_win)->window, &x, &y);
+ gdk_window_get_root_origin (gtk_widget_get_window (GTK_WIDGET (main_win)), &x, &y);
gnome_cmd_data_set_main_win_pos (x, y);
break;
}
@@ -1187,7 +1187,7 @@ void command_execute (GtkMenuItem *menuitem, gpointer command)
gint argc;
gchar **argv;
GError *error = nullptr;
-
+
DEBUG ('g', "Running: %s\n", cmd.c_str());
g_shell_parse_argv (cmd.c_str(), &argc, &argv, nullptr);
@@ -1212,7 +1212,7 @@ void command_open_terminal__internal (GtkMenuItem *menuitem, gpointer not_used)
command_open_terminal (menuitem, nullptr);
}
-/**
+/**
* Executes the command stored in gnome_cmd_data.options.termopen in the
* active directory.
*/
@@ -1238,14 +1238,14 @@ void command_open_terminal (GtkMenuItem *menuitem, gpointer not_used)
g_free (dpath);
}
-/**
+/**
* Combines the command stored in gnome_cmd_data.options.termopen with a
* command for a GUI for root login screen. The command is executed in
* the active directory afterwards.
*/
void command_open_terminal_as_root (GtkMenuItem *menuitem, gpointer not_used)
{
-
+
int argc = 1;
char **argv = g_new0 (char *, argc+1); //initialize argv
gchar *command;
@@ -1479,7 +1479,7 @@ void mark_compare_directories (GtkMenuItem *menuitem, gpointer not_used)
void view_conbuttons (GtkToggleAction *toggleAction, gpointer not_used)
{
- if (!GTK_WIDGET_REALIZED (main_win)) return;
+ if (!gtk_widget_get_realized ( GTK_WIDGET (main_win))) return;
auto active = gtk_toggle_action_get_active(toggleAction);
g_settings_set_boolean (gcmd_user_actions.settings->general, GCMD_SETTINGS_SHOW_DEVBUTTONS, active);
@@ -1488,7 +1488,7 @@ void view_conbuttons (GtkToggleAction *toggleAction, gpointer not_used)
void view_devlist (GtkToggleAction *toggleAction, gpointer not_used)
{
- if (!GTK_WIDGET_REALIZED (main_win)) return;
+ if (!gtk_widget_get_realized ( GTK_WIDGET (main_win))) return;
auto active = gtk_toggle_action_get_active(toggleAction);
g_settings_set_boolean (gcmd_user_actions.settings->general, GCMD_SETTINGS_SHOW_DEVLIST, active);
@@ -1497,7 +1497,7 @@ void view_devlist (GtkToggleAction *toggleAction, gpointer not_used)
void view_toolbar (GtkToggleAction *toggleAction, gpointer not_used)
{
- if (!GTK_WIDGET_REALIZED (main_win)) return;
+ if (!gtk_widget_get_realized ( GTK_WIDGET (main_win))) return;
auto active = gtk_toggle_action_get_active(toggleAction);
g_settings_set_boolean (gcmd_user_actions.settings->general, GCMD_SETTINGS_SHOW_TOOLBAR, active);
@@ -1506,7 +1506,7 @@ void view_toolbar (GtkToggleAction *toggleAction, gpointer not_used)
void view_buttonbar (GtkToggleAction *toggleAction, gpointer not_used)
{
- if (!GTK_WIDGET_REALIZED (main_win)) return;
+ if (!gtk_widget_get_realized ( GTK_WIDGET (main_win))) return;
auto active = gtk_toggle_action_get_active(toggleAction);
g_settings_set_boolean (gcmd_user_actions.settings->general, GCMD_SETTINGS_SHOW_BUTTONBAR, active);
@@ -1515,7 +1515,7 @@ void view_buttonbar (GtkToggleAction *toggleAction, gpointer not_used)
void view_cmdline (GtkToggleAction *toggleAction, gpointer not_used)
{
- if (!GTK_WIDGET_REALIZED (main_win)) return;
+ if (!gtk_widget_get_realized ( GTK_WIDGET (main_win))) return;
auto active = gtk_toggle_action_get_active(toggleAction);
g_settings_set_boolean (gcmd_user_actions.settings->general, GCMD_SETTINGS_SHOW_CMDLINE, active);
@@ -1530,7 +1530,7 @@ void view_dir_history (GtkMenuItem *menuitem, gpointer not_used)
void view_hidden_files (GtkToggleAction *toggleAction, gpointer not_used)
{
- if (!GTK_WIDGET_REALIZED (main_win)) return;
+ if (!gtk_widget_get_realized ( GTK_WIDGET (main_win))) return;
auto active = gtk_toggle_action_get_active(toggleAction);
g_settings_set_boolean (gcmd_user_actions.settings->filter, GCMD_SETTINGS_FILTER_HIDE_HIDDEN, !active);
@@ -1539,7 +1539,7 @@ void view_hidden_files (GtkToggleAction *toggleAction, gpointer not_used)
void view_backup_files (GtkToggleAction *toggleAction, gpointer not_used)
{
- if (!GTK_WIDGET_REALIZED (main_win)) return;
+ if (!gtk_widget_get_realized ( GTK_WIDGET (main_win))) return;
auto active = gtk_toggle_action_get_active(toggleAction);
g_settings_set_boolean (gcmd_user_actions.settings->filter, GCMD_SETTINGS_FILTER_HIDE_BACKUPS, !active);
@@ -1548,7 +1548,7 @@ void view_backup_files (GtkToggleAction *toggleAction, gpointer not_used)
void view_horizontal_orientation (GtkToggleAction *toggleAction, gpointer not_used)
{
- if (!GTK_WIDGET_REALIZED (main_win)) return;
+ if (!gtk_widget_get_realized ( GTK_WIDGET (main_win))) return;
auto active = gtk_toggle_action_get_active(toggleAction);
g_settings_set_boolean (gcmd_user_actions.settings->general, GCMD_SETTINGS_HORIZONTAL_ORIENTATION,
active);
@@ -1583,7 +1583,7 @@ void view_up (GtkMenuItem *menuitem, gpointer not_used)
void view_main_menu (GtkMenuItem *menuitem, gpointer not_used)
{
- if (!GTK_WIDGET_REALIZED (main_win)) return;
+ if (!gtk_widget_get_realized ( GTK_WIDGET (main_win))) return;
gboolean mainmenu_visibility;
mainmenu_visibility = g_settings_get_boolean (gcmd_user_actions.settings->general,
GCMD_SETTINGS_MAINMENU_VISIBILITY);
@@ -2077,7 +2077,7 @@ void help_about (GtkMenuItem *menuitem, gpointer not_used)
g_free (license_trans);
}
-/**
+/**
* Parses a command, stored in a char array, and substitutes a certain
* symbol with path or URI names. The result is stored in a string
* variable, which is expanded if needed. Possible symbols are:
diff --git a/src/gnome-cmd-xfer-progress-win.cc b/src/gnome-cmd-xfer-progress-win.cc
index 7d1e5569..3d11bc4b 100644
--- a/src/gnome-cmd-xfer-progress-win.cc
+++ b/src/gnome-cmd-xfer-progress-win.cc
@@ -107,7 +107,7 @@ static void init (GnomeCmdXferProgressWin *win)
gtk_container_add (GTK_CONTAINER (vbox), bbox);
button = create_stock_button (w, GTK_STOCK_CANCEL, GTK_SIGNAL_FUNC (on_cancel));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_container_add (GTK_CONTAINER (bbox), button);
}
diff --git a/src/intviewer/image-render.cc b/src/intviewer/image-render.cc
index f7a99d34..5199750d 100644
--- a/src/intviewer/image-render.cc
+++ b/src/intviewer/image-render.cc
@@ -222,7 +222,7 @@ static void image_render_init (ImageRender *w)
w->priv->orig_pixbuf = NULL;
w->priv->disp_pixbuf = NULL;
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (w), GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (GTK_WIDGET (w), TRUE);
}
@@ -490,15 +490,18 @@ static void image_render_realize (GtkWidget *widget)
{
g_return_if_fail (IS_IMAGE_RENDER (widget));
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_realized (widget, TRUE);
ImageRender *obj = IMAGE_RENDER (widget);
GdkWindowAttr attributes;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ GtkAllocation widget_allocation;
+ gtk_widget_get_allocation (widget, &widget_allocation);
+
+ attributes.x = widget_allocation.x;
+ attributes.y = widget_allocation.y;
+ attributes.width = widget_allocation.width;
+ attributes.height = widget_allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) |
@@ -510,12 +513,12 @@ static void image_render_realize (GtkWidget *widget)
gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- GdkWindow *window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
+ GdkWindow *window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gtk_widget_set_window (widget, window);
- widget->style = gtk_style_attach (widget->style, window);
+ gtk_widget_style_attach (widget);
gdk_window_set_user_data (window, widget);
- gtk_style_set_background (widget->style, window, GTK_STATE_ACTIVE);
+ gtk_style_set_background (gtk_widget_get_style (widget), window, GTK_STATE_ACTIVE);
// image_render_prepare_disp_pixbuf (obj);
if (!obj->priv->scaled_pixbuf_loaded)
@@ -525,7 +528,7 @@ static void image_render_realize (GtkWidget *widget)
static void image_render_redraw (ImageRender *w)
{
- if (!GTK_WIDGET_REALIZED(GTK_WIDGET (w)))
+ if (!gtk_widget_get_realized (GTK_WIDGET (w)))
return;
image_render_notify_status_changed (w);
@@ -545,9 +548,9 @@ static void image_render_size_allocate (GtkWidget *widget, GtkAllocation *alloca
g_return_if_fail (IS_IMAGE_RENDER (widget));
g_return_if_fail (allocation != NULL);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
- if (GTK_WIDGET_REALIZED (widget))
+ if (gtk_widget_get_realized (widget))
{
gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y,
allocation->width, allocation->height);
image_render_prepare_disp_pixbuf (IMAGE_RENDER (widget));
@@ -565,7 +568,10 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
ImageRender *w = IMAGE_RENDER (widget);
- gdk_window_clear_area (gtk_widget_get_window (widget), 0, 0, widget->allocation.width,
widget->allocation.height);
+ GtkAllocation widget_allocation;
+ gtk_widget_get_allocation (widget, &widget_allocation);
+
+ gdk_window_clear_area (gtk_widget_get_window (widget), 0, 0, widget_allocation.width,
widget_allocation.height);
if (!w->priv->disp_pixbuf)
return FALSE;
@@ -573,11 +579,11 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
gint xc, yc;
if (w->priv->best_fit ||
- (gdk_pixbuf_get_width (w->priv->disp_pixbuf) < widget->allocation.width &&
- gdk_pixbuf_get_height (w->priv->disp_pixbuf) < widget->allocation.height))
+ (gdk_pixbuf_get_width (w->priv->disp_pixbuf) < widget_allocation.width &&
+ gdk_pixbuf_get_height (w->priv->disp_pixbuf) < widget_allocation.height))
{
- xc = widget->allocation.width / 2 - gdk_pixbuf_get_width (w->priv->disp_pixbuf)/2;
- yc = widget->allocation.height / 2 - gdk_pixbuf_get_height (w->priv->disp_pixbuf)/2;
+ xc = widget_allocation.width / 2 - gdk_pixbuf_get_width (w->priv->disp_pixbuf)/2;
+ yc = widget_allocation.height / 2 - gdk_pixbuf_get_height (w->priv->disp_pixbuf)/2;
gdk_draw_pixbuf (gtk_widget_get_window (widget),
NULL,
@@ -593,17 +599,17 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
gint dst_x, dst_y;
gint width, height;
- if (widget->allocation.width > gdk_pixbuf_get_width (w->priv->disp_pixbuf))
+ if (widget_allocation.width > gdk_pixbuf_get_width (w->priv->disp_pixbuf))
{
src_x = 0;
- dst_x = widget->allocation.width / 2 - gdk_pixbuf_get_width (w->priv->disp_pixbuf)/2;
+ dst_x = widget_allocation.width / 2 - gdk_pixbuf_get_width (w->priv->disp_pixbuf)/2;
width = gdk_pixbuf_get_width (w->priv->disp_pixbuf);
}
else
{
src_x = (int) gtk_adjustment_get_value (w->priv->h_adjustment);
dst_x = 0;
- width = MIN(widget->allocation.width, gdk_pixbuf_get_width (w->priv->disp_pixbuf));
+ width = MIN(widget_allocation.width, gdk_pixbuf_get_width (w->priv->disp_pixbuf));
if (src_x + width > gdk_pixbuf_get_width (w->priv->disp_pixbuf))
src_x = gdk_pixbuf_get_width (w->priv->disp_pixbuf) - width;
}
@@ -612,14 +618,14 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
if ((int) gtk_adjustment_get_value (w->priv->h_adjustment) > gdk_pixbuf_get_height
(w->priv->disp_pixbuf))
{
src_y = 0;
- dst_y = widget->allocation.height / 2 - gdk_pixbuf_get_height (w->priv->disp_pixbuf)/2;
+ dst_y = widget_allocation.height / 2 - gdk_pixbuf_get_height (w->priv->disp_pixbuf)/2;
height = gdk_pixbuf_get_height (w->priv->disp_pixbuf);
}
else
{
src_y = (int) gtk_adjustment_get_value (w->priv->v_adjustment);
dst_y = 0;
- height = MIN(widget->allocation.height, gdk_pixbuf_get_height (w->priv->disp_pixbuf));
+ height = MIN(widget_allocation.height, gdk_pixbuf_get_height (w->priv->disp_pixbuf));
if (src_y + height > gdk_pixbuf_get_height (w->priv->disp_pixbuf))
src_y = gdk_pixbuf_get_height (w->priv->disp_pixbuf) - height;
@@ -632,8 +638,8 @@ static gboolean image_render_expose (GtkWidget *widget, GdkEventExpose *event)
width, height,
gdk_pixbuf_get_width (w->priv->disp_pixbuf),
gdk_pixbuf_get_height (w->priv->disp_pixbuf),
- widget->allocation.width,
- widget->allocation.height,
+ widget_allocation.width,
+ widget_allocation.height,
(int)w->priv->h_adjustment->value,
(int)w->priv->v_adjustment->value);
#endif
@@ -931,14 +937,14 @@ void image_render_load_scaled_pixbuf (ImageRender *obj)
g_return_if_fail (obj->priv->filename!=NULL);
g_return_if_fail (obj->priv->scaled_pixbuf_loaded==FALSE);
- g_return_if_fail (GTK_WIDGET_REALIZED(GTK_WIDGET (obj)));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (obj)));
- int width = GTK_WIDGET (obj)->allocation.width;
- int height = GTK_WIDGET (obj)->allocation.height;
+ GtkAllocation obj_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (obj), &obj_allocation);
GError *err = NULL;
- obj->priv->disp_pixbuf = gdk_pixbuf_new_from_file_at_scale (obj->priv->filename, width, height, TRUE,
&err);
+ obj->priv->disp_pixbuf = gdk_pixbuf_new_from_file_at_scale (obj->priv->filename, obj_allocation.width,
obj_allocation.height, TRUE, &err);
if (err)
{
@@ -991,7 +997,7 @@ static void image_render_prepare_disp_pixbuf (ImageRender *obj)
if (g_atomic_int_get (&obj->priv->orig_pixbuf_loaded)==0)
return;
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (obj)))
+ if (!gtk_widget_get_realized (GTK_WIDGET (obj)))
return;
if (obj->priv->disp_pixbuf)
@@ -1003,8 +1009,11 @@ static void image_render_prepare_disp_pixbuf (ImageRender *obj)
if (obj->priv->best_fit)
{
- if (gdk_pixbuf_get_height (obj->priv->orig_pixbuf) < GTK_WIDGET (obj)->allocation.height &&
- gdk_pixbuf_get_width (obj->priv->orig_pixbuf) < GTK_WIDGET (obj)->allocation.width)
+ GtkAllocation obj_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (obj), &obj_allocation);
+
+ if (gdk_pixbuf_get_height (obj->priv->orig_pixbuf) < obj_allocation.height &&
+ gdk_pixbuf_get_width (obj->priv->orig_pixbuf) < obj_allocation.width)
{
// no need to scale down
@@ -1013,15 +1022,15 @@ static void image_render_prepare_disp_pixbuf (ImageRender *obj)
return;
}
- int height = GTK_WIDGET (obj)->allocation.height;
- int width = (((double) GTK_WIDGET (obj)->allocation.height) /
+ int height = obj_allocation.height;
+ int width = (((double) obj_allocation.height) /
gdk_pixbuf_get_height (obj->priv->orig_pixbuf))*
gdk_pixbuf_get_width (obj->priv->orig_pixbuf);
- if (width >= GTK_WIDGET (obj)->allocation.width)
+ if (width >= obj_allocation.width)
{
- width = GTK_WIDGET (obj)->allocation.width;
- height = (((double)GTK_WIDGET (obj)->allocation.width) /
+ width = obj_allocation.width;
+ height = (((double)obj_allocation.width) /
gdk_pixbuf_get_width (obj->priv->orig_pixbuf))*
gdk_pixbuf_get_height (obj->priv->orig_pixbuf);
}
@@ -1055,9 +1064,12 @@ static void image_render_update_adjustments (ImageRender *obj)
if (!obj->priv->disp_pixbuf)
return;
+ GtkAllocation obj_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (obj), &obj_allocation);
+
if (obj->priv->best_fit ||
- (gdk_pixbuf_get_width (obj->priv->disp_pixbuf) < GTK_WIDGET (obj)->allocation.width &&
- gdk_pixbuf_get_height (obj->priv->disp_pixbuf) < GTK_WIDGET (obj)->allocation.height))
+ (gdk_pixbuf_get_width (obj->priv->disp_pixbuf) < obj_allocation.width &&
+ gdk_pixbuf_get_height (obj->priv->disp_pixbuf) < obj_allocation.height))
{
if (obj->priv->h_adjustment)
{
@@ -1080,14 +1092,14 @@ static void image_render_update_adjustments (ImageRender *obj)
{
gtk_adjustment_set_lower (obj->priv->h_adjustment, 0);
gtk_adjustment_set_upper (obj->priv->h_adjustment, gdk_pixbuf_get_width
(obj->priv->disp_pixbuf));
- gtk_adjustment_set_page_size (obj->priv->h_adjustment, GTK_WIDGET (obj)->allocation.width);
+ gtk_adjustment_set_page_size (obj->priv->h_adjustment, obj_allocation.width);
gtk_adjustment_changed (obj->priv->h_adjustment);
}
if (obj->priv->v_adjustment)
{
gtk_adjustment_set_lower (obj->priv->v_adjustment, 0);
gtk_adjustment_set_upper (obj->priv->v_adjustment, gdk_pixbuf_get_height
(obj->priv->disp_pixbuf));
- gtk_adjustment_set_page_size (obj->priv->v_adjustment, GTK_WIDGET (obj)->allocation.height);
+ gtk_adjustment_set_page_size (obj->priv->v_adjustment, obj_allocation.height);
gtk_adjustment_changed (obj->priv->v_adjustment);
}
}
diff --git a/src/intviewer/search-dlg.cc b/src/intviewer/search-dlg.cc
index b2ff6d02..524ecda6 100644
--- a/src/intviewer/search-dlg.cc
+++ b/src/intviewer/search-dlg.cc
@@ -252,7 +252,7 @@ static void search_dlg_init (GViewerSearchDlg *sdlg)
table = GTK_TABLE (gtk_table_new (2, 2, FALSE));
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_box_pack_start (GTK_BOX (dlg->vbox), GTK_WIDGET (table), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dlg)), GTK_WIDGET (table), FALSE, TRUE, 0);
sdlg->priv->table = GTK_WIDGET (table);
// Label
@@ -359,4 +359,4 @@ GtkWidget* gviewer_search_dlg_new (GtkWindow *parent)
auto dlg = static_cast<GViewerSearchDlg*> (g_object_new (gviewer_search_dlg_get_type(), nullptr));
return GTK_WIDGET (dlg);
-}
\ No newline at end of file
+}
diff --git a/src/intviewer/search-progress-dlg.cc b/src/intviewer/search-progress-dlg.cc
index b8593b46..1b824486 100644
--- a/src/intviewer/search-progress-dlg.cc
+++ b/src/intviewer/search-progress-dlg.cc
@@ -81,7 +81,7 @@ static void search_progress_dlg_init (GViewerSearchProgressDlg *sdlg)
// Text Label
sdlg->priv->label = gtk_label_new("");
- gtk_box_pack_start(GTK_BOX(dlg->vbox), sdlg->priv->label, FALSE, TRUE, 5);
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area (dlg)), sdlg->priv->label, FALSE, TRUE, 5);
// Progress Bar
sdlg->priv->progressbar = gtk_progress_bar_new();
@@ -95,9 +95,9 @@ static void search_progress_dlg_init (GViewerSearchProgressDlg *sdlg)
#pragma GCC diagnostic pop
#endif
- gtk_box_pack_start(GTK_BOX(dlg->vbox), sdlg->priv->progressbar, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area (dlg)), sdlg->priv->progressbar, TRUE, TRUE, 0);
- gtk_widget_show_all(dlg->vbox);
+ gtk_widget_show_all(gtk_dialog_get_content_area (dlg));
gtk_widget_show (GTK_WIDGET (dlg));
}
diff --git a/src/intviewer/text-render.cc b/src/intviewer/text-render.cc
index 6abe14b2..a54ecd52 100644
--- a/src/intviewer/text-render.cc
+++ b/src/intviewer/text-render.cc
@@ -191,9 +191,9 @@ void text_render_set_h_adjustment (TextRender *obj, GtkAdjustment *adjustment)
g_signal_connect (adjustment, "changed", G_CALLBACK (text_render_h_adjustment_changed), obj);
g_signal_connect (adjustment, "value-changed", G_CALLBACK (text_render_h_adjustment_value_changed), obj);
- obj->priv->old_h_adj_value = adjustment->value;
- obj->priv->old_h_adj_lower = adjustment->lower;
- obj->priv->old_h_adj_upper = adjustment->upper;
+ obj->priv->old_h_adj_value = gtk_adjustment_get_value (adjustment);
+ obj->priv->old_h_adj_lower = gtk_adjustment_get_lower (adjustment);
+ obj->priv->old_h_adj_upper = gtk_adjustment_get_upper (adjustment);
text_render_h_adjustment_update (obj);
}
@@ -215,9 +215,9 @@ void text_render_set_v_adjustment (TextRender *obj, GtkAdjustment *adjustment)
g_signal_connect (adjustment, "changed", G_CALLBACK (text_render_v_adjustment_changed), obj);
g_signal_connect (adjustment, "value-changed", G_CALLBACK (text_render_v_adjustment_value_changed), obj);
- obj->priv->old_v_adj_value = adjustment->value;
- obj->priv->old_v_adj_lower = adjustment->lower;
- obj->priv->old_v_adj_upper = adjustment->upper;
+ obj->priv->old_v_adj_value = gtk_adjustment_get_value (adjustment);
+ obj->priv->old_v_adj_lower = gtk_adjustment_get_lower (adjustment);
+ obj->priv->old_v_adj_upper = gtk_adjustment_get_upper (adjustment);
text_render_v_adjustment_update (obj);
}
@@ -262,7 +262,7 @@ static void text_render_init (TextRender *w)
w->priv->layout = gtk_widget_create_pango_layout (GTK_WIDGET (w), NULL);
- GTK_WIDGET_SET_FLAGS(GTK_WIDGET (w), GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(GTK_WIDGET (w), TRUE);
}
@@ -348,7 +348,7 @@ void text_render_notify_status_changed(TextRender *w)
static void text_render_position_changed(TextRender *w)
{
- if (!GTK_WIDGET_REALIZED(GTK_WIDGET (w)))
+ if (!gtk_widget_get_realized (GTK_WIDGET (w)))
return;
text_render_notify_status_changed(w);
@@ -356,13 +356,13 @@ static void text_render_position_changed(TextRender *w)
// update the hotz & vert adjustments
if (w->priv->v_adjustment)
{
- w->priv->v_adjustment->value = w->priv->current_offset;
+ gtk_adjustment_set_value (w->priv->v_adjustment, w->priv->current_offset);
gtk_adjustment_changed (w->priv->v_adjustment);
}
if (w->priv->h_adjustment)
{
- w->priv->h_adjustment->value = w->priv->column;
+ gtk_adjustment_set_value (w->priv->h_adjustment, w->priv->column);
gtk_adjustment_changed (w->priv->h_adjustment);
}
}
@@ -370,10 +370,10 @@ static void text_render_position_changed(TextRender *w)
static void text_render_redraw(TextRender *w)
{
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (w)))
+ if (!gtk_widget_get_realized (GTK_WIDGET (w)))
return;
- gdk_window_invalidate_rect (GTK_WIDGET (w)->window, NULL, FALSE);
+ gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (w)), NULL, FALSE);
}
@@ -444,15 +444,18 @@ static void text_render_realize (GtkWidget *widget)
{
g_return_if_fail (IS_TEXT_RENDER (widget));
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_realized (widget, TRUE);
TextRender *obj = TEXT_RENDER (widget);
GdkWindowAttr attributes;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ GtkAllocation widget_allocation;
+ gtk_widget_get_allocation (widget, &widget_allocation);
+
+ attributes.x = widget_allocation.x;
+ attributes.y = widget_allocation.y;
+ attributes.width = widget_allocation.width;
+ attributes.height = widget_allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) |
@@ -463,15 +466,15 @@ static void text_render_realize (GtkWidget *widget)
attributes.colormap = gtk_widget_get_colormap (widget);
gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
+ gtk_widget_set_window (widget, gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
attributes_mask));
- widget->style = gtk_style_attach (widget->style, widget->window);
+ gtk_widget_style_attach(widget);
- gdk_window_set_user_data (widget->window, widget);
+ gdk_window_set_user_data (gtk_widget_get_window (widget), widget);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
+ gtk_style_set_background (gtk_widget_get_style (widget), gtk_widget_get_window (widget),
GTK_STATE_ACTIVE);
- obj->priv->gc = gdk_gc_new (GTK_WIDGET (obj)->window);
+ obj->priv->gc = gdk_gc_new (gtk_widget_get_window (GTK_WIDGET (obj)));
gdk_gc_set_exposures (obj->priv->gc, TRUE);
text_render_setup_font(obj, obj->priv->fixed_font_name, obj->priv->font_size);
@@ -490,11 +493,11 @@ static void text_render_size_allocate (GtkWidget *widget, GtkAllocation *allocat
g_return_if_fail (IS_TEXT_RENDER (widget));
g_return_if_fail (allocation != NULL);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
TextRender *w = TEXT_RENDER (widget);
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width,
allocation->height);
+ if (gtk_widget_get_realized (widget))
+ gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y,
allocation->width, allocation->height);
if (w->priv->dp && (w->priv->char_width>0))
{
@@ -525,7 +528,10 @@ static gboolean text_render_expose(GtkWidget *widget, GdkEventExpose *event)
if (w->priv->dp==NULL)
return FALSE;
- gdk_window_clear_area (widget->window, 0, 0, widget->allocation.width, widget->allocation.height);
+ GtkAllocation widget_allocation;
+ gtk_widget_get_allocation (widget, &widget_allocation);
+
+ gdk_window_clear_area (gtk_widget_get_window (widget), 0, 0, widget_allocation.width,
widget_allocation.height);
ofs = w->priv->current_offset;
y = 0;
@@ -546,7 +552,7 @@ static gboolean text_render_expose(GtkWidget *widget, GdkEventExpose *event)
ofs = eol_offset;
y += w->priv->char_height;
- if (y>=widget->allocation.height)
+ if (y>=widget_allocation.height)
break;
}
@@ -680,8 +686,8 @@ static gboolean text_render_motion_notify(GtkWidget *widget, GdkEventMotion *eve
x = event->x;
y = event->y;
- if (event->is_hint || (event->window != widget->window))
- gdk_window_get_pointer (widget->window, &x, &y, &mods);
+ if (event->is_hint || (event->window != gtk_widget_get_window (widget)))
+ gdk_window_get_pointer (gtk_widget_get_window (widget), &x, &y, &mods);
// TODO: respond to motion event
new_marker = w->priv->pixel_to_offset(w, x, y, FALSE);
@@ -701,17 +707,17 @@ static void text_render_h_adjustment_update (TextRender *obj)
{
g_return_if_fail (IS_TEXT_RENDER (obj));
- gfloat new_value = obj->priv->h_adjustment->value;
+ gfloat new_value = gtk_adjustment_get_value (obj->priv->h_adjustment);
- if (new_value < obj->priv->h_adjustment->lower)
- new_value = obj->priv->h_adjustment->lower;
+ if (new_value < gtk_adjustment_get_lower (obj->priv->h_adjustment))
+ new_value = gtk_adjustment_get_lower (obj->priv->h_adjustment);
- if (new_value > obj->priv->h_adjustment->upper)
- new_value = obj->priv->h_adjustment->upper;
+ if (new_value > gtk_adjustment_get_upper (obj->priv->h_adjustment))
+ new_value = gtk_adjustment_get_upper (obj->priv->h_adjustment);
- if (new_value != obj->priv->h_adjustment->value)
+ if (new_value != gtk_adjustment_get_value (obj->priv->h_adjustment))
{
- obj->priv->h_adjustment->value = new_value;
+ gtk_adjustment_set_value (obj->priv->h_adjustment, new_value);
gtk_signal_emit_by_name (GTK_OBJECT (obj->priv->h_adjustment), "value-changed");
}
@@ -728,15 +734,15 @@ static void text_render_h_adjustment_changed (GtkAdjustment *adjustment, gpointe
TextRender *obj = TEXT_RENDER (data);
- if ((obj->priv->old_h_adj_value != adjustment->value) ||
- (obj->priv->old_h_adj_lower != adjustment->lower) ||
- (obj->priv->old_h_adj_upper != adjustment->upper))
+ if ((obj->priv->old_h_adj_value != gtk_adjustment_get_value (adjustment)) ||
+ (obj->priv->old_h_adj_lower != gtk_adjustment_get_lower (adjustment)) ||
+ (obj->priv->old_h_adj_upper != gtk_adjustment_get_upper (adjustment)))
{
text_render_h_adjustment_update (obj);
- obj->priv->old_h_adj_value = adjustment->value;
- obj->priv->old_h_adj_lower = adjustment->lower;
- obj->priv->old_h_adj_upper = adjustment->upper;
+ obj->priv->old_h_adj_value = gtk_adjustment_get_value (adjustment);
+ obj->priv->old_h_adj_lower = gtk_adjustment_get_lower (adjustment);
+ obj->priv->old_h_adj_upper = gtk_adjustment_get_upper (adjustment);
}
}
@@ -748,10 +754,10 @@ static void text_render_h_adjustment_value_changed (GtkAdjustment *adjustment, g
TextRender *obj = TEXT_RENDER (data);
- if (obj->priv->old_h_adj_value != adjustment->value)
+ if (obj->priv->old_h_adj_value != gtk_adjustment_get_value (adjustment))
{
text_render_h_adjustment_update (obj);
- obj->priv->old_h_adj_value = adjustment->value;
+ obj->priv->old_h_adj_value = gtk_adjustment_get_value (adjustment);
}
}
@@ -761,13 +767,13 @@ static void text_render_v_adjustment_update (TextRender *obj)
g_return_if_fail (obj != NULL);
g_return_if_fail (IS_TEXT_RENDER (obj));
- gfloat new_value = obj->priv->v_adjustment->value;
+ gfloat new_value = gtk_adjustment_get_value (obj->priv->v_adjustment);
- if (new_value < obj->priv->v_adjustment->lower)
- new_value = obj->priv->v_adjustment->lower;
+ if (new_value < gtk_adjustment_get_lower (obj->priv->v_adjustment))
+ new_value = gtk_adjustment_get_lower (obj->priv->v_adjustment);
- if (new_value > obj->priv->v_adjustment->upper-1)
- new_value = obj->priv->v_adjustment->upper-1;
+ if (new_value > gtk_adjustment_get_upper (obj->priv->v_adjustment)-1)
+ new_value = gtk_adjustment_get_upper (obj->priv->v_adjustment)-1;
if ((offset_type)new_value==obj->priv->current_offset)
return;
@@ -775,9 +781,9 @@ static void text_render_v_adjustment_update (TextRender *obj)
if (obj->priv->dp)
new_value = gv_align_offset_to_line_start(obj->priv->dp, (offset_type) new_value);
- if (new_value != obj->priv->v_adjustment->value)
+ if (new_value != gtk_adjustment_get_value (obj->priv->v_adjustment))
{
- obj->priv->v_adjustment->value = new_value;
+ gtk_adjustment_set_value (obj->priv->v_adjustment, new_value);
gtk_signal_emit_by_name (GTK_OBJECT (obj->priv->v_adjustment), "value-changed");
}
@@ -794,15 +800,15 @@ static void text_render_v_adjustment_changed (GtkAdjustment *adjustment, gpointe
TextRender *obj = TEXT_RENDER (data);
- if ((obj->priv->old_v_adj_value != adjustment->value) ||
- (obj->priv->old_v_adj_lower != adjustment->lower) ||
- (obj->priv->old_v_adj_upper != adjustment->upper))
+ if ((obj->priv->old_v_adj_value != gtk_adjustment_get_value (adjustment)) ||
+ (obj->priv->old_v_adj_lower != gtk_adjustment_get_lower (adjustment)) ||
+ (obj->priv->old_v_adj_upper != gtk_adjustment_get_upper (adjustment)))
{
text_render_v_adjustment_update (obj);
- obj->priv->old_v_adj_value = adjustment->value;
- obj->priv->old_v_adj_lower = adjustment->lower;
- obj->priv->old_v_adj_upper = adjustment->upper;
+ obj->priv->old_v_adj_value = gtk_adjustment_get_value (adjustment);
+ obj->priv->old_v_adj_lower = gtk_adjustment_get_lower (adjustment);
+ obj->priv->old_v_adj_upper = gtk_adjustment_get_upper (adjustment);
}
}
@@ -814,10 +820,10 @@ static void text_render_v_adjustment_value_changed (GtkAdjustment *adjustment, g
TextRender *obj = TEXT_RENDER (data);
- if (obj->priv->old_v_adj_value != adjustment->value)
+ if (obj->priv->old_v_adj_value != gtk_adjustment_get_value (adjustment))
{
text_render_v_adjustment_update (obj);
- obj->priv->old_v_adj_value = adjustment->value;
+ obj->priv->old_v_adj_value = gtk_adjustment_get_value (adjustment);
}
}
@@ -914,21 +920,21 @@ static void text_render_update_adjustments_limits(TextRender *w)
if (w->priv->v_adjustment)
{
- w->priv->v_adjustment->lower = 0;
- w->priv->v_adjustment->upper = gv_file_get_max_offset(w->priv->fops)-1;
+ gtk_adjustment_set_lower (w->priv->v_adjustment, 0);
+ gtk_adjustment_set_upper (w->priv->v_adjustment, gv_file_get_max_offset(w->priv->fops)-1);
gtk_adjustment_changed (w->priv->v_adjustment);
}
if (w->priv->h_adjustment)
{
- w->priv->h_adjustment->step_increment = 1;
- w->priv->h_adjustment->page_increment = 5;
- w->priv->h_adjustment->page_size = w->priv->chars_per_line;
- w->priv->h_adjustment->lower = 0;
+ gtk_adjustment_set_step_increment (w->priv->h_adjustment, 1);
+ gtk_adjustment_set_page_increment (w->priv->h_adjustment, 5);
+ gtk_adjustment_set_page_size (w->priv->h_adjustment, w->priv->chars_per_line);
+ gtk_adjustment_set_lower (w->priv->h_adjustment, 0);
if (gv_get_data_presentation_mode(w->priv->dp)==PRSNT_NO_WRAP)
- w->priv->h_adjustment->upper = w->priv->max_column; // TODO: find our the real horz limit
+ gtk_adjustment_set_upper (w->priv->h_adjustment, w->priv->max_column); // TODO: find our the
real horz limit
else
- w->priv->h_adjustment->upper = 0;
+ gtk_adjustment_set_upper (w->priv->h_adjustment, 0);
gtk_adjustment_changed (w->priv->h_adjustment);
}
}
@@ -1679,7 +1685,7 @@ static int text_mode_display_line(TextRender *w, int y, int column, offset_type
marker_closer(w, marker_shown);
pango_layout_set_markup (w->priv->layout, (gchar *) w->priv->utf8buf, w->priv->utf8buf_length);
- gdk_draw_layout (GTK_WIDGET (w)->window, w->priv->gc, -(w->priv->char_width*column), y, w->priv->layout);
+ gdk_draw_layout (gtk_widget_get_window (GTK_WIDGET (w)), w->priv->gc, -(w->priv->char_width*column), y,
w->priv->layout);
return 0;
}
@@ -1738,7 +1744,7 @@ static int binary_mode_display_line(TextRender *w, int y, int column, offset_typ
marker_closer(w, marker_shown);
pango_layout_set_markup (w->priv->layout, (gchar *) w->priv->utf8buf, w->priv->utf8buf_length);
- gdk_draw_layout (GTK_WIDGET (w)->window, w->priv->gc, -(w->priv->char_width*column), y, w->priv->layout);
+ gdk_draw_layout (gtk_widget_get_window (GTK_WIDGET (w)), w->priv->gc, -(w->priv->char_width*column), y,
w->priv->layout);
return 0;
}
@@ -1916,7 +1922,7 @@ static int hex_mode_display_line(TextRender *w, int y, int column, offset_type s
marker_closer(w, marker_shown);
pango_layout_set_markup (w->priv->layout, (gchar *) w->priv->utf8buf, w->priv->utf8buf_length);
- gdk_draw_layout (GTK_WIDGET (w)->window, w->priv->gc, 0, y, w->priv->layout);
+ gdk_draw_layout (gtk_widget_get_window (GTK_WIDGET (w)), w->priv->gc, 0, y, w->priv->layout);
return 0;
}
diff --git a/src/intviewer/viewer-window.cc b/src/intviewer/viewer-window.cc
index 609f8861..2f80ea1b 100644
--- a/src/intviewer/viewer-window.cc
+++ b/src/intviewer/viewer-window.cc
@@ -389,8 +389,8 @@ void gviewer_window_load_settings(GViewerWindow *gViewerWindow, GViewerWindowSet
#if 0
// This doesn't work because the window is not shown yet
- if (GTK_WIDGET (obj)->window)
- gdk_window_move (GTK_WIDGET (obj)->window, settings->rect.x, settings->rect.y);
+ if (gtk_widget_get_window (GTK_WIDGET (obj)))
+ gdk_window_move (gtk_widget_get_window (GTK_WIDGET (obj)), settings->rect.x, settings->rect.y);
#endif
gtk_window_set_position (GTK_WINDOW (gViewerWindow), GTK_WIN_POS_CENTER);
}
@@ -404,11 +404,14 @@ void gviewer_window_get_current_settings(GViewerWindow *obj, /* out */ GViewerWi
memset(settings, 0, sizeof(GViewerWindowSettings));
- if (GTK_WIDGET (obj)->window)
+ if (gtk_widget_get_window (GTK_WIDGET (obj)))
{
- settings->rect.width = GTK_WIDGET (obj)->allocation.width;
- settings->rect.height = GTK_WIDGET (obj)->allocation.height;
- gdk_window_get_position(GTK_WIDGET (obj)->window, &settings->rect.x, &settings->rect.y);
+ GtkAllocation obj_allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (obj), &obj_allocation);
+
+ settings->rect.width = obj_allocation.width;
+ settings->rect.height = obj_allocation.height;
+ gdk_window_get_position(gtk_widget_get_window (GTK_WIDGET (obj)), &settings->rect.x,
&settings->rect.y);
}
else
{
@@ -1351,7 +1354,7 @@ GtkWidget *create_view ()
GtkTreeViewColumn *col = nullptr;
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_TYPE, _("Type"));
- gtk_widget_set_tooltip_text (col->button, _("Metadata namespace"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Metadata namespace"));
g_object_set (renderer,
"weight-set", TRUE,
@@ -1359,13 +1362,13 @@ GtkWidget *create_view ()
nullptr);
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), COL_NAME, _("Name"));
- gtk_widget_set_tooltip_text (col->button, _("Tag name"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Tag name"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), COL_VALUE, _("Value"));
- gtk_widget_set_tooltip_text (col->button, _("Tag value"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Tag value"));
col = gnome_cmd_treeview_create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_DESC,
_("Description"));
- gtk_widget_set_tooltip_text (col->button, _("Metadata tag description"));
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (col), _("Metadata tag description"));
g_object_set (renderer,
"foreground-set", TRUE,
diff --git a/src/utils.cc b/src/utils.cc
index 70c15f2f..574c17a4 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -587,7 +587,7 @@ void set_cursor_busy_for_widget (GtkWidget *widget)
if (!cursor_busy)
cursor_busy = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (widget->window, cursor_busy);
+ gdk_window_set_cursor (gtk_widget_get_window (widget), cursor_busy);
while (gtk_events_pending ())
gtk_main_iteration();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]