[gedit] Code cleanup
- From: Paolo Borelli <pborelli src gnome org>
- To: svn-commits-list gnome org
- Subject: [gedit] Code cleanup
- Date: Sat, 18 Jul 2009 15:03:53 +0000 (UTC)
commit 7aa0d06f1649f45555c82525b68387c4d278a6d9
Author: Paolo Borelli <porelli gnome org>
Date: Sat Jul 18 17:00:22 2009 +0200
Code cleanup
gedit/gedit-app.c | 6 ++++--
gedit/gedit-utils.c | 28 ++++++++++++++++++++--------
2 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 1809f99..db52a18 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -631,6 +631,7 @@ is_in_viewport (GeditWindow *window,
{
GdkScreen *s;
GdkDisplay *display;
+ GdkWindow *gdkwindow;
const gchar *cur_name;
const gchar *name;
gint cur_n;
@@ -659,8 +660,9 @@ is_in_viewport (GeditWindow *window,
return FALSE;
/* Check for viewport match */
- gdk_window_get_position (GTK_WIDGET (window)->window, &x, &y);
- gdk_drawable_get_size (GTK_WIDGET (window)->window, &width, &height);
+ gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
+ gdk_window_get_position (gdkwindow, &x, &y);
+ gdk_drawable_get_size (gdkwindow, &width, &height);
gedit_utils_get_current_viewport (screen, &vp_x, &vp_y);
x += vp_x;
y += vp_y;
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index 3708f93..15f5b8d 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -107,6 +107,16 @@ gedit_utils_uri_has_writable_scheme (const gchar *uri)
return res;
}
+static void
+widget_get_origin (GtkWidget *widget, gint *x, gint *y)
+
+{
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (widget);
+ gdk_window_get_origin (window, x, y);
+}
+
void
gedit_utils_menu_position_under_widget (GtkMenu *menu,
gint *x,
@@ -114,22 +124,24 @@ gedit_utils_menu_position_under_widget (GtkMenu *menu,
gboolean *push_in,
gpointer user_data)
{
- GtkWidget *w = GTK_WIDGET (user_data);
+ GtkWidget *widget;
GtkRequisition requisition;
- gdk_window_get_origin (w->window, x, y);
+ widget = GTK_WIDGET (user_data);
+ widget_get_origin (widget, x, y);
+
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
- if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
- *x += w->allocation.x + w->allocation.width - requisition.width;
+ *x += widget->allocation.x + widget->allocation.width - requisition.width;
}
else
{
- *x += w->allocation.x;
+ *x += widget->allocation.x;
}
- *y += w->allocation.y + w->allocation.height;
+ *y += widget->allocation.y + widget->allocation.height;
*push_in = TRUE;
}
@@ -157,7 +169,7 @@ gedit_utils_menu_position_under_tree_view (GtkMenu *menu,
GtkTreePath *path;
GdkRectangle rect;
- gdk_window_get_origin (GTK_WIDGET (tree)->window, x, y);
+ widget_get_origin (GTK_WIDGET (tree), x, y);
path = gtk_tree_model_get_path (model, &iter);
gtk_tree_view_get_cell_area (tree, path,
@@ -891,7 +903,7 @@ gedit_utils_get_window_workspace (GtkWindow *gtkwindow)
g_return_val_if_fail (GTK_IS_WINDOW (gtkwindow), 0);
g_return_val_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (gtkwindow)), 0);
- window = GTK_WIDGET (gtkwindow)->window;
+ window = gtk_widget_get_window (GTK_WIDGET (gtkwindow));
display = gdk_drawable_get_display (window);
gdk_error_trap_push ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]