[gitg] Issue #268 Ctrl+O shortcut does not work



commit 20f95e66b75f0c1a569032b2eaf6692878dce780
Author: Sabri Ünal <libreajans gmail com>
Date:   Thu Jan 9 03:30:21 2020 +0300

    Issue #268 Ctrl+O shortcut does not work

 gitg/gitg-window.vala | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index ca640d5b..c3d93d9d 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -159,6 +159,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
        private const ActionEntry[] win_entries = {
                {"search", on_search_activated, null, "false", null},
                {"gear-menu", on_gear_menu_activated, null, "false", null},
+               {"open-repository", on_open_repository},
                {"close", on_close_activated},
                {"reload", on_reload_activated},
                {"author-details-repo", on_repo_author_details_activated},
@@ -695,6 +696,34 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
                }
        }
 
+       private void on_open_repository()
+       {
+               var chooser = new Gtk.FileChooserDialog (_("Open Repository"), this,
+                                                        Gtk.FileChooserAction.SELECT_FOLDER,
+                                                        _("_Cancel"), Gtk.ResponseType.CANCEL,
+                                                        _("_Open"), Gtk.ResponseType.OK);
+
+               chooser.modal = true;
+
+               chooser.response.connect((c, id) => {
+                       if (id == Gtk.ResponseType.OK)
+                       {
+                               var file = chooser.get_file();
+
+                               if (file == null)
+                               {
+                                       file = chooser.get_current_folder_file();
+                               }
+
+                               open_repository(file);
+                       }
+
+                       c.destroy();
+               });
+
+               chooser.show();
+       }
+
        private void on_reload_activated()
        {
                try


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]