summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-05-19 17:22:45 +0200
committerinfirit <[email protected]>2014-05-19 20:57:49 +0200
commit3fc6d6c429837cdd4ef2d17c2b9f20859187fa93 (patch)
treea94bddbe2b38d7a84517cf44235fb99e53be98fa
parent36a55c5f8e4a3820a3599c29ff9d7f55e92d6570 (diff)
downloadpluma-3fc6d6c429837cdd4ef2d17c2b9f20859187fa93.tar.bz2
pluma-3fc6d6c429837cdd4ef2d17c2b9f20859187fa93.tar.xz
Cleanup GTK_CHECK_VERSION and unify gtk+2/3 code where possible
Replace functions available in gtk+2 and gtk+3 gdk_window_get_* | since 2.24 gtk_widget_get_allocation | since 2.18 gtk_widget_get_window | since 2.14 gtk_window_get_group | since 2.10 gtk_widget_get_mapped | since 2.20 gtk_widget_get_realized | since 2.20 gdk_window_get_display | since 2.24 Remove deprecated GtkNotebookPage and check.
-rw-r--r--pluma/pluma-app.c4
-rw-r--r--pluma/pluma-documents-panel.c8
-rw-r--r--pluma/pluma-encodings-combo-box.c4
-rw-r--r--pluma/pluma-notebook.c12
-rw-r--r--pluma/pluma-panel.c4
-rw-r--r--pluma/pluma-status-combo-box.c9
-rw-r--r--pluma/pluma-utils.c12
-rw-r--r--pluma/pluma-view.c22
-rw-r--r--pluma/pluma-window.c8
-rwxr-xr-xpluma/smclient/eggsmclient-xsmp.c4
10 files changed, 0 insertions, 87 deletions
diff --git a/pluma/pluma-app.c b/pluma/pluma-app.c
index 48eb1dc1..248656bb 100644
--- a/pluma/pluma-app.c
+++ b/pluma/pluma-app.c
@@ -679,12 +679,8 @@ is_in_viewport (PlumaWindow *window,
gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
gdk_window_get_position (gdkwindow, &x, &y);
- #if GTK_CHECK_VERSION(3, 0, 0)
width = gdk_window_get_width(gdkwindow);
height = gdk_window_get_height(gdkwindow);
- #else
- gdk_drawable_get_size(gdkwindow, &width, &height);
- #endif
pluma_utils_get_current_viewport (screen, &vp_x, &vp_y);
x += vp_x;
diff --git a/pluma/pluma-documents-panel.c b/pluma/pluma-documents-panel.c
index ea2739e1..66d3405f 100644
--- a/pluma/pluma-documents-panel.c
+++ b/pluma/pluma-documents-panel.c
@@ -522,11 +522,7 @@ menu_position (GtkMenu *menu,
w = panel->priv->treeview;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_allocation(w, &allocation);
-#else
- allocation = w->allocation;
-#endif
path = get_current_path (panel);
@@ -538,11 +534,7 @@ menu_position (GtkMenu *menu,
wx = rect.x;
wy = rect.y;
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_origin (gtk_widget_get_window (w), x, y);
-#else
- gdk_window_get_origin (w->window, x, y);
-#endif
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
diff --git a/pluma/pluma-encodings-combo-box.c b/pluma/pluma-encodings-combo-box.c
index cb056d03..2f355424 100644
--- a/pluma/pluma-encodings-combo-box.c
+++ b/pluma/pluma-encodings-combo-box.c
@@ -208,11 +208,7 @@ add_or_remove (PlumaEncodingsComboBox *menu,
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (toplevel));
-#if GTK_CHECK_VERSION (3, 0, 0)
wg = gtk_window_get_group (GTK_WINDOW (toplevel));
-#else
- wg = GTK_WINDOW (toplevel)->group;
-#endif
if (wg == NULL)
{
wg = gtk_window_group_new ();
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c
index 01164c4c..ea9ac6b2 100644
--- a/pluma/pluma-notebook.c
+++ b/pluma/pluma-notebook.c
@@ -259,28 +259,16 @@ find_tab_num_at_pos (PlumaNotebook *notebook,
tab = gtk_notebook_get_tab_label (nb, page);
g_return_val_if_fail (tab != NULL, AFTER_ALL_TABS);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (!gtk_widget_get_mapped (tab))
-#else
- if (!GTK_WIDGET_MAPPED (GTK_WIDGET (tab)))
-#endif
{
++page_num;
continue;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_origin (GDK_WINDOW (gtk_widget_get_window (tab)),
-#else
- gdk_window_get_origin (GDK_WINDOW (tab->window),
-#endif
&x_root, &y_root);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_allocation(tab, &allocation);
-#else
- allocation = tab->allocation;
-#endif
max_x = x_root + allocation.x + allocation.width;
max_y = y_root + allocation.y + allocation.height;
diff --git a/pluma/pluma-panel.c b/pluma/pluma-panel.c
index d8467a0c..68438b8a 100644
--- a/pluma/pluma-panel.c
+++ b/pluma/pluma-panel.c
@@ -368,11 +368,7 @@ sync_title (PlumaPanel *panel,
static void
notebook_page_changed (GtkNotebook *notebook,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *page,
-#else
- GtkNotebookPage *page,
-#endif
guint page_num,
PlumaPanel *panel)
{
diff --git a/pluma/pluma-status-combo-box.c b/pluma/pluma-status-combo-box.c
index ed0f4917..e800c406 100644
--- a/pluma/pluma-status-combo-box.c
+++ b/pluma/pluma-status-combo-box.c
@@ -180,13 +180,8 @@ menu_position_func (GtkMenu *menu,
gtk_widget_size_request (gtk_widget_get_toplevel (GTK_WIDGET (menu)), &request);
/* get the origin... */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (combo)), x, y);
gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
-#else
- gdk_window_get_origin (GTK_WIDGET (combo)->window, x, y);
- allocation = GTK_WIDGET (combo)->allocation;
-#endif
/* make the menu as wide as the widget */
if (request.width < allocation.width)
@@ -208,11 +203,7 @@ button_press_event (GtkWidget *widget,
gint max_height;
gtk_widget_size_request (combo->priv->menu, &request);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
-#else
- allocation = GTK_WIDGET (combo)->allocation;
-#endif
/* do something relative to our own height here, maybe we can do better */
max_height = allocation.height * 20;
diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c
index f6a9dbb3..8e92d5fe 100644
--- a/pluma/pluma-utils.c
+++ b/pluma/pluma-utils.c
@@ -132,11 +132,7 @@ pluma_utils_menu_position_under_widget (GtkMenu *menu,
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_allocation (widget, &allocation);
-#else
- allocation = widget->allocation;
-#endif
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
@@ -907,18 +903,10 @@ pluma_utils_get_window_workspace (GtkWindow *gtkwindow)
guint ret = PLUMA_ALL_WORKSPACES;
g_return_val_if_fail (GTK_IS_WINDOW (gtkwindow), 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_return_val_if_fail (gtk_widget_get_realized (GTK_WIDGET (gtkwindow)), 0);
-#else
- g_return_val_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (gtkwindow)), 0);
-#endif
window = gtk_widget_get_window (GTK_WIDGET (gtkwindow));
-#if GTK_CHECK_VERSION (3, 0, 0)
display = gdk_window_get_display (window);
-#else
- display = gdk_drawable_get_display (window);
-#endif
gdk_error_trap_push ();
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c
index fd689e45..d17b6a01 100644
--- a/pluma/pluma-view.c
+++ b/pluma/pluma-view.c
@@ -917,11 +917,7 @@ send_focus_change (GtkWidget *widget,
g_object_ref (widget);
fevent->focus_change.type = GDK_FOCUS_CHANGE;
-#if GTK_CHECK_VERSION (3, 0, 0)
fevent->focus_change.window = g_object_ref (gtk_widget_get_window (widget));
-#else
- fevent->focus_change.window = g_object_ref (widget->window);
-#endif
fevent->focus_change.in = in;
gtk_widget_event (widget, fevent);
@@ -988,11 +984,7 @@ update_search_window_position (PlumaView *view)
{
gint x, y;
gint view_x, view_y;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkWindow *view_window = gtk_widget_get_window (GTK_WIDGET (view));
-#else
- GdkWindow *view_window = GTK_WIDGET (view)->window;
-#endif
gtk_widget_realize (view->priv->search_window);
@@ -1468,15 +1460,9 @@ ensure_search_window (PlumaView *view)
GtkWindowGroup *search_group;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
-#if GTK_CHECK_VERSION (3, 0, 0)
group = gtk_window_get_group (GTK_WINDOW (toplevel));
if (view->priv->search_window != NULL)
search_group = gtk_window_get_group (GTK_WINDOW (view->priv->search_window));
-#else
- group = GTK_WINDOW (toplevel)->group;
- if (view->priv->search_window != NULL)
- search_group = GTK_WINDOW (view->priv->search_window)->group;
-#endif
if (view->priv->search_window != NULL)
{
@@ -1947,11 +1933,7 @@ pluma_view_drag_motion (GtkWidget *widget,
if (drag_get_uri_target (widget, context) != GDK_NONE)
{
gdk_drag_status (context,
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_drag_context_get_suggested_action (context),
-#else
- context->suggested_action,
-#endif
timestamp);
result = TRUE;
}
@@ -2155,11 +2137,7 @@ delete_line (GtkTextView *text_view,
buffer = gtk_text_view_get_buffer (text_view);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_text_view_reset_im_context (text_view);
-#else
- reset_im_context (text_view);
-#endif
/* If there is a selection delete the selected lines and
* ignore count */
diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c
index 1d47d28f..780879b6 100644
--- a/pluma/pluma-window.c
+++ b/pluma/pluma-window.c
@@ -2419,11 +2419,7 @@ language_changed (GObject *object,
static void
notebook_switch_page (GtkNotebook *book,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *pg,
-#else
- GtkNotebookPage *pg,
-#endif
gint page_num,
PlumaWindow *window)
{
@@ -3582,11 +3578,7 @@ vpaned_restore_position (GtkWidget *widget,
GtkAllocation allocation;
gint pos;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_allocation (widget, &allocation);
-#else
- allocation = widget->allocation;
-#endif
pluma_debug_message (DEBUG_WINDOW,
"Restoring vpaned position: bottom panel size %d",
diff --git a/pluma/smclient/eggsmclient-xsmp.c b/pluma/smclient/eggsmclient-xsmp.c
index 688e20eb..a957f50d 100755
--- a/pluma/smclient/eggsmclient-xsmp.c
+++ b/pluma/smclient/eggsmclient-xsmp.c
@@ -367,11 +367,7 @@ sm_client_xsmp_startup (EggSMClient *client,
free (ret_client_id);
gdk_threads_enter ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_x11_set_sm_client_id (xsmp->client_id);
-#else
- gdk_set_sm_client_id (xsmp->client_id);
-#endif
gdk_threads_leave ();
g_debug ("Got client ID \"%s\"", xsmp->client_id);