Skip to content

Commit

Permalink
dropped support for gtk < 2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Aug 18, 2012
1 parent 8788844 commit 1ff687c
Show file tree
Hide file tree
Showing 32 changed files with 10 additions and 512 deletions.
4 changes: 0 additions & 4 deletions src/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,7 @@ void bar_write_config(GtkWidget *bar, GString *outstr, gint indent)
if (!bd) return;

WRITE_NL(); WRITE_STRING("<bar ");
#if GTK_CHECK_VERSION(2,20,0)
write_bool_option(outstr, indent, "enabled", gtk_widget_get_visible(bar));
#else
write_bool_option(outstr, indent, "enabled", GTK_WIDGET_VISIBLE(bar));
#endif
write_uint_option(outstr, indent, "width", bd->width);
WRITE_STRING(">");

Expand Down
4 changes: 0 additions & 4 deletions src/bar_comment.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,7 @@ static gint bar_pane_comment_event(GtkWidget *bar, GdkEvent *event)
pcd = g_object_get_data(G_OBJECT(bar), "pane_data");
if (!pcd) return FALSE;

#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_has_focus(pcd->comment_view)) return gtk_widget_event(pcd->comment_view, event);
#else
if (GTK_WIDGET_HAS_FOCUS(pcd->comment_view)) return gtk_widget_event(pcd->comment_view, event);
#endif

return FALSE;
}
Expand Down
8 changes: 0 additions & 8 deletions src/bar_exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,7 @@ gint bar_pane_exif_event(GtkWidget *bar, GdkEvent *event)
ExifEntry *ee = g_object_get_data(G_OBJECT(entry), "entry_data");
work = work->next;

