Skip to content

Commit

Permalink
Add link to github issues
Browse files Browse the repository at this point in the history
  • Loading branch information
samdroid-apps committed Nov 12, 2018
1 parent 9b761a9 commit ac5d159
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions data/app-menu.ui
Expand Up @@ -16,6 +16,10 @@
<attribute name="action">app.about</attribute>
<attribute name="label" translatable="yes">About</attribute>
</item>
<item>
<attribute name="action">app.issues</attribute>
<attribute name="label" translatable="yes">GitHub Issues</attribute>
</item>
<item>
<attribute name="action">app.quit</attribute>
<attribute name="label" translatable="yes">Quit</attribute>
Expand Down
9 changes: 8 additions & 1 deletion redditisgtk/main.py
Expand Up @@ -35,6 +35,7 @@
from redditisgtk.identitybutton import IdentityButton
from redditisgtk.comments import CommentsView
from redditisgtk.settings import get_settings, show_settings
from redditisgtk import webviews


VIEW_WEB = 0
Expand Down Expand Up @@ -321,7 +322,9 @@ def goto_reddit_uri(self, uri):

# TODO: Using do_startup causes SIGSEGV for me
def __do_startup_cb(self, app):
actions = [('about', self.__about_cb), ('quit', self.__quit_cb),
actions = [('about', self.__about_cb),
('quit', self.__quit_cb),
('issues', self.__issues_cb),
('shortcuts', self.__shortcuts_cb),
('settings', self.__settings_cb)]
for name, cb in actions:
Expand Down Expand Up @@ -349,6 +352,10 @@ def __about_cb(self, action, param):
modal=True)
about_dialog.present()

def __issues_cb(self, action, param):
webviews.open_uri_external(
'https://github.com/samdroid-apps/something-for-reddit/issues')

def __quit_cb(self, action, param):
self.quit()

Expand Down
9 changes: 8 additions & 1 deletion redditisgtk/webviews.py
Expand Up @@ -21,6 +21,13 @@
from gi.repository import WebKit2


def open_uri_external(uri: str):
'''
Open the given uri in an external browser
'''
subprocess.call(['xdg-open', uri])


class FullscreenableWebview(WebKit2.WebView):

def do_enter_fullscreen(self):
Expand Down Expand Up @@ -106,7 +113,7 @@ def __load_changed_cb(self, webview, load_event):

def __external_cb(self, button):
uri = self._webview.props.uri
subprocess.call(['xdg-open', uri])
open_uri_external(uri)

def __clicked_cb(self, button, func):
func()

0 comments on commit ac5d159

Please sign in to comment.