Commit d17185bb authored by Javier Jardón's avatar Javier Jardón

Use accessor functions instead direct access

A compatibility header was added: gseal-compat-gtk.h
Still remaining (no GTK+ api):
text_view->need_im_reset

https://bugzilla.gnome.org/show_bug.cgi?id=593601
parent f573439b
......@@ -90,7 +90,8 @@ NOINST_H_FILES = \
gedit-tab-label.h \
gedittextregion.h \
gedit-ui.h \
gedit-window-private.h
gedit-window-private.h \
gseal-gtk-compat.h
INST_H_FILES = \
gedit-app.h \
......
......@@ -39,6 +39,7 @@
#include <gedit/gedit-utils.h>
#include <gedit/gedit-window.h>
#include <gedit/gseal-gtk-compat.h>
/* Properties */
enum
......@@ -508,7 +509,7 @@ build_single_doc_dialog (GeditCloseConfirmationDialog *dlg)
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
GTK_WIDGET_UNSET_FLAGS (primary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (primary_label, FALSE);
doc_name = gedit_document_get_short_name_for_display (doc);
......@@ -541,7 +542,7 @@ build_single_doc_dialog (GeditCloseConfirmationDialog *dlg)
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
GTK_WIDGET_UNSET_FLAGS (secondary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (secondary_label, FALSE);
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
......
......@@ -45,6 +45,7 @@
#include "gedit-utils.h"
#include "gedit-enum-types.h"
#include "gedit-dirs.h"
#include "gseal-gtk-compat.h"
#ifdef OS_OSX
#include <ige-mac-integration.h>
......@@ -632,7 +633,7 @@ gedit_app_get_active_window (GeditApp *app)
* enough that the second instance comes up before the
* first one shows its window.
*/
if (!GTK_WIDGET_REALIZED (GTK_WIDGET (app->priv->active_window)))
if (!gtk_widget_get_realized (GTK_WIDGET (app->priv->active_window)))
gtk_widget_realize (GTK_WIDGET (app->priv->active_window));
return app->priv->active_window;
......
......@@ -35,6 +35,7 @@
#include "gedit-documents-panel.h"
#include "gedit-utils.h"
#include "gedit-notebook.h"
#include "gseal-gtk-compat.h"
#include <glib/gi18n.h>
......@@ -518,6 +519,7 @@ menu_position (GtkMenu *menu,
gint wx, wy;
GtkRequisition requisition;
GtkWidget *w;
GtkAllocation allocation;
w = panel->priv->treeview;
......@@ -531,21 +533,23 @@ menu_position (GtkMenu *menu,
wx = rect.x;
wy = rect.y;
gdk_window_get_origin (w->window, x, y);
gdk_window_get_origin (gtk_widget_get_window (w), x, y);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
gtk_widget_get_allocation (w, &allocation);
if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
{
*x += w->allocation.x + w->allocation.width - requisition.width - 10;
*x += allocation.x + allocation.width - requisition.width - 10;
}
else
{
*x += w->allocation.x + 10;
*x += allocation.x + 10;
}
wy = MAX (*y + 5, *y + wy + 5);
wy = MIN (wy, *y + w->allocation.height - requisition.height - 5);
wy = MIN (wy, *y + allocation.height - requisition.height - 5);
*y = wy;
......
......@@ -40,6 +40,8 @@
#include <gedit/gedit-prefs-manager.h>
#include <gedit/dialogs/gedit-encodings-dialog.h>
#include "gseal-gtk-compat.h"
#define ENCODING_KEY "Enconding"
#define GEDIT_ENCODINGS_COMBO_BOX_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
......@@ -191,11 +193,7 @@ add_or_remove (GeditEncodingsComboBox *menu,
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu));
#if !GTK_CHECK_VERSION (2, 18, 0)
if (!GTK_WIDGET_TOPLEVEL (toplevel))
#else
if (!gtk_widget_is_toplevel (toplevel))
#endif
toplevel = NULL;
g_signal_handler_block (menu, menu->priv->changed_id);
......@@ -212,7 +210,7 @@ add_or_remove (GeditEncodingsComboBox *menu,
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (toplevel));
wg = GTK_WINDOW (toplevel)->group;
wg = gtk_window_get_group (GTK_WINDOW (toplevel));
if (wg == NULL)
{
wg = gtk_window_group_new ();
......
......@@ -48,6 +48,8 @@
#include "gedit-prefs-manager.h"
#include <gedit/gedit-encodings-combo-box.h>
#include "gseal-gtk-compat.h"
#if !GTK_CHECK_VERSION (2, 17, 1)
#include "gedit-message-area.h"
#endif
......@@ -144,7 +146,7 @@ set_message_area_text_and_icon (GtkWidget *message_area,
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
if (secondary_text != NULL)
......@@ -154,7 +156,7 @@ set_message_area_text_and_icon (GtkWidget *message_area,
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (secondary_label, TRUE);
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
......@@ -575,7 +577,7 @@ create_conversion_error_message_area (const gchar *primary_text,
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
if (secondary_text != NULL)
......@@ -585,7 +587,7 @@ create_conversion_error_message_area (const gchar *primary_text,
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (secondary_label, TRUE);
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
......@@ -860,7 +862,7 @@ gedit_file_already_open_warning_message_area_new (GFile *location)
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
secondary_text = _("gedit opened this instance of the file in a non-editable way. "
......@@ -870,7 +872,7 @@ gedit_file_already_open_warning_message_area_new (GFile *location)
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (secondary_label, TRUE);
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
......@@ -966,7 +968,7 @@ gedit_externally_modified_saving_error_message_area_new (
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
secondary_text = _("If you save it, all the external changes could be lost. Save it anyway?");
......@@ -975,7 +977,7 @@ gedit_externally_modified_saving_error_message_area_new (
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (secondary_label, TRUE);
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
......@@ -1076,7 +1078,7 @@ gedit_no_backup_saving_error_message_area_new (GFile *location,
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
secondary_text = _("gedit could not back up the old copy of the file before saving the new one. "
......@@ -1087,7 +1089,7 @@ gedit_no_backup_saving_error_message_area_new (GFile *location,
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (secondary_label, TRUE);
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
......
......@@ -53,6 +53,8 @@
#include "gedit-spinner.h"
#endif
#include "gseal-gtk-compat.h"
#define AFTER_ALL_TABS -1
#define NOT_IN_APP_WINDOWS -2
......@@ -247,11 +249,6 @@ find_tab_num_at_pos (GeditNotebook *notebook,
tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (notebook));
if (GTK_NOTEBOOK (notebook)->first_tab == NULL)
{
return AFTER_ALL_TABS;
}
/* For some reason unfullscreen + quick click can
cause a wrong click event to be reported to the tab */
if (!is_in_notebook_window (notebook, abs_x, abs_y))
......@@ -264,21 +261,23 @@ find_tab_num_at_pos (GeditNotebook *notebook,
GtkWidget *tab;
gint max_x, max_y;
gint x_root, y_root;
GtkAllocation allocation;
tab = gtk_notebook_get_tab_label (nb, page);
g_return_val_if_fail (tab != NULL, AFTER_ALL_TABS);
if (!GTK_WIDGET_MAPPED (GTK_WIDGET (tab)))
if (!gtk_widget_get_mapped (tab))
{
++page_num;
continue;
}
gdk_window_get_origin (GDK_WINDOW (tab->window),
gdk_window_get_origin (GDK_WINDOW (gtk_widget_get_window (tab)),
&x_root, &y_root);
max_x = x_root + tab->allocation.x + tab->allocation.width;
max_y = y_root + tab->allocation.y + tab->allocation.height;
gtk_widget_get_allocation (tab, &allocation);
max_x = x_root + allocation.x + allocation.width;
max_y = y_root + allocation.y + allocation.height;
if (((tab_pos == GTK_POS_TOP) ||
(tab_pos == GTK_POS_BOTTOM)) &&
......
......@@ -38,6 +38,7 @@
#include "gedit-close-button.h"
#include "gedit-window.h"
#include "gedit-debug.h"
#include "gseal-gtk-compat.h"
#define PANEL_ITEM_KEY "GeditPanelItemKey"
......@@ -142,11 +143,7 @@ static void
gedit_panel_focus_document (GeditPanel *panel)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (panel));
#if !GTK_CHECK_VERSION (2, 18, 0)
if (GTK_WIDGET_TOPLEVEL (toplevel) && GEDIT_IS_WINDOW (toplevel))
#else
if (gtk_widget_is_toplevel (toplevel) && GEDIT_IS_WINDOW (toplevel))
#endif
{
GeditView *view;
......@@ -697,7 +694,7 @@ gedit_panel_add_item (GeditPanel *panel,
menu_label = gtk_label_new (name);
gtk_misc_set_alignment (GTK_MISC (menu_label), 0.0, 0.5);
if (!GTK_WIDGET_VISIBLE (item))
if (!gtk_widget_get_visible (item))
gtk_widget_show (item);
gtk_notebook_append_page_menu (GTK_NOTEBOOK (panel->priv->notebook),
......
......@@ -40,6 +40,7 @@
#include <cairo-pdf.h>
#include "gedit-print-preview.h"
#include "gseal-gtk-compat.h"
#define PRINTER_DPI (72.)
......@@ -956,7 +957,7 @@ create_preview_layout (GeditPrintPreview *preview)
GDK_BUTTON_PRESS_MASK |
GDK_KEY_PRESS_MASK);
GTK_WIDGET_SET_FLAGS (priv->layout, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (priv->layout, TRUE);
g_signal_connect (priv->layout,
"key-press-event",
......
......@@ -53,6 +53,7 @@
#include "gedit-commands.h"
#include "dialogs/gedit-close-confirmation-dialog.h"
#include "smclient/eggsmclient.h"
#include "gseal-gtk-compat.h"
/* The master client we use for SM */
static EggSMClient *master_client = NULL;
......@@ -87,11 +88,11 @@ save_window_session (GKeyFile *state_file,
panel = gedit_window_get_side_panel (window);
g_key_file_set_boolean (state_file, group_name, "side-panel-visible",
GTK_WIDGET_VISIBLE (panel));
gtk_widget_get_visible (GTK_WIDGET (panel)));
panel = gedit_window_get_bottom_panel (window);
g_key_file_set_boolean (state_file, group_name, "bottom-panel-visible",
GTK_WIDGET_VISIBLE (panel));
gtk_widget_get_visible (GTK_WIDGET (panel)));
active_document = gedit_window_get_active_document (window);
if (active_document)
......
......@@ -39,11 +39,12 @@
#include <config.h>
#endif
#include "gedit-spinner.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
#include "gedit-spinner.h"
#include "gseal-gtk-compat.h"
/* Spinner cache implementation */
#define GEDIT_TYPE_SPINNER_CACHE (gedit_spinner_cache_get_type())
......@@ -616,7 +617,7 @@ gedit_spinner_init (GeditSpinner *spinner)
priv = spinner->priv = GEDIT_SPINNER_GET_PRIVATE (spinner);
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (spinner), GTK_NO_WINDOW);
gtk_widget_set_has_window (GTK_WIDGET (spinner), FALSE);
priv->cache = gedit_spinner_cache_ref ();
priv->size = GTK_ICON_SIZE_DIALOG;
......@@ -636,8 +637,9 @@ gedit_spinner_expose (GtkWidget *widget,
GdkGC *gc;
int x_offset, y_offset, width, height;
GdkRectangle pix_area, dest;
GtkAllocation allocation;
if (!GTK_WIDGET_DRAWABLE (spinner))
if (!gtk_widget_is_drawable (GTK_WIDGET (spinner)))
{
return FALSE;
}
......@@ -668,11 +670,12 @@ gedit_spinner_expose (GtkWidget *widget,
height = gdk_pixbuf_get_height (pixbuf);
/* Compute the offsets for the image centered on our allocation */
x_offset = (widget->allocation.width - width) / 2;
y_offset = (widget->allocation.height - height) / 2;
gtk_widget_get_allocation (widget, &allocation);
x_offset = (allocation.width - width) / 2;
y_offset = (allocation.height - height) / 2;
pix_area.x = x_offset + widget->allocation.x;
pix_area.y = y_offset + widget->allocation.y;
pix_area.x = x_offset + allocation.x;
pix_area.y = y_offset + allocation.y;
pix_area.width = width;
pix_area.height = height;
......@@ -681,10 +684,10 @@ gedit_spinner_expose (GtkWidget *widget,
return FALSE;
}
gc = gdk_gc_new (widget->window);
gdk_draw_pixbuf (widget->window, gc, pixbuf,
dest.x - x_offset - widget->allocation.x,
dest.y - y_offset - widget->allocation.y,
gc = gdk_gc_new (gtk_widget_get_window (widget));
gdk_draw_pixbuf (gtk_widget_get_window (widget), gc, pixbuf,
dest.x - x_offset - allocation.x,
dest.y - y_offset - allocation.y,
dest.x, dest.y,
dest.width, dest.height,
GDK_RGB_DITHER_MAX, 0, 0);
......
......@@ -21,6 +21,7 @@
*/
#include "gedit-status-combo-box.h"
#include "gseal-gtk-compat.h"
#define COMBO_BOX_TEXT_DATA "GeditStatusComboBoxTextData"
......@@ -173,18 +174,20 @@ menu_position_func (GtkMenu *menu,
GeditStatusComboBox *combo)
{
GtkRequisition request;
GtkAllocation allocation;
*push_in = FALSE;
gtk_widget_size_request (gtk_widget_get_toplevel (GTK_WIDGET (menu)), &request);
/* get the origin... */
gdk_window_get_origin (GTK_WIDGET (combo)->window, x, y);
gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (combo)), x, y);
/* make the menu as wide as the widget */
if (request.width < GTK_WIDGET (combo)->allocation.width)
gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
if (request.width < allocation.width)
{
gtk_widget_set_size_request (GTK_WIDGET (menu), GTK_WIDGET (combo)->allocation.width, -1);
gtk_widget_set_size_request (GTK_WIDGET (menu), allocation.width, -1);
}
/* position it above the widget */
......@@ -198,11 +201,13 @@ button_press_event (GtkWidget *widget,
{
GtkRequisition request;
gint max_height;
GtkAllocation allocation;
gtk_widget_size_request (combo->priv->menu, &request);
/* do something relative to our own height here, maybe we can do better */
max_height = GTK_WIDGET (combo)->allocation.height * 20;
gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
max_height = allocation.height * 20;
if (request.height > max_height)
{
......
......@@ -59,6 +59,8 @@
#include <X11/Xatom.h>
#endif
#include "gseal-gtk-compat.h"
#define STDIN_DELAY_MICROSECONDS 100000
/* Returns true if location is a file: uri and is not a chained uri */
......@@ -87,22 +89,25 @@ gedit_utils_menu_position_under_widget (GtkMenu *menu,
{
GtkWidget *widget;
GtkRequisition requisition;
GtkAllocation allocation;
widget = GTK_WIDGET (user_data);
widget_get_origin (widget, x, y);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
gtk_widget_get_allocation (widget, &allocation);
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
*x += widget->allocation.x + widget->allocation.width - requisition.width;
*x += allocation.x + allocation.width - requisition.width;
}
else
{
*x += widget->allocation.x;
*x += allocation.x;
}
*y += widget->allocation.y + widget->allocation.height;
*y += allocation.y + allocation.height;
*push_in = TRUE;
}
......@@ -196,7 +201,7 @@ gedit_dialog_add_button (GtkDialog *dialog,
button = gedit_gtk_button_new_with_stock_icon (text, stock_id);
g_return_val_if_fail (button != NULL, NULL);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
......@@ -861,7 +866,7 @@ gedit_utils_get_window_workspace (GtkWindow *gtkwindow)
guint ret = GEDIT_ALL_WORKSPACES;
g_return_val_if_fail (GTK_IS_WINDOW (gtkwindow), 0);
g_return_val_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (gtkwindow)), 0);
g_return_val_if_fail (gtk_widget_get_realized (GTK_WIDGET (gtkwindow)), 0);
window = gtk_widget_get_window (GTK_WIDGET (gtkwindow));
display = gdk_drawable_get_display (window);
......
......@@ -47,6 +47,7 @@
#include "gedit-prefs-manager-app.h"
#include "gedit-marshal.h"
#include "gedit-utils.h"
#include "gseal-gtk-compat.h"
#define GEDIT_VIEW_SCROLL_MARGIN 0.02
......@@ -900,21 +901,27 @@ send_focus_change (GtkWidget *widget,
GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
g_object_ref (widget);
#if !GTK_CHECK_VERSION (2, 21, 0)
if (in)
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
#endif
fevent->focus_change.type = GDK_FOCUS_CHANGE;
fevent->focus_change.window = g_object_ref (widget->window);
fevent->focus_change.window = g_object_ref (gtk_widget_get_window (widget));
fevent->focus_change.in = in;
#if !GTK_CHECK_VERSION (2, 21, 0)
gtk_widget_event (widget, fevent);
g_object_notify (G_OBJECT (widget), "has-focus");
g_object_unref (widget);
#else
gtk_widget_send_focus_change (widget, fevent);
#endif
gdk_event_free (fevent);
}
......@@ -974,7 +981,7 @@ update_search_window_position (GeditView *view)
{
gint x, y;
gint view_x, view_y;
GdkWindow *view_window = GTK_WIDGET (view)->window;
GdkWindow *view_window = gtk_widget_get_window (GTK_WIDGET (view));
gtk_widget_realize (view->priv->search_window);
......@@ -1433,12 +1440,12 @@ ensure_search_window (GeditView *view)
if (view->priv->search_window != NULL)
{
if (GTK_WINDOW (toplevel)->group)
gtk_window_group_add_window (GTK_WINDOW (toplevel)->group,
if (gtk_window_get_group (GTK_WINDOW (toplevel)))
gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
GTK_WINDOW (view->priv->search_window));
else if (GTK_WINDOW (view->priv->search_window)->group)
gtk_window_group_remove_window (GTK_WINDOW (view->priv->search_window)->group,
GTK_WINDOW (view->priv->search_window));
else if (gtk_window_get_group (GTK_WINDOW (view->priv->search_window)))
gtk_window_group_remove_window (gtk_window_get_group (GTK_WINDOW (view->priv->search_window)),
GTK_WINDOW (view->priv->search_window));
customize_for_search_mode (view);
......@@ -1447,8 +1454,8 @@ ensure_search_window (GeditView *view)
view->priv->search_window = gtk_window_new (GTK_WINDOW_POPUP);
if (GTK_WINDOW (toplevel)->group)
gtk_window_group_add_window (GTK_WINDOW (toplevel)->group,
if (gtk_window_get_group (GTK_WINDOW (toplevel)))
gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
GTK_WINDOW (view->priv->search_window));
gtk_window_set_modal (GTK_WINDOW (view->priv->search_window), TRUE);
......@@ -1743,10 +1750,10 @@ start_interactive_search_real (GeditView *view)
GtkTextBuffer *buffer;
if ((view->priv->search_window != NULL) &&
GTK_WIDGET_VISIBLE (view->priv->search_window))
gtk_widget_get_visible (view->priv->search_window))
return TRUE;
if (!GTK_WIDGET_HAS_FOCUS (view))
if (!gtk_widget_has_focus (GTK_WIDGET (view)))
return FALSE;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
......
......@@ -56,6 +56,7 @@
#include "gedit-enum-types.h"
#include "gedit-dirs.h"
#include "gedit-status-combo-box.h"
#include "gseal-gtk-compat.h"
#ifdef OS_OSX
#include "osx/gedit-osx.h"
......@@ -573,7 +574,7 @@ set_toolbar_style (GeditWindow *window,
if (origin == NULL)
visible = gedit_prefs_manager_get_toolbar_visible ();
else
visible = GTK_WIDGET_VISIBLE (origin->priv->toolbar);
visible = gtk_widget_get_visible (origin->priv->toolbar);
/* Set visibility */
if (visible)
......@@ -1421,7 +1422,7 @@ toolbar_visibility_changed (GtkWidget *toolbar,
gboolean visible;
GtkAction *action;
visible = GTK_WIDGET_VISIBLE (toolbar);
visible = gtk_widget_get_visible (toolbar);
if (gedit_prefs_manager_toolbar_visible_can_set ())
gedit_prefs_manager_set_toolbar_visible (visible);
......@@ -1837,7 +1838,7 @@ set_statusbar_style (GeditWindow *window,
if (origin == NULL)
visible = gedit_prefs_manager_get_statusbar_visible ();
else
visible = GTK_WIDGET_VISIBLE (origin->priv->statusbar);
visible = gtk_widget_get_visible (origin->priv->statusbar);
if (visible)
gtk_widget_show (window->priv->statusbar);
......@@ -1860,7 +1861,7 @@ statusbar_visibility_changed (GtkWidget *statusbar,
gboolean visible;
GtkAction *action;
visible = GTK_WIDGET_VISIBLE (statusbar);
visible = gtk_widget_get_visible (statusbar);
if (gedit_prefs_manager_statusbar_visible_can_set ())
gedit_prefs_manager_set_statusbar_visible (visible);
......@@ -2133,15 +2134,10 @@ clone_window (GeditWindow *origin)
_gedit_panel_set_active_item_by_id (GEDIT_PANEL (window->priv->bottom_panel),
panel_page);
if (GTK_WIDGET_VISIBLE (origin->priv->side_panel))
gtk_widget_show (window->priv->side_panel);
else
gtk_widget_hide (window->priv->side_panel);
if (GTK_WIDGET_VISIBLE (origin->priv->bottom_panel))
gtk_widget_show (window->priv->bottom_panel);
else
gtk_widget_hide (window->priv->bottom_panel);
gtk_widget_set_visible (window->priv->side_panel,
gtk_widget_get_visible (origin->priv->side_panel));
gtk_widget_set_visible (window->priv->bottom_panel,
gtk_widget_get_visible (origin->priv->bottom_panel));
set_statusbar_style (window, origin);
set_toolbar_style (window, origin);
......@@ -3623,12 +3619,14 @@ vpaned_restore_position (GtkWidget *widget,
GeditWindow *window)
{
gint pos;
GtkAllocation allocation;
gedit_debug_message (DEBUG_WINDOW,
"Restoring vpaned position: bottom panel size %d",
window->priv->bottom_panel_size);
pos = widget->allocation.height -
gtk_widget_get_allocation (widget, &allocation);
pos = allocation.height -
MAX (50, window->priv->bottom_panel_size);
gtk_paned_set_position (GTK_PANED (window->priv->vpaned), pos);
......@@ -3649,7 +3647,7 @@ side_panel_visibility_changed (GtkWidget *side_panel,
gboolean visible;
GtkAction *action;
visible = GTK_WIDGET_VISIBLE (side_panel);
visible = gtk_widget_get_visible (side_panel);
if (gedit_prefs_manager_side_pane_visible_can_set ())
gedit_prefs_manager_set_side_pane_visible (visible);
......@@ -3703,7 +3701,7 @@ bottom_panel_visibility_changed (GeditPanel *bottom_panel,
gboolean visible;
GtkAction *action;
visible = GTK_WIDGET_VISIBLE (bottom_panel);
visible = gtk_widget_get_visible (GTK_WIDGET (bottom_panel));
if (gedit_prefs_manager_bottom_panel_visible_can_set ())
gedit_prefs_manager_set_bottom_panel_visible (visible);
......@@ -4175,7 +4173,7 @@ gedit_window_create_tab (GeditWindow *window,
-1,
jump_to);
if (!GTK_WIDGET_VISIBLE (window))
if (!gtk_widget_get_visible (GTK_WIDGET (window)))
{
gtk_window_present (GTK_WINDOW (window));
}
......@@ -4229,7 +4227,7 @@ gedit_window_create_tab_from_location (GeditWindow *window,
jump_to);
if (!GTK_WIDGET_VISIBLE (window))
if (!gtk_widget_get_visible (GTK_WIDGET (window)))
{
gtk_window_present (GTK_WINDOW (window));
}
......
......@@ -59,6 +59,8 @@
#include "eggsmclient.h"
#include "eggdesktopfile.h"
#include "gseal-gtk-compat.h"
#ifdef G_OS_WIN32
#define SAVE_DATADIR DATADIR
#undef DATADIR
......@@ -426,7 +428,7 @@ on_message_received (const char *message,
* terminal. We also need to make sure that the window
* has been realized otherwise it will not work. lame.
*/
if (!GTK_WIDGET_REALIZED (window))
if (!gtk_widget_get_realized (GTK_WIDGET (window)))
gtk_widget_realize (GTK_WIDGET (window));
#ifdef GDK_WINDOWING_X11
......
......@@ -29,6 +29,8 @@
#include <gtk/gtk.h>
#include <stdlib.h>
#include <gedit/gseal-gtk-compat.h>
#include <gconf/gconf-client.h>
#if !GTK_CHECK_VERSION(2, 17, 1)