Remove conditional compilation for GTK+ 3.12.

This commit is contained in:
Michael James Gratton 2016-04-10 00:44:15 +10:00 committed by Michael Gratton
parent b3946f2133
commit b7cf0ec663
5 changed files with 5 additions and 62 deletions

View file

@ -65,8 +65,6 @@ pkg_check_modules(WEBKITGTK22X QUIET webkitgtk-3.0>=2.2.0 webkitgtk-3.0<=2.2.100
pkg_check_modules(WEBKITGTK20X QUIET webkitgtk-3.0>=2.0.0 webkitgtk-3.0<=2.0.100)
pkg_check_modules(WEBKITGTK110X QUIET webkitgtk-3.0>=1.10.0 webkitgtk-3.0<=1.10.2)
pkg_check_modules(GTK312X QUIET gtk+-3.0>=3.12.0)
pkg_check_modules(SQLITE311 QUIET sqlite3>=3.11.0)
pkg_check_modules(SQLITE312 QUIET sqlite3>=3.12.0)
if (SQLITE311_FOUND AND NOT SQLITE312_FOUND)

View file

@ -518,15 +518,6 @@ else ()
message(FATAL_ERROR "WebKitGTK not installed / unknown version detected")
endif ()
if (GTK312X_FOUND)
message(STATUS "GTK+ 3.12 support: ON")
set(EXTRA_VALA_OPTIONS
${EXTRA_VALA_OPTIONS}
-D GTK_3_12
)
endif ()
if (NO_FATAL_WARNINGS)
message(STATUS "Vala fatal warnings: OFF")
else ()

View file

@ -87,15 +87,9 @@ public class MainToolbar : Gtk.Box {
insert.add(search_button);
Gtk.Box search = folder_header.create_pill_buttons(insert, false);
#if !GTK_3_12
folder_header.add_end(empty);
folder_header.add_end(search);
folder_header.add_end(new Gtk.Separator(Gtk.Orientation.VERTICAL));
#else
folder_header.add_end(new Gtk.Separator(Gtk.Orientation.VERTICAL));
folder_header.add_end(search);
folder_header.add_end(empty);
#endif
// Reply buttons
insert.clear();
@ -127,25 +121,14 @@ public class MainToolbar : Gtk.Box {
false));
Gtk.Box undo = conversation_header.create_pill_buttons(insert);
// pack_end() ordering is reversed in GtkHeaderBar in 3.12 and above
#if !GTK_3_12
conversation_header.add_end(archive_trash_delete);
conversation_header.add_end(undo);
#else
conversation_header.add_end(undo);
conversation_header.add_end(archive_trash_delete);
#endif
pack_start(folder_header, false, false);
pack_start(conversation_header, true, true);
#if GTK_3_12
Gtk.Settings.get_default().notify["gtk-decoration-layout"].connect(set_window_buttons);
realize.connect(set_window_buttons);
#else
get_style_context().changed.connect(set_close_buttons_side);
realize.connect(set_close_buttons_side);
#endif
}
/// Updates the trash button as trash or delete, and shows or hides the archive button.
@ -164,9 +147,7 @@ public class MainToolbar : Gtk.Box {
guest_header_binding = bind_property("show-close-button-right", header,
"show-close-button", BindingFlags.SYNC_CREATE);
pack_start(header, true, true);
#if GTK_3_12
header.decoration_layout = conversation_header.decoration_layout;
#endif
}
public void remove_conversation_header(Gtk.HeaderBar header) {
@ -175,13 +156,10 @@ public class MainToolbar : Gtk.Box {
header.get_style_context().remove_class("geary-titlebar-right");
GtkUtil.unbind(guest_header_binding);
header.show_close_button = false;
#if GTK_3_12
header.decoration_layout = Gtk.Settings.get_default().gtk_decoration_layout;
#endif
conversation_header.show();
}
#if GTK_3_12
private void set_window_buttons() {
string[] buttons = Gtk.Settings.get_default().gtk_decoration_layout.split(":");
if (buttons.length != 2) {
@ -193,12 +171,5 @@ public class MainToolbar : Gtk.Box {
folder_header.decoration_layout = buttons[0] + ":";
conversation_header.decoration_layout = ":" + buttons[1];
}
#else
private void set_close_buttons_side() {
bool at_end = folder_header.close_button_at_end();
show_close_button_left = show_close_button && !at_end;
show_close_button_right = show_close_button && at_end;
}
#endif
}
}

View file

@ -133,11 +133,7 @@ public class PillHeaderbar : Gtk.HeaderBar, PillBar {
public bool close_button_at_end() {
string layout;
bool at_end = false;
#if GTK_3_12
layout = Gtk.Settings.get_default().gtk_decoration_layout;
#else
get_toplevel().style_get("decoration-button-layout", out layout);
#endif
// Based on logic of close_button_at_end in gtkheaderbar.c: Close button appears
// at end iff "close" follows a colon in the layout string.
if (layout != null) {

View file

@ -83,29 +83,16 @@ public class ComposerHeaderbar : PillHeaderbar {
add_start(detach_start);
add_start(attach_buttons);
add_start(recipients);
#if !GTK_3_12
add_end(send_button);
add_end(close_buttons);
add_end(detach_end);
#else
add_end(detach_end);
add_end(close_buttons);
add_end(send_button);
#endif
#if GTK_3_12
add_end(detach_end);
add_end(close_buttons);
add_end(send_button);
notify["decoration-layout"].connect(set_detach_button_side);
#else
get_style_context().changed.connect(set_detach_button_side);
#endif
realize.connect(set_detach_button_side);
notify["state"].connect((s, p) => {
if (state == ComposerWidget.ComposerState.DETACHED) {
#if GTK_3_12
notify["decoration-layout"].disconnect(set_detach_button_side);
#else
get_style_context().changed.disconnect(set_detach_button_side);
#endif
detach_start.visible = detach_end.visible = false;
}
});