~artem-anufrij/audience/tv-shows

« back to all changes in this revision

Viewing changes to src/Window.vala

  • Committer: Artem Anufrij
  • Date: 2016-09-26 19:18:45 UTC
  • Revision ID: artem.anufrij@live.de-20160926191845-ptgmoha0vgjaqxtn
improved trash and undo

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        search_entry.placeholder_text = _("Search Videos");
68
68
        search_entry.margin_right = 5;
69
69
        search_entry.search_changed.connect (() => {
70
 
                if (main_stack.get_visible_child () == episodes_page ) {
 
70
                if (main_stack.visible_child == episodes_page ) {
71
71
                    episodes_page.filter (search_entry.text);
72
72
                } else {
73
73
                    library_page.filter (search_entry.text);
90
90
            }
91
91
        });
92
92
        library_page.unmap.connect (() => {
93
 
            if (main_stack.get_visible_child () != alert_view && main_stack.get_visible_child () != episodes_page) {
 
93
            if (main_stack.visible_child != alert_view && main_stack.visible_child != episodes_page) {
94
94
                search_entry.visible = false;
95
95
            }
96
96
        });
97
97
        library_page.filter_result_changed.connect ((has_result) => {
98
98
            if (!has_result) {
99
99
                show_alert (_("No Results for “%s”".printf (search_entry.text)), _("Try changing search terms."), "edit-find-symbolic");
100
 
            } else if (main_stack.get_visible_child () != library_page ) {
 
100
            } else if (main_stack.visible_child != library_page ) {
101
101
                hide_alert ();
102
102
            }
103
103
        });
150
150
        restore_button.clicked.connect (() => {
151
151
            library_page.manager.undo_delete_item ();
152
152
            app_notification.reveal_child = false;
153
 
            main_stack.set_visible_child (library_page);
 
153
            if (main_stack.visible_child != episodes_page) {
 
154
                main_stack.set_visible_child (library_page);
 
155
            }
154
156
        });
155
157
 
156
158
        var close_button = new Gtk.Button.from_icon_name ("close-symbolic", Gtk.IconSize.MENU);
258
260
            return true;
259
261
        }
260
262
 
261
 
        if (main_stack.get_visible_child () == player_page) {
 
263
        if (main_stack.visible_child == player_page) {
262
264
            if (match_keycode (Gdk.Key.p, keycode) || match_keycode (Gdk.Key.space, keycode)) {
263
265
                player_page.playing = !player_page.playing;
264
266
            } else if (match_keycode (Gdk.Key.a, keycode)) {
329
331
                default:
330
332
                    break;
331
333
            }
332
 
        } else if (main_stack.get_visible_child () == welcome_page) {
 
334
        } else if (main_stack.visible_child == welcome_page) {
333
335
            if (match_keycode (Gdk.Key.p, keycode) || match_keycode (Gdk.Key.space, keycode)) {
334
336
                resume_last_videos ();
335
337
                return true;
400
402
    public void show_library () {
401
403
        navigation_button.label = navigation_button_welcomescreen;
402
404
        navigation_button.show ();
403
 
        main_stack.set_visible_child (library_page);
 
405
        main_stack.visible_child = library_page;
404
406
        library_page.scrolled_window.grab_focus ();
405
407
    }
406
408
 
539
541
        notification_label.label = text;
540
542
        app_notification.reveal_child = true;
541
543
    }
 
544
    
 
545
    public Gtk.Widget get_visible_child () {
 
546
        return main_stack.visible_child;
 
547
    }
542
548
}