[eog] Make libegg code and EogWindow GSEAL-compatible. See bug 606883.
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Make libegg code and EogWindow GSEAL-compatible. See bug 606883.
- Date: Mon, 3 May 2010 19:55:19 +0000 (UTC)
commit f10411901ad9b8d3a87f7e8ef4312d016a76407d
Author: Andre Klapper <a9016009 gmx de>
Date: Wed Apr 14 17:24:49 2010 +0200
Make libegg code and EogWindow GSEAL-compatible. See bug 606883.
configure.ac | 2 +-
cut-n-paste/toolbar-editor/egg-editable-toolbar.c | 50 +++++++++++----------
cut-n-paste/toolbar-editor/egg-toolbar-editor.c | 8 ++--
src/eog-window.c | 24 ++++++++++
4 files changed, 55 insertions(+), 29 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ef51307..25b5b02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,7 +83,7 @@ GNOME_DOC_INIT
# GNOME Libs
# **********
-GTK_REQUIRED=2.17.5
+GTK_REQUIRED=2.18.0
GLIB_REQUIRED=2.15.3
GNOME_DESKTOP_REQUIRED=2.25.1
GDKPIXBUF_REQUIRED=2.4.0
diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
index 0719788..a31bdb3 100644
--- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
+++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
@@ -100,7 +100,7 @@ get_dock_position (EggEditableToolbar *etoolbar,
static int
get_toolbar_position (EggEditableToolbar *etoolbar, GtkWidget *toolbar)
{
- return get_dock_position (etoolbar, toolbar->parent);
+ return get_dock_position (etoolbar, gtk_widget_get_parent (toolbar));
}
static int
@@ -182,9 +182,9 @@ drag_data_delete_cb (GtkWidget *widget,
g_return_if_fail (widget != NULL);
g_return_if_fail (EGG_IS_EDITABLE_TOOLBAR (etoolbar));
- pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (widget->parent),
+ pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (gtk_widget_get_parent (widget)),
GTK_TOOL_ITEM (widget));
- toolbar_pos = get_toolbar_position (etoolbar, widget->parent);
+ toolbar_pos = get_toolbar_position (etoolbar, gtk_widget_get_parent (widget));
egg_toolbars_model_remove_item (etoolbar->priv->model,
toolbar_pos, pos);
@@ -273,10 +273,10 @@ drag_data_get_cb (GtkWidget *widget,
g_return_if_fail (name != NULL);
}
- data = egg_toolbars_model_get_data (model, selection_data->target, name);
+ data = egg_toolbars_model_get_data (model, gtk_selection_data_get_target (selection_data), name);
if (data != NULL)
{
- gtk_selection_data_set (selection_data, selection_data->target, 8, (unsigned char *)data, strlen (data));
+ gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8, (unsigned char *)data, strlen (data));
g_free (data);
}
}
@@ -310,8 +310,8 @@ remove_item_cb (GtkAction *action,
GtkWidget *toolitem = gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar), GTK_TYPE_TOOL_ITEM);
int pos, toolbar_pos;
- toolbar_pos = get_toolbar_position (etoolbar, toolitem->parent);
- pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolitem->parent),
+ toolbar_pos = get_toolbar_position (etoolbar, gtk_widget_get_parent (toolitem));
+ pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (gtk_widget_get_parent (toolitem)),
GTK_TOOL_ITEM (toolitem));
egg_toolbars_model_remove_item (etoolbar->priv->model,
@@ -420,7 +420,7 @@ configure_item_cursor (GtkToolItem *item,
EggEditableToolbarPrivate *priv = etoolbar->priv;
GtkWidget *widget = GTK_WIDGET (item);
- if (widget->window != NULL)
+ if (gtk_widget_get_window (widget) != NULL)
{
if (priv->edit_mode > 0)
{
@@ -432,7 +432,7 @@ configure_item_cursor (GtkToolItem *item,
cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen),
GDK_HAND2);
- gdk_window_set_cursor (widget->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
gdk_cursor_unref (cursor);
gtk_drag_source_set (widget, GDK_BUTTON1_MASK, dest_drag_types,
@@ -498,7 +498,7 @@ configure_item_cursor (GtkToolItem *item,
}
else
{
- gdk_window_set_cursor (GTK_WIDGET(item)->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(item)), NULL);
}
}
}
@@ -642,15 +642,15 @@ toolbar_drag_data_received_cb (GtkToolbar *toolbar,
* actually add a new item to the toolbar.
*/
- GdkAtom type = selection_data->type;
- const char *data = (char *)selection_data->data;
+ GdkAtom type = gtk_selection_data_get_data_type (selection_data);
+ const char *data = (char *)gtk_selection_data_get_data (selection_data);
int ipos = -1;
char *name = NULL;
gboolean used = FALSE;
/* Find out where the drop is occuring, and the name of what is being dropped. */
- if (selection_data->length >= 0)
+ if (gtk_selection_data_get_length (selection_data) >= 0)
{
ipos = gtk_toolbar_get_drop_index (toolbar, x, y);
name = egg_toolbars_model_get_name (etoolbar->priv->model, type, data, FALSE);
@@ -679,7 +679,7 @@ toolbar_drag_data_received_cb (GtkToolbar *toolbar,
etoolbar->priv->dnd_toolitem = NULL;
/* If we don't have a name to use yet, try to create one. */
- if (name == NULL && selection_data->length >= 0)
+ if (name == NULL && gtk_selection_data_get_length (selection_data) >= 0)
{
name = egg_toolbars_model_get_name (etoolbar->priv->model, type, data, TRUE);
}
@@ -872,7 +872,7 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar)
priv->visibility_id = gtk_ui_manager_new_merge_id (priv->manager);
- showing = GTK_WIDGET_VISIBLE (etoolbar);
+ showing = gtk_widget_get_visible (GTK_WIDGET (etoolbar));
n_toolbars = egg_toolbars_model_n_toolbars (priv->model);
for (i = 0; i < n_toolbars; i++)
@@ -954,7 +954,7 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar)
gtk_action_set_visible (GTK_ACTION (action), (egg_toolbars_model_get_flags (priv->model, i)
& EGG_TB_MODEL_NOT_REMOVABLE) == 0);
gtk_action_set_sensitive (GTK_ACTION (action), showing);
- gtk_toggle_action_set_active (action, GTK_WIDGET_VISIBLE
+ gtk_toggle_action_set_active (action, gtk_widget_get_visible
(get_dock_nth (etoolbar, i)));
for (list = priv->visibility_paths; list != NULL; list = g_list_next (list))
@@ -1078,7 +1078,7 @@ unparent_fixed (EggEditableToolbar *etoolbar)
toolbar = etoolbar->priv->fixed_toolbar;
dock = get_dock_nth (etoolbar, 0);
- if (dock && toolbar->parent != NULL)
+ if (dock && gtk_widget_get_parent (toolbar) != NULL)
{
gtk_container_remove (GTK_CONTAINER (dock), toolbar);
}
@@ -1093,7 +1093,7 @@ update_fixed (EggEditableToolbar *etoolbar)
toolbar = etoolbar->priv->fixed_toolbar;
dock = get_dock_nth (etoolbar, 0);
- if (dock && toolbar && toolbar->parent == NULL)
+ if (dock && toolbar && gtk_widget_get_parent (toolbar) == NULL)
{
gtk_box_pack_end (GTK_BOX (dock), toolbar, FALSE, TRUE, 0);
@@ -1733,18 +1733,20 @@ fake_expose_widget (GtkWidget *widget,
{
GdkWindow *tmp_window;
GdkEventExpose event;
+ GtkAllocation allocation;
event.type = GDK_EXPOSE;
event.window = pixmap;
event.send_event = FALSE;
- event.area = widget->allocation;
+ gtk_widget_get_allocation (widget, &allocation);
+ event.area = allocation;
event.region = NULL;
event.count = 0;
- tmp_window = widget->window;
- widget->window = pixmap;
+ tmp_window = gtk_widget_get_window (widget);
+ gtk_widget_set_window (widget, pixmap);
gtk_widget_send_expose (widget, (GdkEvent *) &event);
- widget->window = tmp_window;
+ gtk_widget_set_window (widget, tmp_window);
}
/* We should probably experiment some more with this.
@@ -1808,8 +1810,8 @@ new_pixbuf_from_widget (GtkWidget *widget)
/* Draw the window */
gtk_widget_ensure_style (window);
- g_assert (window->style);
- g_assert (window->style->font_desc);
+ g_assert (gtk_widget_get_style (window));
+ g_assert ((gtk_widget_get_style (window))->font_desc);
fake_expose_widget (window, pixmap);
fake_expose_widget (widget, pixmap);
diff --git a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c
index 1c375e5..7ee7f45 100644
--- a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c
+++ b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c
@@ -322,7 +322,7 @@ drag_data_get_cb (GtkWidget *widget,
target = g_object_get_data (G_OBJECT (widget), "egg-item-name");
g_return_if_fail (target != NULL);
- gtk_selection_data_set (selection_data, selection_data->target, 8,
+ gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8,
(const guchar *) target, strlen (target));
}
@@ -362,7 +362,7 @@ set_drag_cursor (GtkWidget *widget)
cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen),
GDK_HAND2);
- gdk_window_set_cursor (widget->window, cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
gdk_cursor_unref (cursor);
}
@@ -631,11 +631,11 @@ update_editor_sheet (EggToolbarEditor *editor)
g_ptr_array_free (items, TRUE);
/* Delete old table. */
- viewport = GTK_BIN (editor->priv->scrolled_window)->child;
+ viewport = gtk_bin_get_child (GTK_BIN (editor->priv->scrolled_window));
if (viewport)
{
gtk_container_remove (GTK_CONTAINER (viewport),
- GTK_BIN (viewport)->child);
+ gtk_bin_get_child (GTK_BIN (viewport)));
}
/* Add table to window. */
diff --git a/src/eog-window.c b/src/eog-window.c
index 9cf5091..3f7d8a5 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -1369,7 +1369,11 @@ eog_window_obtain_desired_size (EogImage *image,
img_width = width;
img_height = height;
+#if GTK_CHECK_VERSION (2, 20, 0)
+ if (!gtk_widget_get_realized (window->priv->view)) {
+#else
if (!GTK_WIDGET_REALIZED (window->priv->view)) {
+#endif
gtk_widget_realize (window->priv->view);
}
@@ -1377,7 +1381,11 @@ eog_window_obtain_desired_size (EogImage *image,
view_width = allocation.width;
view_height = allocation.height;
+#if GTK_CHECK_VERSION (2, 20, 0)
+ if (!gtk_widget_get_realized (GTK_WIDGET (window))) {
+#else
if (!GTK_WIDGET_REALIZED (GTK_WIDGET (window))) {
+#endif
gtk_widget_realize (GTK_WIDGET (window));
}
@@ -2763,7 +2771,11 @@ eog_window_cmd_show_hide_bar (GtkAction *action, gpointer user_data)
if (visible) {
/* Make sure the focus widget is realized to
* avoid warnings on keypress events */
+#if GTK_CHECK_VERSION (2, 20, 0)
+ if (!gtk_widget_get_realized (window->priv->thumbview))
+#else
if (!GTK_WIDGET_REALIZED (window->priv->thumbview))
+#endif
gtk_widget_realize (window->priv->thumbview);
gtk_widget_show (priv->nav);
@@ -2773,13 +2785,21 @@ eog_window_cmd_show_hide_bar (GtkAction *action, gpointer user_data)
* avoid warnings on keypress events.
* Don't do it during init phase or the view
* will get a bogus allocation. */
+#if GTK_CHECK_VERSION (2, 20, 0)
+ if (!gtk_widget_get_realized (priv->view)
+#else
if (!GTK_WIDGET_REALIZED (priv->view)
+#endif
&& priv->status == EOG_WINDOW_STATUS_NORMAL)
gtk_widget_realize (priv->view);
gtk_widget_hide (priv->nav);
+#if GTK_CHECK_VERSION (2, 20, 0)
+ if (gtk_widget_get_realized (priv->view))
+#else
if (GTK_WIDGET_REALIZED (priv->view))
+#endif
gtk_widget_grab_focus (priv->view);
}
gconf_client_set_bool (priv->client, EOG_CONF_UI_IMAGE_COLLECTION, visible, NULL);
@@ -4948,7 +4968,11 @@ eog_window_key_press (GtkWidget *widget, GdkEventKey *event)
/* If the focus is not in the toolbar and we still haven't handled the
event, give the scrollview a chance to do it. */
if (!gtk_container_get_focus_child (tbcontainer) && result == FALSE &&
+#if GTK_CHECK_VERSION (2, 20, 0)
+ gtk_widget_get_realized (GTK_WIDGET (EOG_WINDOW (widget)->priv->view))) {
+#else
GTK_WIDGET_REALIZED(GTK_WIDGET (EOG_WINDOW (widget)->priv->view))) {
+#endif
result = gtk_widget_event (GTK_WIDGET (EOG_WINDOW (widget)->priv->view),
(GdkEvent *) event);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]