[rhythmbox/gobject-introspection: 32/39] Merge branch 'master' into gobject-introspection



commit 6020a462fbfce8dfec2997498013cbf8be49709f
Merge: 19c7059 1a64c4e
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Nov 6 16:06:09 2010 +1000

    Merge branch 'master' into gobject-introspection
    
    Conflicts:
    	bindings/python/rb.defs
    	bindings/python/rb.override
    	configure.ac
    	lib/gseal-gtk-compat.h
    	plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
    	plugins/coherence/upnp_coherence/__init__.py
    	plugins/jamendo/jamendo/JamendoSource.py
    	plugins/jamendo/jamendo/__init__.py
    	plugins/magnatune/magnatune/MagnatuneSource.py
    	plugins/magnatune/magnatune/__init__.py
    	plugins/visualizer/rb-visualizer-plugin.c
    	shell/rb-shell.c
    	sources/rb-source.c
    	sources/rb-sourcelist-model.c
    	widgets/rb-rating.c

 NEWS                                               |   68 +
 README                                             |    2 +-
 bindings/vala/Makefile.am                          |    2 +-
 configure.ac                                       |    6 +-
 data/rhythmbox.schemas                             |   55 +
 data/ui/rhythmbox-ui.xml                           |    6 +-
 lib/gseal-gtk-compat.h                             |    3 +-
 .../artdisplay/MusicBrainzCoverArtSearch.py        |    3 +
 plugins/audiocd/rb-audiocd-plugin.c                |    2 +-
 plugins/audiocd/rb-audiocd-source.c                |   47 +-
 plugins/audioscrobbler/Makefile.am                 |    4 +-
 .../audioscrobbler/audioscrobbler-profile-ui.xml   |    2 +-
 plugins/audioscrobbler/rb-audioscrobbler-plugin.c  |   70 +-
 ...e-source.c => rb-audioscrobbler-profile-page.c} |  957 ++--
 .../rb-audioscrobbler-profile-page.h               |   71 +
 .../rb-audioscrobbler-profile-source.h             |   69 -
 .../rb-audioscrobbler-radio-source.c               |   85 +-
 .../rb-audioscrobbler-radio-source.h               |    4 +-
 .../rb-disc-recorder-plugin.c                      |   57 +-
 plugins/coherence/upnp_coherence/__init__.py       |    5 +-
 plugins/daap/Makefile.am                           |    4 +-
 plugins/daap/rb-daap-plugin.c                      |   15 +-
 plugins/daap/rb-daap-source.c                      |   76 +-
 plugins/daap/rb-dacp-pairing-page.c                |  643 ++
 .../{rb-dacp-source.h => rb-dacp-pairing-page.h}   |   42 +-
 plugins/daap/rb-dacp-source.c                      |  656 --
 plugins/fmradio/rb-fm-radio-plugin.c               |    5 +-
 plugins/fmradio/rb-fm-radio-source.c               |   26 +-
 .../rb-generic-player-playlist-source.c            |    9 +-
 plugins/generic-player/rb-generic-player-plugin.c  |   22 +-
 plugins/generic-player/rb-generic-player-source.c  |   50 +-
 plugins/generic-player/rb-nokia770-source.c        |    1 -
 plugins/generic-player/rb-psp-source.c             |    1 -
 plugins/ipod/rb-ipod-db.c                          |   29 +
 plugins/ipod/rb-ipod-plugin.c                      |   28 +-
 plugins/ipod/rb-ipod-source.c                      |  174 +-
 plugins/ipod/rb-ipod-static-playlist-source.c      |   53 +-
 plugins/ipod/rb-ipod-static-playlist-source.h      |    2 +
 plugins/iradio/rb-iradio-plugin.c                  |    5 +-
 plugins/iradio/rb-iradio-source.c                  |   45 +-
 plugins/jamendo/jamendo/JamendoSource.py           |   10 +-
 plugins/jamendo/jamendo/__init__.py                |    7 +-
 plugins/magnatune/magnatune/MagnatuneSource.py     |   12 +-
 plugins/magnatune/magnatune/__init__.py            |    7 +-
 plugins/mtpdevice/rb-mtp-plugin.c                  |   22 +-
 plugins/mtpdevice/rb-mtp-source.c                  |   26 +-
 plugins/visualizer/rb-visualizer-plugin.c          |   10 +-
 po/LINGUAS                                         |    1 +
 po/POTFILES.in                                     |   10 +-
 po/bg.po                                           | 2670 +++++----
 po/ca valencia po                                  | 6603 ++++++++++++++++++++
 po/cs.po                                           |  784 ++--
 po/da.po                                           |   56 +-
 po/hu.po                                           | 1532 +++--
 po/it.po                                           | 1702 +++---
 po/nb.po                                           | 1784 +++---
 po/pa.po                                           | 2116 ++++---
 po/pl.po                                           |    8 +-
 po/pt_BR.po                                        | 1747 +++---
 podcast/rb-podcast-main-source.c                   |   15 +-
 podcast/rb-podcast-source.c                        |   51 +-
 shell/rb-playlist-manager.c                        |  191 +-
 shell/rb-playlist-manager.h                        |    7 +-
 shell/rb-removable-media-manager.c                 |    6 +-
 shell/rb-shell-clipboard.c                         |   40 +-
 shell/rb-shell-player.c                            |   27 +-
 shell/rb-shell-preferences.c                       |   10 +-
 shell/rb-shell.c                                   |  543 +-
 shell/rb-shell.h                                   |   20 +-
 shell/rb-statusbar.c                               |   91 +-
 shell/rb-statusbar.h                               |    6 +-
 sources/Makefile.am                                |   14 +-
 sources/rb-auto-playlist-source.c                  |   35 +-
 sources/rb-browser-source.c                        |   20 +-
 sources/rb-display-page-group.c                    |  351 ++
 sources/rb-display-page-group.h                    |   95 +
 sources/rb-display-page-model.c                    |  868 +++
 sources/rb-display-page-model.h                    |   93 +
 sources/rb-display-page-tree.c                     | 1095 ++++
 sources/rb-display-page-tree.h                     |   81 +
 sources/rb-display-page.c                          |  749 +++
 sources/rb-display-page.h                          |  112 +
 sources/rb-import-errors-source.c                  |   16 +-
 sources/rb-library-source.c                        |   53 +-
 sources/rb-media-player-source.c                   |    8 +-
 sources/rb-missing-files-source.c                  |   16 +-
 sources/rb-play-queue-source.c                     |   29 +-
 sources/rb-playlist-source.c                       |   34 +-
 sources/rb-removable-media-source.c                |   29 +-
 sources/rb-source-group.c                          |  254 -
 sources/rb-source-group.h                          |   85 -
 sources/rb-source.c                                |  835 +---
 sources/rb-source.h                                |   44 +-
 sources/rb-sourcelist-model.c                      |  648 --
 sources/rb-sourcelist-model.h                      |   89 -
 sources/rb-sourcelist.c                            | 1417 -----
 sources/rb-sourcelist.h                            |   94 -
 sources/rb-static-playlist-source.c                |   23 +-
 sources/rb-streaming-source.c                      |    6 +-
 widgets/gossip-cell-renderer-expander.c            |   50 +-
 widgets/gossip-cell-renderer-expander.h            |    9 +-
 widgets/rb-rating.c                                |    4 +
 widgets/rb-uri-dialog.c                            |   35 +
 103 files changed, 19676 insertions(+), 11133 deletions(-)
