Hello community,

here is the log from the commit of package yishu for openSUSE:Factory checked 
in at 2018-12-04 20:56:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yishu (Old)
 and      /work/SRC/openSUSE:Factory/.yishu.new.19453 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yishu"

Tue Dec  4 20:56:38 2018 rev:5 rq:653675 version:1.1.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/yishu/yishu.changes      2018-09-25 
15:43:47.153203133 +0200
+++ /work/SRC/openSUSE:Factory/.yishu.new.19453/yishu.changes   2018-12-04 
20:56:46.500689835 +0100
@@ -1,0 +2,11 @@
+Sun Nov 25 20:38:55 UTC 2018 - Alexei Podvalsky <avvi...@yandex.by>
+
+- Update to 1.1.2:
+  * Fixing startup
+  * Remove confliting search
+  * Functioning search!
+  * Trying to do search
+  * Start the new version up
+- Add yishu-1.1.2-vala-0.42.patch
+
+-------------------------------------------------------------------

Old:
----
  yishu-1.0.9.tar.gz

New:
----
  yishu-1.1.2-vala-0.42.patch
  yishu-1.1.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yishu.spec ++++++
--- /var/tmp/diff_new_pack.8HAYO7/_old  2018-12-04 20:56:47.016689266 +0100
+++ /var/tmp/diff_new_pack.8HAYO7/_new  2018-12-04 20:56:47.016689266 +0100
@@ -17,13 +17,15 @@
 
 
 Name:           yishu
-Version:        1.0.9
+Version:        1.1.2
 Release:        0
 Summary:        A bespoke and simple Todo.txt client
 License:        GPL-3.0-or-later
 Group:          Productivity/Office/Organizers
 URL:            https://github.com/lainsce
 Source:         
https://github.com/lainsce/yishu/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM -- Build with vala >= 0.42
+Patch0:         yishu-1.1.2-vala-0.42.patch
 BuildRequires:  fdupes
 BuildRequires:  hicolor-icon-theme
 BuildRequires:  libxml2-tools
@@ -43,6 +45,7 @@
 
 %prep
 %setup -q
+%patch0 -p2
 
 %build
 %meson

++++++ yishu-1.1.2-vala-0.42.patch ++++++
diff -ruN yishu-1.1.2.orig/yishu-1.1.2/src/MainWindow.vala 
yishu-1.1.2/yishu-1.1.2/src/MainWindow.vala
--- yishu-1.1.2.orig/yishu-1.1.2/src/MainWindow.vala    2018-10-22 
19:13:43.000000000 +0300
+++ yishu-1.1.2/yishu-1.1.2/src/MainWindow.vala 2018-11-25 23:52:34.162974427 
+0300
@@ -173,7 +173,11 @@
             return false;
         }
 