#if GTK_CHECK_VERSION(2,20,0)
if (ee->editable && gtk_widget_has_focus(ee->value_widget)) ret = gtk_widget_event(ee->value_widget, event);
#else
if (ee->editable && GTK_WIDGET_HAS_FOCUS(ee->value_widget)) ret = gtk_widget_event(ee->value_widget, event);
#endif
}
g_list_free(list);
return ret;
Expand Down Expand Up @@ -403,11 +399,7 @@ static void bar_pane_exif_dnd_receive(GtkWidget *pane, GdkDragContext *context,

gtk_widget_get_allocation(entry, &allocation);

#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_is_drawable(entry) &&
#else
if (GTK_WIDGET_DRAWABLE(entry) &&
#endif
gtk_widget_translate_coordinates(pane, entry, x, y, &nx, &ny) &&
ny < allocation.height / 2) break;
pos++;
Expand Down
4 changes: 0 additions & 4 deletions src/bar_histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ static void bar_pane_histogram_update(PaneHistogramData *phd)
/* histmap_get is relatively expensive, run it only when we really need it
and with lower priority than pixbuf_renderer
FIXME: this does not work for fullscreen*/
#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_is_drawable(phd->drawing_area))
#else
if (GTK_WIDGET_DRAWABLE(phd->drawing_area))
#endif
{
if (!phd->idle_id)
{
Expand Down
4 changes: 0 additions & 4 deletions src/bar_keywords.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,7 @@ gint bar_pane_keywords_event(GtkWidget *bar, GdkEvent *event)
pkd = g_object_get_data(G_OBJECT(bar), "pane_data");
if (!pkd) return FALSE;

#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_has_focus(pkd->keyword_view)) return gtk_widget_event(pkd->keyword_view, event);
#else
if (GTK_WIDGET_HAS_FOCUS(pkd->keyword_view)) return gtk_widget_event(pkd->keyword_view, event);
#endif

return FALSE;
}
Expand Down
4 changes: 0 additions & 4 deletions src/bar_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,7 @@ void bar_sort_write_config(GtkWidget *bar, GString *outstr, gint indent)
if (!sd) return;

WRITE_NL(); WRITE_STRING("<bar_sort ");
#if GTK_CHECK_VERSION(2,20,0)
write_bool_option(outstr, indent, "enabled", gtk_widget_get_visible(bar));
#else
write_bool_option(outstr, indent, "enabled", GTK_WIDGET_VISIBLE(bar));
#endif
WRITE_INT(*sd, mode);
WRITE_INT(*sd, action);
WRITE_INT(*sd, selection);
Expand Down
20 changes: 0 additions & 20 deletions src/cache_maint.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,7 @@ static void cache_maintain_home_close_cb(GenericDialog *gd, gpointer data)
{
CMData *cm = data;

#if GTK_CHECK_VERSION(2,20,0)
if (!gtk_widget_get_sensitive(cm->button_close)) return;
#else
if (!GTK_WIDGET_SENSITIVE(cm->button_close)) return;
#endif

cache_maintain_home_close(cm);
}
Expand Down Expand Up @@ -712,11 +708,7 @@ static void cache_manager_render_close_cb(GenericDialog *fd, gpointer data)
{
CleanData *cd = data;

#if GTK_CHECK_VERSION(2,20,0)
if (!gtk_widget_get_sensitive(cd->button_close)) return;
#else
if (!GTK_WIDGET_SENSITIVE(cd->button_close)) return;
#endif

cache_manager_render_reset(cd);
generic_dialog_close(cd->gd);
Expand Down Expand Up @@ -831,11 +823,7 @@ static void cache_manager_render_start_cb(GenericDialog *fd, gpointer data)
CleanData *cd = data;
gchar *path;

#if GTK_CHECK_VERSION(2,20,0)
if (cd->list || !gtk_widget_get_sensitive(cd->button_start)) return;
#else
if (cd->list || !GTK_WIDGET_SENSITIVE(cd->button_start)) return;
#endif

path = remove_trailing_slash((gtk_entry_get_text(GTK_ENTRY(cd->entry))));
parse_out_relatives(path);
Expand Down Expand Up @@ -932,11 +920,7 @@ static void cache_manager_standard_clean_close_cb(GenericDialog *gd, gpointer da
{
CleanData *cd = data;

#if GTK_CHECK_VERSION(2,20,0)
if (!gtk_widget_get_sensitive(cd->button_close)) return;
#else
if (!GTK_WIDGET_SENSITIVE(cd->button_close)) return;
#endif

generic_dialog_close(cd->gd);

Expand Down Expand Up @@ -1049,11 +1033,7 @@ static void cache_manager_standard_clean_start_cb(GenericDialog *gd, gpointer da
gchar *path;
FileData *dir_fd;

#if GTK_CHECK_VERSION(2,20,0)
if (cd->list || !gtk_widget_get_sensitive(cd->button_start)) return;
#else
if (cd->list || !GTK_WIDGET_SENSITIVE(cd->button_start)) return;
#endif

gtk_widget_set_sensitive(cd->button_start, FALSE);
gtk_widget_set_sensitive(cd->button_stop, TRUE);
Expand Down
12 changes: 0 additions & 12 deletions src/cellrenderericon.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,22 +678,14 @@ gqv_cell_renderer_icon_render(GtkCellRenderer *cell,

if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
{
#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_has_focus(widget))
#else
if (GTK_WIDGET_HAS_FOCUS(widget))
#endif
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_ACTIVE;
}
else
{
#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_get_state(widget) == GTK_STATE_INSENSITIVE)
#else
if (GTK_WIDGET_STATE(widget) == GTK_STATE_INSENSITIVE)
#endif
state = GTK_STATE_INSENSITIVE;
else
state = GTK_STATE_NORMAL;
Expand Down Expand Up @@ -836,11 +828,7 @@ gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
}
}

#if GTK_CHECK_VERSION(2,20,0)
if (cellicon->focused && gtk_widget_has_focus(widget))
#else
if (cellicon->focused && GTK_WIDGET_HAS_FOCUS(widget))
#endif
{
#if GTK_CHECK_VERSION(3,0,0)
#else
Expand Down
16 changes: 0 additions & 16 deletions src/collect-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,7 @@ static void tip_show(CollectTable *ct)

gdk_window_get_pointer(NULL, &x, &y, NULL);

#if GTK_CHECK_VERSION(2,20,0)
if (!gtk_widget_get_realized(ct->tip_window)) gtk_widget_realize(ct->tip_window);
#else
if (!GTK_WIDGET_REALIZED(ct->tip_window)) gtk_widget_realize(ct->tip_window);
#endif
gtk_window_move(GTK_WINDOW(ct->tip_window), x + 16, y + 16);
gtk_widget_show(ct->tip_window);
}
Expand Down Expand Up @@ -1574,11 +1570,7 @@ static gboolean collection_table_press_cb(GtkWidget *widget, GdkEventButton *bev
layout_image_set_collection(NULL, ct->cd, info);
}
}
#if GTK_CHECK_VERSION(2,20,0)
else if (!gtk_widget_has_focus(ct->listview))
#else
else if (!GTK_WIDGET_HAS_FOCUS(ct->listview))
#endif
{
gtk_widget_grab_focus(ct->listview);
}
Expand Down Expand Up @@ -1729,11 +1721,7 @@ 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 All @@ -1744,11 +1732,7 @@ static void collection_table_populate(CollectTable *ct, gboolean resize)
"show_text", ct->show_text, NULL);
}
}
#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_get_realized(ct->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(ct->listview));
#else
if (GTK_WIDGET_REALIZED(ct->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(ct->listview));
#endif
}

row = -1;
Expand Down
43 changes: 0 additions & 43 deletions src/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,6 @@
#include "main.h"
#include "compat.h"

/* gtk_radio_action_set_current_value() replacement for GTK+ < 2.10 */
void radio_action_set_current_value(GtkRadioAction *action, gint current_value)
{
#if GTK_CHECK_VERSION(2, 10, 0)
gtk_radio_action_set_current_value(action, current_value);
#else
GSList *group;
gint value;

group = gtk_radio_action_get_group(action);
while (group)
{
action = GTK_RADIO_ACTION(group->data);
g_object_get(G_OBJECT(action), "value", &value, NULL);
if (value == current_value)
{
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
return;
}
group = g_slist_next(group);
}
#endif
}

#if !GLIB_CHECK_VERSION(2, 14, 0)
static void hash_table_add(gpointer key, gpointer value, gpointer user_data)
{
GList **list = user_data;
*list = g_list_prepend(*list, key);
}
#endif

GList* hash_table_get_keys(GHashTable *hash_table)
{
#if GLIB_CHECK_VERSION(2, 14, 0)
return g_hash_table_get_keys(hash_table);
#else
GList *list = NULL;
g_hash_table_foreach(hash_table, hash_table_add, &list);
return list;
#endif
}

#if !GTK_CHECK_VERSION(2,24,0)
gint compat_gdk_window_get_width(GdkWindow *window)
{
Expand Down
7 changes: 0 additions & 7 deletions src/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
#ifndef COMPAT_H
#define COMPAT_H

void radio_action_set_current_value(GtkRadioAction *action, gint current_value);
GList* hash_table_get_keys(GHashTable *hash_table);

#if !GTK_CHECK_VERSION(2,12,0)
#define gtk_widget_set_tooltip_text(widget, text) /* ignored */
#endif


/* Some systems (BSD,MacOsX,HP-UX,...) define MAP_ANON and not MAP_ANONYMOUS */
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
Expand Down
12 changes: 0 additions & 12 deletions src/dupe.c
Original file line number Diff line number Diff line change
Expand Up @@ -2216,11 +2216,7 @@ static GList *dupe_window_get_fd_list(DupeWindow *dw)
{
GList *list;

#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_has_focus(dw->second_listview))
#else
if (GTK_WIDGET_HAS_FOCUS(dw->second_listview))
#endif
{
list = dupe_listview_get_selection(dw, dw->second_listview);
}
Expand Down Expand Up @@ -2773,11 +2769,7 @@ 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 Expand Up @@ -2864,11 +2856,7 @@ static gboolean dupe_window_keypress_cb(GtkWidget *widget, GdkEventKey *event, g
GList *slist;
DupeItem *di = NULL;

#if GTK_CHECK_VERSION(2,20,0)
on_second = gtk_widget_has_focus(dw->second_listview);
#else
on_second = GTK_WIDGET_HAS_FOCUS(dw->second_listview);
#endif

if (on_second)
{
Expand Down
24 changes: 0 additions & 24 deletions src/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -1796,19 +1796,11 @@ void image_set_frame(ImageWindow *imd, gboolean frame)
if (frame)
{
imd->frame = gtk_frame_new(NULL);
#if GTK_CHECK_VERSION(2,12,0)
g_object_ref(imd->pr);
#else
gtk_widget_ref(imd->pr);
#endif
if (imd->has_frame != -1) gtk_container_remove(GTK_CONTAINER(imd->widget), imd->pr);
gtk_container_add(GTK_CONTAINER(imd->frame), imd->pr);

#if GTK_CHECK_VERSION(2,12,0)
g_object_unref(imd->pr);
#else
gtk_widget_unref(imd->pr);
#endif
gtk_widget_set_can_focus(imd->frame, TRUE);
gtk_widget_set_app_paintable(imd->frame, TRUE);

Expand All @@ -1822,37 +1814,21 @@ void image_set_frame(ImageWindow *imd, gboolean frame)
g_signal_connect(G_OBJECT(imd->frame), "focus_in_event",
G_CALLBACK(image_focus_in_cb), imd);

#if GTK_CHECK_VERSION(2,14,0)
gtk_box_pack_start(GTK_BOX(imd->widget), imd->frame, TRUE, TRUE, 0);
#else
gtk_box_pack_start_defaults(GTK_BOX(imd->widget), imd->frame);
#endif
gtk_widget_show(imd->frame);
}
else
{
#if GTK_CHECK_VERSION(2,12,0)
g_object_ref(imd->pr);
#else
gtk_widget_ref(imd->pr);
#endif
if (imd->frame)
{
gtk_container_remove(GTK_CONTAINER(imd->frame), imd->pr);
gtk_widget_destroy(imd->frame);
imd->frame = NULL;
}
#if GTK_CHECK_VERSION(2,14,0)
gtk_box_pack_start(GTK_BOX(imd->widget), imd->pr, TRUE, TRUE, 0);
#else
gtk_box_pack_start_defaults(GTK_BOX(imd->widget), imd->pr);
#endif

#if GTK_CHECK_VERSION(2,12,0)
g_object_unref(imd->pr);
#else
gtk_widget_unref(imd->pr);
#endif
}

gtk_widget_show(imd->pr);
Expand Down
Loading

0 comments on commit 1ff687c

Please sign in to comment.