Skip to content

Commit

Permalink
Some work on overview in HTL and VTL views.
Browse files Browse the repository at this point in the history
  • Loading branch information
cando committed May 13, 2012
1 parent b1bed3c commit 1bd83c1
Show file tree
Hide file tree
Showing 7 changed files with 521 additions and 93 deletions.
43 changes: 41 additions & 2 deletions data/gtk-style.css
Expand Up @@ -2,6 +2,14 @@
@define-color journal_timeline_color darker(@theme_bg_color); @define-color journal_timeline_color darker(@theme_bg_color);
@define-color journal_label_color shade (@theme_bg_color, 0.9); @define-color journal_label_color shade (@theme_bg_color, 0.9);


GtkDrawingArea {
background-color: alpha(#000, 0.0);
}

GtkNotebook{
background-color: alpha(#000, 0.0);
}

/* DAY VIEW STYLE */ /* DAY VIEW STYLE */
.dayview { .dayview {
background-color: @journal_label_color; background-color: @journal_label_color;
Expand Down Expand Up @@ -36,8 +44,34 @@
color: @journal_roundbox_bg_color; color: @journal_roundbox_bg_color;
} }


GtkDrawingArea { /*TIMELINE FILTER*/
background-color: alpha(#000, 0.0);
GtkScale.mark {
color: @theme_fg_color;
}

.vtimenav GtkButton {
background-color: @journal_label_color;
border-image: none;
background-image: none;
padding: 10px;
border-bottom-right-radius: 10px;
border-top-right-radius: 10px;
}

.htimenav GtkButton{
background-color: @journal_label_color;
border-image: none;
background-image: none;
padding: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}

@define-color journal_label_hover_color lighter (@journal_label_color);
.vtimenav GtkButton:hover,
.htimenav GtkButton:hover{
background-color: @journal_label_hover_color;
} }


/* OSD STYLE */ /* OSD STYLE */
Expand Down Expand Up @@ -112,3 +146,8 @@ GtkDrawingArea {
border-width: 0; border-width: 0;
} }


.frame {
color: lighter (@theme_fg_color);
border-style: none;
border-width: 0;
}
106 changes: 66 additions & 40 deletions src/app.vala
Expand Up @@ -2,7 +2,6 @@
using Gtk; using Gtk;


public class Journal.App: GLib.Object { public class Journal.App: GLib.Object {
public Clutter.Actor actor { get { return stage; } }
public Gtk.ApplicationWindow window; public Gtk.ApplicationWindow window;
public bool fullscreen { public bool fullscreen {
get { return Gdk.WindowState.FULLSCREEN in window.get_window ().get_state (); } get { return Gdk.WindowState.FULLSCREEN in window.get_window ().get_state (); }
Expand All @@ -15,22 +14,23 @@ public class Journal.App: GLib.Object {
} }
private bool maximized { get { return Gdk.WindowState.MAXIMIZED in window.get_window ().get_state (); } } private bool maximized { get { return Gdk.WindowState.MAXIMIZED in window.get_window ().get_state (); } }
public Gtk.Notebook notebook; public Gtk.Notebook notebook;
public Gtk.Box main_box; public Gtk.Box main_box;
public GtkClutter.Embed embed;
public Clutter.Stage stage;
public Clutter.Actor box; // the whole app box public Clutter.Actor box; // the whole app box
public GLib.SimpleAction action_fullscreen; public GLib.SimpleAction action_fullscreen;
public uint duration; public uint duration;


private Gtk.Application application; private Gtk.Application application;
private Clutter.BoxLayout box_table;
private LoadingActor loading_actor;
private DayView day_view; private DayView day_view;
private ClutterRoundBoxView crv; private ClutterVTL cvtl;
private GtkRoundBoxView grv; private ClutterHTL chtl;
private GtkVTL gvtl;
private ReminderView reminder_view; private ReminderView reminder_view;
private Revealer revealer; private Revealer revealer;
private Gd.MainToolbar main_toolbar; private Gd.MainToolbar main_toolbar;

//Loading actor
private LoadingActor loading;
private LoadingActor loading2;


private ZeitgeistBackend _backend; private ZeitgeistBackend _backend;


Expand Down Expand Up @@ -94,7 +94,6 @@ public class Journal.App: GLib.Object {
application.activate.connect_after ((app) => { application.activate.connect_after ((app) => {
window.present (); window.present ();
}); });

} }


public int run () { public int run () {
Expand All @@ -118,6 +117,7 @@ public class Journal.App: GLib.Object {
window = new Gtk.ApplicationWindow (application); window = new Gtk.ApplicationWindow (application);
window.show_menubar = false; window.show_menubar = false;
window.hide_titlebar_when_maximized = true; window.hide_titlebar_when_maximized = true;
window.set_default_size (840, 680);


// restore window geometry/position // restore window geometry/position
var size = Utils.settings.get_value ("window-size"); var size = Utils.settings.get_value ("window-size");
Expand Down Expand Up @@ -159,14 +159,14 @@ public class Journal.App: GLib.Object {
if (mode) { if (mode) {
this.main_toolbar.set_mode (Gd.MainToolbarMode.SELECTION); this.main_toolbar.set_mode (Gd.MainToolbarMode.SELECTION);
main_toolbar.set_labels (null, _("(Click on items to select them)")); main_toolbar.set_labels (null, _("(Click on items to select them)"));
//revealer.reveal (); revealer.reveal ();
} }
else { else {
main_toolbar.set_mode (Gd.MainToolbarMode.OVERVIEW); main_toolbar.set_mode (Gd.MainToolbarMode.OVERVIEW);
int num_days = 3; int num_days = 3;
string label = _(@"Last $num_days days"); string label = _(@"Last $num_days days");
main_toolbar.set_labels (_("Timeline"), label); main_toolbar.set_labels (_("Timeline"), label);
//revealer.unreveal (); revealer.unreveal ();
} }
}); });
notebook = new Gtk.Notebook (); notebook = new Gtk.Notebook ();
Expand All @@ -176,47 +176,73 @@ public class Journal.App: GLib.Object {
main_box.pack_start (main_toolbar, false, false, 0); main_box.pack_start (main_toolbar, false, false, 0);
main_box.pack_start (notebook, true, true, 0); main_box.pack_start (notebook, true, true, 0);


window.delete_event.connect (() => { return quit (); });
window.key_press_event.connect (on_key_pressed);

//CLUTTER VTL
var embed = new GtkClutter.Embed ();
var stage = embed.get_stage () as Clutter.Stage;
stage.set_color (Utils.gdk_rgba_to_clutter_color (Utils.get_journal_bg_color ()));
cvtl = new ClutterVTL (this, stage);
TimeNav vnav = new TimeNav (Orientation.VERTICAL);
vnav.go_to_date.connect ((date) => {cvtl.jump_to_day(date);});

stage.add_actor (cvtl.viewport);
var box = new Box (Orientation.HORIZONTAL, 0);
box.pack_start (vnav, false, false, 0);
box.pack_start (embed, true, true, 0);
notebook.append_page (box, null);

loading = new LoadingActor (this, stage);
loading.start ();
//CLUTTER HTL
var embed2 = new GtkClutter.Embed ();
var stage2 = embed2.get_stage () as Clutter.Stage;
stage2.set_color (Utils.gdk_rgba_to_clutter_color (Utils.get_journal_bg_color ()));
chtl = new ClutterHTL (this, stage2);
TimeNav hnav = new TimeNav (Orientation.HORIZONTAL);
hnav.go_to_date.connect ((date) => {chtl.jump_to_day(date);});

stage2.add_actor (chtl.viewport);
var box2 = new Grid ();
box2.orientation = Orientation.VERTICAL;
box2.add (embed2);
box2.add (hnav);
notebook.append_page (box2, null);

loading2 = new LoadingActor (this, stage2);
loading2.start ();
//GTK VTL FIXME doesn't work!
gvtl = new GtkVTL (this);
ScrolledWindow sw = new ScrolledWindow (null, null);
sw.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
sw.add_with_viewport (gvtl);
//notebook.append_page (sw, null);

//THREE COLUMN VIEW
//FIXME Make the num of days displayed a preferences?? //FIXME Make the num of days displayed a preferences??
int num_days = 3; int num_days = 3;
day_view = new DayView (this, num_days); day_view = new DayView (this, num_days);


// revealer = new Revealer (); string label = _(@"Last $num_days days");
// reminder_view = new ReminderView (this); main_toolbar.set_labels (_("Timeline"), label);
// reminder_view.set_hexpand (false);
// revealer.add (reminder_view); revealer = new Revealer ();
reminder_view = new ReminderView (this);
reminder_view.set_hexpand (false);
revealer.add (reminder_view);


var grid = new Grid (); var grid = new Grid ();
grid.set_orientation (Orientation.HORIZONTAL); grid.set_orientation (Orientation.HORIZONTAL);
grid.add (day_view); grid.add (day_view);
//grid.add (revealer); grid.add (revealer);
notebook.append_page (grid, null); notebook.append_page (grid, null);


string label = _(@"Last $num_days days"); window.show_all();
main_toolbar.set_labels (_("Timeline"), label);

embed = new GtkClutter.Embed ();
notebook.append_page (embed, null);
stage = embed.get_stage () as Clutter.Stage;
stage.set_color (Utils.gdk_rgba_to_clutter_color (Utils.get_journal_bg_color ()));

window.delete_event.connect (() => { return quit (); });
window.key_press_event.connect (on_key_pressed);


crv = new ClutterRoundBoxView (this);
grv = new GtkRoundBoxView (this);
ScrolledWindow sw = new ScrolledWindow (null, null);
sw.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
sw.add_with_viewport (grv);
notebook.append_page (sw, null);

loading_actor = new LoadingActor(this);
loading_actor.start ();


main_box.show_all ();


// revealer.set_no_show_all (true); revealer.set_no_show_all (true);
// revealer.hide (); revealer.hide ();
} }


public bool quit () { public bool quit () {
Expand Down
18 changes: 10 additions & 8 deletions src/loading.vala
Expand Up @@ -3,28 +3,30 @@ using Cairo;


private class Journal.LoadingActor: GLib.Object { private class Journal.LoadingActor: GLib.Object {
private App app; private App app;
private Clutter.Stage stage;
private GtkClutter.Actor gtk_actor_box; private GtkClutter.Actor gtk_actor_box;
private GtkClutter.Actor gtk_actor_throbber; private GtkClutter.Actor gtk_actor_throbber;
private Box box; private Box box;
private Spinner throbber; private Spinner throbber;


public LoadingActor (App app) { public LoadingActor (App app, Clutter.Stage stage) {
this.app = app; this.app = app;
this.stage = stage;


box = new Box(Orientation.VERTICAL, 0); box = new Box(Orientation.VERTICAL, 0);
throbber = new Spinner (); throbber = new Spinner ();
throbber.set_size_request((int)app.stage.height/3, (int)app.stage.height/3); throbber.set_size_request((int)stage.height/3, (int)stage.height/3);


gtk_actor_box = new GtkClutter.Actor.with_contents (box); gtk_actor_box = new GtkClutter.Actor.with_contents (box);
gtk_actor_box.opacity = 235; gtk_actor_box.opacity = 200;
gtk_actor_throbber = new GtkClutter.Actor.with_contents (throbber); gtk_actor_throbber = new GtkClutter.Actor.with_contents (throbber);
gtk_actor_throbber.get_widget ().get_style_context ().add_class ("throbber"); gtk_actor_throbber.get_widget ().get_style_context ().add_class ("throbber");


gtk_actor_throbber.add_constraint (new Clutter.AlignConstraint (app.stage, Clutter.AlignAxis.X_AXIS, 0.5f)); gtk_actor_throbber.add_constraint (new Clutter.AlignConstraint (stage, Clutter.AlignAxis.X_AXIS, 0.5f));
gtk_actor_throbber.add_constraint (new Clutter.AlignConstraint (app.stage, Clutter.AlignAxis.Y_AXIS, 0.5f)); gtk_actor_throbber.add_constraint (new Clutter.AlignConstraint (stage, Clutter.AlignAxis.Y_AXIS, 0.5f));
gtk_actor_box.add_constraint (new Clutter.BindConstraint (app.stage, Clutter.BindCoordinate.SIZE, 0)); gtk_actor_box.add_constraint (new Clutter.BindConstraint (stage, Clutter.BindCoordinate.SIZE, 0));
app.stage.add_actor (gtk_actor_box); stage.add_actor (gtk_actor_box);
app.stage.add_actor (gtk_actor_throbber); stage.add_actor (gtk_actor_throbber);


app.backend.events_loaded.connect ( () => { app.backend.events_loaded.connect ( () => {
stop (); stop ();
Expand Down
6 changes: 4 additions & 2 deletions src/selectionbar.vala
Expand Up @@ -7,15 +7,17 @@ private class Journal.Selectionbar: GLib.Object {
public static const float spacing = 60.0f; public static const float spacing = 60.0f;


private App app; private App app;
private Clutter.Stage stage;
private GtkClutter.Actor gtk_actor; private GtkClutter.Actor gtk_actor;
private Gtk.Toolbar toolbar; private Gtk.Toolbar toolbar;
private Gtk.ToggleToolButton favorite_btn; private Gtk.ToggleToolButton favorite_btn;
private Gtk.ToggleToolButton remove_btn; private Gtk.ToggleToolButton remove_btn;


private bool _visible; private bool _visible;


public Selectionbar (App app) { public Selectionbar (App app, Clutter.Stage stage) {
this.app = app; this.app = app;
this.stage = stage;


_visible = false; _visible = false;


Expand Down Expand Up @@ -46,7 +48,7 @@ private class Journal.Selectionbar: GLib.Object {
toggle_visible (); toggle_visible ();
}); });


app.stage.add_actor (actor); stage.add_actor (actor);
} }


public void toggle_visible () { public void toggle_visible () {
Expand Down

0 comments on commit 1bd83c1

Please sign in to comment.