Skip to content

Commit

Permalink
Add compatibility for GTK 2.18
Browse files Browse the repository at this point in the history
With 2.18 some functions are deprecated. With geeqie that are two at the
moment.
- gtk_tree_view_column_get_cell_renderers - which can be replaced by
  gtk_cell_layout_get_cells
- gdk_event_get_graphics_expose - I just commented it as there seems to
  be no replacement in GTK 2.18
  • Loading branch information
mowgli committed Oct 13, 2009
1 parent 84b602a commit 3bd2b7d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/collect-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,11 @@ static void collection_table_populate(CollectTable *ct, gboolean resize)
gtk_tree_view_column_set_visible(column, (i < ct->columns));
gtk_tree_view_column_set_fixed_width(column, thumb_width + (THUMB_BORDER_PADDING * 6));

#if GTK_CHECK_VERSION(2,18,0)
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
#else
list = gtk_tree_view_column_get_cell_renderers(column);
#endif
cell = (list) ? list->data : NULL;
g_list_free(list);

Expand Down
4 changes: 4 additions & 0 deletions src/dupe.c
Original file line number Diff line number Diff line change
Expand Up @@ -2769,7 +2769,11 @@ static void dupe_listview_set_height(GtkWidget *listview, gboolean thumb)

gtk_tree_view_column_set_fixed_width(column, (thumb) ? options->thumbnails.max_width : 4);

#if GTK_CHECK_VERSION(2,18,0)
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
#else
list = gtk_tree_view_column_get_cell_renderers(column);
#endif
if (!list) return;
cell = list->data;
g_list_free(list);
Expand Down
2 changes: 2 additions & 0 deletions src/pixbuf-renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3682,6 +3682,7 @@ void pixbuf_renderer_scroll(PixbufRenderer *pr, gint x, gint y)
}

/* process exposures here, "expose_event" seems to miss a few with obstructed windows */
#if ! GTK_CHECK_VERSION(2,18,0)
while ((event = gdk_event_get_graphics_expose(box->window)) != NULL)
{
pixbuf_renderer_paint(pr, &event->expose.area);
Expand All @@ -3693,6 +3694,7 @@ void pixbuf_renderer_scroll(PixbufRenderer *pr, gint x, gint y)
}
gdk_event_free(event);
}
#endif
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,11 @@ static void search_result_thumb_height(SearchData *sd)

gtk_tree_view_column_set_fixed_width(column, (sd->thumb_enable) ? options->thumbnails.max_width : 4);

#if GTK_CHECK_VERSION(2,18,0)
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
#else
list = gtk_tree_view_column_get_cell_renderers(column);
#endif
if (!list) return;
cell = list->data;
g_list_free(list);
Expand Down
8 changes: 8 additions & 0 deletions src/ui_tree_edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ gboolean tree_edit_by_path(GtkTreeView *tree, GtkTreePath *tpath, gint column, c
tcolumn = gtk_tree_view_get_column(tree, column);
if (!tcolumn) return FALSE;

#if GTK_CHECK_VERSION(2,18,0)
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(tcolumn));
#else
list = gtk_tree_view_column_get_cell_renderers(tcolumn);
#endif
work = list;
while (work && !cell)
{
Expand Down Expand Up @@ -289,7 +293,11 @@ gboolean tree_view_get_cell_origin(GtkTreeView *widget, GtkTreePath *tpath, gint
gint cell_x;
gint cell_width;

#if GTK_CHECK_VERSION(2,18,0)
renderers = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(tv_column));
#else
renderers = gtk_tree_view_column_get_cell_renderers(tv_column);
#endif
work = renderers;
while (work && !cell)
{
Expand Down
4 changes: 4 additions & 0 deletions src/view_file_icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,11 @@ static void vficon_populate(ViewFile *vf, gboolean resize, gboolean keep_positio
gtk_tree_view_column_set_visible(column, (i < VFICON(vf)->columns));
gtk_tree_view_column_set_fixed_width(column, thumb_width + (THUMB_BORDER_PADDING * 6));

#if GTK_CHECK_VERSION(2,18,0)
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
#else
list = gtk_tree_view_column_get_cell_renderers(column);
#endif
cell = (list) ? list->data : NULL;
g_list_free(list);

Expand Down
4 changes: 4 additions & 0 deletions src/view_file_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,11 @@ static void vflist_listview_set_columns(GtkWidget *listview, gboolean thumb, gbo

gtk_tree_view_column_set_fixed_width(column, options->thumbnails.max_width + 4);

#if GTK_CHECK_VERSION(2,18,0)
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
#else
list = gtk_tree_view_column_get_cell_renderers(column);
#endif
if (!list) return;
cell = list->data;
g_list_free(list);
Expand Down

0 comments on commit 3bd2b7d

Please sign in to comment.