Skip to content

Commit

Permalink
Remove features like a true gnome dev
Browse files Browse the repository at this point in the history
First attempt to simplify the code:

- build the search popover with an UI file instead of a python method
- remove the "presentation" window
  • Loading branch information
maoschanz committed Sep 20, 2019
1 parent a2acdde commit 56f1f29
Show file tree
Hide file tree
Showing 20 changed files with 722 additions and 831 deletions.
Empty file modified LICENSE
100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion POTFILES
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
./markdown_preview/__init__.py
./markdown_preview/prefs.py
./markdown_preview/preview.py
./markdown_preview/window.py
./markdown_preview/export.ui
./markdown_preview/menus.ui
./markdown_preview/prefs.ui
Expand Down
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified example.css
100644 → 100755
Empty file.
56 changes: 17 additions & 39 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,51 +1,29 @@
#!/bin/bash

if (( $EUID == 0 )); then
install_dir="/usr/lib/x86_64-linux-gnu/gedit/plugins"
schemas_dir="/usr/share/glib-2.0/schemas"
else
install_dir="$HOME/.local/share/gedit/plugins"
schemas_dir="$HOME/.local/share/glib-2.0/schemas"
fi

if [ ! -d "/usr/lib/x86_64-linux-gnu/gedit/plugins" ]; then
mkdir /usr/lib/x86_64-linux-gnu/gedit/plugins
fi
echo "Checking if adequate folders exist…"

echo "Installing setting schemas in /usr/share/glib-2.0/schemas"

cp org.gnome.gedit.plugins.markdown_preview.gschema.xml /usr/share/glib-2.0/schemas
glib-compile-schemas /usr/share/glib-2.0/schemas
mkdir -p $install_dir
mkdir -p $schemas_dir

echo "Installing plugin files in /usr/lib/x86_64-linux-gnu/gedit/plugins/"

cp markdown_preview.plugin /usr/lib/x86_64-linux-gnu/gedit/plugins/markdown_preview.plugin
cp -r markdown_preview /usr/lib/x86_64-linux-gnu/gedit/plugins/
echo "Installing setting schemas in $schemas_dir"

else
cp org.gnome.gedit.plugins.markdown_preview.gschema.xml $schemas_dir
glib-compile-schemas $schemas_dir

echo "Checking if adequate folders exist..."

if [ ! -d "$HOME/.local/share/glib-2.0" ]; then
mkdir ~/.local/share/glib-2.0
fi
if [ ! -d "$HOME/.local/share/glib-2.0/schemas" ]; then
mkdir ~/.local/share/glib-2.0/schemas
fi
if [ ! -d "$HOME/.local/share/gedit" ]; then
mkdir ~/.local/share/gedit
fi
if [ ! -d "$HOME/.local/share/gedit/plugins" ]; then
mkdir ~/.local/share/gedit/plugins
fi

echo "Installing setting schemas in ~/.local/share/glib-2.0/schemas"

cp org.gnome.gedit.plugins.markdown_preview.gschema.xml ~/.local/share/glib-2.0/schemas
glib-compile-schemas ~/.local/share/glib-2.0/schemas

echo "Installing plugin files in ~/.local/share/gedit/plugins/"

cp markdown_preview.plugin ~/.local/share/gedit/plugins/markdown_preview.plugin
cp -r markdown_preview ~/.local/share/gedit/plugins/

fi
echo "Installing plugin files in $install_dir"

cp markdown_preview.plugin $install_dir/markdown_preview.plugin
cp -r markdown_preview $install_dir/

echo "Done."

exit
exit 0

Empty file modified markdown_preview.plugin
100644 → 100755
Empty file.
22 changes: 12 additions & 10 deletions markdown_preview/__init__.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# __init__.py
# GPL v3

import subprocess, gi, os, markdown
gi.require_version('WebKit2', '4.0')
from gi.repository import GObject, Gtk, Gedit, Gio, PeasGtk, WebKit2, GLib
Expand All @@ -19,7 +22,7 @@

MD_PREVIEW_KEY_BASE = 'org.gnome.gedit.plugins.markdown_preview'

####### ####### #######
################################################################################

class MarkdownGeditPluginApp(GObject.Object, Gedit.AppActivatable):
app = GObject.property(type=Gedit.App)
Expand Down Expand Up @@ -95,7 +98,7 @@ def remove_accelerators(self):
self.app.remove_accelerator('win.md-prev-format-title-upper', None)
self.app.remove_accelerator('win.md-prev-format-title-lower', None)

####### ####### #######
################################################################################

class MarkdownGeditPluginWindow(GObject.Object, Gedit.WindowActivatable, PeasGtk.Configurable):
window = GObject.property(type=Gedit.Window)
Expand Down Expand Up @@ -157,8 +160,8 @@ def connect_actions(self):
None, GLib.Variant.new_boolean(autoreload))
action_autoreload.connect('change-state', self.preview.on_set_reload)

self.action_reload_preview = Gio.SimpleAction(name='md-prev-reload')
self.action_reload_preview.connect('activate', self.preview.on_reload)
self.action_reload = Gio.SimpleAction(name='md-prev-reload')
self.action_reload.connect('activate', self.preview.on_reload)

self.action_open_link_with = Gio.SimpleAction(name='md-prev-open-link-with')
self.action_open_link_with.connect('activate', self.preview.on_open_link_with)
Expand All @@ -175,7 +178,7 @@ def connect_actions(self):
self.window.add_action(action_previous)
self.window.add_action(action_panel)
self.window.add_action(action_autoreload)
self.window.add_action(self.action_reload_preview)
self.window.add_action(self.action_reload)
self.window.add_action(self.action_open_link_with)
self.window.add_action(self.action_open_image_with)

Expand Down Expand Up @@ -214,9 +217,7 @@ def add_format_action(self, action_name, method_name):

def on_change_view_mode(self, *args):
mode = args[1].get_string()
if mode == 'window':
self.preview.on_presentation()
elif mode == 'separators':
if mode == 'separators':
self.preview.on_set_paginated(False)
else: # mode == 'whole'
self.preview.on_set_paginated(True)
Expand Down Expand Up @@ -302,7 +303,7 @@ def print_doc(self, *args):
p = WebKit2.PrintOperation.new(self.preview._webview)
p.run_dialog()

####### ####### #######
################################################################################

class MarkdownGeditPluginView(GObject.Object, Gedit.ViewActivatable):
view = GObject.Property(type=Gedit.View)
Expand Down Expand Up @@ -488,4 +489,5 @@ def forward_tag(self, iter, tag):
def backward_tag(self, iter, tag):
iter.backward_chars(len(tag))

##################################################
################################################################################

Empty file modified markdown_preview/export.py
100644 → 100755
Empty file.
Empty file modified markdown_preview/export.ui
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified markdown_preview/locale/gedit-plugin-markdown-preview.pot
100644 → 100755
Empty file.
Loading

0 comments on commit 56f1f29

Please sign in to comment.