-               protected bool match_keycode (int keyval, uint code) {
+#if VALA_0_42
+        protected bool match_keycode (uint keyval, uint code) {
+#else
+        protected bool match_keycode (int keyval, uint code) {
+#endif
             Gdk.KeymapKey [] keys;
             Gdk.Keymap keymap = Gdk.Keymap.get_for_display 
(Gdk.Display.get_default ());
             if (keymap.get_entries_for_keyval (keyval, out keys)) {
++++++ yishu-1.0.9.tar.gz -> yishu-1.1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yishu-1.0.9/data/com.github.lainsce.yishu.appdata.xml 
new/yishu-1.1.2/data/com.github.lainsce.yishu.appdata.xml
--- old/yishu-1.0.9/data/com.github.lainsce.yishu.appdata.xml   2018-08-02 
17:14:56.000000000 +0200
+++ new/yishu-1.1.2/data/com.github.lainsce.yishu.appdata.xml   2018-10-22 
18:13:43.000000000 +0200
@@ -53,6 +53,15 @@
         </screenshot>
     </screenshots>
     <releases>
+        <release version="1.0.8" date="2018-10-26">
+            <description>
+                <p>Release: Search &amp; Blues</p>
+                <ul>
+                    <li>NEW: Search your tasks.</li>
+                    <li>FIX: Task folder is properly saved now.</li>
+                </ul>
+            </description>
+        </release>
       <release version="1.0.7" date="2018-07-13">
           <description>
               <p>Release: Juno Offering</p>
Binary files old/yishu-1.0.9/data/shot.png and new/yishu-1.1.2/data/shot.png 
differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yishu-1.0.9/data/stylesheet.css 
new/yishu-1.1.2/data/stylesheet.css
--- old/yishu-1.0.9/data/stylesheet.css 2018-08-02 17:14:56.000000000 +0200
+++ new/yishu-1.1.2/data/stylesheet.css 2018-10-22 18:13:43.000000000 +0200
@@ -1,2 +1,21 @@
 @define-color colorPrimary #ACE580;
 @define-color textColorPrimary #333333;
+
+treeview header button,
+column-header .button {
+   background-image:
+        linear-gradient(
+           to bottom,
+           shade (
+               @bg_color,
+               1.1
+           ),
+           @bg_color
+        );
+   padding: 4px 2px;
+}
+
+treeview header button:last-child,
+column-header:last-child .button {
+    border-right-width: 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yishu-1.0.9/meson.build new/yishu-1.1.2/meson.build
--- old/yishu-1.0.9/meson.build 2018-08-02 17:14:56.000000000 +0200
+++ new/yishu-1.1.2/meson.build 2018-10-22 18:13:43.000000000 +0200
@@ -1,6 +1,6 @@
 # Name our project
 project('com.github.lainsce.yishu', ['vala', 'c'],
-    version: '1.0.7'
+    version: '1.0.8'
 )
 
 # Import main lib files
@@ -46,6 +46,7 @@
     'src/Task.vala',
     'src/TaskDialog.vala',
     'src/TodoFile.vala',
+    'src/SearchEntry.vala',
     'src/MainWindow.vala',
     'src/Preferences.vala',
     'src/Constants/AppSettings.vala',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yishu-1.0.9/src/Application.vala 
new/yishu-1.1.2/src/Application.vala
--- old/yishu-1.0.9/src/Application.vala        2018-08-02 17:14:56.000000000 
+0200
+++ new/yishu-1.1.2/src/Application.vala        2018-10-22 18:13:43.000000000 
+0200
@@ -28,7 +28,7 @@
                DONE,
                LINE_NR
        }
-       
+
        public class Application : Gtk.Application {
                private TodoFile todo_file;
                private MainWindow window;
@@ -36,19 +36,20 @@
                private Gtk.ListStore tasks_list_store;
                private TreeModelFilter tasks_model_filter;
                private TreeModelSort tasks_model_sort;
-               
+        public SearchTasks search_entry;
+
                private Task trashed_task;
                public string current_filename = null;
-               
+
                construct {
                        application_id = "com.github.lainsce.yishu";
                        trashed_task = null;
                }
-               
+
                public Application () {
                        ApplicationFlags flags = ApplicationFlags.HANDLES_OPEN;
                        set_flags(flags);
-                       
+
                        var settings = AppSettings.get_default ();
                        if (settings.todo_txt_file_path == null) {
                                read_file(null);
@@ -57,17 +58,21 @@
                                        read_file(settings.todo_txt_file_path);
                                });
                        }
-                       
+
                        if (!settings.show_completed) {
                                toggle_show_completed ();
                        }
                }
-               
+
                public override void activate(){
                        window = new MainWindow(this);
+            var settings = AppSettings.get_default ();
                        tasks_list_store = new Gtk.ListStore (6, typeof 
(string), typeof(string), typeof(GLib.Object), typeof(bool), typeof(bool), 
typeof(int));
                        setup_model();
                        window.tree_view.set_model(tasks_model_sort);
+            search_entry = new SearchTasks (window.tree_view, 
tasks_model_sort);
+            search_entry.placeholder_text = "Search task";
+            window.toolbar.set_custom_title(search_entry);
                        setup_menus();
                        window.add_button.clicked.connect(add_task);
                        window.tree_view.button_press_event.connect( (tv, 
event) => {
@@ -81,12 +86,7 @@
                                        if 
(window.tree_view.get_path_at_pos((int)event.x, (int)event.y, out path, out 
column, out cell_x, out cell_y)){
                                                
tasks_model_sort.get_iter_from_string(out iter,path.to_string());
                                                tasks_model_sort.get(iter, 
Columns.TASK_OBJECT, out task, -1);
-                                               
-                                               if (Gtk.get_minor_version() < 
20) {
-                                                       popup_menu.popup(null, 
null, null, event.button, event.time);
-                                               } else {
-                                                       // 
popup_menu.popup_at_pointer(event);
-                                               }
+                                               
popup_menu.popup_at_pointer(event);
                                        }
                                }
                                return false;
@@ -114,24 +114,36 @@
                                todo_file.write_file();
                                toggle_show_completed();
                        });
-                       if (read_file(null)) {
+
+            string homedir = GLib.Environment.get_home_dir ();
+            string home = homedir + "/todo.txt";
+            settings.todo_txt_file_path = home;
+
+            if (read_file(null)) {
                                window.welcome.hide();
                                window.tree_view.show();
                        } else {
                                window.welcome.show();
                                window.tree_view.hide();
                        }
+
+            settings.changed.connect (() => {
+                       if (read_file(settings.todo_txt_file_path)) {
+                               window.welcome.hide();
+                               window.tree_view.show();
+                       } else if (settings.todo_txt_file_path == "" && 
read_file(null)) {
+                               window.welcome.show();
+                               window.tree_view.hide();
+                       }
+            });
                        tasks_model_filter.refilter();
-                       var settings = AppSettings.get_default ();
-                       string DS = "%c".printf(GLib.Path.DIR_SEPARATOR);
-                       settings.todo_txt_file_path = 
Environment.get_home_dir() + DS + "todo.txt";
                }
-               
+
                private void toggle_show_completed(){
                        tasks_model_filter.refilter();
                        update_global_tags();
                }
-               
+
                private void setup_menus () {
                        popup_menu = new Gtk.Menu();
                        var accel_group_popup = new Gtk.AccelGroup();
@@ -140,12 +152,12 @@
                        var edit_task_menu_item = new 
Gtk.MenuItem.with_label(_("Edit task"));
                        var delete_task_menu_item = new 
Gtk.MenuItem.with_label(_("Delete task"));
                        var toggle_done_menu_item = new 
Gtk.MenuItem.with_label(_("Toggle done"));
-                       
+
                        var priority_menu = new Gtk.Menu();
-                       
+
                        var priority_menu_item = new 
Gtk.MenuItem.with_label(_("Priority"));
                        priority_menu_item.set_submenu(priority_menu);
-                       
+
                        var priority_none_menu_item = new 
Gtk.MenuItem.with_label(_("None"));
                        priority_menu.append(priority_none_menu_item);
                        priority_none_menu_item.add_accelerator("activate", 
accel_group_popup, Gdk.Key.BackSpace, Gdk.ModifierType.CONTROL_MASK, 
Gtk.AccelFlags.VISIBLE);
@@ -156,12 +168,12 @@
                                        update_todo_file_after_task_edited 
(task);
                                }
                        });
-                       
+
                        for (char prio = 'A'; prio <= 'F'; prio++){
                                var priority_x_menu_item = new 
Gtk.MenuItem.with_label("%c".printf(prio));
                                
priority_x_menu_item.add_accelerator("activate", accel_group_popup, Gdk.Key.A + 
(prio - 'A'), Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE);
                                priority_x_menu_item.activate.connect( 
(menu_item) => {
-                                       
+
                                        Task task = get_selected_task();
                                        if (task != null){
                                                task.priority = 
menu_item.get_label ();
@@ -170,22 +182,22 @@
                                });
                                priority_menu.append(priority_x_menu_item);
                        }
-                       
+
                        edit_task_menu_item.add_accelerator("activate", 
accel_group_popup, Gdk.Key.F2, 0, Gtk.AccelFlags.VISIBLE);
                        delete_task_menu_item.add_accelerator("activate", 
accel_group_popup, Gdk.Key.Delete, 0, Gtk.AccelFlags.VISIBLE);
                        toggle_done_menu_item.add_accelerator("activate", 
accel_group_popup, Gdk.Key.space, 0, Gtk.AccelFlags.VISIBLE);
                        edit_task_menu_item.activate.connect(edit_task);
                        delete_task_menu_item.activate.connect(delete_task);
                        toggle_done_menu_item.activate.connect(toggle_done);
-                       
+
                        popup_menu.append(toggle_done_menu_item);
                        popup_menu.append(priority_menu_item);
                        popup_menu.append(edit_task_menu_item);
                        popup_menu.append(delete_task_menu_item);
-                       
+
                        popup_menu.show_all();
                }
-               
+
                private void update_todo_file_after_task_edited (Task task){
                        if (task != null){
                                tasks_model_filter.refilter ();
@@ -194,11 +206,11 @@
                                todo_file.write_file();
                        }
                }
-               
+
                private void reset(){
                        tasks_list_store.clear();
                }
-               
+
                private void setup_model(){
                        tasks_model_filter = new 
TreeModelFilter(tasks_list_store, null);
                        tasks_model_sort = new 
Gtk.TreeModelSort.with_model(tasks_model_filter);
@@ -207,7 +219,7 @@
                                string prio_b;
                                model.get(iter_a, Columns.PRIORITY, out prio_a, 
-1);
                                model.get(iter_b, Columns.PRIORITY, out prio_b, 
-1);
-                               
+
                                if (prio_a == "" && prio_b != ""){
                                        return 1;
                                }
@@ -218,24 +230,24 @@
                        });
                        tasks_model_sort.set_sort_column_id(Columns.PRIORITY, 
Gtk.SortType.ASCENDING);
                }
