summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrifa75 <yahiaoui.fakhri@gmail.com>2022-12-04 23:57:00 +0100
committerBastien Nocera <hadess@hadess.net>2022-12-05 13:18:10 +0100
commit19e8bd51ebf2dc31752d05e9274098193db4a3e6 (patch)
tree2446e747cff7543087a712549d52ce54b614de0f
parent71b680b72968b19cfa59dd52da780cb6ebbb60de (diff)
downloadtotem-19e8bd51ebf2dc31752d05e9274098193db4a3e6.tar.gz
opensubtitles: Move treeview columns creation to GtkBuilder
-rw-r--r--src/plugins/opensubtitles/opensubtitles.py21
-rw-r--r--src/plugins/opensubtitles/opensubtitles.ui47
2 files changed, 48 insertions, 20 deletions
diff --git a/src/plugins/opensubtitles/opensubtitles.py b/src/plugins/opensubtitles/opensubtitles.py
index dae889a75..079a96192 100644
--- a/src/plugins/opensubtitles/opensubtitles.py
+++ b/src/plugins/opensubtitles/opensubtitles.py
@@ -13,7 +13,7 @@ gi.require_version('Gtk', '3.0')
gi.require_version('Totem', '1.0')
from gi.repository import GLib, GObject # pylint: disable=wrong-import-position
from gi.repository import Peas, Gtk, Gdk # pylint: disable=wrong-import-position,
-from gi.repository import Gio, Pango # pylint: disable=wrong-import-position,no-name-in-module
+from gi.repository import Gio # pylint: disable=wrong-import-position,no-name-in-module
from hash import hash_file # pylint: disable=wrong-import-position
@@ -495,25 +495,6 @@ class OpenSubtitles (GObject.Object, # pylint: disable=R0902
if success:
combobox.set_active_iter (parentit)
- # Set up the results treeview
- renderer = Gtk.CellRendererText ()
- self._tree_view.set_model (self._list_store)
- renderer.set_property ('ellipsize', Pango.EllipsizeMode.END)
- column = Gtk.TreeViewColumn (_("Subtitles"), renderer, text=0)
- column.set_resizable (True)
- column.set_expand (True)
- self._tree_view.append_column (column)
- # translators comment:
- # This is the file-type of the subtitle file detected
- column = Gtk.TreeViewColumn (_("Format"), renderer, text=1)
- column.set_resizable (False)
- self._tree_view.append_column (column)
- # translators comment:
- # This is a rating of the quality of the subtitle
- column = Gtk.TreeViewColumn (_("Rating"), renderer, text=2)
- column.set_resizable (False)
- self._tree_view.append_column (column)
-
self._apply_button.set_sensitive (False)
self._apply_button.connect ('clicked', self.__on_apply_clicked)
diff --git a/src/plugins/opensubtitles/opensubtitles.ui b/src/plugins/opensubtitles/opensubtitles.ui
index 3b8929b3d..69a9f836f 100644
--- a/src/plugins/opensubtitles/opensubtitles.ui
+++ b/src/plugins/opensubtitles/opensubtitles.ui
@@ -92,6 +92,53 @@
<object class="GtkTreeView" id="subtitle_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="model">subtitle_model</property>
+ <child>
+ <object class="GtkTreeViewColumn">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Subtitles</property>
+ <property name="resizable">True</property>
+ <property name="expand">True</property>
+ <child>
+ <object class="GtkCellRendererText">
+ <property name="ellipsize">end</property>
+ </object>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" comments="This is the file-type of the subtitle file detected">Format</property>
+ <property name="resizable">False</property>
+ <child>
+ <object class="GtkCellRendererText">
+ <property name="ellipsize">end</property>
+ </object>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" comments="This is a rating of the quality of the subtitle">Rating</property>
+ <property name="resizable">False</property>
+ <child>
+ <object class="GtkCellRendererText">
+ <property name="ellipsize">end</property>
+ </object>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>