[rhythmbox/gobject-introspection] context: Port Context pane to GI
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox/gobject-introspection] context: Port Context pane to GI
- Date: Thu, 13 Jan 2011 13:45:04 +0000 (UTC)
commit 50aa69ff964af3ce136402d8ade8562efd813589
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jan 13 13:44:29 2011 +0000
context: Port Context pane to GI
And re-enable it in the plugins engine loader.
plugins/context/context/AlbumTab.py | 8 ++++----
plugins/context/context/ArtistTab.py | 6 +++---
plugins/context/context/ContextView.py | 30 +++++++++++++++++-------------
plugins/context/context/LinksTab.py | 8 ++++----
plugins/context/context/LyricsTab.py | 6 +++---
shell/rb-plugins-engine.c | 3 +--
6 files changed, 32 insertions(+), 29 deletions(-)
---
diff --git a/plugins/context/context/AlbumTab.py b/plugins/context/context/AlbumTab.py
index 1bffaaa..236ac30 100644
--- a/plugins/context/context/AlbumTab.py
+++ b/plugins/context/context/AlbumTab.py
@@ -25,7 +25,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
import gobject
-import webkit
import os
import cgi
import urllib
@@ -37,6 +36,7 @@ import LastFM
import rb
from gi.repository import RB
from gi.repository import Gtk
+from gi.repository import WebKit
class AlbumTab (gobject.GObject):
@@ -63,7 +63,7 @@ class AlbumTab (gobject.GObject):
self.button.set_focus_on_click(False)
self.button.connect ('clicked',
lambda button: self.emit ('switch-tab', 'album'))
- buttons.pack_start (self.button, True, True)
+ buttons.pack_start (self.button, True, True, 0)
def activate (self):
self.button.set_active(True)
@@ -79,8 +79,8 @@ class AlbumTab (gobject.GObject):
if entry is None:
return None
- artist = self.db.entry_get_string (entry, RB.RhythmDBPropType.ARTIST)
- album = self.db.entry_get_string (entry, RB.RhythmDBPropType.ALBUM)
+ artist = entry.get_string (RB.RhythmDBPropType.ARTIST)
+ album = entry.get_string (RB.RhythmDBPropType.ALBUM)
if self.active and artist != self.artist:
self.view.loading(artist)
self.ds.fetch_album_list (artist)
diff --git a/plugins/context/context/ArtistTab.py b/plugins/context/context/ArtistTab.py
index 8382e00..f944908 100644
--- a/plugins/context/context/ArtistTab.py
+++ b/plugins/context/context/ArtistTab.py
@@ -30,12 +30,12 @@ import cgi
import urllib
import xml.dom.minidom as dom
-import webkit
from mako.template import Template
import rb
import LastFM
+from gi.repository import WebKit
from gi.repository import Gtk
from gi.repository import RB
@@ -64,7 +64,7 @@ class ArtistTab (gobject.GObject):
self.button.set_focus_on_click(False)
self.button.connect ('clicked',
lambda button : self.emit('switch-tab', 'artist'))
- buttons.pack_start (self.button, True, True)
+ buttons.pack_start (self.button, True, True, 0)
def activate (self):
print "activating Artist Tab"
@@ -82,7 +82,7 @@ class ArtistTab (gobject.GObject):
if entry is None:
print "Nothing playing"
return None
- artist = self.db.entry_get_string (entry, RB.RhythmDBPropType.ARTIST)
+ artist = entry.get_string (RB.RhythmDBPropType.ARTIST)
if self.active and self.artist != artist:
self.datasource.fetch_artist_data (artist)
diff --git a/plugins/context/context/ContextView.py b/plugins/context/context/ContextView.py
index 4138fa4..ac042ab 100644
--- a/plugins/context/context/ContextView.py
+++ b/plugins/context/context/ContextView.py
@@ -25,7 +25,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
import gobject, gio
-import webkit
import os
import ArtistTab as at
@@ -36,6 +35,7 @@ import LinksTab as lit
import rb
from gi.repository import Gtk, Gdk, Pango
from gi.repository import RB
+from gi.repository import WebKit
context_ui = """
<ui>
@@ -177,10 +177,12 @@ class ContextView (gobject.GObject):
self.top_five_list.append(["%d. " % (i+1), ""])
else:
num_tracks = len(top_tracks)
+ ## empty liststore
+ self.top_five_list.clear()
for i in range (0, 5):
if i >= num_tracks : track = ""
else : track = top_tracks[i]
- self.top_five_list[(i,)] = ("%d. " % (i+1), track)
+ self.top_five_list.append(["%d. " % (i+1), str(track)])
def playing_changed_cb (self, playing, user_data):
# this sometimes happens on a streaming thread, so we need to
@@ -195,7 +197,7 @@ class ContextView (gobject.GObject):
if playing_entry is None:
return
- playing_artist = self.db.entry_get_string (playing_entry, RB.RhythmDBPropType.ARTIST)
+ playing_artist = playing_entry.get_string(RB.RhythmDBPropType.ARTIST)
if self.current_artist != playing_artist:
self.current_artist = playing_artist.replace ('&', '&')
@@ -223,7 +225,9 @@ class ContextView (gobject.GObject):
self.apply_font_settings()
def apply_font_settings(self):
- style = self.webview.style
+ # FIXME apply font style
+ # style = self.webview.style
+ return
font_size = style.font_desc.get_size()
if style.font_desc.get_size_is_absolute() is False:
@@ -235,7 +239,7 @@ class ContextView (gobject.GObject):
def init_gui(self):
self.vbox = Gtk.VBox()
self.frame = Gtk.Frame()
- self.label = Gtk.Label(str=_('Nothing Playing'))
+ self.label = Gtk.Label(_('Nothing Playing'))
self.frame.set_shadow_type(Gtk.ShadowType.IN)
self.frame.set_label_align(0.0,0.0)
self.frame.set_label_widget(self.label)
@@ -244,7 +248,7 @@ class ContextView (gobject.GObject):
#----- set up top 5 tree view -----#
self.top_five_list = Gtk.ListStore (gobject.TYPE_STRING, gobject.TYPE_STRING)
- self.top_five_view = Gtk.TreeView(self.top_five_list)
+ self.top_five_view = Gtk.TreeView.new_with_model(self.top_five_list)
self.top_five_tvc1 = Gtk.TreeViewColumn()
self.top_five_tvc2 = Gtk.TreeViewColumn()
@@ -264,7 +268,7 @@ class ContextView (gobject.GObject):
self.frame.add (self.top_five_view)
#---- set up webkit pane -----#
- self.webview = webkit.WebView()
+ self.webview = WebKit.WebView()
self.webview.connect("navigation-requested", self.navigation_request_cb)
self.scroll = Gtk.ScrolledWindow()
self.scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
@@ -272,7 +276,7 @@ class ContextView (gobject.GObject):
self.scroll.add (self.webview)
# set up webkit settings to match gtk font settings
- self.websettings = webkit.WebSettings()
+ self.websettings = WebKit.WebSettings()
self.webview.set_settings(self.websettings)
self.apply_font_settings()
self.webview.connect("style-set", self.style_set_cb)
@@ -282,11 +286,11 @@ class ContextView (gobject.GObject):
self.buttons = Gtk.HBox()
#---- pack everything into side pane ----#
- self.vbox.pack_start (self.frame, expand = False)
- self.vbox2.pack_start (self.buttons, expand = False)
- self.vbox2.pack_start (self.scroll, expand = True)
- self.vbox.pack_start (self.vbox2, expand = True)
+ self.vbox.pack_start (self.frame, False, True, 0)
+ self.vbox2.pack_start (self.buttons, False, True, 0)
+ self.vbox2.pack_start (self.scroll, True, True, 0)
+ self.vbox.pack_start (self.vbox2, True, True, 0)
self.vbox.show_all()
self.vbox.set_size_request(200, -1)
- self.shell.add_widget (self.vbox, RB.ShellUILocation.RIGHT_SIDEBAR, expand=True)
+ self.shell.add_widget (self.vbox, RB.ShellUILocation.RIGHT_SIDEBAR, True, True)
diff --git a/plugins/context/context/LinksTab.py b/plugins/context/context/LinksTab.py
index 42fef8f..96cfa05 100644
--- a/plugins/context/context/LinksTab.py
+++ b/plugins/context/context/LinksTab.py
@@ -31,10 +31,10 @@ import urllib
from gi.repository import Gtk
from gi.repository import RB
+from gi.repository import WebKit
from gettext import gettext as _
-import webkit
from mako.template import Template
@@ -63,7 +63,7 @@ class LinksTab (gobject.GObject):
self.button.set_focus_on_click(False)
self.button.connect ('clicked',
lambda button : self.emit('switch-tab', 'links'))
- buttons.pack_start (self.button, True, True)
+ buttons.pack_start (self.button, True, True, 0)
def activate (self):
print "activating Links Tab"
@@ -79,8 +79,8 @@ class LinksTab (gobject.GObject):
if entry is None:
return None
- artist = self.db.entry_get (entry, RB.RhythmDBPropType.ARTIST)
- album = self.db.entry_get (entry, RB.RhythmDBPropType.ALBUM)
+ artist = entry.get_string (RB.RhythmDBPropType.ARTIST)
+ album = entry.get_string (RB.RhythmDBPropType.ALBUM)
self.artist = artist
self.album = album
diff --git a/plugins/context/context/LyricsTab.py b/plugins/context/context/LyricsTab.py
index b69930c..92cd4a7 100644
--- a/plugins/context/context/LyricsTab.py
+++ b/plugins/context/context/LyricsTab.py
@@ -57,7 +57,7 @@ class LyricsTab (gobject.GObject):
self.button.set_focus_on_click(False)
self.button.connect ('clicked',
lambda button: self.emit('switch-tab', 'lyrics'))
- toolbar.pack_start (self.button, True, True)
+ toolbar.pack_start (self.button, True, True, 0)
def activate (self):
print "activating Lyrics Tab"
@@ -154,8 +154,8 @@ class LyricsDataSource (gobject.GObject):
self.emit ('lyrics-ready', self.entry, lyrics)
def get_title (self):
- return self.db.entry_get_string(self.entry, RB.RhythmDBPropType.TITLE)
+ return self.entry.get_string (RB.RhythmDBPropType.TITLE)
def get_artist (self):
- return self.db.entry_get_string(self.entry, RB.RhythmDBPropType.ARTIST)
+ return self.entry.get_string (RB.RhythmDBPropType.ARTIST)
diff --git a/shell/rb-plugins-engine.c b/shell/rb-plugins-engine.c
index 2fc751e..a21588d 100644
--- a/shell/rb-plugins-engine.c
+++ b/shell/rb-plugins-engine.c
@@ -152,8 +152,7 @@ rb_plugins_engine_load (const gchar *file)
/* FIXME:
* Blacklist a few plugins that we know not to work,
* and cause crashes */
- if (g_str_equal (str, "upnp_coherence") ||
- g_str_equal (str, "context"))
+ if (g_str_equal (str, "upnp_coherence"))
goto error;
} else {
g_warning ("Could not find 'Module' in %s", file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]