~martijnbraam/thumbdrives

fab84dc2932e662b84c4f383c155fbc8975b7410 — Martijn Braam 4 years ago 6edc5fc
Fixes
2 files changed, 7 insertions(+), 11 deletions(-)

M src/window.py
M src/window.ui
M src/window.py => src/window.py +5 -7
@@ 28,9 28,10 @@

import subprocess
import os
from pathlib import Path

from gi.repository import Gtk
from xdg import XDG_DATA_HOME
import xdg.BaseDirectory

import thumbdrives.vdisk as vdisk



@@ 39,16 40,13 @@ import thumbdrives.vdisk as vdisk
class ThumbdrivesWindow(Gtk.ApplicationWindow):
    __gtype_name__ = 'ThumbdrivesWindow'

    mount = Gtk.Template.Child()
    unmount = Gtk.Template.Child()

    thumbdrive_list = Gtk.Template.Child()
    iso_list = Gtk.Template.Child()

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        datadir = XDG_DATA_HOME / "thumbdrives"
        datadir = Path(xdg.BaseDirectory.xdg_data_home) / "thumbdrives"
        if not datadir.is_dir():
            datadir.mkdir()



@@ 65,13 63,13 @@ class ThumbdrivesWindow(Gtk.ApplicationWindow):
    def on_unmount_clicked(self, widget, args):
        vdisk.unmount()

    def add_img(path):
    def add_img(self, path):
        box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)
        label = Gtk.Label(path.name.replace(".img", ""))
        box.pack_start(label, True, True, False)
        self.thumbdrive_list.insert(box)

    def add_iso(path):
    def add_iso(self, path):
        box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)
        label = Gtk.Label(path.name.replace(".iso", ""))
        box.pack_start(label, True, True, False)

M src/window.ui => src/window.ui +2 -4
@@ 102,8 102,7 @@
                            <property name="can_focus">False</property>
                            <property name="left_padding">12</property>
                            <child>
                              <object class="GtkListBox">
                                <property name="name">thumbdrive_list</property>
                              <object class="GtkListBox" id="thumbdrive_list">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                              </object>


@@ 182,8 181,7 @@
                            <property name="can_focus">False</property>
                            <property name="left_padding">12</property>
                            <child>
                              <object class="GtkListBox">
                                <property name="name">iso_list</property>
                              <object class="GtkListBox" id="iso_list">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                              </object>