Commit 96010977 authored by Dylan McCall's avatar Dylan McCall

Remove libgd. We don't need it anymore!

Bump GTK version requirement.

Fix misaligned close button in settings dialog. Note that this also (as an unfortunate side-effect) disables the lovely arrow pointing to the close button in the welcome tour.
parent 587fd60c
[submodule "libgd"]
path = libgd
url = git://git.gnome.org/libgd
SUBDIRS = \
data \
po \
libgd \
common \
settings \
helper \
tests
ACLOCAL_AMFLAGS = -I m4 -I libgd
ACLOCAL_AMFLAGS = -I m4
INTLTOOL_FILES = intltool-extract.in \
intltool-merge.in \
......
......@@ -28,8 +28,8 @@ AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
GLIB_REQUIRED=2.36.0
GTK_REQUIRED=3.8.0
GTK_RECOMMENDED=3.9.4
GTK_REQUIRED=3.10.0
GTK_RECOMMENDED=3.10.0
PKG_CHECK_MODULES([CFG_CORE], [
glib-2.0 >= $GLIB_REQUIRED
......@@ -68,8 +68,6 @@ PKG_CHECK_MODULES(
)]
)
LIBGD_INIT([header-bar stack revealer vapi])
# Some helpful constants that are available to the application
......@@ -89,7 +87,6 @@ AC_CONFIG_FILES([Makefile
helper/util/Makefile
data/Makefile
data/icons/Makefile
libgd/Makefile
po/Makefile.in
tests/Makefile
])
......
libgd @ 7f080984
Subproject commit 7f080984bf6a92212def9fb8aa0f6c0f9979b57e
......@@ -15,17 +15,11 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
#if HAS_GTK_3_10
using Gtk;
#else
using Gd;
#endif
public class MainWindow : Gtk.ApplicationWindow {
private BreakManager break_manager;
private WindowHeaderBar header;
private Stack main_stack; // Gtk.Stack or Gd.Stack
private Gtk.HeaderBar header;
private Gtk.Stack main_stack;
private Gtk.Button settings_button;
private Gtk.Switch master_switch;
......@@ -38,7 +32,7 @@ public class MainWindow : Gtk.ApplicationWindow {
public MainWindow (SettingsApplication application, BreakManager break_manager) {
Object (application: application);
this.break_manager = break_manager;
this.set_title ( _("Break Timer"));
Gtk.Builder builder = new Gtk.Builder ();
......@@ -57,14 +51,9 @@ public class MainWindow : Gtk.ApplicationWindow {
content.set_orientation (Gtk.Orientation.VERTICAL);
content.set_vexpand (true);
this.header = new WindowHeaderBar (this);
#if HAS_GTK_3_10
this.header = new Gtk.HeaderBar ();
this.set_titlebar (this.header);
this.header.set_is_titlebar (true);
#else
content.add (this.header);
this.set_hide_titlebar_when_maximized (true);
#endif
this.header.set_show_close_button (true);
this.header.set_hexpand (true);
this.master_switch = new Gtk.Switch ();
......@@ -83,16 +72,17 @@ public class MainWindow : Gtk.ApplicationWindow {
settings_button.valign = Gtk.Align.CENTER;
settings_button.set_always_show_image (true);
this.main_stack = new Stack ();
this.main_stack = new Gtk.Stack ();
content.add (this.main_stack);
main_stack.set_margin_top (6);
main_stack.set_margin_bottom (6);
main_stack.set_transition_duration (250);
this.status_panel = new StatusPanel (break_manager, builder);
this.main_stack.add (this.status_panel);
this.main_stack.add_named (this.status_panel, "status_panel");
this.welcome_panel = new WelcomePanel (break_manager, builder, this);
this.main_stack.add (this.welcome_panel);
this.main_stack.add_named (this.welcome_panel, "welcome_panel");
this.welcome_panel.tour_finished.connect (this.on_tour_finished);
this.header.show_all ();
......@@ -112,12 +102,13 @@ public class MainWindow : Gtk.ApplicationWindow {
}
public Gtk.Widget? get_close_button () {
return this.header.get_visible_close_button ();
// TODO: We need some way to get the close button position from this.header
return null;
}
private void break_added_cb (BreakType break_type) {
var info_panel = break_type.info_panel;
this.main_stack.add (info_panel);
this.main_stack.add_named (info_panel, break_type.id);
info_panel.set_margin_left (20);
info_panel.set_margin_right (20);
info_panel.set_halign (Gtk.Align.CENTER);
......@@ -126,24 +117,23 @@ public class MainWindow : Gtk.ApplicationWindow {
private void update_visible_panel () {
// Use a transition when switching from the welcome panel
// TODO: Once we switch to GtkStack, use set_visible_child_full
Gtk.StackTransitionType transition;
if (this.main_stack.get_visible_child () == this.welcome_panel) {
main_stack.set_transition_type (StackTransitionType.SLIDE_LEFT);
main_stack.set_transition_duration (250);
transition = Gtk.StackTransitionType.SLIDE_LEFT;
} else {
main_stack.set_transition_type (StackTransitionType.NONE);
transition = Gtk.StackTransitionType.NONE;
}
BreakType? foreground_break = this.break_manager.foreground_break;
if (this.welcome_panel.is_active ()) {
this.main_stack.set_visible_child (this.welcome_panel);
this.main_stack.set_visible_child_full ("welcome_panel", transition);
this.header.set_title ( _("Welcome Tour"));
} else if (foreground_break != null) {
this.main_stack.set_visible_child (foreground_break.info_panel);
this.main_stack.set_visible_child_full (foreground_break.id, transition);
this.header.set_title (foreground_break.info_panel.title);
} else {
this.main_stack.set_visible_child (this.status_panel);
this.header.set_title (null);
this.main_stack.set_visible_child_full ("status_panel", transition);
this.header.set_title ( _("Break Timer"));
}
}
......@@ -176,7 +166,7 @@ public class MainWindow : Gtk.ApplicationWindow {
/* TODO: It would be nice to move some of this code to a UI file built with
* Glade. Especially anything involving long strings. */
private class WelcomePanel : Stack {
private class WelcomePanel : Gtk.Stack {
private BreakManager break_manager;
private MainWindow main_window;
......@@ -202,7 +192,7 @@ private class WelcomePanel : Stack {
this.current_step = Step.WELCOME;
}
this.set_transition_type (StackTransitionType.SLIDE_LEFT);
this.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT);
this.set_transition_duration (250);
this.start_page = this.build_page_with_arrow (
......@@ -290,7 +280,7 @@ private class WelcomePanel : Stack {
}
}
private class StatusPanel : Stack {
private class StatusPanel : Gtk.Stack {
private BreakManager break_manager;
private Gtk.Grid breaks_list;
......@@ -364,4 +354,4 @@ private class StatusPanel : Stack {
this.set_visible_child (this.error_message);
}
}
}
\ No newline at end of file
}
/*
* This file is part of GNOME Break Timer.
*
* GNOME Break Timer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNOME Break Timer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
#if HAS_GTK_3_10
using Gtk;
#else
using Gd;
#endif
/**
* A Gtk.HeaderBar that expects to be set as the titlebar for a Gtk.Window.
* If it is in titlebar mode, it adds a conventional close button and adjusts
* its own titles accordingly.
*/
public class WindowHeaderBar : HeaderBar { // Gtk.HeaderBar or Gd.HeaderBar
private weak Gtk.Window owner_window;
private Gtk.Button close_button;
private Gtk.Separator close_separator;
private bool is_titlebar;
public WindowHeaderBar (Gtk.Window window) {
this.owner_window = window;
this.close_separator = new Gtk.Separator (Gtk.Orientation.VERTICAL);
this.close_separator.valign = Gtk.Align.FILL;
this.close_button = new Gtk.Button ();
this.close_button.set_image (
new Gtk.Image.from_icon_name ("window-close-symbolic", Gtk.IconSize.MENU)
);
this.close_button.get_style_context ().add_class ("titlebutton");
this.close_button.relief = Gtk.ReliefStyle.NONE;
this.close_button.valign = Gtk.Align.CENTER;
this.close_button.clicked.connect (this.on_close_button_clicked_cb);
this.realize.connect ( () => {
this.pack_end (this.close_separator);
this.pack_end (this.close_button);
});
}
public new void set_title (string? title) {
if (this.is_titlebar && title == null) {
title = this.owner_window.title;
}
base.set_title (title);
}
public void set_is_titlebar (bool is_titlebar) {
this.is_titlebar = is_titlebar;
this.close_separator.set_visible (is_titlebar);
this.close_button.set_visible (is_titlebar);
this.set_title (this.title);
}
private void on_close_button_clicked_cb () {
var event = new Gdk.Event (Gdk.EventType.DESTROY);
event.any.window = this.owner_window.get_window ();
event.any.send_event = 1;
Gtk.main_do_event (event);
}
public Gtk.Widget? get_visible_close_button () {
return this.is_titlebar ? this.close_button : null;
}
}
\ No newline at end of file
......@@ -12,7 +12,6 @@ SETTINGS_SOURCES = \
SettingsApplication.vala \
TimeChooser.vala \
TimerBreakType.vala \
WindowHeaderBar.vala \
$(SETTINGS_BUILT_SOURCES)
SETTINGS_VALAFLAGS = \
......@@ -22,13 +21,11 @@ SETTINGS_VALAFLAGS = \
--pkg gio-unix-2.0 \
--pkg gee-1.0 \
--pkg config \
--pkg common \
--pkg gd-1.0
--pkg common
SETTINGS_CFLAGS = $(CFG_CORE_CFLAGS)
SETTINGS_LIBS = $(CFG_CORE_LIBS) \
$(top_builddir)/libgd/libgd.la \
$(top_builddir)/common/libcommon.la
SETTINGS_DEPENDENCIES = \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment