Use gtkcompat.h to slim down a few ifdefs.

Now that I've got a general place to centralise handling of at least
the simple differences between GTK 1 and 2, I should use it wherever
possible. So this commit removes just a small number of ifdefs which
are either obsoleted by definitions already in gtkcompat.h (like
set_size_request vs set_usize), or can easily be replaced by adding
another (e.g. gtk_color_selection_set_has_opacity_control).
This commit is contained in:
Simon Tatham 2015-08-09 09:59:25 +01:00
Родитель 5fa22495c7
Коммит 78592116a5
4 изменённых файлов: 5 добавлений и 14 удалений

Просмотреть файл

@ -40,6 +40,8 @@
#define gtk_widget_set_size_request gtk_widget_set_usize
#define gtk_radio_button_get_group gtk_radio_button_group
#define gtk_notebook_set_current_page gtk_notebook_set_page
#define gtk_color_selection_set_has_opacity_control \
gtk_color_selection_set_opacity
#define gtk_dialog_get_content_area(dlg) ((dlg)->vbox)
#define gtk_dialog_get_action_area(dlg) ((dlg)->action_area)

Просмотреть файл

@ -1143,11 +1143,7 @@ void dlg_coloursel_start(union control *ctrl, void *dlg, int r, int g, int b)
dp->coloursel_result.ok = FALSE;
gtk_window_set_modal(GTK_WINDOW(coloursel), TRUE);
#if GTK_CHECK_VERSION(2,0,0)
gtk_color_selection_set_has_opacity_control(cs, FALSE);
#else
gtk_color_selection_set_opacity(cs, FALSE);
#endif
#if GTK_CHECK_VERSION(2,0,0)
{

Просмотреть файл

@ -2562,11 +2562,9 @@ unifontsel *unifontsel_new(const char *wintitle)
gtk_label_set_text(GTK_LABEL(label), "48000");
gtk_widget_size_request(label, &req);
size_width = req.width;
#if GTK_CHECK_VERSION(2,10,0)
g_object_ref_sink(label);
g_object_unref(label);
#else
g_object_ref_sink(G_OBJECT(label));
#if GTK_CHECK_VERSION(2,10,0)
g_object_unref(label);
#endif
}

Просмотреть файл

@ -1639,11 +1639,7 @@ void request_resize(void *frontend, int w, int h)
large_x += 32;
large_y += 32;
#if GTK_CHECK_VERSION(2,0,0)
gtk_widget_set_size_request(inst->area, large_x, large_y);
#else
gtk_widget_set_usize(inst->area, large_x, large_y);
#endif
gtk_widget_size_request(inst->area, &inner);
gtk_widget_size_request(inst->window, &outer);
@ -1659,12 +1655,11 @@ void request_resize(void *frontend, int w, int h)
* way to do this, I think, is to set it to what the size is
* really going to end up being.
*/
#if GTK_CHECK_VERSION(2,0,0)
gtk_widget_set_size_request(inst->area, area_x, area_y);
#if GTK_CHECK_VERSION(2,0,0)
gtk_window_resize(GTK_WINDOW(inst->window),
area_x + offset_x, area_y + offset_y);
#else
gtk_widget_set_usize(inst->area, area_x, area_y);
gtk_drawing_area_size(GTK_DRAWING_AREA(inst->area), area_x, area_y);
/*
* I can no longer remember what this call to