-               
+
                private void update_global_tags(){
                        var settings = AppSettings.get_default ();
                        bool show_completed = settings.show_completed;
-                       
+
                        tasks_list_store.foreach( (model, path, iter) => {
                                Task task;
                                model.get(iter, Columns.TASK_OBJECT, out task, 
-1);
-                               
+
                                if (!show_completed && task.done){
                                        return false;
                                }
-                               
+
                                return false;
-                               
+
                        });
                }
-               
+
                private Task get_selected_task(){
                        TreeIter iter;
                        TreeModel model;
@@ -246,27 +258,27 @@
                        }
                        return task;
                }
-               
+
                private TaskDialog add_edit_dialog () {
                        var dialog = new TaskDialog(window);
-                       
+
                        return dialog;
                }
-               
+
                private void toggle_done () {
                        Task task = get_selected_task ();
                        if (task != null) {
-                               
+
                                task.done = !task.done;
                                task.to_model(tasks_list_store, task.iter);
                                tasks_model_filter.refilter();
                                todo_file.lines[task.linenr - 1] = 
task.to_string();
                                todo_file.write_file();
-                               
+
                                update_global_tags();
                        }
                }
-               
+
                private void edit_task () {
                        TreeIter iter;
                        TreeModel model;
@@ -276,13 +288,13 @@
                                return;
                        }
                        model.get(iter, Columns.TASK_OBJECT, out task, -1);