---
diff --cc bindings/vala/Makefile.am
index f0ac8e3,0b542d3..e13bf65
--- a/bindings/vala/Makefile.am
+++ b/bindings/vala/Makefile.am
@@@ -1,17 -1,11 +1,17 @@@
- vapidir = $(VAPIDIR)
+ vapidir = $(datadir)/vala/vapi
  
 -vapi_VAPI = 			\
 -	rb.vapi			\
 -	rhythmdb.vapi
 -
 -dist_noinst_DATA = 		\
 +vapi_DATA = 			\
  	rb.deps			\
 -	rhythmdb.deps
 +	rb.vapi
 +
 +VAPIGEN_PKG = --pkg atk --pkg gtk+-2.0 --pkg gdk-pixbuf-2.0 --pkg gstreamer-0.10 --pkg libxml-2.0
 +
 +RB-0.13.vala.gir: $(top_builddir)/bindings/gi/RB-0.13.gir
 +	sed -e 's/libxml2.NodePtr/Xml.Node/' -e 's/GdkPixbuf.Pixbuf/Gdk.Pixbuf/' -e 's/libxml2.Char/utf8/' < $< > $  tmp
 +	mv $  tmp $@
 +# -e 's/<alias.*//'
 +
 +rb.vapi: RB-0.13.vala.gir
 +	$(VAPIGEN) $(VAPIGEN_PKG) --vapidir $(top_builddir)/bindings/vala --library rb $<
  
 -EXTRA_DIST = $(vapi_VAPI)
 +CLEANFILES = rb.vapi RB-0.13.vala.gir
