Skip to content

Commit

Permalink
j
Browse files Browse the repository at this point in the history
  • Loading branch information
alainm23 committed Feb 10, 2022
1 parent 5a635cb commit bdb14ca
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ public class Planner : Gtk.Application {
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);


Gtk.Settings.get_default ().set_property ("gtk-icon-theme-name", "elementary");
Gtk.Settings.get_default ().set_property ("gtk-theme-name", "io.elementary.stylesheet.blueberry");
Util.get_default ().update_theme ();

if (clear_database) {
Expand Down
36 changes: 32 additions & 4 deletions src/Dialogs/QuickFind/QuickFind.vala
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public class Dialogs.QuickFind.QuickFind : Hdy.Window {
headerbar.custom_title = search_entry;

listbox = new Gtk.ListBox ();
listbox.hexpand = true;
// listbox.set_placeholder (placeholder_grid);
listbox.expand = true;
listbox.set_placeholder (get_placeholder ());
listbox.set_header_func (header_function);

unowned Gtk.StyleContext listbox_context = listbox.get_style_context ();
listbox_context.add_class ("listbox-background");
listbox_context.add_class ("picker-background");
listbox_context.add_class ("listbox-separator-3");

var listbox_grid = new Gtk.Grid () {
Expand All @@ -71,6 +71,10 @@ public class Dialogs.QuickFind.QuickFind : Hdy.Window {
};
listbox_grid.add (listbox);

unowned Gtk.StyleContext placeholder_grid_context = listbox_grid.get_style_context ();
placeholder_grid_context.add_class ("transition");
placeholder_grid_context.add_class ("picker-content");

var listbox_scrolled = new Gtk.ScrolledWindow (null, null) {
expand = true,
hscrollbar_policy = Gtk.PolicyType.NEVER
Expand Down Expand Up @@ -106,7 +110,7 @@ public class Dialogs.QuickFind.QuickFind : Hdy.Window {
});

focus_out_event.connect (() => {
hide_destroy ();
// hide_destroy ();
return false;
});

Expand Down Expand Up @@ -143,6 +147,30 @@ public class Dialogs.QuickFind.QuickFind : Hdy.Window {
});
}

private Gtk.Widget get_placeholder () {
var message_label = new Gtk.Label (_("Quickly switch projects and views, find tasks, search by labels.")) {
wrap = true,
justify = Gtk.Justification.CENTER,
expand = true,
margin = 6
};

unowned Gtk.StyleContext message_label_context = message_label.get_style_context ();
message_label_context.add_class ("dim-label");
message_label_context.add_class (Granite.STYLE_CLASS_SMALL_LABEL);

var placeholder_grid = new Gtk.Grid () {
margin = 6,
margin_top = 0,
expand = true
};

placeholder_grid.add (message_label);
placeholder_grid.show_all ();

return placeholder_grid;
}

private void row_activated (Gtk.ListBoxRow row) {
var base_object = ((Dialogs.QuickFind.QuickFindItem) row).base_object;

Expand Down
13 changes: 11 additions & 2 deletions src/Dialogs/QuickFind/QuickFindItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,17 @@ public class Dialogs.QuickFind.QuickFindItem : Gtk.ListBoxRow {
use_markup = true
};

main_grid.add (checked_button);
main_grid.add (content_label);
var project_label = new Gtk.Label (item.project.name) {
ellipsize = Pango.EllipsizeMode.END,
xalign = 0
};

project_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
project_label.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL);

main_grid.attach (checked_button, 0, 0, 1, 2);
main_grid.attach (content_label, 1, 0, 1, 1);
main_grid.attach (project_label, 1, 1, 1, 1);
}

add (main_grid);
Expand Down

0 comments on commit bdb14ca

Please sign in to comment.