-                       
+
                        if (task != null){
-                               
+
                                var dialog = add_edit_dialog();
-                               
+
                                dialog.entry.set_text(task.to_string());
-                               
+
                                dialog.show_all();
                                int response = dialog.run();
                                switch (response){
@@ -298,54 +310,40 @@
                                }
                                update_global_tags();
                                dialog.destroy();
-                               
+
                                sel.select_iter(iter);
                        }
                }
-               
+
                private void add_task (){
                        var dialog = add_edit_dialog();
                        dialog.show_all ();
-                       
+
                        var settings = AppSettings.get_default ();
-                       string DS = "%c".printf(GLib.Path.DIR_SEPARATOR);
-                       
-                       if (settings.todo_txt_file_path == 
Environment.get_home_dir() + DS + "todo.txt") {
-                               settings.todo_txt_file_path = 
Environment.get_home_dir() + DS + "todo.txt";
-                       } else if (settings.todo_txt_file_path == 
Environment.get_home_dir() + DS + "Dropbox" + DS + "todo.txt") {
-                               settings.todo_txt_file_path = 
Environment.get_home_dir() + DS + "Dropbox" + DS + "todo.txt";
-                       } else if (settings.todo_txt_file_path == 
Environment.get_home_dir() + DS + "Nextcloud" + DS + "Todo" + DS + "todo.txt") {
-                               settings.todo_txt_file_path = 
Environment.get_home_dir() + DS + "Nextcloud" + DS + "todo.txt";
-                       } else if (settings.todo_txt_file_path == 
Environment.get_home_dir() + DS + "ownCloud" + DS + "Todo" + DS + "todo.txt") {
-                               settings.todo_txt_file_path = 
Environment.get_home_dir() + DS + "ownCloud" + DS + "Todo" + DS + "todo.txt";
-                       } else if (settings.todo_txt_file_path == 
Environment.get_home_dir() + DS + "bin" + DS + "todo.txt" + DS + "todo.txt") {
-                               settings.todo_txt_file_path = 
Environment.get_home_dir() + DS + "bin" + DS + "todo.txt" + DS + "todo.txt";
-                       } else {
-                               settings.todo_txt_file_path = 
Environment.get_home_dir() + DS + "todo.txt";
-                       }
-                       
+                       string file_path_txt = settings.todo_txt_file_path;
+
                        int response = dialog.run ();
                        switch (response){
                                case Gtk.ResponseType.ACCEPT:
-                               
+
                                string str = dialog.entry.get_text();
                                Task task = new Task();
-                               
+
                                if (task.parse_from_string(str)){
                                        Date d = Date();
                                        var output = new char[100];
                                        d.set_time_t(time_t(null));
                                        d.strftime(output, "%Y-%m-%d");
                                        task.date = (string)output;
-                                       
-                                       read_file (settings.todo_txt_file_path);
+
+                                       read_file (file_path_txt);
                                        todo_file.lines.add(task.to_string());
-                                       
+
                                        TreeIter iter, fiter, siter;
-                                       
+
                                        tasks_list_store.append(out iter);
                                        task.to_model(tasks_list_store, iter);
-                                       
+
                                        if (todo_file.write_file()){
                                                task.linenr = todo_file.n_lines;
                                                task.to_model(tasks_list_store, 
iter);
@@ -353,25 +351,25 @@
                                        else {
                                                warning ("Failed to write 
file");
                                        }
-                                       
+
                                        update_global_tags();
-                                       
+
                                        
tasks_model_filter.convert_child_iter_to_iter(out fiter, iter);
                                        
tasks_model_sort.convert_child_iter_to_iter(out siter, fiter);
-                                       
+
                                        
window.tree_view.get_selection().select_iter(siter);
                                }
-                               
+
                                window.welcome.hide();
                                window.tree_view.show();
-                               
+
                                break;
                                default:
                                break;
                        }
                        dialog.destroy();
                }
-               
+
                private void delete_task () {
                        Task task = get_selected_task ();
                        if (task != null) {
@@ -384,43 +382,45 @@
                var infobar_label = new Gtk.Label ("The task has been deleted");
                                infobar.get_content_area ().add (infobar_label);
                                infobar.add_button("_Undo", 
Gtk.ResponseType.ACCEPT);
-               infobar.show_close_button = false;
+               infobar.show_close_button = true;
                infobar.message_type = Gtk.MessageType.INFO;
                                infobar.show_all();
-                               
+
                                window.info_bar_box.foreach( (child) => {
                                        child.destroy();
                                });
-                               
+
                                window.info_bar_box.pack_start(infobar, true, 
true, 0);
-                               infobar.response.connect( () => {
-                                       undelete();
+                               infobar.response.connect( (response) => {
+                    if (response == Gtk.ResponseType.ACCEPT) {
+                        undelete();
+                    }
                                        infobar.destroy();
                                });
-                               
+
                                update_global_tags();
                        }
                }
-               
+
                private void undelete () {
                        if (trashed_task != null){
                                debug ("Restoring task: " + trashed_task.text + 
" at line nr. " + "%u".printf(trashed_task.linenr));
-                               
+
                                todo_file.lines.insert(trashed_task.linenr - 1, 
trashed_task.to_string());
                                todo_file.write_file();
                                TreeIter iter;
                                tasks_list_store.append(out iter);
                                trashed_task.to_model(tasks_list_store, iter);
                                tasks_model_filter.refilter();
-                               
+
                                trashed_task = null;
                        }
                }
-               
+
                public bool read_file (string? filename) {
                        reset();
                        var settings = AppSettings.get_default ();
-                       
+
                        if (filename != null){
                                todo_file = new TodoFile(filename);
                        }
@@ -431,15 +431,15 @@
                                        todo_file = test_file;
                                }
                        }
-                       
+
                        if (todo_file == null){
                                return false;
                        }
-                       
+
                        this.current_filename = filename;
-                       
+
                        todo_file.monitor.changed.connect( (file, other_file, 
event) => {
-                               
+
                                if (event == 
FileMonitorEvent.CHANGES_DONE_HINT){
                                        var info_bar = new 
Gtk.InfoBar.with_buttons("_OK", Gtk.ResponseType.ACCEPT);
                                        
info_bar.set_message_type(Gtk.MessageType.WARNING);
@@ -456,7 +456,7 @@
                                        read_file(null);
                                }
                        });
-                       
+
                        int n = todo_file.read_file();
                        for (int i = 0; i < n; i++){
                                var task = new Task();
@@ -470,7 +470,7 @@
                        update_global_tags();
                        return true;
                }
-               
+
                public static int main(string[] args){
                        var app = new Yishu.Application();
                        return app.run(args);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yishu-1.0.9/src/MainWindow.vala 
new/yishu-1.1.2/src/MainWindow.vala
--- old/yishu-1.0.9/src/MainWindow.vala 2018-08-02 17:14:56.000000000 +0200
+++ new/yishu-1.1.2/src/MainWindow.vala 2018-10-22 18:13:43.000000000 +0200
@@ -28,16 +28,16 @@
                public Granite.Widgets.Welcome no_file;
                public Gtk.TreeView tree_view;
                public Gtk.CellRendererToggle cell_renderer_toggle;
-        
+
                public const string ACTION_PREFIX = "win.";
                public const string ACTION_PREFS = "action_prefs";
                public SimpleActionGroup actions { get; construct; }
         public static Gee.MultiMap<string, string> action_accelerators = new 
Gee.HashMultiMap<string, string> ();
-        
+
         private const GLib.ActionEntry[] action_entries = {
             { ACTION_PREFS,              action_prefs     }
         };
-        
+
         public MainWindow (Gtk.Application application) {
             GLib.Object (application: application,
             icon_name: "com.github.lainsce.yishu",
@@ -45,7 +45,7 @@
             width_request: 600,
             title: N_("Yishu"));
         }
-        
+
         construct {
             key_press_event.connect ((e) => {
                 uint keycode = e.hardware_keycode;
@@ -60,19 +60,19 @@
             var provider = new Gtk.CssProvider ();
             provider.load_from_resource 
("/com/github/lainsce/yishu/stylesheet.css");
             Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default 
(), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-            
+
                        actions = new SimpleActionGroup ();
             actions.add_action_entries (action_entries, this);
             insert_action_group ("win", actions);
-            
+
             var settings = AppSettings.get_default ();
             int x = settings.window_x;
                        int y = settings.window_y;
-            
+
             if (x != -1 && y != -1) {
                 move (x, y);
             }
-            
+
             if (Gtk.get_minor_version() < 20) {
                 set_default_size (settings.saved_state_width, 
settings.saved_state_height);
             } else {
@@ -83,32 +83,31 @@
                     set_allocation (rect);
                 }
             }
-            
+
                        var vbox = new Box(Gtk.Orientation.VERTICAL, 0);
                        var stack = new Stack();
                        var swin = new ScrolledWindow(null, null);
-            
+
                        welcome = new Granite.Widgets.Welcome("No Todo.txt File 
Open", _("Open a todo.txt file to start adding tasks"));
             welcome.append("appointment-new", _("Add task"), _("Create a new 
todo.txt file with this task in your Home folder"));
                        welcome.append("help-contents", _("What is a todo.txt 
file?"), _("Learn more about todo.txt files"));
                        no_file = new Granite.Widgets.Welcome("No Todo.txt File 
Found", _("Add tasks to start this todo.txt file"));
-            
+
                        /* Create toolbar */
                        toolbar = new HeaderBar();
             this.set_titlebar(toolbar);
             toolbar.set_show_close_button (true);
             toolbar.has_subtitle = false;
-            toolbar.set_title("Yishu");
-            
+
                        add_button = new Gtk.Button ();
             add_button.set_image (new Gtk.Image.from_icon_name 
("appointment-new", Gtk.IconSize.LARGE_TOOLBAR));
             add_button.has_tooltip = true;
             add_button.tooltip_text = (_("Add task…"));
-            
+
                        var prefs_button = new Gtk.ModelButton ();
             prefs_button.action_name = ACTION_PREFIX + ACTION_PREFS;
                        prefs_button.text = (_("Preferences"));
-            
+
                        var menu_grid = new Gtk.Grid ();
             menu_grid.margin = 6;
             menu_grid.row_spacing = 6;
@@ -116,48 +115,48 @@
             menu_grid.orientation = Gtk.Orientation.VERTICAL;
             menu_grid.add (prefs_button);
             menu_grid.show_all ();
-            
+
             var menu = new Gtk.Popover (null);
             menu.add (menu_grid);
-            
+
             var menu_button = new Gtk.MenuButton ();
             menu_button.set_image (new Gtk.Image.from_icon_name ("open-menu", 
Gtk.IconSize.LARGE_TOOLBAR));
             menu_button.has_tooltip = true;
             menu_button.tooltip_text = (_("Settings"));
                        menu_button.popover = menu;
-                       
+
                        toolbar.pack_start (add_button);
                        toolbar.pack_end (menu_button);
-            
+
                        tree_view = setup_tree_view();
                        swin.add(tree_view);
                        stack.add(welcome);
                        stack.add(swin);
-            
+
                        info_bar_box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 
0);
                        vbox.pack_start(info_bar_box, false, false, 0);
                        vbox.pack_start(stack, true, true, 0);
                        add(vbox);
-            
+
                        show_all();
                }
-        
+
                private void action_prefs () {
             debug ("Prefs button pressed.");
                        var preferences_dialog = new Widgets.Preferences (this);
                        preferences_dialog.show_all ();
         }
-        
+
         public override bool delete_event (Gdk.EventAny event) {
             int x, y;
             int w, h;
             Gtk.Allocation rect;
             var settings = AppSettings.get_default ();
-            
+
             if (Gtk.get_minor_version() < 20) {
                 get_position (out x, out y);
                 get_size(out w, out h);
-                
+
                 settings.window_x = x;
                 settings.window_y = y;
                 settings.saved_state_width = w;
@@ -165,7 +164,7 @@
             } else {
                 get_position (out x, out y);
                 get_allocation (out rect);
-                
+
                 settings.saved_state_width = rect.width;
                 settings.saved_state_height = rect.height;
                 settings.window_x = x;
@@ -186,28 +185,28 @@
 
             return false;
         }
-        
+
                private TreeView setup_tree_view(){
                        TreeView tv = new TreeView();
                        TreeViewColumn col;
-            
+
                        col = new TreeViewColumn.with_attributes(_("Priority"), 
new Granite.Widgets.CellRendererBadge(), "text", Columns.PRIORITY);
                        col.set_sort_column_id(Columns.PRIORITY);
                        col.resizable = true;
                        tv.append_column(col);
-            
+
                        col = new TreeViewColumn.with_attributes(_("Task"), new 
CellRendererText(), "markup", Columns.MARKUP);
                        col.set_sort_column_id(Columns.MARKUP);
                        col.resizable = true;
             col.expand = true;
                        tv.append_column(col);
-            
+
                        cell_renderer_toggle = new CellRendererToggle();
                        col = new TreeViewColumn.with_attributes(_("Done"), 
cell_renderer_toggle, "active", Columns.DONE);
                        col.set_sort_column_id(Columns.DONE);
                        col.resizable = true;
                        tv.append_column(col);
-            
+
                        return tv;
                }
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yishu-1.0.9/src/Preferences.vala 
new/yishu-1.1.2/src/Preferences.vala
--- old/yishu-1.0.9/src/Preferences.vala        2018-08-02 17:14:56.000000000 
+0200
+++ new/yishu-1.1.2/src/Preferences.vala        2018-10-22 18:13:43.000000000 
+0200
@@ -19,7 +19,7 @@
 namespace Yishu.Widgets {
     public class Preferences : Gtk.Dialog {
         public Gtk.ComboBoxText list_place;
-        
+
         public Preferences (Gtk.Window? parent) {
             Object (
             border_width: 6,
@@ -31,10 +31,10 @@
             window_position: Gtk.WindowPosition.CENTER_ON_PARENT
             );
         }
-        
+
         construct {
             var settings = AppSettings.get_default ();
-            
+
             var header = new Granite.HeaderLabel (_("Todo.txt Preferences"));
             var label = new SettingsLabel (_("Default Location:"));
             list_place = new Gtk.ComboBoxText();
@@ -44,73 +44,81 @@
             list_place.append_text("Nextcloud Folder");
             list_place.append_text("ownCloud Folder");
             list_place.append_text("Other Clients Folder");
-            
-            string DS = "%c".printf(GLib.Path.DIR_SEPARATOR);
-            
-            if (settings.todo_txt_file_path == Environment.get_home_dir() + DS 
+ "todo.txt") {
+
+            string homedir = GLib.Environment.get_home_dir ();
+            string home = homedir + "/todo.txt";
+            string db = homedir + "/Dropbox/todo.txt";
+            string nc = homedir + "/Nextcloud/todo.txt";
+            string oc = homedir + "/ownCloud/todo.txt";
+            string other = homedir + "/bin/todo.txt/todo.txt";
+            settings.todo_txt_file_path = home;
+            string file_used = settings.todo_txt_file_path;
+
+            if (file_used == home) {
                 list_place.set_active(0);
-                list_place.sensitive = true;
                 debug ("Set as Home");
-            } else if (settings.todo_txt_file_path == 
Environment.get_home_dir() + DS + "Dropbox" + DS + "todo.txt") {
+            } else if (file_used == db) {
                 list_place.set_active(1);
-                list_place.sensitive = true;
                 debug ("Set as Dropbox");
-            } else if (settings.todo_txt_file_path == 
Environment.get_home_dir() + DS + "Nextcloud" + DS + "Todo" + DS + "todo.txt") {
+            } else if (file_used == nc) {
                 list_place.set_active(2);
-                list_place.sensitive = true;
                 debug ("Set as Nextcloud");
-            } else if (settings.todo_txt_file_path == 
Environment.get_home_dir() + DS + "ownCloud" + DS + "Todo" + DS + "todo.txt") {
+            } else if (file_used == oc) {
                 list_place.set_active(3);
-                list_place.sensitive = true;
                 debug ("Set as ownCloud");
-            } else if (settings.todo_txt_file_path == 
Environment.get_home_dir() + DS + "bin" + DS + "todo.txt" + DS + "todo.txt") {
+            } else if (file_used == other) {
                 list_place.set_active(4);
-                list_place.sensitive = true;
                 debug ("Set as Other");
-            } else {
-                list_place.sensitive = false;
             }
-            
+
             list_place.changed.connect (() => {
-                if (list_place.get_active_text () == "Home Folder") {
-                    settings.todo_txt_file_path = Environment.get_home_dir() + 
DS + "todo.txt";
-                    list_place.sensitive = true;
-                } else if (list_place.get_active_text () == "Dropbox Folder") {
-                    settings.todo_txt_file_path = Environment.get_home_dir() + 
DS + "Dropbox" + DS + "todo.txt";
-                    list_place.sensitive = true;
-                } else if (list_place.get_active_text () == "Nextcloud 
Folder") {
-                    settings.todo_txt_file_path = Environment.get_home_dir() + 
DS + "Nextcloud" + DS + "Todo" + DS + "todo.txt";
-                    list_place.sensitive = true;
-                } else if (list_place.get_active_text () == "ownCloud Folder") 
{
-                    settings.todo_txt_file_path = Environment.get_home_dir() + 
DS + "ownCloud" + DS + "Todo" + DS + "todo.txt";
-                    list_place.sensitive = true;
-                } else if (list_place.get_active_text () == "Other Clients 
Folder") {
-                    settings.todo_txt_file_path = Environment.get_home_dir() + 
DS + "bin" + DS + "todo.txt" + DS + "todo.txt";
-                    list_place.sensitive = true;
-                } else {
-                    list_place.sensitive = false;
+                switch (list_place.get_active ()) {
+                    case 0:
+                        settings.todo_txt_file_path = home;
+                        list_place.sensitive = true;
+                        break;
+                    case 1:
+                        settings.todo_txt_file_path = db;
+                        list_place.sensitive = true;
+                        break;
+                    case 2:
+                        settings.todo_txt_file_path = nc;
+                        list_place.sensitive = true;
+                        break;
+                    case 3:
+                        settings.todo_txt_file_path = oc;
+                        list_place.sensitive = true;
+                        break;
+                    case 4:
+                        settings.todo_txt_file_path = other;
+                        list_place.sensitive = true;
+                        break;
+                    default:
+                        settings.todo_txt_file_path = home;
+                        list_place.sensitive = true;
+                        break;
                 }
             });
-            
+
             var label_c = new SettingsLabel (_("Custom Location:"));
             var switch_c = new SettingsSwitch ("custom-file-enable");
             var chooser = new Gtk.FileChooserButton ("Open your file", 
Gtk.FileChooserAction.OPEN);
             chooser.hexpand = true;
-            
+
             var custom_help = new Gtk.Image.from_icon_name 
("help-info-symbolic", Gtk.IconSize.BUTTON);
             custom_help.halign = Gtk.Align.START;
             custom_help.hexpand = true;
             custom_help.tooltip_text = _("Enabling custom locations will have 
you save your file\nin other places not recognized by other clients.");
-            
+
             var filter = new Gtk.FileFilter ();
             chooser.set_filter (filter);
             filter.add_mime_type ("todo.txt");
-            
+
             chooser.selection_changed.connect (() => {
-                string uris = chooser.get_filename ();
-                settings.todo_txt_file_path = uris;
+                string uri = chooser.get_filename ();
+                settings.todo_txt_file_path = uri;
             });
-            
+
             switch_c.notify["active"].connect (() => {
                 if (settings.custom_file_enable == true) {
                     chooser.sensitive = true;
@@ -120,7 +128,7 @@
                     switch_c.active = false;
                 }
             });
-            
+
             if (settings.custom_file_enable == true) {
                 chooser.sensitive = true;
                 switch_c.active = true;
@@ -128,11 +136,11 @@
                 chooser.sensitive = false;
                 switch_c.active = false;
             }
-            
+
             var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
             hbox.pack_start (switch_c, false, true, 0);
             hbox.pack_start (chooser, false, true, 0);
-            
+
             var main_grid = new Gtk.Grid ();
             main_grid.margin = 6;
             main_grid.row_spacing = 6;
@@ -143,16 +151,16 @@
             main_grid.attach (label_c, 0, 3, 1, 1);
             main_grid.attach (hbox, 1, 3, 3, 1);
             main_grid.attach (custom_help, 4, 3, 1, 1);
-            
+
             var content = this.get_content_area () as Gtk.Box;
             content.margin = 6;
             content.margin_top = 0;
             content.add (main_grid);
-            
+
             var close_button = this.add_button (_("Close"), 
Gtk.ResponseType.CLOSE);
             ((Gtk.Button) close_button).clicked.connect (() => destroy ());
         }
-        
+
         private class SettingsLabel : Gtk.Label {
             public SettingsLabel (string text) {
                 label = text;
@@ -160,7 +168,7 @@
                 margin_start = 12;
             }
         }
-        
+
         private class SettingsSwitch : Gtk.Switch {
             public SettingsSwitch (string setting) {
                 var main_settings = AppSettings.get_default ();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yishu-1.0.9/src/SearchEntry.vala 
new/yishu-1.1.2/src/SearchEntry.vala
--- old/yishu-1.0.9/src/SearchEntry.vala        1970-01-01 01:00:00.000000000 
+0100
+++ new/yishu-1.1.2/src/SearchEntry.vala        2018-10-22 18:13:43.000000000 
+0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2018 Lains
+*
+* This program 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 2 of the License, or (at your option) any later version.
+*
+* This program 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 this program; if not, write to the
+* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+* Boston, MA 02110-1301 USA
+*
+* Co-authored by Stanisław <stanislaw....@gmail.com>
+*/
+using Gtk;
+using Yishu;
+namespace Yishu {
+    public class SearchTasks : Gtk.SearchEntry {
+        public Gtk.TreeModelFilter filter_model { get; private set; }
+        private Gtk.TreeView process_view;
+
+        public SearchTasks (Gtk.TreeView process_view, Gtk.TreeModel model) {
+            this.process_view = process_view;
+            this.placeholder_text = _("Search Process");
+            this.set_tooltip_text (_("Type Process Name or PID"));
+            filter_model = new Gtk.TreeModelFilter (model, null);
+            connect_signal ();
+            filter_model.set_visible_func(filter_func);
+            process_view.set_model (filter_model);
+
+            var sort_model = new Gtk.TreeModelSort.with_model (filter_model);
+            process_view.set_model (sort_model);
+
+            this.show_all ();
+        }
+
+        private void connect_signal () {
+            this.search_changed.connect (() => {
+                if (this.is_focus) {
+                    process_view.collapse_all ();
+                }
+                filter_model.refilter ();
+                if (filter_model.iter_n_children (null) == 1) {
+                    Gtk.TreePath tree_path = new Gtk.TreePath.from_indices (0, 
0);
+                    process_view.set_cursor (tree_path, null, false);
+                    process_view.grab_focus ();
+                }
+            });
+        }
+
+        private bool filter_func (Gtk.TreeModel model, Gtk.TreeIter iter) {
+            string name_haystack;
+            bool found = false;
+            var needle = this.text;
+            if ( needle.length == 0 ) {
+                return true;
+            }
+
+            model.get(iter, Columns.MARKUP, out name_haystack, -1);
+
+            // sometimes name_haystack is null
+            if (name_haystack != null) {
+                bool name_found = 
name_haystack.casefold().contains(needle.casefold()) || false;
+                found = name_found;
+            }
+
+            Gtk.TreeIter child_iter;
+            bool child_found = false;
+
+            if (model.iter_children (out child_iter, iter)) {
+                do {
+                    child_found = filter_func (model, child_iter);
+                } while (model.iter_next (ref child_iter) && !child_found);
+            }
+
+            if (child_found && needle.length > 0) {
+                process_view.expand_all ();
+            }
+
+            return found || child_found;
+        }
+
+        // reset filter, grab focus and insert the character
+        public void activate_entry (string search_text = "") {
+            this.text = "";
+            this.grab_focus ();
+            this.insert_at_cursor (search_text);
+        }
+
+    }
+}


Reply via email to