diff --cc plugins/coherence/upnp_coherence/__init__.py
index 388324d,97c425a..1142b19
--- a/plugins/coherence/upnp_coherence/__init__.py
+++ b/plugins/coherence/upnp_coherence/__init__.py
@@@ -250,7 -252,7 +250,7 @@@ class CoherencePlugin(RB.Plugin, log.Lo
              return
  
          db = self.shell.props.db
-         group = RB.rb_source_group_get_by_name("shared")
 -        group = rb.rb_display_page_group_get_by_id ("shared")
++        group = RB.display_page_group_get_by_id ("shared")
  
          from UpnpSource import UpnpSource
          source = gobject.new (UpnpSource,
diff --cc plugins/jamendo/jamendo/JamendoSource.py
index 7c6e572,9481962..adab830
--- a/plugins/jamendo/jamendo/JamendoSource.py
+++ b/plugins/jamendo/jamendo/JamendoSource.py
@@@ -163,8 -161,7 +162,7 @@@ class JamendoSource(RB.BrowserSource)
  			self.__catalogue_check.cancel()
  			self.__catalogue_check = None
  
 -		gconf.client_get_default().set_string(JamendoConfigureDialog.gconf_keys['sorting'], self.get_entry_view().get_sorting_type())
 +		GConf.Client.get_default().set_string(JamendoConfigureDialog.gconf_keys['sorting'], self.get_entry_view().get_sorting_type())
- 		# RB.BrowserSource.do_impl_delete_thyself (self)
  
  
  	#
diff --cc plugins/jamendo/jamendo/__init__.py
index 5304167,9ad2d11..926b27f
--- a/plugins/jamendo/jamendo/__init__.py
+++ b/plugins/jamendo/jamendo/__init__.py
@@@ -78,13 -73,13 +78,13 @@@ class Jamendo(RB.Plugin)
  		self.entry_type = JamendoEntryType()
  		self.db.register_entry_type(self.entry_type)
  
 -		theme = gtk.icon_theme_get_default()
 +		theme = Gtk.icon_theme_get_default()
  		rb.append_plugin_source_path(theme, "/icons/")
  
 -		width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
 +		what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
  		icon = rb.try_load_icon(theme, "jamendo", width, 0)
  
- 		group = RB.Source.group_get_by_name ("stores")	# RB.SourceGroup.get_by_name()?
 -		group = rb.rb_display_page_group_get_by_id ("stores")
++		group = RB.display_page_group_get_by_id ("stores")	# RB.DisplayPageGroup.get_by_id()?
  		self.source = gobject.new (JamendoSource,
  					   shell=shell,
  					   entry_type=self.entry_type,
diff --cc plugins/magnatune/magnatune/MagnatuneSource.py
index a379ca8,02c19a2..72df8b1
--- a/plugins/magnatune/magnatune/MagnatuneSource.py
+++ b/plugins/magnatune/magnatune/MagnatuneSource.py
@@@ -157,12 -156,12 +155,12 @@@ class MagnatuneSource(RB.BrowserSource)
  		return False
  
  	def do_impl_pack_paned(self, paned):
 -		self.__paned_box = gtk.VBox(False, 5)
 -		self.pack_start(self.__paned_box)
 -		self.__paned_box.pack_start(paned)
 +		self.__paned_box = Gtk.VBox(homogeneous=False, spacing=5)
 +		self.pack_start(self.__paned_box, True, True, 0)
 +		self.__paned_box.pack_start(paned, True, True, 0)
  
  
- 	def do_impl_delete_thyself(self):
+ 	def do_delete_thyself(self):
  		if self.__update_id != 0:
  			gobject.source_remove(self.__update_id)
  			self.__update_id = 0
@@@ -181,8 -180,6 +179,8 @@@
  
  		self.__client.set_string("/apps/rhythmbox/plugins/magnatune/sorting", self.get_entry_view().get_sorting_type())
  
- 		RB.BrowserSource.do_impl_delete_thyself(self)
++		RB.BrowserSource.do_delete_thyself(self)
 +
  	#
  	# methods for use by plugin and UI
  	#
diff --cc plugins/magnatune/magnatune/__init__.py
index a0ccd43,28b7c40..9879226
--- a/plugins/magnatune/magnatune/__init__.py
+++ b/plugins/magnatune/magnatune/__init__.py
@@@ -95,13 -92,13 +95,13 @@@ class Magnatune(RB.Plugin)
  		self.entry_type = MagnatuneEntryType()
  		self.db.register_entry_type(self.entry_type)
  
 -		theme = gtk.icon_theme_get_default()
 +		theme = Gtk.IconTheme.get_default()
  		rb.append_plugin_source_path(theme, "/icons")
  
 -		width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
 +		what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
  		icon = rb.try_load_icon(theme, "magnatune", width, 0)
  
- 		group = RB.Source.group_get_by_name("stores")		# XXX should be RB.SourceGroup.get_by_name()
 -		group = rb.rb_display_page_group_get_by_id ("stores")
++		group = RB.display_page_group_get_by_id ("stores")
  		self.source = gobject.new(MagnatuneSource,
  					  shell=shell,
  					  entry_type=self.entry_type,
diff --cc shell/rb-shell.c
index 78234c4,8ced9e9..8de2c58
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@@ -2003,32 -1988,29 +1988,29 @@@ rb_shell_register_entry_type_for_sourc
  }
  
  /**
-  * rb_shell_append_source:
+  * rb_shell_append_display_page:
   * @shell: the #RBShell
-  * @source: the new #RBSource
-  * @parent: (allow-none): the parent source for the new source
+  * @page: the new #RBDisplayPage
 - * @parent: the parent page for the new page (optional)
++ * @parent: (allow-none): the parent page for the new page
   *
-  * Registers a new source with the shell.  All sources must be
-  * registered.
+  * Adds a new display page to the shell.
   */
  void
- rb_shell_append_source (RBShell *shell,
- 			RBSource *source,
- 			RBSource *parent)
+ rb_shell_append_display_page (RBShell *shell, RBDisplayPage *page, RBDisplayPage *parent)
  {
- 	shell->priv->sources
- 		= g_list_append (shell->priv->sources, source);
+ 	if (RB_IS_SOURCE (page)) {
+ 		shell->priv->sources = g_list_append (shell->priv->sources, RB_SOURCE (page));
+ 	}
  
- 	g_signal_connect_object (G_OBJECT (source), "deleted",
- 				 G_CALLBACK (rb_shell_source_deleted_cb), shell, 0);
+ 	g_signal_connect_object (G_OBJECT (page), "deleted",
+ 				 G_CALLBACK (rb_shell_display_page_deleted_cb), shell, 0);
  
  	gtk_notebook_append_page (GTK_NOTEBOOK (shell->priv->notebook),
- 				  GTK_WIDGET (source),
+ 				  GTK_WIDGET (page),
  				  gtk_label_new (""));
- 	gtk_widget_show (GTK_WIDGET (source));
+ 	gtk_widget_show (GTK_WIDGET (page));
  
- 	rb_sourcelist_append (RB_SOURCELIST (shell->priv->sourcelist),
- 			      source, parent);
+ 	rb_display_page_model_add_page (shell->priv->display_page_model, page, parent);
  }
  
  static void
diff --cc sources/rb-display-page.c
index 0000000,f06c904..c69580e
mode 000000,100644..100644
--- a/sources/rb-display-page.c
+++ b/sources/rb-display-page.c
@@@ -1,0 -1,724 +1,749 @@@
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+  *
+  *  Copyright (C) 2010 Jonathan Matthew <jonathan d14n org>
+  *
+  *  This program is free software; you can redistribute it and/or modify
+  *  it under the terms of the GNU General Public License as published by
+  *  the Free Software Foundation; either version 2 of the License, or
+  *  (at your option) any later version.
+  *
+  *  The Rhythmbox authors hereby grant permission for non-GPL compatible
+  *  GStreamer plugins to be used and distributed together with GStreamer
+  *  and Rhythmbox. This permission is above and beyond the permissions granted
+  *  by the GPL license by which Rhythmbox is covered. If you modify this code
+  *  you may extend this exception to your version of the code, but you are not
+  *  obligated to do so. If you do not wish to do so, delete this exception
+  *  statement from your version.
+  *
+  *  This program is distributed in the hope that it will be useful,
+  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  *  GNU General Public License for more details.
+  *
+  *  You should have received a copy of the GNU General Public License
+  *  along with this program; if not, write to the Free Software
+  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
+  *
+  */
+ 
+ #include "config.h"
+ 
+ #include "rb-display-page.h"
+ #include "rb-plugin.h"
+ #include "rb-debug.h"
+ #include "rb-util.h"
+ 
+ G_DEFINE_ABSTRACT_TYPE (RBDisplayPage, rb_display_page, GTK_TYPE_HBOX)
+ 
+ /**
+  * SECTION:rb-display-page
+  * @short_description: base class for items that appear in the display page tree
+  *
+  * This is the base class for items that appear in the display page tree and can
+  * occupy the main display area.  Sources and source groups are display pages.
+  * Other types of display, such as music visualization, could be implemented as
+  * display pages too.
+  *
+  * The display page object itself is the widget shown in the main display area.
+  * The pixbuf and name properties control its appearance in the display page
+  * tree, and its location is determined by its parent display page, the sorting
+  * rules for its source group (if any), and insertion order.  The visibility property
+  * controls whether the display page is actually shown in the display page tree at all.
+  */
+ 
+ struct _RBDisplayPagePrivate
+ {
+ 	char *name;
+ 	gboolean visible;
+ 	GdkPixbuf *pixbuf;
+ 	RBDisplayPage *parent;
+ 
+ 	RBPlugin *plugin;
+ 	RBShell *shell;
+ 
+ 	gboolean deleted;
+ };
+ 
+ enum
+ {
+ 	PROP_0,
+ 	PROP_SHELL,
+ 	PROP_UI_MANAGER,
+ 	PROP_NAME,
+ 	PROP_PIXBUF,
+ 	PROP_VISIBLE,
+ 	PROP_PARENT,
+ 	PROP_PLUGIN,
+ };
+ 
+ enum
+ {
+ 	STATUS_CHANGED,
+ 	DELETED,
+ 	LAST_SIGNAL
+ };
+ 
+ static guint signals[LAST_SIGNAL] = { 0 };
+ 
+ /**
+  * rb_display_age_receive_drag:
+  * @page: a #RBDisplayPage
+  * @data: the selection data
+  *
+  * This is called when the user drags something to the page.
+  * Depending on the drag data type, the data might be a list of
+  * #RhythmDBEntry objects, a list of URIs, or a list of album
+  * or artist or genre names.
+  *
+  * Return value: TRUE if the page accepted the drag data
+  */
+ gboolean
+ rb_display_page_receive_drag (RBDisplayPage *page, GtkSelectionData *data)
+ {
+ 	RBDisplayPageClass *klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 
+ 	if (klass->receive_drag)
+ 		return klass->receive_drag (page, data);
+ 	else
+ 		return FALSE;
+ }
+ 
+ /**
+  * rb_display_page_show_popup:
+  * @page: a #RBDisplayPage
+  *
+  * Called when the user performs an action (such as right-clicking)
+  * that should result in a popup menu being displayed for the page.
+  *
+  * Return value: TRUE if the page managed to display a popup
+  */
+ gboolean
+ rb_display_page_show_popup (RBDisplayPage *page)
+ {
+ 	RBDisplayPageClass *klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 
+ 	if (klass->show_popup)
+ 		return klass->show_popup (page);
+ 	else
+ 		return FALSE;
+ }
+ 
+ /**
+  * rb_display_page_delete_thyself:
+  * @page: a #RBDisplayPage
+  *
+  * This is called when the page should delete itself.
+  * The 'deleted' signal will be emitted, which removes the page
+  * from the page model.  This will not actually dispose of the
+  * page object, so reference counting must still be handled
+  * correctly.
+  */
+ void
+ rb_display_page_delete_thyself (RBDisplayPage *page)
+ {
+ 	RBDisplayPageClass *klass;
+ 
+ 	g_return_if_fail (page != NULL);
+ 	if (page->priv->deleted) {
+ 		rb_debug ("source has already been deleted");
+ 		return;
+ 	}
+ 	page->priv->deleted = TRUE;
+ 
+ 	klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 	klass->delete_thyself (page);
+ 
+ 	g_signal_emit (G_OBJECT (page), signals[DELETED], 0);
+ }
+ 
+ /**
+  * rb_display_page_selectable:
+  * @page: a #RBDisplayPage
+  *
+  * Checks if @page can be selected
+  */
+ gboolean
+ rb_display_page_selectable (RBDisplayPage *page)
+ {
+ 	RBDisplayPageClass *klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 	if (klass->selectable)
+ 		return klass->selectable (page);
+ 	else
+ 		return TRUE;
+ }
+ 
+ /**
+  * rb_display_page_selected:
+  * @page: a #RBDisplayPage
+  *
+  * Called when the page is selected in the page tree.
+  */
+ void
+ rb_display_page_selected (RBDisplayPage *page)
+ {
+ 	RBDisplayPageClass *klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 
+ 	if (klass->selected)
+ 		klass->selected (page);
+ }
+ 
+ /**
+  * rb_display_page_deselected:
+  * @page: a #RBDisplayPage
+  *
+  * Called when the page is deselected in the page tree.
+  */
+ void
+ rb_display_page_deselected (RBDisplayPage *page)
+ {
+ 	RBDisplayPageClass *klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 
+ 	if (klass->deselected)
+ 		klass->deselected (page);
+ }
+ 
+ /**
+  * rb_display_page_activate:
+  * @page: a #RBDisplayPage
+  *
+  * Called when the page is activated (double clicked, etc.) in the page tree.
+  */
+ void
+ rb_display_page_activate (RBDisplayPage *page)
+ {
+ 	RBDisplayPageClass *klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 
+ 	if (klass->activate)
+ 		klass->activate (page);
+ }
+ 
+ 
+ /**
+  * rb_display_page_get_config_widget:
+  * @page: a #RBDisplayPage
+  * @prefs: the #RBShellPreferences object
+  *
+  * Source implementations can use this to return an optional
+  * configuration widget. The widget will be displayed in a
+  * page in the preferences dialog.
+  *
 - * Return value: configuration widget
++ * Return value: (transfer none): configuration widget
+  */
+ GtkWidget *
+ rb_display_page_get_config_widget (RBDisplayPage *page,
+ 				   RBShellPreferences *prefs)
+ {
+ 	RBDisplayPageClass *klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 
+ 	if (klass->get_config_widget) {
+ 		return klass->get_config_widget (page, prefs);
+ 	} else {
+ 		return NULL;
+ 	}
+ }
+ 
+ /**
+  * rb_display_page_get_ui_actions:
+  * @page: a #RBDisplayPage
+  *
+  * Returns a list of UI action names.  Items for
+  * these actions will be added to the toolbar.
+  *
 - * Return value: list of action names
++ * Return value: (element-type utf8) (transfer full): list of action names
+  */
+ GList *
+ rb_display_page_get_ui_actions (RBDisplayPage *page)
+ {
+ 	RBDisplayPageClass *klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 
+ 	if (klass->get_ui_actions)
+ 		return klass->get_ui_actions (page);
+ 	else
+ 		return NULL;
+ }
+ 
+ /**
+  * rb_display_page_get_status:
+  * @page: a #RBDisplayPage
 - * @text: holds the returned status text (allocated)
 - * @progress_text: holds the returned text for the progress bar (allocated)
 - * @progress: holds the progress value
++ * @text: (inout) (allow-none) (transfer full): holds the returned status text
++ * @progress_text: (inout) (allow-none) (transfer full): holds the returned text for the progress bar
++ * @progress: (inout) (allow-none): holds the progress value
+  *
+  * Retrieves the details to display in the status bar for the page.
+  * If the progress value returned is less than zero, the progress bar
+  * will pulse.  If the progress value is greater than or equal to 1,
+  * the progress bar will be hidden.
+  **/
+ void
+ rb_display_page_get_status (RBDisplayPage *page,
+ 			    char **text,
+ 			    char **progress_text,
+ 			    float *progress)
+ {
+ 	RBDisplayPageClass *klass = RB_DISPLAY_PAGE_GET_CLASS (page);
+ 
+ 	if (klass->get_status)
+ 		klass->get_status (page, text, progress_text, progress);
+ }
+ 
+ /**
+  * _rb_display_page_notify_status_changed:
+  * @page: a #RBDisplayPage
+  *
+  * Page implementations call this when their status bar information
+  * changes.
+  */
+ void
+ _rb_display_page_notify_status_changed (RBDisplayPage *page)
+ {
+ 	g_signal_emit (G_OBJECT (page), signals[STATUS_CHANGED], 0);
+ }
+ 
+ /**
+  * _rb_display_page_show_popup:
+  * @page: a #RBDisplayPage
+  * @ui_path: UI path to the popup to show
+  *
+  * Page implementations can use this as a shortcut to
+  * display a popup that has been loaded into the UI manager.
+  */
+ void
+ _rb_display_page_show_popup (RBDisplayPage *page, const char *ui_path)
+ {
+ 	GtkUIManager *uimanager;
+ 
+ 	g_object_get (page->priv->shell, "ui-manager", &uimanager, NULL);
+ 	rb_gtk_action_popup_menu (uimanager, ui_path);
+ 	g_object_unref (uimanager);
+ }
+ 
+ static GtkActionGroup *
+ find_action_group (GtkUIManager *uimanager, const char *group_name)
+ {
+ 	GList *actiongroups;
+ 	GList *i;
+ 	actiongroups = gtk_ui_manager_get_action_groups (uimanager);
+ 
+ 	/* Don't create the action group if it's already registered */
+ 	for (i = actiongroups; i != NULL; i = i->next) {
+ 		const char *name;
+ 
+ 		name = gtk_action_group_get_name (GTK_ACTION_GROUP (i->data));
+ 		if (g_strcmp0 (name, group_name) == 0) {
+ 			return GTK_ACTION_GROUP (i->data);
+ 		}
+ 	}
+ 
+ 	return NULL;
+ }
+ 
+ /**
+  * _rb_display_page_register_action_group:
+  * @page: a #RBDisplayPage
+  * @group_name: action group name
+  * @actions: array of GtkActionEntry structures for the action group
+  * @num_actions: number of actions in the @actions array
+  * @user_data: user data to use for action signal handlers
+  *
+  * Creates and registers a GtkActionGroup for the page.
+  *
+  * Return value: the created action group
+  */
+ GtkActionGroup *
+ _rb_display_page_register_action_group (RBDisplayPage *page,
+ 					const char *group_name,
+ 					GtkActionEntry *actions,
+ 					int num_actions,
+ 					gpointer user_data)
+ {
+ 	GtkUIManager *uimanager;
+ 	GtkActionGroup *group;
+ 
+ 	g_return_val_if_fail (group_name != NULL, NULL);
+ 
+ 	g_object_get (page, "ui-manager", &uimanager, NULL);
+ 	group = find_action_group (uimanager, group_name);
+ 	if (group == NULL) {
+ 		group = gtk_action_group_new (group_name);
+ 		gtk_action_group_set_translation_domain (group,
+ 							 GETTEXT_PACKAGE);
+ 		if (actions != NULL) {
+ 			gtk_action_group_add_actions (group,
+ 						      actions, num_actions,
+ 						      user_data);
+ 		}
+ 		gtk_ui_manager_insert_action_group (uimanager, group, 0);
+ 	} else {
+ 		g_object_ref (group);
+ 	}
+ 	g_object_unref (uimanager);
+ 
+ 	return group;
+ }
+ 
+ typedef void (*DisplayPageActionCallback) (GtkAction *action, RBDisplayPage *page);
+ 
+ typedef struct {
+ 	DisplayPageActionCallback callback;
+ 	gpointer shell;
+ } DisplayPageActionData;
+ 
+ static void
+ display_page_action_data_destroy (DisplayPageActionData *data)
+ {
+ 	if (data->shell != NULL) {
+ 		g_object_remove_weak_pointer (G_OBJECT (data->shell), &data->shell);
+ 	}
+ 	g_slice_free (DisplayPageActionData, data);
+ }
+ 
+ static void
+ display_page_action_cb (GtkAction *action, DisplayPageActionData *data)
+ {
+ 	RBDisplayPage *page;
+ 
+ 	if (data->shell == NULL) {
+ 		return;
+ 	}
+ 
+ 	/* get current page */
+ 	g_object_get (data->shell, "selected-page", &page, NULL);
+ 	if (page != NULL) {
+ 		data->callback (action, page);
+ 		g_object_unref (page);
+ 	}
+ }
+ 
+ /**
+  * _rb_action_group_add_display_page_actions:
+  * @group: a #GtkActionGroup
+  * @shell: the #RBShell
+  * @actions: array of GtkActionEntry structures for the action group
+  * @num_actions: number of actions in the @actions array
+  *
+  * Adds actions to an action group where the action callback is
+  * called with the current selected display page.  This can safely be called
+  * multiple times on the same action group.
+  */
+ void
+ _rb_action_group_add_display_page_actions (GtkActionGroup *group,
+ 					   GObject *shell,
+ 					   GtkActionEntry *actions,
+ 					   int num_actions)
+ {
+ 	int i;
+ 	for (i = 0; i < num_actions; i++) {
+ 		GtkAction *action;
+ 		const char *label;
+ 		const char *tooltip;
+ 		DisplayPageActionData *page_action_data;
+ 
+ 		if (gtk_action_group_get_action (group, actions[i].name) != NULL) {
+ 			/* action was already added */
+ 			continue;
+ 		}
+ 
+ 		label = gtk_action_group_translate_string (group, actions[i].label);
+ 		tooltip = gtk_action_group_translate_string (group, actions[i].tooltip);
+ 
+ 		action = gtk_action_new (actions[i].name, label, tooltip, NULL);
+ 		if (actions[i].stock_id != NULL) {
+ 			g_object_set (action, "stock-id", actions[i].stock_id, NULL);
+ 			if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
+ 						     actions[i].stock_id)) {
+ 				g_object_set (action, "icon-name", actions[i].stock_id, NULL);
+ 			}
+ 		}
+ 
+ 		if (actions[i].callback) {
+ 			GClosure *closure;
+ 			page_action_data = g_slice_new0 (DisplayPageActionData);
+ 			page_action_data->callback = (DisplayPageActionCallback) actions[i].callback;
+ 			page_action_data->shell = shell;
+ 			g_object_add_weak_pointer (shell, &page_action_data->shell);
+ 
+ 			closure = g_cclosure_new (G_CALLBACK (display_page_action_cb),
+ 						  page_action_data,
+ 						  (GClosureNotify) display_page_action_data_destroy);
+ 			g_signal_connect_closure (action, "activate", closure, FALSE);
+ 		}
+ 
+ 		gtk_action_group_add_action_with_accel (group, action, actions[i].accelerator);
+ 		g_object_unref (action);
+ 	}
+ }
+ 
+ static void
+ impl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+ {
+ 	RBDisplayPage *page = RB_DISPLAY_PAGE (object);
+ 
+ 	switch (prop_id) {
+ 	case PROP_SHELL:
+ 		g_value_set_object (value, page->priv->shell);
+ 		break;
+ 	case PROP_UI_MANAGER:
+ 		{
+ 			GtkUIManager *manager;
+ 			g_object_get (page->priv->shell, "ui-manager", &manager, NULL);
+ 			g_value_set_object (value, manager);
+ 			g_object_unref (manager);
+ 			break;
+ 		}
+ 	case PROP_NAME:
+ 		g_value_set_string (value, page->priv->name);
+ 		break;
+ 	case PROP_PIXBUF:
+ 		g_value_set_object (value, page->priv->pixbuf);
+ 		break;
+ 	case PROP_VISIBLE:
+ 		g_value_set_boolean (value, page->priv->visible);
+ 		break;
+ 	case PROP_PARENT:
+ 		g_value_set_object (value, page->priv->parent);
+ 		break;
+ 	case PROP_PLUGIN:
+ 		g_value_set_object (value, page->priv->plugin);
+ 		break;
+ 	default:
+ 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ 		break;
+ 	}
+ }
+ 
+ static void
+ impl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+ {
+ 	RBDisplayPage *page = RB_DISPLAY_PAGE (object);
+ 
+ 	switch (prop_id) {
+ 	case PROP_SHELL:
+ 		page->priv->shell = g_value_get_object (value);
+ 		break;
+ 	case PROP_NAME:
+ 		g_free (page->priv->name);
+ 		page->priv->name = g_value_dup_string (value);
+ 		break;
+ 	case PROP_PIXBUF:
+ 		if (page->priv->pixbuf) {
+ 			g_object_unref (page->priv->pixbuf);
+ 		}
+ 		page->priv->pixbuf = g_value_dup_object (value);
+ 		break;
+ 	case PROP_VISIBLE:
+ 		page->priv->visible = g_value_get_boolean (value);
+ 		break;
+ 	case PROP_PARENT:
+ 		page->priv->parent = g_value_get_object (value);
+ 		break;
+ 	case PROP_PLUGIN:
+ 		page->priv->plugin = g_value_get_object (value);
+ 		break;
+ 	default:
+ 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ 		break;
+ 	}
+ }
+ 
+ static void
+ impl_delete_thyself (RBDisplayPage *page)
+ {
+ }
+ 
+ static void
+ impl_dispose (GObject *object)
+ {
+ 	RBDisplayPage *page;
+ 
+ 	g_return_if_fail (object != NULL);
+ 	g_return_if_fail (RB_IS_DISPLAY_PAGE (object));
+ 	page = RB_DISPLAY_PAGE (object);
+ 
+ 	rb_debug ("Disposing page %s", page->priv->name);
+ 	if (page->priv->pixbuf != NULL) {
+ 		g_object_unref (page->priv->pixbuf);
+ 		page->priv->pixbuf = NULL;
+ 	}
+ 
+ 	G_OBJECT_CLASS (rb_display_page_parent_class)->dispose (object);
+ }
+ 
+ static void
+ impl_finalize (GObject *object)
+ {
+ 	RBDisplayPage *page;
+ 
+ 	g_return_if_fail (object != NULL);
+ 	g_return_if_fail (RB_IS_DISPLAY_PAGE (object));
+ 	page = RB_DISPLAY_PAGE (object);
+ 
+ 	rb_debug ("finalizing page %s", page->priv->name);
+ 
+ 	g_free (page->priv->name);
+ 
+ 	G_OBJECT_CLASS (rb_display_page_parent_class)->finalize (object);
+ }
+ 
+ static void
+ rb_display_page_init (RBDisplayPage *page)
+ {
+ 	page->priv = G_TYPE_INSTANCE_GET_PRIVATE (page, RB_TYPE_DISPLAY_PAGE, RBDisplayPagePrivate);
+ 
+ 	page->priv->visible = TRUE;
+ }
+ 
+ static void
+ rb_display_page_class_init (RBDisplayPageClass *klass)
+ {
+ 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ 
+ 	object_class->dispose = impl_dispose;
+ 	object_class->finalize = impl_finalize;
+ 
+ 	object_class->set_property = impl_set_property;
+ 	object_class->get_property = impl_get_property;
+ 
+ 	klass->delete_thyself = impl_delete_thyself;
+ 
+ 	/**
+ 	 * RBDisplayPage:shell:
+ 	 *
+ 	 * The rhythmbox shell object
+ 	 */
+ 	g_object_class_install_property (object_class,
+ 					 PROP_SHELL,
+ 					 g_param_spec_object ("shell",
+ 							      "RBShell",
+ 							      "RBShell object",
+ 							      RB_TYPE_SHELL,
+ 							      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ 	/**
+ 	 * RBDisplayPage:ui-manager:
+ 	 *
+ 	 * The Gtk UIManager object
+ 	 */
+ 	g_object_class_install_property (object_class,
+ 					 PROP_UI_MANAGER,
+ 					 g_param_spec_object ("ui-manager",
+ 							      "GtkUIManager",
+ 							      "GtkUIManager object",
+ 							      GTK_TYPE_UI_MANAGER,
+ 							      G_PARAM_READABLE));
+ 	/**
+ 	 * RBDisplayPage:name:
+ 	 *
+ 	 * Page name as displayed in the tree
+ 	 */
+ 	g_object_class_install_property (object_class,
+ 					 PROP_NAME,
+ 					 g_param_spec_string ("name",
+ 							      "UI name",
+ 							      "Interface name",
+ 							      NULL,
+ 							      G_PARAM_READWRITE));
+ 	/**
+ 	 * RBDisplayPage:pixbuf:
+ 	 *
+ 	 * Pixbuf to display in the page tree
+ 	 */
+ 	g_object_class_install_property (object_class,
+ 					 PROP_PIXBUF,
+ 					 g_param_spec_object ("pixbuf",
+ 							      "Pixbuf",
+ 							      "Page pixbuf",
+ 							      GDK_TYPE_PIXBUF,
+ 							      G_PARAM_READWRITE));
+ 	/**
+ 	 * RBDisplayPage:visibility:
+ 	 *
+ 	 * If FALSE, the page will not be displayed in the tree
+ 	 */
+ 	g_object_class_install_property (object_class,
+ 					 PROP_VISIBLE,
+ 					 g_param_spec_boolean ("visibility",
+ 							       "visibility",
+ 							       "Whether the page should be displayed in the tree",
+ 							       TRUE,
+ 							       G_PARAM_READWRITE));
+ 	/**
+ 	 * RBDisplayPage:parent:
+ 	 *
+ 	 * The parent page in the tree (may be NULL)
+ 	 */
+ 	g_object_class_install_property (object_class,
+ 					 PROP_PARENT,
+ 					 g_param_spec_object ("parent",
+ 							      "Parent",
+ 							      "Parent page",
+ 							      RB_TYPE_DISPLAY_PAGE,
+ 							      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ 	/**
+ 	 * RBDisplayPage:plugin:
+ 	 *
+ 	 * The plugin that created this page.
+ 	 */
+ 	g_object_class_install_property (object_class,
+ 					 PROP_PLUGIN,
+ 					 g_param_spec_object ("plugin",
+ 							      "RBPlugin",
+ 							      "RBPlugin instance for the plugin that created the page",
+ 							      RB_TYPE_PLUGIN,
+ 							      G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ 	/**
+ 	 * RBDisplayPage::deleted:
+ 	 * @page: the #RBDisplayPage
+ 	 *
+ 	 * Emitted when the page is being deleted.
+ 	 */
+ 	signals[DELETED] =
+ 		g_signal_new ("deleted",
+ 			      RB_TYPE_DISPLAY_PAGE,
+ 			      G_SIGNAL_RUN_LAST,
+ 			      G_STRUCT_OFFSET (RBDisplayPageClass, deleted),
+ 			      NULL, NULL,
+ 			      g_cclosure_marshal_VOID__VOID,
+ 			      G_TYPE_NONE,
+ 			      0);
+ 	/**
+ 	 * RBDisplayPage::status-changed:
+ 	 * @page: the #RBDisplayPage
+ 	 *
+ 	 * Emitted when the page's status changes.
+ 	 */
+ 	signals[STATUS_CHANGED] =
+ 		g_signal_new ("status_changed",
+ 			      RB_TYPE_DISPLAY_PAGE,
+ 			      G_SIGNAL_RUN_LAST,
+ 			      G_STRUCT_OFFSET (RBDisplayPageClass, status_changed),
+ 			      NULL, NULL,
+ 			      g_cclosure_marshal_VOID__VOID,
+ 			      G_TYPE_NONE,
+ 			      0);
+ 
+ 	g_type_class_add_private (object_class, sizeof (RBDisplayPagePrivate));
+ }
++
++/* introspection annotations for vmethods */
++
++/**
++ * impl_get_status:
++ * @source: a #RBSource
++ * @text: (inout) (allow-none) (transfer full): holds the returned status text
++ * @progress_text: (inout) (allow-none) (transfer full): holds the returned text for the progress bar
++ * @progress: (inout): holds the progress value
++ */
++
++/**
++ * impl_get_config_widget:
++ * @source: a #RBSource
++ * @prefs: a #RBShellPreferences
++ *
++ * Return value: (transfer none): configuration widget
++ */
++
++/**
++ * impl_get_ui_actions:
++ * @source: a #RBSource
++ *
++ * Return value: (element-type utf8) (transfer full): list of action names
++ */
diff --cc sources/rb-source.c
index 65125c0,aef06d0..a50cbc7
--- a/sources/rb-source.c
+++ b/sources/rb-source.c
@@@ -2007,69 -1383,3 +1383,46 @@@ rb_source_search_type_get_type (void
  
  	return etype;
  }
 +
 +/* introspection annotations for vmethods */
 +
 +/**
-  * impl_get_status:
-  * @source: a #RBSource
-  * @text: (inout) (allow-none) (transfer full): holds the returned status text
-  * @progress_text: (inout) (allow-none) (transfer full): holds the returned text for the progress bar
-  * @progress: (inout): holds the progress value
-  */
- 
- /**
 + * impl_get_entry_view:
 + * @source: a #RBSource
 + *
 + * Return value: (transfer none): the RBEntryView for the source
 + */
 +
 +/**
 + * impl_get_property_views:
 + * @source: a #RBSource
 + *
 + * Return value: (element-type RB.PropertyView) (transfer container): list of property views
 + */
 +
 +/**
-  * impl_get_config_widget:
-  * @source: a #RBSource
-  * @prefs: a #RBShellPreferences
-  *
-  * Return value: (transfer none): configuration widget
-  */
- 
- /**
 + * impl_cut:
 + * @source: a #RBSource
 + *
 + * Return value: (element-type RB.RhythmDBEntry) (transfer full): list of entries
 + */
 +
 +/**
 + * impl_copy:
 + * @source: a #RBSource
 + *
 + * Return value: (element-type RB.RhythmDBEntry) (transfer full): list of entries
 + */
 +
 +/**
 + * impl_paste:
 + * @source: a #RBSource
 + * @entries: (element-type RB.RhythmDBEntry) (transfer none): list of entries to paste
 + */
 +
 +/**
-  * impl_get_ui_actions:
-  * @source: a #RBSource
-  *
-  * Return value: (element-type utf8) (transfer full): list of action names
-  */
- 
- /**
 + * impl_get_search_actions:
 + * @source: a #RBSource
 + *
 + * Return value: (element-type utf8) (transfer full): list of action names
 + */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]