File: thunarx-preferences-plugin.py

package info (click to toggle)
thunarx-python 0.5.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 360 kB
  • sloc: xml: 1,500; ansic: 678; python: 136; makefile: 106; sh: 11
file content (30 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from gi.repository import GObject, Gtk, Thunarx

class DialogExample(Gtk.Dialog):
    def __init__(self, parent):
        Gtk.Dialog.__init__(self, "My Dialog", parent, 0,
            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
             Gtk.STOCK_OK, Gtk.ResponseType.OK))

        self.set_default_size(150, 100)
        self.set_transient_for(parent)

        label = Gtk.Label("This is a dialog to display additional information")

        box = self.get_content_area()
        box.add(label)
        self.show_all()

class ThunarxPreferencesPlugin(GObject.GObject, Thunarx.PreferencesProvider):
    def __init__(self):
        pass
    
    def get_preferences_menu_items(self, window):
        item = Thunarx.MenuItem(name="TPP:PrefItem", label="My Example Preferences", tooltip=None, icon=None)
        item.connect("activate", self.__open_preferences, window)
        return item,
    
    def __open_preferences(self, action, window):
        dialog = DialogExample(window)
        response = dialog.run()
        dialog.destroy()