Merge lp:~dobey/ubuntu/precise/rhythmbox/prereleases-2-95-5 into lp:ubuntu/precise/rhythmbox
- Precise (12.04)
- prereleases-2-95-5
- Merge into precise
Proposed by
dobey
on 2012-03-08
| Status: | Merged |
|---|---|
| Merged at revision: | 202 |
| Proposed branch: | lp:~dobey/ubuntu/precise/rhythmbox/prereleases-2-95-5 |
| Merge into: | lp:ubuntu/precise/rhythmbox |
| Diff against target: |
86803 lines (+21230/-36496) 179 files modified
.pc/01_lpi.patch/configure.ac (+0/-988) .pc/01_lpi.patch/data/ui/rhythmbox-ui.xml (+0/-330) .pc/01_lpi.patch/shell/rb-shell.c (+0/-4126) .pc/02_use_escaped_podcast_uri.patch/podcast/rb-podcast-manager.c (+0/-2203) .pc/03_magnatune_partner.patch/plugins/magnatune/MagnatuneSource.py (+0/-560) .pc/04_pause_button.patch/shell/rb-shell-player.c (+0/-3942) .pc/05_hide_on_quit.patch/shell/rb-shell.c (+0/-4131) .pc/05_hide_on_quit.patch/shell/rb-shell.h (+0/-170) .pc/applied-patches (+0/-6) .pc/git_use_correct_mpris_name.patch/plugins/mpris/rb-mpris-plugin.c (+0/-1644) ChangeLog (+843/-1) Makefile.in (+3/-3) NEWS (+13/-0) README (+1/-1) backends/gstreamer/rb-encoder-gst.c (+14/-6) backends/rb-encoder.c (+4/-28) backends/rb-encoder.h (+4/-3) bindings/gi/MPID-3.0.gir (+4/-2) bindings/gi/Makefile.am (+4/-0) bindings/gi/Makefile.in (+4/-0) bindings/gi/RB-3.0.gir (+378/-106) config.h.in (+12/-0) configure (+88/-23) configure.ac (+10/-6) data/org.gnome.rhythmbox.gschema.xml (+10/-3) data/ui/rhythmbox-ui.xml (+0/-1) debian/changelog (+25/-1) debian/control (+85/-18) debian/control.in (+85/-13) debian/patches/01_lpi.patch (+14/-14) debian/patches/02_use_escaped_podcast_uri.patch (+5/-16) debian/patches/03_magnatune_partner.patch (+6/-8) debian/patches/git_use_correct_mpris_name.patch (+0/-24) debian/patches/series (+0/-1) debian/rhythmbox-mozilla.install (+2/-0) debian/rhythmbox-plugin-coherence.install (+0/-1) debian/rhythmbox-plugin-magnatune.install (+3/-0) debian/rhythmbox-plugin-visualizer.install (+3/-0) debian/rhythmbox-plugin-zeitgeist.install (+2/-0) debian/rhythmbox-plugins.install (+0/-15) debian/rhythmbox.install (+12/-3) doc/reference/html/RBEncoder.html (+7/-31) doc/reference/html/RBShell.html (+1/-1) doc/reference/html/RBSource.html (+1/-2) doc/reference/html/RBTrackTransferBatch.html (+7/-6) doc/reference/html/RhythmDB.html (+4/-10) doc/reference/html/RhythmDBQueryModel.html (+1/-2) doc/reference/html/ch01.html (+1/-1) doc/reference/html/ch02.html (+1/-1) doc/reference/html/ch03.html (+1/-1) doc/reference/html/ch04.html (+1/-1) doc/reference/html/ch05.html (+1/-1) doc/reference/html/ch06.html (+1/-1) doc/reference/html/ch07.html (+1/-1) doc/reference/html/index.sgml (+0/-1) doc/reference/html/rhythmbox-rb-debug.html (+3/-8) doc/reference/html/rhythmbox-rb-rating-helper.html (+1/-2) doc/reference/html/rhythmbox.devhelp2 (+0/-1) doc/reference/rhythmbox.types (+2/-0) doc/reference/tmpl/rb-encoder.sgml (+1/-10) doc/reference/tmpl/rb-track-transfer-batch.sgml (+0/-1) doc/reference/tmpl/rhythmbox-unused.sgml (+9/-0) lib/Makefile.am (+5/-1) lib/Makefile.in (+5/-2) lib/rb-async-copy.c (+237/-0) lib/rb-async-copy.h (+82/-0) lib/rb-chunk-loader.c (+314/-0) lib/rb-chunk-loader.h (+79/-0) lib/rb-file-helpers.c (+2/-1) lib/rb-gst-media-types.c (+5/-0) lib/rb-tree-dnd.c (+5/-1) ltmain.sh (+1/-1) macros/gsettings.m4 (+26/-11) metadata/rb-ext-db-key.c (+3/-3) metadata/rb-metadata-dbus-service.c (+5/-1) metadata/rb-metadata-gst.c (+93/-24) plugins/artdisplay/artdisplay.plugin.in (+3/-0) plugins/artsearch/artsearch.plugin.in (+3/-0) plugins/audiocd/rb-audiocd-source.c (+208/-170) plugins/audiocd/sj-metadata-marshal.c (+1/-1) plugins/audioscrobbler/audioscrobbler.plugin.in (+3/-0) plugins/audioscrobbler/rb-audioscrobbler-profile-page.c (+2/-2) plugins/audioscrobbler/rb-audioscrobbler-radio-source.c (+1/-1) plugins/brasero-disc-recorder/cd-recorder.plugin.in (+3/-0) plugins/daap/Makefile.am (+0/-2) plugins/daap/Makefile.in (+0/-12) plugins/daap/daap.plugin.in (+3/-0) plugins/daap/rb-daap-dialog.c (+0/-100) plugins/daap/rb-daap-dialog.h (+0/-42) plugins/daap/rb-daap-plugin.c (+8/-2) plugins/daap/rb-daap-source.c (+0/-1) plugins/dbus-media-server/dbus-media-server.plugin.in (+3/-0) plugins/dbus-media-server/rb-dbus-media-server-plugin.c (+47/-27) plugins/fmradio/rb-fm-radio-source.c (+8/-2) plugins/grilo/rb-grilo-source.c (+1/-1) plugins/im-status/im-status.py (+53/-104) plugins/ipod/ipod.plugin.in (+3/-0) plugins/ipod/rb-ipod-db.c (+2/-0) plugins/ipod/rb-ipod-helpers.c (+2/-81) plugins/ipod/rb-ipod-helpers.h (+1/-2) plugins/ipod/rb-ipod-plugin.c (+0/-13) plugins/ipod/rb-ipod-source.c (+145/-9) plugins/iradio/iradio-initial.xspf (+14/-0) plugins/iradio/rb-iradio-source.c (+12/-5) plugins/lirc/Makefile.am (+1/-1) plugins/lirc/Makefile.in (+1/-1) plugins/lirc/lirc.plugin.in (+0/-8) plugins/lirc/rblirc.plugin.in (+8/-0) plugins/lyrics/TerraParser.py (+3/-1) plugins/lyrics/lyrics.py (+1/-1) plugins/magnatune/BuyAlbumHandler.py (+0/-59) plugins/magnatune/DownloadAlbumHandler.py (+59/-0) plugins/magnatune/MagnatuneAccount.py (+89/-0) plugins/magnatune/MagnatuneSource.py (+127/-143) plugins/magnatune/Makefile.am (+8/-9) plugins/magnatune/Makefile.in (+155/-22) plugins/magnatune/TrackListHandler.py (+1/-14) plugins/magnatune/magnatune-loading.ui (+46/-208) plugins/magnatune/magnatune-prefs.ui (+166/-176) plugins/magnatune/magnatune.py (+73/-99) plugins/mpris/mpris.plugin.in (+3/-0) plugins/mtpdevice/mtpdevice.plugin.in (+3/-0) plugins/mtpdevice/rb-mtp-source.c (+10/-3) plugins/mtpdevice/rb-mtp-thread.c (+1/-0) plugins/notification/notification.plugin.in (+3/-0) plugins/rb/Loader.py (+0/-84) plugins/rb/rb.py (+0/-1) plugins/sample-vala/rb-sample-vala-plugin.c (+2/-2) po/POTFILES.in (+1/-2) po/be.po (+885/-886) po/bg.po (+1279/-1252) po/ca.po (+2/-2) po/cs.po (+754/-864) po/de.po (+65/-63) po/eo.po (+1366/-1317) po/es.po (+927/-935) po/gl.po (+1141/-1109) po/lt.po (+405/-360) po/nb.po (+1712/-1734) po/pl.po (+272/-383) po/pt_BR.po (+2586/-2467) po/sl.po (+922/-877) po/sr.po (+939/-939) po/sr@latin.po (+939/-939) po/sv.po (+2340/-1766) po/te.po (+289/-304) podcast/rb-podcast-main-source.c (+20/-8) podcast/rb-podcast-manager.c (+86/-62) podcast/rb-podcast-manager.h (+7/-6) podcast/rb-podcast-source.c (+88/-69) remote/dbus/rb-set-rating.py (+17/-8) rhythmdb/rhythmdb-dbus.c (+17/-6) rhythmdb/rhythmdb-tree.c (+1/-0) rhythmdb/rhythmdb.c (+1/-1) shell/main.c (+2/-0) shell/rb-playlist-manager.c (+39/-17) shell/rb-shell-player.c (+19/-13) shell/rb-shell.c (+73/-48) shell/rb-shell.h (+0/-2) shell/rb-track-transfer-batch.c (+93/-52) shell/rb-track-transfer-batch.h (+3/-0) shell/rb-track-transfer-queue.c (+51/-32) sources/rb-auto-playlist-source.c (+1/-1) sources/rb-browser-source.c (+1/-1) sources/rb-import-errors-source.c (+1/-1) sources/rb-library-source.c (+25/-16) sources/rb-static-playlist-source.c (+1/-1) sources/rb-transfer-target.c (+3/-3) sources/sync/rb-sync-state-ui.c (+1/-1) widgets/gossip-cell-renderer-expander.c (+5/-1) widgets/rb-alert-dialog.c (+2/-2) widgets/rb-cell-renderer-pixbuf.c (+5/-1) widgets/rb-cell-renderer-rating.c (+5/-1) widgets/rb-header.c (+5/-5) widgets/rb-query-creator-properties.c (+2/-2) widgets/rb-query-creator.c (+1/-1) widgets/rb-rating.c (+3/-1) widgets/rb-song-info.c (+1/-1) widgets/test-rb-segmented-bar.c (+1/-1) |
| To merge this branch: | bzr merge lp:~dobey/ubuntu/precise/rhythmbox/prereleases-2-95-5 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Martin Pitt | 2012-03-08 | Approve on 2012-03-09 | |
|
Review via email:
|
|||
Commit Message
Description of the Change
To post a comment you must log in.
lp:~dobey/ubuntu/precise/rhythmbox/prereleases-2-95-5
updated
on 2012-03-08
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === removed directory '.pc/01_lpi.patch' |
| 2 | === removed file '.pc/01_lpi.patch/configure.ac' |
| 3 | --- .pc/01_lpi.patch/configure.ac 2012-01-17 16:56:40 +0000 |
| 4 | +++ .pc/01_lpi.patch/configure.ac 1970-01-01 00:00:00 +0000 |
| 5 | @@ -1,988 +0,0 @@ |
| 6 | -AC_PREREQ(2.53) |
| 7 | -AC_INIT([rhythmbox], |
| 8 | - [2.95], |
| 9 | - [https://bugzilla.gnome.org/enter_bug.cgi?product=rhythmbox]) |
| 10 | -AC_CONFIG_SRCDIR(rhythmbox.pc.in) |
| 11 | -AC_CONFIG_MACRO_DIR(macros) |
| 12 | -AM_CONFIG_HEADER(config.h) |
| 13 | -AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-dist-gzip]) |
| 14 | - |
| 15 | -AC_SUBST(ACLOCAL_AMFLAGS, "-I macros") |
| 16 | - |
| 17 | -AM_MAINTAINER_MODE([enable]) |
| 18 | -GNOME_MAINTAINER_MODE_DEFINES |
| 19 | - |
| 20 | -# plugin API versioning |
| 21 | -# Increment on interface addition, reset on removal |
| 22 | -RHYTHMBOX_CORE_AGE=0 |
| 23 | -# Increment on interface add, remove, or change |
| 24 | -RHYTHMBOX_CORE_CURRENT=5 |
| 25 | -# Increment on source change, reset when CURRENT changes. |
| 26 | -RHYTHMBOX_CORE_REVISION=0 |
| 27 | - |
| 28 | -AC_SUBST(RHYTHMBOX_CORE_AGE) |
| 29 | -AC_SUBST(RHYTHMBOX_CORE_CURRENT) |
| 30 | -AC_SUBST(RHYTHMBOX_CORE_REVISION) |
| 31 | - |
| 32 | -m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],) |
| 33 | - |
| 34 | -dnl XXXX hack to kill off all the libtool tags ... |
| 35 | -dnl it isn't like we are using C++ or Fortran. |
| 36 | -m4_define([_LT_AC_TAGCONFIG],[]) |
| 37 | - |
| 38 | -GOBJECT_INTROSPECTION_REQS=0.10.0 |
| 39 | -GOBJECT_INTROSPECTION_REQUIRE([$GOBJECT_INTROSPECTION_REQS]) |
| 40 | - |
| 41 | -IT_PROG_INTLTOOL([0.35.0]) |
| 42 | - |
| 43 | -AC_ISC_POSIX |
| 44 | -AC_PROG_CC |
| 45 | -AC_STDC_HEADERS |
| 46 | -AM_PROG_LIBTOOL |
| 47 | -m4_ifdef([LT_OUTPUT], [LT_OUTPUT]) |
| 48 | -AC_C_BIGENDIAN |
| 49 | -AC_CHECK_SIZEOF(long) |
| 50 | - |
| 51 | -GTK_REQS=2.91.4 |
| 52 | - |
| 53 | -GST_0_10_REQS=0.10.32 |
| 54 | -GDK_PIXBUF_REQS=2.18.0 |
| 55 | -GLIB_REQS=2.26.0 |
| 56 | -LIBGPOD_REQS=0.6 |
| 57 | -MUSICBRAINZ3_REQS=3.0.2 |
| 58 | -TOTEM_PLPARSER_REQS=2.32.1 |
| 59 | -VALA_REQS=0.9.4 |
| 60 | -AVAHI_REQS=0.6 |
| 61 | -LIBSOUP_REQS=2.26.0 |
| 62 | -GUDEV_REQS=143 |
| 63 | -LIBMTP_REQS=0.3.0 |
| 64 | -LIBPEAS_REQS=0.7.3 |
| 65 | -GRILO_REQS=0.1.17 |
| 66 | - |
| 67 | -LIBNOTIFY_REQS=0.7.0 |
| 68 | -BRASERO_MIN_REQS=2.31.5 |
| 69 | -WEBKIT_MIN_REQS=1.3.9 |
| 70 | -PYGOBJECT_REQUIRED=2.90.2 |
| 71 | - |
| 72 | -GLIB_GSETTINGS |
| 73 | - |
| 74 | - |
| 75 | - |
| 76 | -AC_MSG_CHECKING([for GNU extension fwrite_unlocked]) |
| 77 | -AC_LINK_IFELSE( |
| 78 | -[AC_LANG_PROGRAM([[ |
| 79 | -#define _GNU_SOURCE |
| 80 | -#include <stdio.h> |
| 81 | -]], |
| 82 | -[[fwrite_unlocked ("foo", 1, sizeof ("foo"), stdout);]])],[have_fwrite_unlocked=yes]) |
| 83 | -if test x"$have_fwrite_unlocked" = xyes; then |
| 84 | - AC_DEFINE(HAVE_GNU_FWRITE_UNLOCKED,1,[Define if you have GNU fwrite_unlocked]) |
| 85 | - AC_MSG_RESULT([yes]) |
| 86 | -else |
| 87 | - AC_MSG_RESULT([no]) |
| 88 | -fi |
| 89 | - |
| 90 | -PKG_PROG_PKG_CONFIG |
| 91 | - |
| 92 | -PKG_CHECK_MODULES(RB_CLIENT, glib-2.0 >= $GLIB_REQS gio-2.0 >= $GLIB_REQS gio-unix-2.0 >= $GLIB_REQS) |
| 93 | - |
| 94 | -dnl note: gio-unix-2.0 is here for libmediaplayerid |
| 95 | -PKG_CHECK_MODULES(RHYTHMBOX, \ |
| 96 | - gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQS \ |
| 97 | - gtk+-3.0 >= $GTK_REQS \ |
| 98 | - gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQS \ |
| 99 | - glib-2.0 >= $GLIB_REQS \ |
| 100 | - gio-2.0 >= $GLIB_REQS \ |
| 101 | - gio-unix-2.0 >= $GLIB_REQS \ |
| 102 | - libsoup-2.4 >= $LIBSOUP_REQS \ |
| 103 | - libsoup-gnome-2.4 >= $LIBSOUP_REQS \ |
| 104 | - libpeas-1.0 >= $LIBPEAS_REQS \ |
| 105 | - libpeas-gtk-1.0 >= $LIBPEAS_REQS \ |
| 106 | - tdb >= 1.2.6) |
| 107 | - |
| 108 | -PKG_CHECK_MODULES(TOTEM_PLPARSER, totem-plparser >= $TOTEM_PLPARSER_REQS, have_totem_plparser=yes, have_totem_plparser=no) |
| 109 | -if test x$have_totem_plparser != xyes; then |
| 110 | - AC_MSG_ERROR([totem playlist parsing library not found or too old]) |
| 111 | -else |
| 112 | - if test "x`pkg-config --variable uselibcamel totem-plparser`" = "xno" ; then |
| 113 | - AC_MSG_ERROR([totem playlist parsing library has Podcast parsing disabled]) |
| 114 | - fi |
| 115 | -fi |
| 116 | - |
| 117 | -dnl gudev |
| 118 | -AC_ARG_WITH(gudev, |
| 119 | - AC_HELP_STRING([--with-gudev], |
| 120 | - [Enable GUdev for hardware detection]),, |
| 121 | - with_gudev=auto) |
| 122 | -if test x"$with_gudev" != "xno"; then |
| 123 | - PKG_CHECK_MODULES(GUDEV, gudev-1.0 >= $GUDEV_REQS, |
| 124 | - have_gudev=yes, have_gudev=no) |
| 125 | - if test x"$have_gudev" = "xno" -a x"$with_gudev" = "xyes"; then |
| 126 | - AC_MSG_ERROR([GUdev explicitly requested, but is not available]) |
| 127 | - fi |
| 128 | - if test x"$have_gudev" = "xyes"; then |
| 129 | - use_gudev=yes |
| 130 | - AC_SUBST(GUDEV_CFLAGS) |
| 131 | - AC_SUBST(GUDEV_LIBS) |
| 132 | - AC_DEFINE(HAVE_GUDEV, 1, [Use GUdev for hardware detection]) |
| 133 | - else |
| 134 | - use_gudev=no |
| 135 | - fi |
| 136 | -else |
| 137 | - use_gudev=no |
| 138 | -fi |
| 139 | -AM_CONDITIONAL(USE_GUDEV, test x"$use_gudev" = xyes) |
| 140 | - |
| 141 | -dnl hal remnants |
| 142 | -AC_ARG_WITH(hal, |
| 143 | - AC_HELP_STRING([--without-hal], |
| 144 | - [Disable HAL support])) |
| 145 | -if test "x$with_hal" != "xno"; then |
| 146 | - PKG_CHECK_MODULES(HAL, hal >= 0.5 hal < 0.6 dbus-glib-1, enable_hal=yes, enable_hal=no) |
| 147 | - if test "x$enable_hal" != "xyes" -a "x$with_hal" = "xyes"; then |
| 148 | - AC_MSG_ERROR([HAL support explicitly requested but HAL couldn't be found]) |
| 149 | - fi |
| 150 | - |
| 151 | - if test "x$enable_hal" = "xyes"; then |
| 152 | - AC_DEFINE(HAVE_HAL, 1, [Define if you have HAL support]) |
| 153 | - AC_SUBST(HAL_CFLAGS) |
| 154 | - AC_SUBST(HAL_LIBS) |
| 155 | - fi |
| 156 | -fi |
| 157 | -AM_CONDITIONAL(HAVE_HAL, test x"$enable_hal" = xyes) |
| 158 | - |
| 159 | - |
| 160 | -dnl iPod support |
| 161 | -AC_ARG_WITH(ipod, |
| 162 | - AC_HELP_STRING([--with-ipod], |
| 163 | - [Enable iPod support]),, |
| 164 | - with_ipod=auto) |
| 165 | -if test "x$with_ipod" != "xno"; then |
| 166 | - PKG_CHECK_MODULES(IPOD, libgpod-1.0 >= $LIBGPOD_REQS, |
| 167 | - have_libgpod=yes, have_libgpod=no) |
| 168 | - if test "x$have_libgpod" = "xno" -a "x$with_ipod" = "xyes"; then |
| 169 | - AC_MSG_ERROR([iPod explicitly requested but libgpod couldn't be found]) |
| 170 | - fi |
| 171 | - if test "x$have_libgpod" = "xyes"; then |
| 172 | - PKG_CHECK_EXISTS(libgpod-1.0 >= 0.7.92, have_itdb_start_stop_sync=yes, |
| 173 | - have_itdb_start_stop_sync=no) |
| 174 | - if test "x$have_itdb_start_stop_sync" = "xyes"; then |
| 175 | - AC_DEFINE([HAVE_ITDB_START_STOP_SYNC], 1, [Indicates whether libgpod is new enough to have its itdb_start/stop_sync API]) |
| 176 | - fi |
| 177 | - use_ipod=yes |
| 178 | - AC_SUBST(IPOD_CFLAGS) |
| 179 | - AC_SUBST(IPOD_LIBS) |
| 180 | - fi |
| 181 | -fi |
| 182 | -AM_CONDITIONAL(USE_IPOD, test x"$use_ipod" = xyes) |
| 183 | - |
| 184 | -dnl mtp support |
| 185 | -AC_ARG_WITH(mtp, |
| 186 | - AC_HELP_STRING([--with-mtp], |
| 187 | - [Enable MTP support]),, |
| 188 | - with_mtp=auto) |
| 189 | -if test "x$with_mtp" != "xno"; then |
| 190 | - can_use_mtp=no |
| 191 | - if test x"$use_gudev" = "xyes" -o x"$enable_hal" = "xyes"; then |
| 192 | - can_use_mtp=yes |
| 193 | - fi |
| 194 | - |
| 195 | - PKG_CHECK_MODULES(MTP, libmtp >= $LIBMTP_REQS, have_libmtp=yes, have_libmtp=no) |
| 196 | - if test x"$with_mtp" = "xyes"; then |
| 197 | - if test x"$have_libmtp" = "xno"; then |
| 198 | - AC_MSG_ERROR([MTP explicitly requested but libmtp is not available]) |
| 199 | - fi |
| 200 | - if test x"$can_use_mtp" = "xno"; then |
| 201 | - AC_MSG_ERROR([MTP explicitly requested but GUdev and HAL are not available]) |
| 202 | - fi |
| 203 | - fi |
| 204 | - if test "x$have_libmtp" = "xyes" -a "x$can_use_mtp" = "xyes"; then |
| 205 | - use_mtp=yes |
| 206 | - AC_SUBST(MTP_CFLAGS) |
| 207 | - AC_SUBST(MTP_LIBS) |
| 208 | - fi |
| 209 | -fi |
| 210 | -AM_CONDITIONAL(USE_MTP, test x"$use_mtp" = xyes) |
| 211 | - |
| 212 | - |
| 213 | -dnl gnome-keyring support |
| 214 | - |
| 215 | -AC_ARG_WITH(gnome-keyring, |
| 216 | - AC_HELP_STRING([--with-gnome-keyring], |
| 217 | - [Enable gnome-keyring support]),, |
| 218 | - with_gnome_keyring=auto) |
| 219 | -if test "x$with_gnome_keyring" != "xno"; then |
| 220 | - |
| 221 | - PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1, have_gnome_keyring=yes, have_gnome_keyring=no) |
| 222 | - if test "x$have_gnome_keyring" = "xno" -a "x$with_gnome_keyring" = "xyes"; then |
| 223 | - AC_MSG_ERROR([gnome-keyring support explicitly requested but gnome-keyring couldn't be found]) |
| 224 | - fi |
| 225 | - if test "x$have_gnome_keyring" = "xyes"; then |
| 226 | - AC_DEFINE(WITH_GNOME_KEYRING, 1, [Define if gnome-keyring support is enabled]) |
| 227 | - use_gnome_keyring=yes |
| 228 | - AC_SUBST(GNOME_KEYRING_CFLAGS) |
| 229 | - AC_SUBST(GNOME_KEYRING_LIBS) |
| 230 | - fi |
| 231 | -fi |
| 232 | -AM_CONDITIONAL(USE_GNOME_KEYRING, test x"$use_gnome_keyring" = xyes) |
| 233 | - |
| 234 | -dnl Database |
| 235 | -AC_ARG_WITH(database, |
| 236 | - AC_HELP_STRING([--with-database=tree], |
| 237 | - [Select the database to use (default tree)]),, |
| 238 | - with_database=tree) |
| 239 | -AM_CONDITIONAL(USE_TREEDB, test x"$with_database" = xtree) |
| 240 | - |
| 241 | -case "x$with_database" in |
| 242 | - "xtree") |
| 243 | - AC_DEFINE(WITH_RHYTHMDB_TREE, 1, [Define if you are using the RhythmDB tree database]) |
| 244 | - ;; |
| 245 | - *) |
| 246 | - AC_MSG_ERROR([Unknown database selected]) |
| 247 | - ;; |
| 248 | -esac |
| 249 | - |
| 250 | -dnl Database debugging |
| 251 | -AC_ARG_WITH(rhythmdb-debug, |
| 252 | - AC_HELP_STRING([--with-rhythmdb-debug=0|1|2], |
| 253 | - [Level of RhythmDB sanity checking]),,with_rhythmdb_debug=0) |
| 254 | -if test x"${with_rhythmdb_debug}" != x0; then |
| 255 | - AC_DEFINE_UNQUOTED([RHYTHMDB_ENABLE_SANITY_CHECK], "${with_rhythmdb_debug}", [Define to the level of RhythmDB sanity checking]) |
| 256 | -fi |
| 257 | - |
| 258 | -dnl Sound system |
| 259 | -dnl Now we're ready to ask for gstreamer libs and cflags |
| 260 | -dnl And we can also ask for the right version of gstreamer |
| 261 | -PKG_CHECK_MODULES(GSTREAMER_0_10, \ |
| 262 | - gstreamer-0.10 >= $GST_0_10_REQS |
| 263 | - gstreamer-base-0.10 >= $GST_0_10_REQS |
| 264 | - gstreamer-plugins-base-0.10 >= $GST_0_10_REQS |
| 265 | - gstreamer-interfaces-0.10 >= $GST_0_10_REQS |
| 266 | - gstreamer-pbutils-0.10 >= $GST_0_10_REQS) |
| 267 | - |
| 268 | -RHYTHMBOX_CFLAGS="$RHYTHMBOX_CFLAGS $GSTREAMER_0_10_CFLAGS" |
| 269 | -RHYTHMBOX_LIBS="$RHYTHMBOX_LIBS $GSTREAMER_0_10_LIBS" |
| 270 | - |
| 271 | -AC_ARG_WITH(mdns, |
| 272 | - AC_HELP_STRING([--with-mdns=auto|avahi], |
| 273 | - [Select the mDNS/DNS-SD implementation to use (default auto)]),, |
| 274 | - with_mdns=auto) |
| 275 | - |
| 276 | -have_avahi=no |
| 277 | -have_mdns=no |
| 278 | -use_avahi=no |
| 279 | - |
| 280 | -PKG_CHECK_MODULES(AVAHI, |
| 281 | - avahi-client >= $AVAHI_REQS |
| 282 | - avahi-glib >= $AVAHI_REQS, |
| 283 | - have_avahi=yes, |
| 284 | - have_avahi=no) |
| 285 | - |
| 286 | -if test x"$with_mdns" = xauto || test x"$with_mdns" = xavahi; then |
| 287 | - if test x"$have_avahi" = xyes; then |
| 288 | - MDNS_CFLAGS=$AVAHI_CFLAGS |
| 289 | - MDNS_LIBS=$AVAHI_LIBS |
| 290 | - AC_DEFINE(WITH_AVAHI, 1, [Define if mDNS/DNS-SD implementation uses Avahi]) |
| 291 | - use_avahi=yes |
| 292 | - AC_MSG_NOTICE([Detected Avahi, using it for mDNS/DNS-SD]) |
| 293 | - have_mdns=yes |
| 294 | - elif test x"$with_mdns" = xavahi; then |
| 295 | - AC_MSG_ERROR([Avahi explicitly requested but not found.]) |
| 296 | - fi |
| 297 | -fi |
| 298 | - |
| 299 | -AM_CONDITIONAL(USE_AVAHI, test "x$use_avahi" = "xyes") |
| 300 | - |
| 301 | -AC_ARG_ENABLE(libnotify, |
| 302 | - AC_HELP_STRING([--disable-libnotify], |
| 303 | - [Disable libnotify support]),, |
| 304 | - enable_libnotify=auto) |
| 305 | -if test "x$enable_libnotify" != "xno"; then |
| 306 | - PKG_CHECK_MODULES(NOTIFY, \ |
| 307 | - libnotify >= $LIBNOTIFY_REQS, |
| 308 | - have_libnotify=yes, |
| 309 | - have_libnotify=no) |
| 310 | - if test "x$have_libnotify" = "xno" -a "x$enable_libnotify" = "xyes"; then |
| 311 | - AC_MSG_ERROR([libnotify support explicitly requested, but libnotify couldn't be found]) |
| 312 | - fi |
| 313 | - if test "x$have_libnotify" = "xyes"; then |
| 314 | - enable_libnotify=yes |
| 315 | - fi |
| 316 | -fi |
| 317 | -AM_CONDITIONAL(USE_NOTIFY, test x"$enable_libnotify" = xyes) |
| 318 | -if test x$enable_libnotify = xyes ; then |
| 319 | - # Find out the version of LIBNOTIFY we're using |
| 320 | - libnotify_version=`pkg-config --modversion libnotify` |
| 321 | - LIBNOTIFY_VERSION_MAJOR=`echo $libnotify_version | awk -F. '{print $1}'` |
| 322 | - LIBNOTIFY_VERSION_MINOR=`echo $libnotify_version | awk -F. '{print $2}'` |
| 323 | - LIBNOTIFY_VERSION_MICRO=`echo $libnotify_version | awk -F. '{print $3}'` |
| 324 | - if test "z$LIBNOTIFY_VERSION_MAJOR" = "z"; then |
| 325 | - LIBNOTIFY_VERSION_MAJOR="0" |
| 326 | - fi |
| 327 | - if test "z$LIBNOTIFY_VERSION_MINOR" = "z"; then |
| 328 | - LIBNOTIFY_VERSION_MINOR="0" |
| 329 | - fi |
| 330 | - if test "z$LIBNOTIFY_VERSION_MICRO" = "z"; then |
| 331 | - LIBNOTIFY_VERSION_MICRO="0" |
| 332 | - fi |
| 333 | - echo "Your libnotify version is $LIBNOTIFY_VERSION_MAJOR,$LIBNOTIFY_VERSION_MINOR,$LIBNOTIFY_VERSION_MICRO." |
| 334 | - NOTIFY_CFLAGS="$NOTIFY_CFLAGS -DLIBNOTIFY_VERSION_MAJOR=$LIBNOTIFY_VERSION_MAJOR" |
| 335 | - NOTIFY_CFLAGS="$NOTIFY_CFLAGS -DLIBNOTIFY_VERSION_MINOR=$LIBNOTIFY_VERSION_MINOR" |
| 336 | - NOTIFY_CFLAGS="$NOTIFY_CFLAGS -DLIBNOTIFY_VERSION_MICRO=$LIBNOTIFY_VERSION_MICRO" |
| 337 | - |
| 338 | - AC_DEFINE(HAVE_NOTIFY, 1, [Define if libnotify support is enabled]) |
| 339 | - AC_SUBST(NOTIFY_CFLAGS) |
| 340 | - AC_SUBST(NOTIFY_LIBS) |
| 341 | -fi |
| 342 | - |
| 343 | -AC_CHECK_LIB(z, uncompress) |
| 344 | - |
| 345 | -dnl check for libgstcdda, needed to list the audio tracks |
| 346 | -PKG_CHECK_MODULES(GSTCDDA, gstreamer-cdda-0.10) |
| 347 | -AC_SUBST(GSTCDDA_LIBS) |
| 348 | -AC_SUBST(GSTCDDA_CFLAGS) |
| 349 | - |
| 350 | -dnl check for MusicBrainz |
| 351 | -have_sj_metadata_getter=no |
| 352 | -AC_ARG_ENABLE(musicbrainz, AC_HELP_STRING([--disable-musicbrainz], |
| 353 | - [don't build with MusicBrainz support])) |
| 354 | -if test x"$enable_musicbrainz" != "xno"; then |
| 355 | - PKG_CHECK_MODULES(MUSICBRAINZ3, libmusicbrainz3 >= $MUSICBRAINZ3_REQS gconf-2.0, [have_musicbrainz3=yes], [have_musicbrainz3=no]) |
| 356 | - |
| 357 | - AC_SUBST(MUSICBRAINZ3_CFLAGS) |
| 358 | - AC_SUBST(MUSICBRAINZ3_LIBS) |
| 359 | - |
| 360 | - if test x"$have_musicbrainz3" = xyes; then |
| 361 | - oldlibs=$LIBS |
| 362 | - LIBS="$LIBS $MUSICBRAINZ3_LIBS" |
| 363 | - AC_CHECK_FUNCS(mb_extract_uuid) |
| 364 | - LIBS="$oldlibs" |
| 365 | - |
| 366 | - AC_DEFINE([HAVE_MUSICBRAINZ3], 1, [Whether libmusicbrainz3 is available]) |
| 367 | - have_sj_metadata_getter=yes |
| 368 | - AC_DEFINE([HAVE_SJ_METADATA_GETTER], 1, [Whether to use the sound-juicer metadata getter code]) |
| 369 | - else |
| 370 | - if test x"$enable_musicbrainz" = xyes; then |
| 371 | - AC_MSG_ERROR([MusicBrainz requested, but neither libmusicbrainz nor libmusicbrainz3 are available]) |
| 372 | - fi |
| 373 | - fi |
| 374 | -fi |
| 375 | -AM_CONDITIONAL([HAVE_MUSICBRAINZ3], [test "x$have_musicbrainz3" = "xyes"]) |
| 376 | -AM_CONDITIONAL([HAVE_SJ_METADATA_GETTER], [test "x$have_sj_metadata_getter" = "xyes"]) |
| 377 | - |
| 378 | -AC_PATH_XTRA |
| 379 | -CFLAGS="$CFLAGS $X_CFLAGS" |
| 380 | -#LIBS=$X_LIBS |
| 381 | - |
| 382 | -dnl Multimedia keys |
| 383 | -have_xfree=no |
| 384 | -AC_COMPILE_IFELSE([ |
| 385 | - #include <X11/XF86keysym.h> |
| 386 | -int main(int argc,char **argv) { |
| 387 | - return 0; |
| 388 | -} |
| 389 | -], have_xfree=yes) |
| 390 | -AC_MSG_CHECKING(for XFree86 headers) |
| 391 | -AC_MSG_RESULT($have_xfree) |
| 392 | -if test x"$have_xfree" = "xyes" ; then |
| 393 | - AC_DEFINE(HAVE_XFREE, 1, [defined if you have X11/XF86keysym.h]) |
| 394 | -fi |
| 395 | - |
| 396 | -AC_ARG_ENABLE(mmkeys, AC_HELP_STRING([--disable-mmkeys], |
| 397 | - [don't build with Multimedia Keys support])) |
| 398 | -if test x"$have_xfree" = xyes; then |
| 399 | - if test x"$enable_mmkeys" != xno; then |
| 400 | - enable_mmkeys=yes |
| 401 | - AC_DEFINE(HAVE_MMKEYS, 1, [define if Multimedia Keys are enabled]) |
| 402 | - fi |
| 403 | -else |
| 404 | - if test x"$enable_mmkeys" = xyes; then |
| 405 | - AC_MSG_ERROR([Multimedia keys explicitly requested but no support found]) |
| 406 | - fi |
| 407 | -fi |
| 408 | - |
| 409 | -dnl libbrasero-media support |
| 410 | -have_libbrasero_media=no |
| 411 | -AC_ARG_WITH(brasero, |
| 412 | - AC_HELP_STRING([--with-brasero], |
| 413 | - [Build with libbrasero-media support]),, |
| 414 | - with_brasero=auto) |
| 415 | -if test x"$with_brasero" != "xno"; then |
| 416 | - PKG_CHECK_MODULES(LIBBRASERO_MEDIA, |
| 417 | - libbrasero-media3 >= $BRASERO_MIN_REQS, |
| 418 | - have_libbrasero_media=yes, |
| 419 | - have_libbrasero_media=no) |
| 420 | - AC_SUBST(LIBBRASERO_MEDIA_CFLAGS) |
| 421 | - AC_SUBST(LIBBRASERO_MEDIA_LIBS) |
| 422 | -fi |
| 423 | -if test "x$have_libbrasero_media" = "xyes"; then |
| 424 | - AC_DEFINE([HAVE_LIBBRASERO_MEDIA], 1, [Have libbrasero-media]) |
| 425 | -fi |
| 426 | -AM_CONDITIONAL(HAVE_LIBBRASERO_MEDIA, test x$have_libbrasero_media = xyes) |
| 427 | -AC_SUBST(HAVE_LIBBRASERO_MEDIA) |
| 428 | - |
| 429 | -AC_SUBST(CFLAGS) |
| 430 | -AC_SUBST(LDFLAGS) |
| 431 | - |
| 432 | -AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) |
| 433 | -AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource) |
| 434 | - |
| 435 | -AC_SUBST(RHYTHMBOX_CFLAGS) |
| 436 | -AC_SUBST(RHYTHMBOX_LIBS) |
| 437 | - |
| 438 | -AC_CACHE_CHECK([whether strftime supports %E and %O modifiers], ac_cv_strftime_supports_E_O, [ |
| 439 | -AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h> |
| 440 | - int main () |
| 441 | - { |
| 442 | - char buf[100]; |
| 443 | - struct tm tm = {0}; |
| 444 | - tm.tm_year = 99; |
| 445 | - if (strftime(buf, 100, "%EY", &tm) == 4 && |
| 446 | - strcmp (buf, "1999")==0) |
| 447 | - return 0; |
| 448 | - return 1; |
| 449 | - } |
| 450 | - ]])], |
| 451 | - [ac_cv_strftime_supports_E_O=yes], |
| 452 | - [ac_cv_strftime_supports_E_O=no], |
| 453 | - [AC_MSG_RESULT([cannot run test program while cross compiling]) |
| 454 | - AC_MSG_ERROR([Please set ac_cv_strftime_supports_E_O to yes or no.])] |
| 455 | - ) |
| 456 | -]) |
| 457 | -if test "x$ac_cv_strftime_supports_E_O" = xyes; then |
| 458 | - AC_DEFINE(HAVE_STRFTIME_EXTENSION, 1, [Define if strftime supports %E and %O modifiers.]) |
| 459 | -fi |
| 460 | - |
| 461 | -GETTEXT_PACKAGE=rhythmbox |
| 462 | -AC_SUBST(GETTEXT_PACKAGE) |
| 463 | -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the Gettext package name]) |
| 464 | - |
| 465 | -AM_GLIB_GNU_GETTEXT |
| 466 | - |
| 467 | -dnl Workaround for automake 1.8 |
| 468 | -AC_SUBST(mkdir_p) if test x"$mkdir_p" = "x"; then |
| 469 | - MKINSTALLDIRS="mkinstalldirs" |
| 470 | -fi |
| 471 | -AC_SUBST(MKINSTALLDIRS) |
| 472 | - |
| 473 | -AM_GCONF_SOURCE_2 |
| 474 | - |
| 475 | -dnl LIRC |
| 476 | -AC_ARG_ENABLE(lirc, |
| 477 | - AC_HELP_STRING([--enable-lirc],[enable lirc support])) |
| 478 | -with_lirc=no |
| 479 | -if test x"$enable_lirc" != xno; then |
| 480 | - AC_CHECK_HEADER(lirc/lirc_client.h,[with_lirc=yes],[with_lirc=no]) |
| 481 | - if test x"$with_lirc" = xyes; then |
| 482 | - AC_CHECK_LIB(lirc_client,lirc_init,[with_lirc=yes],[with_lirc=no]) |
| 483 | - fi |
| 484 | - if test x"$with_lirc" = xno -a x"$enable_lirc" = xyes; then |
| 485 | - AC_MSG_ERROR([lirc explicitly requested but no support found]) |
| 486 | - fi |
| 487 | -fi |
| 488 | -AM_CONDITIONAL(WITH_LIRC, test x"$with_lirc" = xyes) |
| 489 | - |
| 490 | -dnl WebKit |
| 491 | -have_webkit=no |
| 492 | -AC_ARG_WITH(webkit, |
| 493 | - AC_HELP_STRING([--with-webkit], |
| 494 | - [Use WebKit to display HTML]),, |
| 495 | - with_webkit=auto) |
| 496 | -if test "x$with_webkit" != xno; then |
| 497 | - PKG_CHECK_MODULES(WEBKIT, [webkitgtk-3.0 >= $WEBKIT_MIN_REQS], have_webkit=yes, have_webkit=no) |
| 498 | - if test "x$have_webkit" = "xno" -a "x$with_webkit" = "xyes"; then |
| 499 | - AC_MSG_ERROR([WebKit support explicitly requested, but WebKit could not be found]) |
| 500 | - fi |
| 501 | - if test "x$have_webkit" = "xyes"; then |
| 502 | - AC_DEFINE(WITH_WEBKIT, 1, [Define if WebKit is enabled]) |
| 503 | - fi |
| 504 | -fi |
| 505 | -AM_CONDITIONAL(WITH_WEBKIT, test x"$have_webkit" = xyes) |
| 506 | - |
| 507 | - |
| 508 | -AC_ARG_ENABLE(uninstalled-build, |
| 509 | - AC_HELP_STRING([--enable-uninstalled-build], |
| 510 | - [Search for files in build directory as well]), |
| 511 | - enable_uninstalled=yes,) |
| 512 | -if test x"$enable_uninstalled" = xyes; then |
| 513 | - AC_DEFINE(USE_UNINSTALLED_DIRS, 1, [Define to look for files in source tree locations]) |
| 514 | -fi |
| 515 | -ROOT_UNINSTALLED_DIR="`pwd`" |
| 516 | -AC_DEFINE_UNQUOTED(SHARE_UNINSTALLED_DIR,"`pwd`/$srcdir/data",[path to source data dir]) |
| 517 | -AC_DEFINE_UNQUOTED(SHARE_UNINSTALLED_BUILDDIR,"`pwd`/data",[path to built source data dir]) |
| 518 | -AC_DEFINE_UNQUOTED(METADATA_UNINSTALLED_DIR,"`pwd`/metadata",[path to metadata build dir]) |
| 519 | -AC_SUBST(ROOT_UNINSTALLED_DIR) |
| 520 | - |
| 521 | - |
| 522 | -dnl warnings bits, copied from gnome-keyring configure.in |
| 523 | -dnl Turn on the additional warnings last, so -Werror doesn't affect other tests. |
| 524 | - |
| 525 | -AC_ARG_ENABLE(more-warnings, |
| 526 | -[ --enable-more-warnings Maximum compiler warnings], |
| 527 | -set_more_warnings="$enableval",[ |
| 528 | -if test -d "$srcdir/.svn" || test -d "$srcdir/{arch}" || test -d "$srcdir/CVS" || test -d "$srcdir/_darcs" || test -d "$srcdir/.git"; then |
| 529 | - set_more_warnings=yes |
| 530 | -else |
| 531 | - set_more_warnings=no |
| 532 | -fi |
| 533 | -]) |
| 534 | -RHYTHMBOX_CFLAGS_NOWARN=$RHYTHMBOX_CFLAGS |
| 535 | -AC_SUBST(RHYTHMBOX_CFLAGS_NOWARN) |
| 536 | -AC_MSG_CHECKING(for more warnings, including -Werror) |
| 537 | -if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then |
| 538 | - AC_MSG_RESULT(yes) |
| 539 | - WARN_CFLAGS="\ |
| 540 | - -Wcomment -Wformat -Wnonnull -Wimplicit-int -Wimplicit \ |
| 541 | - -Wmain -Wmissing-braces -Wparentheses -Wsequence-point \ |
| 542 | - -Wreturn-type -Wswitch -Wtrigraphs -Wunused-function \ |
| 543 | - -Wunused-label -Wunused-value \ |
| 544 | - -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ |
| 545 | - -Wnested-externs -Wpointer-arith \ |
| 546 | - -Wcast-align -Wall \ |
| 547 | - -Werror -std=gnu89" |
| 548 | - |
| 549 | - if echo "$CFLAGS" | grep -q -- '-O' && echo "$CFLAGS" | grep -q -v -- '-O0'; then |
| 550 | - WARN_CFLAGS="-Wuninitialized $WARN_CFLAGS" |
| 551 | - fi |
| 552 | - |
| 553 | - for option in $WARN_CFLAGS; do |
| 554 | - SAVE_CFLAGS="$CFLAGS" |
| 555 | - CFLAGS="$CFLAGS $option" |
| 556 | - AC_MSG_CHECKING([whether gcc understands $option]) |
| 557 | - AC_TRY_COMPILE([], [], |
| 558 | - has_option=yes, |
| 559 | - has_option=no,) |
| 560 | - if test x$has_option = xyes; then |
| 561 | - RHYTHMBOX_CFLAGS="$RHYTHMBOX_CFLAGS $option" |
| 562 | - fi |
| 563 | - AC_MSG_RESULT($has_option) |
| 564 | - CFLAGS="$SAVE_CFLAGS" |
| 565 | - unset has_option |
| 566 | - unset SAVE_CFLAGS |
| 567 | - done |
| 568 | - unset option |
| 569 | - AC_SUBST(WARN_CFLAGS) |
| 570 | - |
| 571 | - SAVE_CFLAGS="$CFLAGS" |
| 572 | - CFLAGS="$CFLAGS -Wno-error" |
| 573 | - AC_TRY_COMPILE([], [], |
| 574 | - WNOERROR_CFLAGS="-Wno-error", |
| 575 | - WNOERROR_CFLAGS="") |
| 576 | - AC_SUBST(WNOERROR_CFLAGS) |
| 577 | - CFLAGS="$SAVE_CFLAGS" |
| 578 | - unset SAVE_CFLAGS |
| 579 | - unset has_wnoerror |
| 580 | - |
| 581 | - dnl enable GSEAL if gtk is new enough |
| 582 | - PKG_CHECK_EXISTS(gtk+-2.0 >= 2.20.0, [CFLAGS="$CFLAGS -DGSEAL_ENABLE"], []) |
| 583 | - |
| 584 | - dnl disable deprecated stuff |
| 585 | - dnl CFLAGS="$CFLAGS $DISABLE_DEPRECATED" |
| 586 | -else |
| 587 | - AC_MSG_RESULT(no) |
| 588 | -fi |
| 589 | - |
| 590 | - |
| 591 | -dnl Check for -fno-strict-aliasing |
| 592 | -FLAGS="-fno-strict-aliasing" |
| 593 | -save_CFLAGS="$CFLAGS" |
| 594 | -CFLAGS="$CFLAGS $FLAGS" |
| 595 | -AC_MSG_CHECKING([whether [$]CC understands $FLAGS]) |
| 596 | -AC_TRY_COMPILE([], [], [compiler_has_option=yes], [compiler_has_option=no]) |
| 597 | -CFLAGS="$save_CFLAGS" |
| 598 | -AC_MSG_RESULT($compiler_has_option) |
| 599 | -if test $compiler_has_option = yes; then |
| 600 | - NO_STRICT_ALIASING_CFLAGS="$FLAGS" |
| 601 | -fi |
| 602 | -AC_SUBST([NO_STRICT_ALIASING_CFLAGS]) |
| 603 | - |
| 604 | -dnl Enable gtk-doc |
| 605 | -GTK_DOC_CHECK(1.4) |
| 606 | - |
| 607 | -dnl Enable gnome-doc-utils |
| 608 | -GNOME_DOC_INIT |
| 609 | - |
| 610 | - |
| 611 | -dnl ================================================================ |
| 612 | -dnl Plugins |
| 613 | -dnl ================================================================ |
| 614 | - |
| 615 | -PLUGIN_LIBTOOL_FLAGS="-module -avoid-version" |
| 616 | -AC_SUBST(PLUGIN_LIBTOOL_FLAGS) |
| 617 | - |
| 618 | -PLUGINDIR='${libdir}/rhythmbox/plugins' |
| 619 | -PLUGINDATADIR='${datadir}/rhythmbox/plugins' |
| 620 | -AC_SUBST(PLUGINDIR) |
| 621 | -AC_SUBST(PLUGINDATADIR) |
| 622 | - |
| 623 | -dnl ================================================================ |
| 624 | -dnl Python plugins |
| 625 | -dnl ================================================================ |
| 626 | -AM_PATH_PYTHON |
| 627 | - |
| 628 | - |
| 629 | -AC_ARG_ENABLE([python], |
| 630 | - AS_HELP_STRING([--enable-python[=@<:@no/auto/yes@:>@]],[Build with python support]), |
| 631 | - [enable_python=$enableval], |
| 632 | - [enable_python="auto"]) |
| 633 | - |
| 634 | -if test "x$enable_python" = "xauto"; then |
| 635 | - PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED], |
| 636 | - [enable_python=yes],[enable_python=no]) |
| 637 | -fi |
| 638 | - |
| 639 | -if test "x$enable_python" = "xyes"; then |
| 640 | - PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED]) |
| 641 | - |
| 642 | - pyoverridesdir=`$PKG_CONFIG --variable=overridesdir pygobject-3.0` |
| 643 | - AC_SUBST(pyoverridesdir) |
| 644 | -fi |
| 645 | - |
| 646 | -AM_CONDITIONAL(ENABLE_PYTHON, test x"$enable_python" = "xyes") |
| 647 | - |
| 648 | -dnl ================================================================ |
| 649 | -dnl Vala plugins |
| 650 | -dnl ================================================================ |
| 651 | -AC_MSG_CHECKING([whether Vala plugin support is requested]) |
| 652 | -AC_ARG_ENABLE([vala], |
| 653 | - AS_HELP_STRING([--enable-vala],[Enable Vala plugin support]), |
| 654 | - [enable_vala=$enableval have_vala=$enableval], |
| 655 | - [enable_vala=autodetect have_vala=yes]) |
| 656 | -AC_MSG_RESULT([$enable_vala]) |
| 657 | -with_vala=no |
| 658 | -if test "x$enable_vala" = "xyes"; then |
| 659 | - AM_PROG_VALAC([$VALA_REQS]) |
| 660 | - if test "x$VALAC" != "x"; then |
| 661 | - VAPIDIR=$datadir/vala/vapi |
| 662 | - # what? |
| 663 | - VAPIGEN=vapigen |
| 664 | - AC_SUBST([VALAC]) |
| 665 | - AC_SUBST([VAPIDIR]) |
| 666 | - AC_SUBST([VAPIGEN]) |
| 667 | - with_vala=yes |
| 668 | - elif test "x$enable_vala" = "xyes"; then |
| 669 | - AC_MSG_ERROR([Vala plugin support explicitly requested, but not found]) |
| 670 | - fi |
| 671 | -fi |
| 672 | -AM_CONDITIONAL(ENABLE_VALA, test "x$with_vala" = "xyes") |
| 673 | - |
| 674 | -dnl ================================================================ |
| 675 | -dnl FM Radio Plugin |
| 676 | -dnl ================================================================ |
| 677 | -AC_MSG_CHECKING([whether FM radio support is requested]) |
| 678 | -AC_ARG_ENABLE([fm-radio], |
| 679 | - AC_HELP_STRING([--disable-fm-radio],[Disable FM radio support]),, |
| 680 | - enable_fm_radio=yes) |
| 681 | -if test "x$enable_fm_radio" != xno; then |
| 682 | - AC_CHECK_HEADER([linux/videodev2.h],,[enable_fm_radio=no]) |
| 683 | -fi |
| 684 | -AM_CONDITIONAL(ENABLE_FM_RADIO, test "x$enable_fm_radio" != xno) |
| 685 | - |
| 686 | - |
| 687 | -dnl check, for unit tests |
| 688 | -PKG_CHECK_MODULES(CHECK, check, have_check=yes, have_check=no) |
| 689 | -AM_CONDITIONAL([HAVE_CHECK],[test "x$have_check" = "xyes"]) |
| 690 | - |
| 691 | -dnl ================================================================ |
| 692 | -dnl Browser plugin |
| 693 | -dnl ================================================================ |
| 694 | - |
| 695 | -AC_ARG_ENABLE([browser-plugin], |
| 696 | - [AS_HELP_STRING([--enable-browser-plugin],[compile the iTunes detection browser plugin])], |
| 697 | - [],[enable_browser_plugin=yes]) |
| 698 | - |
| 699 | -MOZILLA_PLUGINDIR="${MOZILLA_PLUGINDIR:="\${libdir}/mozilla/plugins"}" |
| 700 | -AC_ARG_VAR([MOZILLA_PLUGINDIR],[Where to install the browser plugin to]) |
| 701 | - |
| 702 | -AM_CONDITIONAL([ENABLE_BROWSER_PLUGIN], test x$enable_browser_plugin = xyes) |
| 703 | - |
| 704 | - |
| 705 | -dnl ================================================================ |
| 706 | -dnl Use libdmapsharing for DAAP? |
| 707 | -dnl ================================================================ |
| 708 | -AC_ARG_ENABLE(daap, |
| 709 | - AC_HELP_STRING([--disable-daap], |
| 710 | - [Disable DAAP support]),, |
| 711 | - enable_daap=auto) |
| 712 | -if test "x$enable_daap" != "xno"; then |
| 713 | - PKG_CHECK_MODULES(DMAPSHARING, libdmapsharing-3.0 >= 2.9.11, |
| 714 | - have_libdmapsharing=yes, |
| 715 | - have_libdmapsharing=no) |
| 716 | - if test "x$have_libdmapsharing" = "xno" -a "x$enable_daap" = "xyes"; then |
| 717 | - AC_MSG_ERROR([DAAP support explicitly requested, but libdmapsharing couldn't be found]) |
| 718 | - fi |
| 719 | - if test x"$have_libdmapsharing" = "xyes"; then |
| 720 | - AC_DEFINE(HAVE_LIBDMAPSHARING, 1, [Define if libdmapsharing support is enabled]) |
| 721 | - fi |
| 722 | -fi |
| 723 | - |
| 724 | -AM_CONDITIONAL(USE_LIBDMAPSHARING, test x"$have_libdmapsharing" = "xyes") |
| 725 | - |
| 726 | -AC_SUBST(DMAPSHARING_CFLAGS) |
| 727 | -AC_SUBST(DMAPSHARING_LIBS) |
| 728 | - |
| 729 | -dnl ================================================================ |
| 730 | -dnl clutter for visualizer plugin |
| 731 | -dnl ================================================================ |
| 732 | -AC_ARG_ENABLE(visualizer, |
| 733 | - AC_HELP_STRING([--disable-visualizer], |
| 734 | - [Disable visualizer plugin support]),, |
| 735 | - enable_visualizer=auto) |
| 736 | -if test "x$enable_visualizer" != "xno"; then |
| 737 | - PKG_CHECK_MODULES(CLUTTER, |
| 738 | - clutter-1.0 >= 1.2 \ |
| 739 | - clutter-x11-1.0 >= 1.2 \ |
| 740 | - clutter-gst-1.0 >= 1.0 \ |
| 741 | - clutter-gtk-1.0 >= 1.0 \ |
| 742 | - mx-1.0 >= 1.0.1, |
| 743 | - have_clutter=yes, |
| 744 | - have_clutter=no) |
| 745 | - if test "x$have_clutter" = "xno" -a "x$enable_visualizer" = "xyes"; then |
| 746 | - AC_MSG_ERROR([Visualizer support explicitly requested, but clutter couldn't be found]) |
| 747 | - fi |
| 748 | -fi |
| 749 | - |
| 750 | -AM_CONDITIONAL(USE_CLUTTER, test x"$have_clutter" = "xyes") |
| 751 | - |
| 752 | -AC_SUBST(CLUTTER_CFLAGS) |
| 753 | -AC_SUBST(CLUTTER_LIBS) |
| 754 | - |
| 755 | -dnl ================================================================ |
| 756 | -dnl Dependencies for Last.fm plugin |
| 757 | -dnl ================================================================ |
| 758 | -AC_ARG_ENABLE(lastfm, |
| 759 | - AC_HELP_STRING([--disable-lastfm], |
| 760 | - [Disable Last.fm support]),, |
| 761 | - enable_lastfm=auto) |
| 762 | -if test "x$enable_lastfm" != "xno"; then |
| 763 | - PKG_CHECK_MODULES(JSON_GLIB, json-glib-1.0, |
| 764 | - have_json_glib=yes, |
| 765 | - have_json_glib=no) |
| 766 | - if test "x$have_json_glib" = "xno" -a "x$enable_lastfm" = "xyes"; then |
| 767 | - AC_MSG_ERROR([Last.fm support explicitly requested, but json-glib couldn't be found]) |
| 768 | - fi |
| 769 | - if test x"$have_json_glib" = "xyes"; then |
| 770 | - AC_DEFINE(HAVE_JSON_GLIB, 1, [Define if json-glib support is enabled]) |
| 771 | - fi |
| 772 | -fi |
| 773 | - |
| 774 | -AM_CONDITIONAL(ENABLE_LASTFM, test x"$have_json_glib" = "xyes") |
| 775 | - |
| 776 | -AC_SUBST(JSON_GLIB_CFLAGS) |
| 777 | -AC_SUBST(JSON_GLIB_LIBS) |
| 778 | - |
| 779 | -dnl ================================================================ |
| 780 | -dnl grilo plugin |
| 781 | -dnl ================================================================ |
| 782 | -AC_ARG_ENABLE(grilo, |
| 783 | - AC_HELP_STRING([--disable-grilo], |
| 784 | - [Disable Grilo support]),, |
| 785 | - enable_grilo=auto) |
| 786 | -if test "x$enable_grilo" != "xno"; then |
| 787 | - PKG_CHECK_MODULES(GRILO, grilo-0.1 >= $GRILO_REQS, have_grilo=yes, have_grilo=no) |
| 788 | - if test "x$have_grilo" = "xno" -a "x$enable_grilo" = "xyes"; then |
| 789 | - AC_MSG_ERROR([Grilo support explicitly requested, but grilo couldn not be found]) |
| 790 | - fi |
| 791 | - if test "x$have_grilo" = "xyes"; then |
| 792 | - AC_DEFINE(HAVE_GRILO, 1, [Define if Grilo support is enabled]) |
| 793 | - fi |
| 794 | -fi |
| 795 | - |
| 796 | -AM_CONDITIONAL(ENABLE_GRILO, test x"$have_grilo" = "xyes") |
| 797 | -AC_SUBST(GRILO_CFLAGS) |
| 798 | -AC_SUBST(GRILO_LIBS) |
| 799 | - |
| 800 | -dnl ================================================================ |
| 801 | -dnl end-game |
| 802 | -dnl ================================================================ |
| 803 | - |
| 804 | -AC_OUTPUT([ |
| 805 | -rhythmbox.pc |
| 806 | -Makefile |
| 807 | -macros/Makefile |
| 808 | -lib/Makefile |
| 809 | -lib/libmediaplayerid/Makefile |
| 810 | -metadata/Makefile |
| 811 | -rhythmdb/Makefile |
| 812 | -widgets/Makefile |
| 813 | -podcast/Makefile |
| 814 | -shell/Makefile |
| 815 | -data/Makefile |
| 816 | -data/rhythmbox.desktop.in |
| 817 | -data/rhythmbox-device.desktop.in |
| 818 | -data/ui/Makefile |
| 819 | -data/icons/Makefile |
| 820 | -data/icons/hicolor/Makefile |
| 821 | -data/icons/hicolor/16x16/Makefile |
| 822 | -data/icons/hicolor/16x16/actions/Makefile |
| 823 | -data/icons/hicolor/16x16/apps/Makefile |
| 824 | -data/icons/hicolor/16x16/places/Makefile |
| 825 | -data/icons/hicolor/16x16/status/Makefile |
| 826 | -data/icons/hicolor/22x22/Makefile |
| 827 | -data/icons/hicolor/22x22/actions/Makefile |
| 828 | -data/icons/hicolor/22x22/apps/Makefile |
| 829 | -data/icons/hicolor/22x22/places/Makefile |
| 830 | -data/icons/hicolor/24x24/Makefile |
| 831 | -data/icons/hicolor/24x24/apps/Makefile |
| 832 | -data/icons/hicolor/24x24/places/Makefile |
| 833 | -data/icons/hicolor/32x32/Makefile |
| 834 | -data/icons/hicolor/32x32/actions/Makefile |
| 835 | -data/icons/hicolor/32x32/apps/Makefile |
| 836 | -data/icons/hicolor/32x32/places/Makefile |
| 837 | -data/icons/hicolor/48x48/Makefile |
| 838 | -data/icons/hicolor/48x48/apps/Makefile |
| 839 | -data/icons/hicolor/256x256/Makefile |
| 840 | -data/icons/hicolor/256x256/apps/Makefile |
| 841 | -data/icons/hicolor/scalable/Makefile |
| 842 | -data/icons/hicolor/scalable/actions/Makefile |
| 843 | -data/icons/hicolor/scalable/apps/Makefile |
| 844 | -data/icons/hicolor/scalable/places/Makefile |
| 845 | -data/icons/src/Makefile |
| 846 | -sources/Makefile |
| 847 | -sources/sync/Makefile |
| 848 | -plugins/Makefile |
| 849 | -plugins/sample/Makefile |
| 850 | -plugins/audiocd/Makefile |
| 851 | -plugins/audioscrobbler/Makefile |
| 852 | -plugins/brasero-disc-recorder/Makefile |
| 853 | -plugins/daap/Makefile |
| 854 | -plugins/fmradio/Makefile |
| 855 | -plugins/im-status/Makefile |
| 856 | -plugins/ipod/Makefile |
| 857 | -plugins/mtpdevice/Makefile |
| 858 | -plugins/iradio/Makefile |
| 859 | -plugins/lirc/Makefile |
| 860 | -plugins/lyrics/Makefile |
| 861 | -plugins/sample-python/Makefile |
| 862 | -plugins/sample-vala/Makefile |
| 863 | -plugins/pythonconsole/Makefile |
| 864 | -plugins/artdisplay/Makefile |
| 865 | -plugins/artsearch/Makefile |
| 866 | -plugins/magnatune/Makefile |
| 867 | -plugins/generic-player/Makefile |
| 868 | -plugins/rb/Makefile |
| 869 | -plugins/power-manager/Makefile |
| 870 | -plugins/mmkeys/Makefile |
| 871 | -plugins/context/Makefile |
| 872 | -plugins/sendto/Makefile |
| 873 | -plugins/replaygain/Makefile |
| 874 | -plugins/mpris/Makefile |
| 875 | -plugins/dbus-media-server/Makefile |
| 876 | -plugins/rbzeitgeist/Makefile |
| 877 | -plugins/notification/Makefile |
| 878 | -plugins/visualizer/Makefile |
| 879 | -plugins/grilo/Makefile |
| 880 | -bindings/Makefile |
| 881 | -bindings/vala/Makefile |
| 882 | -bindings/gi/Makefile |
| 883 | -help/Makefile |
| 884 | -po/Makefile.in |
| 885 | -tests/Makefile |
| 886 | -doc/Makefile |
| 887 | -doc/reference/Makefile |
| 888 | -backends/Makefile |
| 889 | -backends/gstreamer/Makefile |
| 890 | -remote/Makefile |
| 891 | -remote/dbus/Makefile |
| 892 | -]) |
| 893 | - |
| 894 | -AC_MSG_NOTICE([Rhythmbox was configured with the following options:]) |
| 895 | -if test x"$with_database" = xtree; then |
| 896 | - AC_MSG_NOTICE([** Tree database is enabled]) |
| 897 | -else |
| 898 | - AC_MSG_ERROR([Unknown database!]) |
| 899 | -fi |
| 900 | -if test x"${with_rhythmdb_debug}" != x0; then |
| 901 | - AC_MSG_NOTICE([** RhythmDB sanity checking enabled (may be slow!)]) |
| 902 | -fi |
| 903 | - |
| 904 | - |
| 905 | -if test x"$enable_mmkeys" != "xyes"; then |
| 906 | - AC_MSG_NOTICE([ Multimedia keys support is disabled]) |
| 907 | -else |
| 908 | - AC_MSG_NOTICE([** Multimedia keys support is enabled]) |
| 909 | -fi |
| 910 | - |
| 911 | -if test x"$have_musicbrainz3" = "xyes"; then |
| 912 | - AC_MSG_NOTICE([** MusicBrainz support is enabled]) |
| 913 | -else |
| 914 | - AC_MSG_NOTICE([ MusicBrainz support is disabled]) |
| 915 | -fi |
| 916 | - |
| 917 | -if test x"$use_ipod" = xyes; then |
| 918 | - AC_MSG_NOTICE([** iPod integration enabled]) |
| 919 | -else |
| 920 | - AC_MSG_NOTICE([ iPod integration disabled]) |
| 921 | -fi |
| 922 | -if test x"$use_mtp" = xyes; then |
| 923 | - AC_MSG_NOTICE([** MTP integration enabled]) |
| 924 | -else |
| 925 | - AC_MSG_NOTICE([ MTP integration disabled]) |
| 926 | -fi |
| 927 | -if test x"$have_libbrasero_media" != xno; then |
| 928 | - AC_MSG_NOTICE([** CD burning support enabled]) |
| 929 | -else |
| 930 | - AC_MSG_NOTICE([ CD burning support disabled]) |
| 931 | -fi |
| 932 | -if test x"$have_libdmapsharing" = xyes; then |
| 933 | - AC_MSG_NOTICE([** DAAP (music sharing) support is enabled]) |
| 934 | -else |
| 935 | - AC_MSG_NOTICE([ DAAP (music sharing) support is disabled]) |
| 936 | -fi |
| 937 | -if test x"$have_libnotify" = xyes; then |
| 938 | - AC_MSG_NOTICE([** libnotify support is enabled]) |
| 939 | -else |
| 940 | - AC_MSG_NOTICE([ libnotify support is disabled]) |
| 941 | -fi |
| 942 | -if test x"$have_webkit" = xyes; then |
| 943 | - AC_MSG_NOTICE([** WebKit support is enabled]) |
| 944 | -else |
| 945 | - AC_MSG_NOTICE([ WebKit support is disabled]) |
| 946 | -fi |
| 947 | -if test x"$use_gudev" = xyes; then |
| 948 | - AC_MSG_NOTICE([** GUdev support enabled]) |
| 949 | -elif test x"$enable_hal" = xyes; then |
| 950 | - AC_MSG_NOTICE([** HAL support enabled]) |
| 951 | -else |
| 952 | - AC_MSG_NOTICE([ GUdev support disabled]) |
| 953 | -fi |
| 954 | -if test x"$enable_python" = xyes; then |
| 955 | - AC_MSG_NOTICE([** Python plugin support enabled]) |
| 956 | -else |
| 957 | - AC_MSG_NOTICE([ Python plugin support disabled]) |
| 958 | -fi |
| 959 | -if test x"$with_vala" = xyes; then |
| 960 | - AC_MSG_NOTICE([** Vala plugin support enabled]) |
| 961 | -else |
| 962 | - AC_MSG_NOTICE([ Vala plugin support disabled]) |
| 963 | -fi |
| 964 | -if test x"$use_gnome_keyring" = xyes; then |
| 965 | - AC_MSG_NOTICE([** gnome-keyring support enabled]) |
| 966 | -else |
| 967 | - AC_MSG_NOTICE([ gnome-keyring support disabled]) |
| 968 | -fi |
| 969 | -if test "x$enable_fm_radio" != xno; then |
| 970 | - AC_MSG_NOTICE([** FM radio support enabled]) |
| 971 | -else |
| 972 | - AC_MSG_NOTICE([ FM radio support disabled]) |
| 973 | -fi |
| 974 | - |
| 975 | -if test "x$enable_browser_plugin" != xno; then |
| 976 | - AC_MSG_NOTICE([** iTunes detection browser plugin (for podcasts) enabled]) |
| 977 | -else |
| 978 | - AC_MSG_NOTICE([ iTunes detection browser plugin (for podcasts) disabled]) |
| 979 | -fi |
| 980 | - |
| 981 | -if test "x$have_clutter" = xyes; then |
| 982 | - AC_MSG_NOTICE([** Visualizer plugin enabled]) |
| 983 | -else |
| 984 | - AC_MSG_NOTICE([ Visualizer plugin disabled]) |
| 985 | -fi |
| 986 | - |
| 987 | -if test "x$have_json_glib" = xyes; then |
| 988 | - AC_MSG_NOTICE([** Last.fm support enabled]) |
| 989 | -else |
| 990 | - AC_MSG_NOTICE([ Last.fm support disabled]) |
| 991 | -fi |
| 992 | - |
| 993 | -AC_MSG_NOTICE([End options]) |
| 994 | |
| 995 | === removed directory '.pc/01_lpi.patch/data' |
| 996 | === removed directory '.pc/01_lpi.patch/data/ui' |
| 997 | === removed file '.pc/01_lpi.patch/data/ui/rhythmbox-ui.xml' |
| 998 | --- .pc/01_lpi.patch/data/ui/rhythmbox-ui.xml 2011-12-05 19:31:23 +0000 |
| 999 | +++ .pc/01_lpi.patch/data/ui/rhythmbox-ui.xml 1970-01-01 00:00:00 +0000 |
| 1000 | @@ -1,330 +0,0 @@ |
| 1001 | -<ui> |
| 1002 | - <menubar name="MenuBar"> |
| 1003 | - <menu name="MusicMenu" action="Music"> |
| 1004 | - <menuitem name="MusicImportFileMenu" action="MusicImportFile"/> |
| 1005 | - <menuitem name="MusicImportFolderMenu" action="MusicImportFolder"/> |
| 1006 | - <separator/> |
| 1007 | - <menuitem name="MusicCheckDevices" action="MusicCheckDevices"/> |
| 1008 | - <separator/> |
| 1009 | - <menu name="PlaylistMenu" action="Playlist"> |
| 1010 | - <menuitem name="MusicPlaylistNewPlaylistMenu" action="MusicPlaylistNewPlaylist"/> |
| 1011 | - <menuitem name="MusicPlaylistNewAutomaticPlaylistMenu" action="MusicPlaylistNewAutomaticPlaylist"/> |
| 1012 | - <menuitem name="MusicPlaylistLoadPlaylistMenu" action="MusicPlaylistLoadPlaylist"/> |
| 1013 | - <menuitem name="MusicPlaylistSavePlaylistMenu" action="MusicPlaylistSavePlaylist"/> |
| 1014 | - <menuitem name="MusicPlaylistEditAutoPlaylistMenu" action="EditAutomaticPlaylist"/> |
| 1015 | - <placeholder name="PluginPlaceholder" /> |
| 1016 | - <separator name="MusicPlaylistSeparator1"/> |
| 1017 | - <menuitem name="MusicPlaylistDeletePlaylistMenu" action="MusicPlaylistDeletePlaylist"/> |
| 1018 | - </menu> |
| 1019 | - <placeholder name="PluginPlaceholder" /> |
| 1020 | - <menuitem name="MusicNewPodcastMenu" action="MusicNewPodcast"/> |
| 1021 | - <separator/> |
| 1022 | - <menuitem name="MusicPropertiesMenu" action="MusicProperties"/> |
| 1023 | - <separator/> |
| 1024 | - <placeholder name="PluginWindowPlaceholder" /> |
| 1025 | - <menuitem name="MusicQuit" action="MusicQuit"/> |
| 1026 | - </menu> |
| 1027 | - |
| 1028 | - <menu name="EditMenu" action="Edit"> |
| 1029 | - <menuitem name="EditCutMenu" action="EditCut"/> |
| 1030 | - <menuitem name="EditCopyMenu" action="EditCopy"/> |
| 1031 | - <menuitem name="EditPasteMenu" action="EditPaste"/> |
| 1032 | - <separator/> |
| 1033 | - <menuitem name="EditSelectAllMenu" action="EditSelectAll"/> |
| 1034 | - <menuitem name="EditSelectNoneMenu" action="EditSelectNone"/> |
| 1035 | - <separator/> |
| 1036 | - <menuitem name="EditAddToQueueMenu" action="AddToQueue"/> |
| 1037 | - <menu name="EditPlaylistAddMenu" action="EditPlaylistAdd"> |
| 1038 | - <menuitem name="EditPlaylistAddNew" action="EditPlaylistAddNew"/> |
| 1039 | - <separator/> |
| 1040 | - <placeholder name="EditPlaylistAddPlaceholder"/> |
| 1041 | - </menu> |
| 1042 | - <separator/> |
| 1043 | - <placeholder name="DeleteActionPlaceholder" /> |
| 1044 | - <menuitem name="EditMovetoTrash" action="EditMovetoTrash"/> |
| 1045 | - <separator/> |
| 1046 | - <menuitem name="EditPluginsMenu" action="EditPlugins"/> |
| 1047 | - <menuitem name="EditPreferencesMenu" action="EditPreferences"/> |
| 1048 | - </menu> |
| 1049 | - |
| 1050 | - <menu name="ViewMenu" action="View"> |
| 1051 | - <menuitem name="ViewSmallDisplayMenu" action="ViewSmallDisplay"/> |
| 1052 | - <menuitem name="ViewPartyModeMenu" action="ViewPartyMode"/> |
| 1053 | - <placeholder name="ViewMenuModePlaceholder"/> |
| 1054 | - <separator name="ViewSep1"/> |
| 1055 | - <menuitem name="ViewSidePaneMenu" action="ViewSidePane"/> |
| 1056 | - <menuitem name="ViewQueueAsSidebarMenu" action="ViewQueueAsSidebar"/> |
| 1057 | - <menuitem name="ViewBrowserMenu" action="ViewBrowser"/> |
| 1058 | - <menuitem name="ViewStatusbarMenu" action="ViewStatusbar"/> |
| 1059 | - <menuitem name="ViewToolbarMenu" action="ViewToolbar"/> |
| 1060 | - <separator name="ViewSep2"/> |
| 1061 | - <menuitem name="ViewAllMenu" action="ViewAll"/> |
| 1062 | - <separator name="ViewSep3"/> |
| 1063 | - <menuitem name="ViewJumpToPlayingMenu" action="ViewJumpToPlaying"/> |
| 1064 | - </menu> |
| 1065 | - |
| 1066 | - <menu name="ToolsMenu" action="Tools"> |
| 1067 | - <placeholder name="ToolsOps_1" /> |
| 1068 | - <separator/> |
| 1069 | - <placeholder name="ToolsOps_2" /> |
| 1070 | - <separator/> |
| 1071 | - <placeholder name="ToolsOps_3" /> |
| 1072 | - <separator/> |
| 1073 | - <placeholder name="ToolsOps_4" /> |
| 1074 | - <separator/> |
| 1075 | - <placeholder name="ToolsOps_5" /> |
| 1076 | - </menu> |
| 1077 | - |
| 1078 | - <menu name="ControlMenu" action="Control"> |
| 1079 | - <menuitem name="ControlPlayMenu" action="ControlPlay"/> |
| 1080 | - <separator name="ControlSep1"/> |
| 1081 | - <menuitem name="ControlPreviousMenu" action="ControlPrevious"/> |
| 1082 | - <menuitem name="ControlNextMenu" action="ControlNext"/> |
| 1083 | - <separator name="ControlSep2"/> |
| 1084 | - <menuitem name="ControlVolumeUpMenu" action="ControlVolumeUp"/> |
| 1085 | - <menuitem name="ControlVolumeDownMenu" action="ControlVolumeDown"/> |
| 1086 | - <separator name="ControlSep3"/> |
| 1087 | - <menuitem name="ControlShuffleMenu" action="ControlShuffle"/> |
| 1088 | - <menuitem name="ControlRepeatMenu" action="ControlRepeat"/> |
| 1089 | - </menu> |
| 1090 | - |
| 1091 | - <menu name="HelpMenu" action="Help"> |
| 1092 | - <menuitem name="HelpContentsMenu" action="HelpContents"/> |
| 1093 | - <menuitem name="HelpAboutMenu" action="HelpAbout"/> |
| 1094 | - </menu> |
| 1095 | - |
| 1096 | - </menubar> |
| 1097 | - |
| 1098 | - <toolbar name="ToolBar"> |
| 1099 | - <toolitem name="Play" action="ControlPlay"/> |
| 1100 | - <toolitem name="Previous" action="ControlPrevious"/> |
| 1101 | - <toolitem name="Next" action="ControlNext"/> |
| 1102 | - <separator/> |
| 1103 | - <toolitem name="Repeat" action="ControlRepeat"/> |
| 1104 | - <toolitem name="Shuffle" action="ControlShuffle"/> |
| 1105 | - <separator/> |
| 1106 | - </toolbar> |
| 1107 | - |
| 1108 | - <popup name="BrowserSourceViewPopup"> |
| 1109 | - <menuitem name="AddToQueueLibraryPopup" action="AddToQueue"/> |
| 1110 | - <menu name="BrowserSourcePopupPlaylistAdd" action="EditPlaylistAdd"> |
| 1111 | - <menuitem name="BrowserSourcePopupPlaylistAddNew" action="EditPlaylistAddNew"/> |
| 1112 | - <separator/> |
| 1113 | - <placeholder name="BrowserSourcePopupPlaylistAddPlaceholder"/> |
| 1114 | - </menu> |
| 1115 | - <menuitem name="CopyLibraryPopup" action="EditCopy"/> |
| 1116 | - <separator/> |
| 1117 | - <placeholder name="DeleteActionPlaceholder" /> |
| 1118 | - <menuitem name="MovetoTrashPopup" action="EditMovetoTrash"/> |
| 1119 | - <separator/> |
| 1120 | - <menuitem name="BrowseGenreLibraryPopup" action="BrowserSrcChooseGenre"/> |
| 1121 | - <menuitem name="BrowseArtistLibraryPopup" action="BrowserSrcChooseArtist"/> |
| 1122 | - <menuitem name="BrowseAlbumLibraryPopup" action="BrowserSrcChooseAlbum"/> |
| 1123 | - <separator/> |
| 1124 | - <placeholder name="PluginPlaceholder"/> |
| 1125 | - <separator/> |
| 1126 | - <menuitem name="PropertiesLibraryPopup" action="MusicProperties"/> |
| 1127 | - </popup> |
| 1128 | - |
| 1129 | - <popup name="BrowserSourceSearchMenu"> |
| 1130 | - <menuitem name="SearchAll" action="BrowserSourceSearchAll"/> |
| 1131 | - <menuitem name="SearchArtists" action="BrowserSourceSearchArtists"/> |
| 1132 | - <menuitem name="SearchAlbums" action="BrowserSourceSearchAlbums"/> |
| 1133 | - <menuitem name="SearchTitles" action="BrowserSourceSearchTitles"/> |
| 1134 | - <placeholder name="PluginPlaceholder"/> |
| 1135 | - </popup> |
| 1136 | - |
| 1137 | - <popup name="AutoPlaylistSourceSearchMenu"> |
| 1138 | - <menuitem name="SearchAll" action="AutoPlaylistSearchAll"/> |
| 1139 | - <menuitem name="SearchArtists" action="AutoPlaylistSearchArtists"/> |
| 1140 | - <menuitem name="SearchAlbums" action="AutoPlaylistSearchAlbums"/> |
| 1141 | - <menuitem name="SearchTitles" action="AutoPlaylistSearchTitles"/> |
| 1142 | - <placeholder name="PluginPlaceholder"/> |
| 1143 | - </popup> |
| 1144 | - |
| 1145 | - <popup name="StaticPlaylistSourceSearchMenu"> |
| 1146 | - <menuitem name="SearchAll" action="StaticPlaylistSearchAll"/> |
| 1147 | - <menuitem name="SearchArtists" action="StaticPlaylistSearchArtists"/> |
| 1148 | - <menuitem name="SearchAlbums" action="StaticPlaylistSearchAlbums"/> |
| 1149 | - <menuitem name="SearchTitles" action="StaticPlaylistSearchTitles"/> |
| 1150 | - <placeholder name="PluginPlaceholder"/> |
| 1151 | - </popup> |
| 1152 | - |
| 1153 | - <popup name="PodcastSourceSearchMenu"> |
| 1154 | - <menuitem name="SearchAll" action="PodcastSearchAll"/> |
| 1155 | - <menuitem name="SearchFeeds" action="PodcastSearchFeeds"/> |
| 1156 | - <menuitem name="SearchEpisodes" action="PodcastSearchEpisodes"/> |
| 1157 | - <placeholder name="PluginPlaceholder"/> |
| 1158 | - </popup> |
| 1159 | - |
| 1160 | - <toolbar name="LibrarySourceToolBar"> |
| 1161 | - <toolitem name="Browse" action="ViewBrowser"/> |
| 1162 | - <toolitem name="ViewAll" action="ViewAll"/> |
| 1163 | - <toolitem name="LibraryImport" action="MusicImportFolder"/> |
| 1164 | - <placeholder name="PluginPlaceholder"/> |
| 1165 | - </toolbar> |
| 1166 | - |
| 1167 | - <toolbar name="QueueSourceToolBar"> |
| 1168 | - <toolitem name="ShuffleQueue" action="ShuffleQueue"/> |
| 1169 | - <toolitem name="Clear" action="ClearQueue"/> |
| 1170 | - <placeholder name="PluginPlaceholder"/> |
| 1171 | - </toolbar> |
| 1172 | - |
| 1173 | - <toolbar name="StaticPlaylistSourceToolBar"> |
| 1174 | - <toolitem name="Browse" action="ViewBrowser"/> |
| 1175 | - <toolitem name="ViewAll" action="ViewAll"/> |
| 1176 | - <placeholder name="PluginPlaceholder"/> |
| 1177 | - </toolbar> |
| 1178 | - |
| 1179 | - <toolbar name="AutoPlaylistSourceToolBar"> |
| 1180 | - <toolitem name="Browse" action="ViewBrowser"/> |
| 1181 | - <toolitem name="ViewAll" action="ViewAll"/> |
| 1182 | - <toolitem name="Edit" action="EditAutomaticPlaylist"/> |
| 1183 | - <placeholder name="PluginPlaceholder"/> |
| 1184 | - </toolbar> |
| 1185 | - |
| 1186 | - <toolbar name="PodcastSourceToolBar"> |
| 1187 | - <toolitem name="Browse" action="ViewBrowser"/> |
| 1188 | - <toolitem name="ViewAll" action="ViewAll"/> |
| 1189 | - <toolitem name="NewPodcast" action="MusicNewPodcast"/> |
| 1190 | - <toolitem name="UpdateFeed" action="PodcastFeedUpdate"/> |
| 1191 | - <placeholder name="PluginPlaceholder"/> |
| 1192 | - </toolbar> |
| 1193 | - |
| 1194 | - <popup name="ImportErrorsViewPopup"> |
| 1195 | - <menuitem name="DeleteLibraryPopup" action="EditRemove"/> |
| 1196 | - <menuitem name="MovetoTrashPopup" action="EditMovetoTrash"/> |
| 1197 | - <separator/> |
| 1198 | - <placeholder name="PluginPlaceholder"/> |
| 1199 | - </popup> |
| 1200 | - |
| 1201 | - <popup name="PlaylistViewPopup"> |
| 1202 | - <menuitem name="AddToQueuePlaylistPopup" action="AddToQueue"/> |
| 1203 | - <menu name="PlaylistPopupPlaylistAdd" action="EditPlaylistAdd"> |
| 1204 | - <menuitem name="PlaylistPopupPlaylistAddNew" action="EditPlaylistAddNew"/> |
| 1205 | - <separator/> |
| 1206 | - <placeholder name="PlaylistPopupPlaylistAddPlaceholder"/> |
| 1207 | - </menu> |
| 1208 | - <menuitem name="CopyPlaylistPopup" action="EditCopy"/> |
| 1209 | - <menuitem name="CutPlaylistPopup" action="EditCut"/> |
| 1210 | - <separator/> |
| 1211 | - <menuitem name="RemoveFromPlaylistPopup" action="RemoveFromPlaylist"/> |
| 1212 | - <menuitem name="MovetoTrashPlaylistPopup" action="EditMovetoTrash"/> |
| 1213 | - <separator/> |
| 1214 | - <placeholder name="PluginPlaceholder"/> |
| 1215 | - <separator/> |
| 1216 | - <menuitem name="PropertiesPlaylistPopup" action="MusicProperties"/> |
| 1217 | - </popup> |
| 1218 | - |
| 1219 | - <popup name="QueuePlaylistViewPopup"> |
| 1220 | - <menuitem name="RemoveFromPlaylistPopup" action="RemoveFromPlaylist"/> |
| 1221 | - <menuitem name="ShufflePlaylistPopup" action="ShuffleQueue"/> |
| 1222 | - <menuitem name="SaveQueuePopup" action="MusicPlaylistSavePlaylist"/> |
| 1223 | - <separator/> |
| 1224 | - <placeholder name="PluginPlaceholder"/> |
| 1225 | - <separator/> |
| 1226 | - <menuitem name="PropertiesPlaylistPopup" action="MusicProperties"/> |
| 1227 | - </popup> |
| 1228 | - |
| 1229 | - <popup name="QueueSidebarViewPopup"> |
| 1230 | - <menuitem name="DeletePlaylistPopup" action="QueueDelete"/> |
| 1231 | - <menuitem name="ClearPlaylistPopup" action="ClearQueue"/> |
| 1232 | - <menuitem name="ShufflePlaylistPopup" action="ShuffleQueue"/> |
| 1233 | - <menuitem name="SaveQueueSidebarPopup" action="MusicPlaylistSaveQueue"/> |
| 1234 | - <separator/> |
| 1235 | - <placeholder name="PluginPlaceholder"/> |
| 1236 | - <separator/> |
| 1237 | - <menuitem name="PropertiesPlaylistPopup" action="QueueMusicProperties"/> |
| 1238 | - </popup> |
| 1239 | - |
| 1240 | - <popup name="QueueSourcePopup"> |
| 1241 | - <menuitem name="ClearPlaylistPopup" action="ClearQueue"/> |
| 1242 | - <menuitem name="ShufflePlaylistPopup" action="ShuffleQueue"/> |
| 1243 | - <menuitem name="SaveQueuePopup" action="MusicPlaylistSavePlaylist"/> |
| 1244 | - <separator/> |
| 1245 | - <placeholder name="PluginPlaceholder" /> |
| 1246 | - </popup> |
| 1247 | - |
| 1248 | - <popup name="DisplayPageTreePopup"> |
| 1249 | - <menuitem name="DisplayPageTreePopupNewPlaylist" action="MusicPlaylistNewPlaylist"/> |
| 1250 | - <menuitem name="DisplayPageTreePopupNewAutomaticPlaylist" action="MusicPlaylistNewAutomaticPlaylist"/> |
| 1251 | - <separator/> |
| 1252 | - <placeholder name="PluginPlaceholder" /> |
| 1253 | - </popup> |
| 1254 | - |
| 1255 | - <popup name="LibrarySourcePopup"> |
| 1256 | - <menuitem name="LibrarySrcPopupAddFile" action="MusicImportFile"/> |
| 1257 | - <menuitem name="LibrarySrcPopupAddFolder" action="MusicImportFolder"/> |
| 1258 | - <separator/> |
| 1259 | - <placeholder name="PluginPlaceholder"/> |
| 1260 | - </popup> |
| 1261 | - |
| 1262 | - <popup name="PodcastSourcePopup"> |
| 1263 | - <menuitem name="PodcastSrcPopupNew" action="MusicNewPodcast"/> |
| 1264 | - <menuitem name="PodcastSrcPopupUpdateAllFeeds" action="PodcastUpdateAllFeeds"/> |
| 1265 | - <separator/> |
| 1266 | - <placeholder name="PluginPlaceholder"/> |
| 1267 | - </popup> |
| 1268 | - |
| 1269 | - <popup name="PodcastViewPopup"> |
| 1270 | - <menuitem name="DownloadPodcastPopup" action="PodcastSrcDownloadPost"/> |
| 1271 | - <menuitem name="CancelDownloadPopup" action="PodcastSrcCancelDownload"/> |
| 1272 | - <menuitem name="DeletePodcastPopup" action="EditDelete"/> |
| 1273 | - <separator/> |
| 1274 | - <menuitem name="AddToQueuePodcastPopup" action="AddToQueue"/> |
| 1275 | - <separator/> |
| 1276 | - <placeholder name="PluginPlaceholder"/> |
| 1277 | - <separator/> |
| 1278 | - <menuitem name="PropertiesPodcastPopup" action="MusicProperties"/> |
| 1279 | - </popup> |
| 1280 | - |
| 1281 | - <popup name="PodcastFeedViewPopup"> |
| 1282 | - <menuitem name="NewPodcastPopup" action="MusicNewPodcast"/> |
| 1283 | - <menuitem name="PodcastSrcPopupUpdateAllFeeds" action="PodcastUpdateAllFeeds"/> |
| 1284 | - <separator/> |
| 1285 | - <menuitem name="UpdateFeedPodcastPopup" action="PodcastFeedUpdate"/> |
| 1286 | - <menuitem name="DeleteFeedPodcastPopup" action="PodcastFeedDelete"/> |
| 1287 | - <separator/> |
| 1288 | - <placeholder name="PluginPlaceholder"/> |
| 1289 | - <separator/> |
| 1290 | - <menuitem name="PropertiesFeedPodcastPopup" action="PodcastFeedProperties"/> |
| 1291 | - </popup> |
| 1292 | - |
| 1293 | - <popup name="PlaylistSourcePopup"> |
| 1294 | - <menuitem name="RenameAutoPlaylistPopup" action="MusicPlaylistRenamePlaylist"/> |
| 1295 | - <separator/> |
| 1296 | - <menuitem name="QueuePlaylistPopup" action="QueuePlaylist"/> |
| 1297 | - <menuitem name="ShufflePlaylistPopup" action="ShufflePlaylist"/> |
| 1298 | - <placeholder name="PluginPlaceholder" /> |
| 1299 | - <separator/> |
| 1300 | - <menuitem name="DeletePlaylistPopup" action="MusicPlaylistDeletePlaylist"/> |
| 1301 | - <separator/> |
| 1302 | - <placeholder name="PluginPlaceholder"/> |
| 1303 | - <separator/> |
| 1304 | - <menuitem name="PlaylistSourceSavePlaylistPopup" action="MusicPlaylistSavePlaylist"/> |
| 1305 | - </popup> |
| 1306 | - |
| 1307 | - <popup name="AutoPlaylistSourcePopup"> |
| 1308 | - <menuitem name="EditAutoPlaylistPopup" action="EditAutomaticPlaylist"/> |
| 1309 | - <menuitem name="RenameAutoPlaylistPopup" action="MusicPlaylistRenamePlaylist"/> |
| 1310 | - <separator/> |
| 1311 | - <menuitem name="QueuePlaylistPopup" action="QueuePlaylist"/> |
| 1312 | - <menuitem name="ShufflePlaylistPopup" action="ShufflePlaylist"/> |
| 1313 | - <placeholder name="PluginPlaceholder" /> |
| 1314 | - <separator/> |
| 1315 | - <menuitem name="DeleteAutoPlaylistPopup" action="MusicPlaylistDeletePlaylist"/> |
| 1316 | - <separator/> |
| 1317 | - <placeholder name="PluginPlaceholder"/> |
| 1318 | - <separator/> |
| 1319 | - <menuitem name="PlaylistSourceSavePlaylistPopup" action="MusicPlaylistSavePlaylist"/> |
| 1320 | - </popup> |
| 1321 | - |
| 1322 | - |
| 1323 | - <popup name="MissingFilesViewPopup"> |
| 1324 | - <menuitem name="DeleteMissingFilesPopup" action="EditRemove"/> |
| 1325 | - <menuitem name="PropertiesMissingFilesPopup" action="MusicProperties"/> |
| 1326 | - <separator/> |
| 1327 | - <placeholder name="PluginPlaceholder"/> |
| 1328 | - </popup> |
| 1329 | - |
| 1330 | -</ui> |
| 1331 | |
| 1332 | === removed directory '.pc/01_lpi.patch/shell' |
| 1333 | === removed file '.pc/01_lpi.patch/shell/rb-shell.c' |
| 1334 | --- .pc/01_lpi.patch/shell/rb-shell.c 2012-01-17 16:56:40 +0000 |
| 1335 | +++ .pc/01_lpi.patch/shell/rb-shell.c 1970-01-01 00:00:00 +0000 |
| 1336 | @@ -1,4126 +0,0 @@ |
| 1337 | -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- |
| 1338 | - * |
| 1339 | - * Copyright (C) 2002, 2003 Jorn Baayen |
| 1340 | - * Copyright (C) 2003, 2004 Colin Walters <walters@gnome.org> |
| 1341 | - * |
| 1342 | - * This program is free software; you can redistribute it and/or modify |
| 1343 | - * it under the terms of the GNU General Public License as published by |
| 1344 | - * the Free Software Foundation; either version 2, or (at your option) |
| 1345 | - * any later version. |
| 1346 | - * |
| 1347 | - * The Rhythmbox authors hereby grant permission for non-GPL compatible |
| 1348 | - * GStreamer plugins to be used and distributed together with GStreamer |
| 1349 | - * and Rhythmbox. This permission is above and beyond the permissions granted |
| 1350 | - * by the GPL license by which Rhythmbox is covered. If you modify this code |
| 1351 | - * you may extend this exception to your version of the code, but you are not |
| 1352 | - * obligated to do so. If you do not wish to do so, delete this exception |
| 1353 | - * statement from your version. |
| 1354 | - * |
| 1355 | - * This program is distributed in the hope that it will be useful, |
| 1356 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1357 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 1358 | - * GNU General Public License for more details. |
| 1359 | - * |
| 1360 | - * You should have received a copy of the GNU General Public License |
| 1361 | - * along with this program; if not, write to the Free Software |
| 1362 | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 1363 | - * |
| 1364 | - */ |
| 1365 | - |
| 1366 | -/** |
| 1367 | - * SECTION:rb-shell |
| 1368 | - * @short_description: holds the Rhythmbox main window and everything else |
| 1369 | - * |
| 1370 | - * RBShell is the main application class in Rhythmbox. It creates and holds |
| 1371 | - * references to the other main objects (#RBShellPlayer, #RhythmDB, #RBDisplayPageTree), |
| 1372 | - * constructs the main window UI, and provides the basic DBus interface. |
| 1373 | - */ |
| 1374 | - |
| 1375 | -#include <config.h> |
| 1376 | - |
| 1377 | -#include <string.h> |
| 1378 | -#include <ctype.h> |
| 1379 | -#include <stdio.h> |
| 1380 | -#include <sys/stat.h> |
| 1381 | - |
| 1382 | -#include <glib/gi18n.h> |
| 1383 | -#include <gdk/gdk.h> |
| 1384 | -#include <gdk/gdkx.h> |
| 1385 | -#include <gtk/gtk.h> |
| 1386 | -#include <girepository.h> |
| 1387 | - |
| 1388 | -#include <libpeas/peas.h> |
| 1389 | -#include <libpeas-gtk/peas-gtk.h> |
| 1390 | - |
| 1391 | -#include <gst/gst.h> |
| 1392 | - |
| 1393 | -#ifdef HAVE_MMKEYS |
| 1394 | -#include <X11/XF86keysym.h> |
| 1395 | -#endif /* HAVE_MMKEYS */ |
| 1396 | - |
| 1397 | -#include "rb-shell.h" |
| 1398 | -#include "rb-debug.h" |
| 1399 | -#include "rb-dialog.h" |
| 1400 | -#ifdef WITH_RHYTHMDB_TREE |
| 1401 | -#include "rhythmdb-tree.h" |
| 1402 | -#else |
| 1403 | -#error "no database specified. configure broken?" |
| 1404 | -#endif |
| 1405 | -#include "rb-stock-icons.h" |
| 1406 | -#include "rb-display-page-tree.h" |
| 1407 | -#include "rb-display-page-group.h" |
| 1408 | -#include "rb-file-helpers.h" |
| 1409 | -#include "rb-source.h" |
| 1410 | -#include "rb-playlist-manager.h" |
| 1411 | -#include "rb-removable-media-manager.h" |
| 1412 | -#include "rb-track-transfer-queue.h" |
| 1413 | -#include "rb-shell-clipboard.h" |
| 1414 | -#include "rb-shell-player.h" |
| 1415 | -#include "rb-statusbar.h" |
| 1416 | -#include "rb-shell-preferences.h" |
| 1417 | -#include "rb-library-source.h" |
| 1418 | -#include "rb-podcast-source.h" |
| 1419 | -#include "totem-pl-parser.h" |
| 1420 | -#include "rb-shell-preferences.h" |
| 1421 | -#include "rb-playlist-source.h" |
| 1422 | -#include "rb-static-playlist-source.h" |
| 1423 | -#include "rb-play-queue-source.h" |
| 1424 | -#include "rb-missing-files-source.h" |
| 1425 | -#include "rb-import-errors-source.h" |
| 1426 | -#include "rb-util.h" |
| 1427 | -#include "rb-display-page-model.h" |
| 1428 | -#include "rb-song-info.h" |
| 1429 | -#include "rb-marshal.h" |
| 1430 | -#include "rb-missing-plugins.h" |
| 1431 | -#include "rb-podcast-manager.h" |
| 1432 | -#include "rb-podcast-main-source.h" |
| 1433 | -#include "rb-podcast-entry-types.h" |
| 1434 | -#include "rb-ext-db.h" |
| 1435 | -#include "rb-auto-playlist-source.h" |
| 1436 | - |
| 1437 | -#include "eggsmclient.h" |
| 1438 | - |
| 1439 | -#define UNINSTALLED_PLUGINS_LOCATION "plugins" |
| 1440 | - |
| 1441 | -#define PLAYING_ENTRY_NOTIFY_TIME 4 |
| 1442 | - |
| 1443 | -static void rb_shell_class_init (RBShellClass *klass); |
| 1444 | -static void rb_shell_init (RBShell *shell); |
| 1445 | -static void rb_shell_constructed (GObject *object); |
| 1446 | -static void rb_shell_finalize (GObject *object); |
| 1447 | -static void rb_shell_set_property (GObject *object, |
| 1448 | - guint prop_id, |
| 1449 | - const GValue *value, |
| 1450 | - GParamSpec *pspec); |
| 1451 | -static void rb_shell_get_property (GObject *object, |
| 1452 | - guint prop_id, |
| 1453 | - GValue *value, |
| 1454 | - GParamSpec *pspec); |
| 1455 | -static void rb_shell_activate (GApplication *app); |
| 1456 | -static void rb_shell_open (GApplication *app, GFile **files, int n_files, const char *hint); |
| 1457 | -static gboolean rb_shell_local_command_line (GApplication *app, gchar ***args, int *exit_status); |
| 1458 | -static gboolean rb_shell_get_visibility (RBShell *shell); |
| 1459 | -static gboolean rb_shell_window_state_cb (GtkWidget *widget, |
| 1460 | - GdkEventWindowState *event, |
| 1461 | - RBShell *shell); |
| 1462 | -static gboolean rb_shell_window_configure_cb (GtkWidget *win, |
| 1463 | - GdkEventConfigure*event, |
| 1464 | - RBShell *shell); |
| 1465 | -static gboolean rb_shell_window_delete_cb (GtkWidget *win, |
| 1466 | - GdkEventAny *event, |
| 1467 | - RBShell *shell); |
| 1468 | -static gboolean rb_shell_key_press_event_cb (GtkWidget *win, |
| 1469 | - GdkEventKey *event, |
| 1470 | - RBShell *shell); |
| 1471 | -static void rb_shell_sync_window_state (RBShell *shell, gboolean dont_maximise); |
| 1472 | -static void rb_shell_sync_paned (RBShell *shell); |
| 1473 | -static void rb_shell_sync_party_mode (RBShell *shell); |
| 1474 | -static void rb_shell_select_page (RBShell *shell, RBDisplayPage *display_page); |
| 1475 | -static void display_page_selected_cb (RBDisplayPageTree *display_page_tree, |
| 1476 | - RBDisplayPage *page, |
| 1477 | - RBShell *shell); |
| 1478 | -static void rb_shell_playing_source_changed_cb (RBShellPlayer *player, |
| 1479 | - RBSource *source, |
| 1480 | - RBShell *shell); |
| 1481 | -static void rb_shell_playing_from_queue_cb (RBShellPlayer *player, |
| 1482 | - GParamSpec *arg, |
| 1483 | - RBShell *shell); |
| 1484 | -static void rb_shell_db_save_error_cb (RhythmDB *db, |
| 1485 | - const char *uri, const GError *error, |
| 1486 | - RBShell *shell); |
| 1487 | - |
| 1488 | -static void rb_shell_playlist_added_cb (RBPlaylistManager *mgr, RBSource *source, RBShell *shell); |
| 1489 | -static void rb_shell_playlist_created_cb (RBPlaylistManager *mgr, RBSource *source, RBShell *shell); |
| 1490 | -static void rb_shell_medium_added_cb (RBRemovableMediaManager *mgr, RBSource *source, RBShell *shell); |
| 1491 | -static void rb_shell_display_page_deleted_cb (RBDisplayPage *page, RBShell *shell); |
| 1492 | -static void rb_shell_set_window_title (RBShell *shell, const char *window_title); |
| 1493 | -static void rb_shell_player_window_title_changed_cb (RBShellPlayer *player, |
| 1494 | - const char *window_title, |
| 1495 | - RBShell *shell); |
| 1496 | -static void rb_shell_cmd_about (GtkAction *action, |
| 1497 | - RBShell *shell); |
| 1498 | -static void rb_shell_cmd_contents (GtkAction *action, |
| 1499 | - RBShell *shell); |
| 1500 | -static void rb_shell_cmd_quit (GtkAction *action, |
| 1501 | - RBShell *shell); |
| 1502 | -static void rb_shell_cmd_preferences (GtkAction *action, |
| 1503 | - RBShell *shell); |
| 1504 | -static void rb_shell_cmd_plugins (GtkAction *action, |
| 1505 | - RBShell *shell); |
| 1506 | -static void rb_shell_cmd_add_folder_to_library (GtkAction *action, |
| 1507 | - RBShell *shell); |
| 1508 | -static void rb_shell_cmd_add_file_to_library (GtkAction *action, |
| 1509 | - RBShell *shell); |
| 1510 | - |
| 1511 | -static void rb_shell_cmd_current_song (GtkAction *action, |
| 1512 | - RBShell *shell); |
| 1513 | -static void rb_shell_jump_to_current (RBShell *shell); |
| 1514 | -static void rb_shell_jump_to_entry_with_source (RBShell *shell, RBSource *source, |
| 1515 | - RhythmDBEntry *entry); |
| 1516 | -static void rb_shell_play_entry (RBShell *shell, RhythmDBEntry *entry); |
| 1517 | -static void rb_shell_cmd_view_all (GtkAction *action, |
| 1518 | - RBShell *shell); |
| 1519 | -static void rb_shell_view_party_mode_changed_cb (GtkAction *action, |
| 1520 | - RBShell *shell); |
| 1521 | -static void rb_shell_view_smalldisplay_changed_cb (GtkAction *action, |
| 1522 | - RBShell *shell); |
| 1523 | -static void rb_shell_view_statusbar_changed_cb (GtkAction *action, |
| 1524 | - RBShell *shell); |
| 1525 | -static void rb_shell_view_queue_as_sidebar_changed_cb (GtkAction *action, |
| 1526 | - RBShell *shell); |
| 1527 | -static void rb_shell_load_complete_cb (RhythmDB *db, RBShell *shell); |
| 1528 | -static void rb_shell_sync_toolbar_state (RBShell *shell); |
| 1529 | -static void rb_shell_sync_smalldisplay (RBShell *shell); |
| 1530 | -static void rb_shell_sync_pane_visibility (RBShell *shell); |
| 1531 | -static void rb_shell_sync_statusbar_visibility (RBShell *shell); |
| 1532 | -static void rb_shell_set_visibility (RBShell *shell, |
| 1533 | - gboolean initial, |
| 1534 | - gboolean visible); |
| 1535 | -static void display_page_tree_drag_received_cb (RBDisplayPageTree *display_page_tree, |
| 1536 | - RBDisplayPage *page, |
| 1537 | - GtkSelectionData *data, |
| 1538 | - RBShell *shell); |
| 1539 | - |
| 1540 | -static void paned_size_allocate_cb (GtkWidget *widget, |
| 1541 | - GtkAllocation *allocation, |
| 1542 | - RBShell *shell); |
| 1543 | -static void rb_shell_volume_widget_changed_cb (GtkScaleButton *vol, |
| 1544 | - gdouble volume, |
| 1545 | - RBShell *shell); |
| 1546 | -static void rb_shell_player_volume_changed_cb (RBShellPlayer *player, |
| 1547 | - GParamSpec *arg, |
| 1548 | - RBShell *shell); |
| 1549 | -static void settings_changed_cb (GSettings *settings, const char *key, RBShell *shell); |
| 1550 | - |
| 1551 | -static void rb_shell_session_init (RBShell *shell); |
| 1552 | - |
| 1553 | -static gboolean rb_shell_visibility_changing (RBShell *shell, gboolean initial, gboolean visible); |
| 1554 | - |
| 1555 | -enum |
| 1556 | -{ |
| 1557 | - PROP_NONE, |
| 1558 | - PROP_NO_REGISTRATION, |
| 1559 | - PROP_NO_UPDATE, |
| 1560 | - PROP_DRY_RUN, |
| 1561 | - PROP_RHYTHMDB_FILE, |
| 1562 | - PROP_PLAYLISTS_FILE, |
| 1563 | - PROP_SELECTED_PAGE, |
| 1564 | - PROP_DB, |
| 1565 | - PROP_UI_MANAGER, |
| 1566 | - PROP_CLIPBOARD, |
| 1567 | - PROP_PLAYLIST_MANAGER, |
| 1568 | - PROP_REMOVABLE_MEDIA_MANAGER, |
| 1569 | - PROP_SHELL_PLAYER, |
| 1570 | - PROP_WINDOW, |
| 1571 | - PROP_PREFS, |
| 1572 | - PROP_QUEUE_SOURCE, |
| 1573 | - PROP_PROXY_CONFIG, |
| 1574 | - PROP_LIBRARY_SOURCE, |
| 1575 | - PROP_DISPLAY_PAGE_MODEL, |
| 1576 | - PROP_DISPLAY_PAGE_TREE, |
| 1577 | - PROP_VISIBILITY, |
| 1578 | - PROP_TRACK_TRANSFER_QUEUE, |
| 1579 | - PROP_AUTOSTARTED, |
| 1580 | - PROP_DISABLE_PLUGINS |
| 1581 | -}; |
| 1582 | - |
| 1583 | -enum |
| 1584 | -{ |
| 1585 | - VISIBILITY_CHANGED, |
| 1586 | - VISIBILITY_CHANGING, |
| 1587 | - CREATE_SONG_INFO, |
| 1588 | - NOTIFY_PLAYING_ENTRY, |
| 1589 | - NOTIFY_CUSTOM, |
| 1590 | - LAST_SIGNAL |
| 1591 | -}; |
| 1592 | - |
| 1593 | -static guint rb_shell_signals[LAST_SIGNAL] = { 0 }; |
| 1594 | - |
| 1595 | -G_DEFINE_TYPE (RBShell, rb_shell, GTK_TYPE_APPLICATION) |
| 1596 | - |
| 1597 | -struct _RBShellPrivate |
| 1598 | -{ |
| 1599 | - GtkWidget *window; |
| 1600 | - gboolean iconified; |
| 1601 | - |
| 1602 | - GtkUIManager *ui_manager; |
| 1603 | - GtkActionGroup *actiongroup; |
| 1604 | - guint source_ui_merge_id; |
| 1605 | - |
| 1606 | - GtkWidget *main_vbox; |
| 1607 | - GtkWidget *paned; |
| 1608 | - GtkWidget *right_paned; |
| 1609 | - RBDisplayPageTree *display_page_tree; |
| 1610 | - GtkWidget *notebook; |
| 1611 | - GtkWidget *queue_paned; |
| 1612 | - GtkWidget *queue_sidebar; |
| 1613 | - |
| 1614 | - GtkBox *sidebar_container; |
| 1615 | - GtkBox *right_sidebar_container; |
| 1616 | - GtkBox *top_container; |
| 1617 | - GtkBox *bottom_container; |
| 1618 | - guint right_sidebar_widget_count; |
| 1619 | - |
| 1620 | - RBDisplayPageModel *display_page_model; |
| 1621 | - GList *sources; /* kill? */ |
| 1622 | - GHashTable *sources_hash; /* kill? */ |
| 1623 | - |
| 1624 | - guint async_state_save_id; |
| 1625 | - guint save_playlist_id; |
| 1626 | - guint save_db_id; |
| 1627 | - |
| 1628 | - gboolean shutting_down; |
| 1629 | - gboolean load_complete; |
| 1630 | - |
| 1631 | - gboolean no_registration; |
| 1632 | - gboolean no_update; |
| 1633 | - gboolean dry_run; |
| 1634 | - gboolean autostarted; |
| 1635 | - gboolean disable_plugins; |
| 1636 | - char *rhythmdb_file; |
| 1637 | - char *playlists_file; |
| 1638 | - |
| 1639 | - RhythmDB *db; |
| 1640 | - RBExtDB *art_store; |
| 1641 | - |
| 1642 | - RBShellPlayer *player_shell; |
| 1643 | - RBShellClipboard *clipboard_shell; |
| 1644 | - RBStatusbar *statusbar; |
| 1645 | - RBPlaylistManager *playlist_manager; |
| 1646 | - RBRemovableMediaManager *removable_media_manager; |
| 1647 | - RBTrackTransferQueue *track_transfer_queue; |
| 1648 | - RBPodcastManager *podcast_manager; |
| 1649 | - |
| 1650 | - RBLibrarySource *library_source; |
| 1651 | - RBPodcastSource *podcast_source; |
| 1652 | - RBPlaylistSource *queue_source; |
| 1653 | - RBSource *missing_files_source; |
| 1654 | - RBSource *import_errors_source; |
| 1655 | - |
| 1656 | - RBDisplayPage *selected_page; |
| 1657 | - |
| 1658 | - GtkWidget *prefs; |
| 1659 | - GtkWidget *plugins; |
| 1660 | - |
| 1661 | - GtkWidget *volume_button; |
| 1662 | - gboolean syncing_volume; |
| 1663 | - |
| 1664 | - char *cached_title; |
| 1665 | - gboolean cached_playing; |
| 1666 | - |
| 1667 | - guint sidepane_visibility_notify_id; |
| 1668 | - guint toolbar_visibility_notify_id; |
| 1669 | - guint toolbar_style_notify_id; |
| 1670 | - guint smalldisplay_notify_id; |
| 1671 | - |
| 1672 | - glong last_small_time; /* when we last changed small mode */ |
| 1673 | - gboolean party_mode; |
| 1674 | - |
| 1675 | - GSettings *settings; |
| 1676 | - |
| 1677 | - GSettings *plugin_settings; |
| 1678 | - PeasEngine *plugin_engine; |
| 1679 | - PeasExtensionSet *activatable; |
| 1680 | -}; |
| 1681 | - |
| 1682 | - |
| 1683 | -static GtkActionEntry rb_shell_actions [] = |
| 1684 | -{ |
| 1685 | - { "Music", NULL, N_("_Music") }, |
| 1686 | - { "Edit", NULL, N_("_Edit") }, |
| 1687 | - { "View", NULL, N_("_View") }, |
| 1688 | - { "Control", NULL, N_("_Control") }, |
| 1689 | - { "Tools", NULL, N_("_Tools") }, |
| 1690 | - { "Help", NULL, N_("_Help") }, |
| 1691 | - |
| 1692 | - { "MusicImportFolder", GTK_STOCK_OPEN, N_("_Import Folder..."), "<control>O", |
| 1693 | - N_("Choose folder to be added to the Library"), |
| 1694 | - G_CALLBACK (rb_shell_cmd_add_folder_to_library) }, |
| 1695 | - { "MusicImportFile", GTK_STOCK_FILE, N_("Import _File..."), NULL, |
| 1696 | - N_("Choose file to be added to the Library"), |
| 1697 | - G_CALLBACK (rb_shell_cmd_add_file_to_library) }, |
| 1698 | - { "HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL, |
| 1699 | - N_("Show information about Rhythmbox"), |
| 1700 | - G_CALLBACK (rb_shell_cmd_about) }, |
| 1701 | - { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", |
| 1702 | - N_("Display Rhythmbox help"), |
| 1703 | - G_CALLBACK (rb_shell_cmd_contents) }, |
| 1704 | - { "MusicQuit", GTK_STOCK_QUIT, N_("_Quit"), "<control>Q", |
| 1705 | - N_("Quit Rhythmbox"), |
| 1706 | - G_CALLBACK (rb_shell_cmd_quit) }, |
| 1707 | - { "EditPreferences", GTK_STOCK_PREFERENCES, N_("Prefere_nces"), NULL, |
| 1708 | - N_("Edit Rhythmbox preferences"), |
| 1709 | - G_CALLBACK (rb_shell_cmd_preferences) }, |
| 1710 | - { "EditPlugins", NULL, N_("Plu_gins"), NULL, |
| 1711 | - N_("Change and configure plugins"), |
| 1712 | - G_CALLBACK (rb_shell_cmd_plugins) }, |
| 1713 | - { "ViewAll", NULL, N_("Show _All Tracks"), "<control>Y", |
| 1714 | - N_("Show all tracks in this music source"), |
| 1715 | - G_CALLBACK (rb_shell_cmd_view_all) }, |
| 1716 | - { "ViewJumpToPlaying", GTK_STOCK_JUMP_TO, N_("_Jump to Playing Song"), "<control>J", |
| 1717 | - N_("Scroll the view to the currently playing song"), |
| 1718 | - G_CALLBACK (rb_shell_cmd_current_song) }, |
| 1719 | -}; |
| 1720 | -static guint rb_shell_n_actions = G_N_ELEMENTS (rb_shell_actions); |
| 1721 | - |
| 1722 | -static GtkToggleActionEntry rb_shell_toggle_entries [] = |
| 1723 | -{ |
| 1724 | - { "ViewSidePane", NULL, N_("Side _Pane"), "F9", |
| 1725 | - N_("Change the visibility of the side pane"), |
| 1726 | - NULL, TRUE }, |
| 1727 | - { "ViewToolbar", NULL, N_("T_oolbar"), NULL, |
| 1728 | - N_("Change the visibility of the toolbar"), |
| 1729 | - NULL, TRUE }, |
| 1730 | - { "ViewSmallDisplay", NULL, N_("_Small Display"), "<control>D", |
| 1731 | - N_("Make the main window smaller"), |
| 1732 | - G_CALLBACK (rb_shell_view_smalldisplay_changed_cb), }, |
| 1733 | - { "ViewPartyMode", NULL, N_("Party _Mode"), "F11", |
| 1734 | - N_("Change the status of the party mode"), |
| 1735 | - G_CALLBACK (rb_shell_view_party_mode_changed_cb), FALSE }, |
| 1736 | - { "ViewQueueAsSidebar", NULL, N_("Play _Queue as Side Pane"), "<control>K", |
| 1737 | - N_("Change whether the queue is visible as a source or a sidebar"), |
| 1738 | - G_CALLBACK (rb_shell_view_queue_as_sidebar_changed_cb) }, |
| 1739 | - { "ViewStatusbar", NULL, N_("S_tatusbar"), NULL, |
| 1740 | - N_("Change the visibility of the statusbar"), |
| 1741 | - G_CALLBACK (rb_shell_view_statusbar_changed_cb), TRUE }, |
| 1742 | - { "ViewBrowser", NULL, N_("_Browse"), "<control>B", |
| 1743 | - N_("Change the visibility of the browser"), |
| 1744 | - NULL, TRUE } |
| 1745 | -}; |
| 1746 | -static guint rb_shell_n_toggle_entries = G_N_ELEMENTS (rb_shell_toggle_entries); |
| 1747 | - |
| 1748 | -static void |
| 1749 | -rb_shell_activate (GApplication *app) |
| 1750 | -{ |
| 1751 | - rb_shell_present (RB_SHELL (app), gtk_get_current_event_time (), NULL); |
| 1752 | -} |
| 1753 | - |
| 1754 | -static void |
| 1755 | -rb_shell_open (GApplication *app, GFile **files, int n_files, const char *hint) |
| 1756 | -{ |
| 1757 | - int i; |
| 1758 | - |
| 1759 | - for (i = 0; i < n_files; i++) { |
| 1760 | - char *uri; |
| 1761 | - |
| 1762 | - uri = g_file_get_uri (files[i]); |
| 1763 | - |
| 1764 | - /* |
| 1765 | - * rb_uri_exists won't work if the location isn't mounted. |
| 1766 | - * however, things that are interesting to mount are generally |
| 1767 | - * non-local, so we'll process them anyway. |
| 1768 | - */ |
| 1769 | - if (rb_uri_is_local (uri) == FALSE || rb_uri_exists (uri)) { |
| 1770 | - rb_shell_load_uri (RB_SHELL (app), uri, TRUE, NULL); |
| 1771 | - } |
| 1772 | - g_free (uri); |
| 1773 | - } |
| 1774 | -} |
| 1775 | - |
| 1776 | -static void |
| 1777 | -load_state_changed_cb (GActionGroup *action_group, const char *action_name, GVariant *state, GPtrArray *files) |
| 1778 | -{ |
| 1779 | - gboolean loaded; |
| 1780 | - gboolean scanned; |
| 1781 | - |
| 1782 | - if (g_strcmp0 (action_name, "LoadURI") != 0) { |
| 1783 | - return; |
| 1784 | - } |
| 1785 | - |
| 1786 | - g_variant_get (state, "(bb)", &loaded, &scanned); |
| 1787 | - if (loaded) { |
| 1788 | - rb_debug ("opening files now"); |
| 1789 | - g_signal_handlers_disconnect_by_func (action_group, load_state_changed_cb, files); |
| 1790 | - |
| 1791 | - g_application_open (G_APPLICATION (action_group), (GFile **)files->pdata, files->len, ""); |
| 1792 | - g_ptr_array_free (files, TRUE); |
| 1793 | - } |
| 1794 | -} |
| 1795 | - |
| 1796 | - |
| 1797 | - |
| 1798 | -static GMountOperation * |
| 1799 | -rb_shell_create_mount_op_cb (RhythmDB *db, RBShell *shell) |
| 1800 | -{ |
| 1801 | - /* we don't want the operation to be modal, so we don't associate it with the window. */ |
| 1802 | - GMountOperation *op = gtk_mount_operation_new (NULL); |
| 1803 | - gtk_mount_operation_set_screen (GTK_MOUNT_OPERATION (op), |
| 1804 | - gtk_window_get_screen (GTK_WINDOW (shell->priv->window))); |
| 1805 | - return op; |
| 1806 | -} |
| 1807 | - |
| 1808 | -static GValue * |
| 1809 | -load_external_art_cb (RBExtDB *store, GValue *value, RBShell *shell) |
| 1810 | -{ |
| 1811 | - const char *data; |
| 1812 | - gsize data_size; |
| 1813 | - GdkPixbufLoader *loader; |
| 1814 | - GdkPixbuf *pixbuf; |
| 1815 | - GValue *v; |
| 1816 | - GError *error = NULL; |
| 1817 | - |
| 1818 | - if (G_VALUE_HOLDS_STRING (value)) { |
| 1819 | - data = g_value_get_string (value); |
| 1820 | - data_size = strlen (data); |
| 1821 | - } else if (G_VALUE_HOLDS (value, G_TYPE_GSTRING)) { |
| 1822 | - GString *str = g_value_get_boxed (value); |
| 1823 | - data = (const char *)str->str; |
| 1824 | - data_size = str->len; |
| 1825 | - } else if (G_VALUE_HOLDS (value, G_TYPE_BYTE_ARRAY)) { |
| 1826 | - GByteArray *bytes = g_value_get_boxed (value); |
| 1827 | - data = (const char *)bytes->data; |
| 1828 | - data_size = bytes->len; |
| 1829 | - } else { |
| 1830 | - rb_debug ("unable to load pixbufs from values of type %s", G_VALUE_TYPE_NAME (value)); |
| 1831 | - return NULL; |
| 1832 | - } |
| 1833 | - |
| 1834 | - loader = gdk_pixbuf_loader_new (); |
| 1835 | - gdk_pixbuf_loader_write (loader, (const guchar *)data, data_size, &error); |
| 1836 | - if (error != NULL) { |
| 1837 | - rb_debug ("unable to load pixbuf: %s", error->message); |
| 1838 | - g_clear_error (&error); |
| 1839 | - g_object_unref (loader); |
| 1840 | - return NULL; |
| 1841 | - } |
| 1842 | - |
| 1843 | - gdk_pixbuf_loader_close (loader, &error); |
| 1844 | - if (error != NULL) { |
| 1845 | - rb_debug ("unable to load pixbuf: %s", error->message); |
| 1846 | - g_clear_error (&error); |
| 1847 | - return NULL; |
| 1848 | - } |
| 1849 | - |
| 1850 | - pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); |
| 1851 | - v = g_new0 (GValue, 1); |
| 1852 | - g_value_init (v, GDK_TYPE_PIXBUF); |
| 1853 | - g_value_set_object (v, pixbuf); |
| 1854 | - g_object_unref (loader); |
| 1855 | - |
| 1856 | - return v; |
| 1857 | -} |
| 1858 | - |
| 1859 | -static GValue * |
| 1860 | -store_external_art_cb (RBExtDB *store, GValue *value, RBShell *shell) |
| 1861 | -{ |
| 1862 | - const char *jpeg_format = "jpeg"; |
| 1863 | - char *jpeg_format_options[] = { "quality", NULL }; |
| 1864 | - char *jpeg_format_values[] = { "100", NULL }; |
| 1865 | - const char *png_format = "png"; |
| 1866 | - char *png_format_options[] = { "compression", NULL }; |
| 1867 | - char *png_format_values[] = { "9", NULL }; |
| 1868 | - const char *format; |
| 1869 | - char **format_options; |
| 1870 | - char **format_values; |
| 1871 | - GdkPixbuf *pixbuf; |
| 1872 | - char *data; |
| 1873 | - gsize data_size; |
| 1874 | - GError *error = NULL; |
| 1875 | - GString *s; |
| 1876 | - GValue *v; |
| 1877 | - |
| 1878 | - if (G_VALUE_HOLDS (value, GDK_TYPE_PIXBUF) == FALSE) { |
| 1879 | - rb_debug ("can't store values of type %s", G_VALUE_TYPE_NAME (value)); |
| 1880 | - return NULL; |
| 1881 | - } |
| 1882 | - |
| 1883 | - pixbuf = GDK_PIXBUF (g_value_get_object (value)); |
| 1884 | - |
| 1885 | - /* switch to png if the image has an alpha channel */ |
| 1886 | - if (gdk_pixbuf_get_has_alpha (pixbuf)) { |
| 1887 | - format = png_format; |
| 1888 | - format_options = png_format_options; |
| 1889 | - format_values = png_format_values; |
| 1890 | - } else { |
| 1891 | - format = jpeg_format; |
| 1892 | - format_options = jpeg_format_options; |
| 1893 | - format_values = jpeg_format_values; |
| 1894 | - } |
| 1895 | - |
| 1896 | - if (gdk_pixbuf_save_to_bufferv (pixbuf, &data, &data_size, format, format_options, format_values, &error) == FALSE) { |
| 1897 | - rb_debug ("unable to save pixbuf: %s", error->message); |
| 1898 | - g_clear_error (&error); |
| 1899 | - return NULL; |
| 1900 | - } |
| 1901 | - |
| 1902 | - s = g_string_new_len (data, data_size); |
| 1903 | - v = g_new0 (GValue, 1); |
| 1904 | - g_value_init (v, G_TYPE_GSTRING); |
| 1905 | - g_value_set_boxed (v, s); |
| 1906 | - return v; |
| 1907 | -} |
| 1908 | - |
| 1909 | -static void |
| 1910 | -construct_db (RBShell *shell) |
| 1911 | -{ |
| 1912 | - char *pathname; |
| 1913 | - |
| 1914 | - /* Initialize the database */ |
| 1915 | - rb_debug ("creating database object"); |
| 1916 | - rb_profile_start ("creating database object"); |
| 1917 | - |
| 1918 | - if (shell->priv->rhythmdb_file) { |
| 1919 | - pathname = g_strdup (shell->priv->rhythmdb_file); |
| 1920 | - } else { |
| 1921 | - pathname = rb_find_user_data_file ("rhythmdb.xml"); |
| 1922 | - } |
| 1923 | - |
| 1924 | -#ifdef WITH_RHYTHMDB_TREE |
| 1925 | - shell->priv->db = rhythmdb_tree_new (pathname); |
| 1926 | -#elif defined(WITH_RHYTHMDB_GDA) |
| 1927 | - shell->priv->db = rhythmdb_gda_new (pathname); |
| 1928 | -#endif |
| 1929 | - g_free (pathname); |
| 1930 | - |
| 1931 | - if (shell->priv->dry_run) |
| 1932 | - g_object_set (shell->priv->db, "dry-run", TRUE, NULL); |
| 1933 | - if (shell->priv->no_update) |
| 1934 | - g_object_set (shell->priv->db, "no-update", TRUE, NULL); |
| 1935 | - |
| 1936 | - g_signal_connect_object (G_OBJECT (shell->priv->db), "load-complete", |
| 1937 | - G_CALLBACK (rb_shell_load_complete_cb), shell, |
| 1938 | - 0); |
| 1939 | - g_signal_connect_object (G_OBJECT (shell->priv->db), "create-mount-op", |
| 1940 | - G_CALLBACK (rb_shell_create_mount_op_cb), shell, |
| 1941 | - 0); |
| 1942 | - |
| 1943 | - shell->priv->art_store = rb_ext_db_new ("album-art"); |
| 1944 | - g_signal_connect (shell->priv->art_store, "load", G_CALLBACK (load_external_art_cb), shell); |
| 1945 | - g_signal_connect (shell->priv->art_store, "store", G_CALLBACK (store_external_art_cb), shell); |
| 1946 | - |
| 1947 | - rb_profile_end ("creating database object"); |
| 1948 | -} |
| 1949 | - |
| 1950 | -static void |
| 1951 | -construct_widgets (RBShell *shell) |
| 1952 | -{ |
| 1953 | - GtkWindow *win; |
| 1954 | - |
| 1955 | - rb_profile_start ("constructing widgets"); |
| 1956 | - |
| 1957 | - /* initialize UI */ |
| 1958 | - win = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL)); |
| 1959 | - gtk_window_set_title (win, _("Rhythmbox")); |
| 1960 | - |
| 1961 | - shell->priv->window = GTK_WIDGET (win); |
| 1962 | - shell->priv->iconified = FALSE; |
| 1963 | - g_signal_connect_object (G_OBJECT (win), "window-state-event", |
| 1964 | - G_CALLBACK (rb_shell_window_state_cb), |
| 1965 | - shell, 0); |
| 1966 | - |
| 1967 | - g_signal_connect_object (G_OBJECT (win), "configure-event", |
| 1968 | - G_CALLBACK (rb_shell_window_configure_cb), |
| 1969 | - shell, 0); |
| 1970 | - |
| 1971 | - /* connect after, so that things can affect behaviour */ |
| 1972 | - g_signal_connect_object (G_OBJECT (win), "delete_event", |
| 1973 | - G_CALLBACK (rb_shell_window_delete_cb), |
| 1974 | - shell, G_CONNECT_AFTER); |
| 1975 | - |
| 1976 | - gtk_widget_add_events (GTK_WIDGET (win), GDK_KEY_PRESS_MASK); |
| 1977 | - g_signal_connect_object (G_OBJECT(win), "key_press_event", |
| 1978 | - G_CALLBACK (rb_shell_key_press_event_cb), shell, 0); |
| 1979 | - |
| 1980 | - rb_debug ("shell: initializing shell services"); |
| 1981 | - |
| 1982 | - shell->priv->podcast_manager = rb_podcast_manager_new (shell->priv->db); |
| 1983 | - shell->priv->track_transfer_queue = rb_track_transfer_queue_new (shell); |
| 1984 | - shell->priv->ui_manager = gtk_ui_manager_new (); |
| 1985 | - shell->priv->source_ui_merge_id = gtk_ui_manager_new_merge_id (shell->priv->ui_manager); |
| 1986 | - |
| 1987 | - shell->priv->player_shell = rb_shell_player_new (shell->priv->db, |
| 1988 | - shell->priv->ui_manager, |
| 1989 | - shell->priv->actiongroup); |
| 1990 | - g_signal_connect_object (G_OBJECT (shell->priv->player_shell), |
| 1991 | - "playing-source-changed", |
| 1992 | - G_CALLBACK (rb_shell_playing_source_changed_cb), |
| 1993 | - shell, 0); |
| 1994 | - g_signal_connect_object (G_OBJECT (shell->priv->player_shell), |
| 1995 | - "notify::playing-from-queue", |
| 1996 | - G_CALLBACK (rb_shell_playing_from_queue_cb), |
| 1997 | - shell, 0); |
| 1998 | - g_signal_connect_object (G_OBJECT (shell->priv->player_shell), |
| 1999 | - "window_title_changed", |
| 2000 | - G_CALLBACK (rb_shell_player_window_title_changed_cb), |
| 2001 | - shell, 0); |
| 2002 | - shell->priv->clipboard_shell = rb_shell_clipboard_new (shell->priv->actiongroup, |
| 2003 | - shell->priv->ui_manager, |
| 2004 | - shell->priv->db); |
| 2005 | - |
| 2006 | - shell->priv->display_page_tree = rb_display_page_tree_new (shell); |
| 2007 | - gtk_widget_show_all (GTK_WIDGET (shell->priv->display_page_tree)); |
| 2008 | - g_signal_connect_object (shell->priv->display_page_tree, "drop-received", |
| 2009 | - G_CALLBACK (display_page_tree_drag_received_cb), shell, 0); |
| 2010 | - g_object_get (shell->priv->display_page_tree, "model", &shell->priv->display_page_model, NULL); |
| 2011 | - rb_display_page_group_add_core_groups (G_OBJECT (shell), shell->priv->display_page_model); |
| 2012 | - |
| 2013 | - shell->priv->statusbar = rb_statusbar_new (shell->priv->db, |
| 2014 | - shell->priv->ui_manager, |
| 2015 | - shell->priv->track_transfer_queue); |
| 2016 | - g_object_set (shell->priv->player_shell, "statusbar", shell->priv->statusbar, NULL); |
| 2017 | - gtk_widget_show (GTK_WIDGET (shell->priv->statusbar)); |
| 2018 | - |
| 2019 | - g_signal_connect_object (shell->priv->display_page_tree, "selected", |
| 2020 | - G_CALLBACK (display_page_selected_cb), shell, 0); |
| 2021 | - |
| 2022 | - shell->priv->notebook = gtk_notebook_new (); |
| 2023 | - gtk_widget_show (shell->priv->notebook); |
| 2024 | - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (shell->priv->notebook), FALSE); |
| 2025 | - gtk_notebook_set_show_border (GTK_NOTEBOOK (shell->priv->notebook), FALSE); |
| 2026 | - g_signal_connect_object (shell->priv->display_page_tree, |
| 2027 | - "size-allocate", |
| 2028 | - G_CALLBACK (paned_size_allocate_cb), |
| 2029 | - shell, 0); |
| 2030 | - |
| 2031 | - shell->priv->queue_source = RB_PLAYLIST_SOURCE (rb_play_queue_source_new (shell)); |
| 2032 | - g_object_set (shell->priv->player_shell, "queue-source", shell->priv->queue_source, NULL); |
| 2033 | - g_object_set (shell->priv->clipboard_shell, "queue-source", shell->priv->queue_source, NULL); |
| 2034 | - rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (shell->priv->queue_source), RB_DISPLAY_PAGE_GROUP_LIBRARY); |
| 2035 | - g_object_get (shell->priv->queue_source, "sidebar", &shell->priv->queue_sidebar, NULL); |
| 2036 | - gtk_widget_show_all (shell->priv->queue_sidebar); |
| 2037 | - gtk_widget_set_no_show_all (shell->priv->queue_sidebar, TRUE); |
| 2038 | - |
| 2039 | - /* places for plugins to put UI */ |
| 2040 | - shell->priv->top_container = GTK_BOX (gtk_vbox_new (FALSE, 0)); |
| 2041 | - shell->priv->bottom_container = GTK_BOX (gtk_vbox_new (FALSE, 0)); |
| 2042 | - shell->priv->sidebar_container = GTK_BOX (gtk_vbox_new (FALSE, 0)); |
| 2043 | - shell->priv->right_sidebar_container = GTK_BOX (gtk_vbox_new (FALSE, 0)); |
| 2044 | - |
| 2045 | - /* set up sidebars */ |
| 2046 | - shell->priv->paned = gtk_hpaned_new (); |
| 2047 | - shell->priv->right_paned = gtk_hpaned_new (); |
| 2048 | - gtk_widget_show_all (shell->priv->right_paned); |
| 2049 | - g_signal_connect_object (G_OBJECT (shell->priv->right_paned), |
| 2050 | - "size-allocate", |
| 2051 | - G_CALLBACK (paned_size_allocate_cb), |
| 2052 | - shell, 0); |
| 2053 | - gtk_widget_set_no_show_all (shell->priv->right_paned, TRUE); |
| 2054 | - { |
| 2055 | - GtkWidget *vbox2 = gtk_vbox_new (FALSE, 0); |
| 2056 | - |
| 2057 | - shell->priv->queue_paned = gtk_vpaned_new (); |
| 2058 | - gtk_paned_pack1 (GTK_PANED (shell->priv->queue_paned), |
| 2059 | - GTK_WIDGET (shell->priv->display_page_tree), |
| 2060 | - FALSE, TRUE); |
| 2061 | - gtk_paned_pack2 (GTK_PANED (shell->priv->queue_paned), |
| 2062 | - shell->priv->queue_sidebar, |
| 2063 | - TRUE, TRUE); |
| 2064 | - gtk_container_child_set (GTK_CONTAINER (shell->priv->queue_paned), |
| 2065 | - GTK_WIDGET (shell->priv->display_page_tree), |
| 2066 | - "resize", FALSE, |
| 2067 | - NULL); |
| 2068 | - |
| 2069 | - gtk_box_pack_start (GTK_BOX (vbox2), |
| 2070 | - shell->priv->notebook, |
| 2071 | - TRUE, TRUE, 0); |
| 2072 | - gtk_box_pack_start (GTK_BOX (vbox2), |
| 2073 | - GTK_WIDGET (shell->priv->bottom_container), |
| 2074 | - FALSE, FALSE, 0); |
| 2075 | - |
| 2076 | - gtk_paned_pack1 (GTK_PANED (shell->priv->right_paned), |
| 2077 | - vbox2, TRUE, TRUE); |
| 2078 | - gtk_paned_pack2 (GTK_PANED (shell->priv->right_paned), |
| 2079 | - GTK_WIDGET (shell->priv->right_sidebar_container), |
| 2080 | - FALSE, FALSE); |
| 2081 | - gtk_widget_hide (GTK_WIDGET(shell->priv->right_sidebar_container)); |
| 2082 | - |
| 2083 | - gtk_box_pack_start (shell->priv->sidebar_container, |
| 2084 | - shell->priv->queue_paned, |
| 2085 | - TRUE, TRUE, 0); |
| 2086 | - gtk_paned_pack1 (GTK_PANED (shell->priv->paned), |
| 2087 | - GTK_WIDGET (shell->priv->sidebar_container), |
| 2088 | - FALSE, TRUE); |
| 2089 | - gtk_paned_pack2 (GTK_PANED (shell->priv->paned), |
| 2090 | - shell->priv->right_paned, |
| 2091 | - TRUE, TRUE); |
| 2092 | - gtk_widget_show (vbox2); |
| 2093 | - } |
| 2094 | - |
| 2095 | - g_signal_connect_object (G_OBJECT (shell->priv->queue_paned), |
| 2096 | - "size-allocate", |
| 2097 | - G_CALLBACK (paned_size_allocate_cb), |
| 2098 | - shell, 0); |
| 2099 | - gtk_widget_show (shell->priv->paned); |
| 2100 | - |
| 2101 | - shell->priv->main_vbox = gtk_vbox_new (FALSE, 0); |
| 2102 | - gtk_container_set_border_width (GTK_CONTAINER (shell->priv->main_vbox), 0); |
| 2103 | - gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), GTK_WIDGET (shell->priv->player_shell), FALSE, TRUE, 6); |
| 2104 | - gtk_widget_show (GTK_WIDGET (shell->priv->player_shell)); |
| 2105 | - |
| 2106 | - gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), GTK_WIDGET (shell->priv->top_container), FALSE, TRUE, 0); |
| 2107 | - gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), shell->priv->paned, TRUE, TRUE, 0); |
| 2108 | - gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), GTK_WIDGET (shell->priv->statusbar), FALSE, TRUE, 0); |
| 2109 | - gtk_widget_show_all (shell->priv->main_vbox); |
| 2110 | - |
| 2111 | - gtk_container_add (GTK_CONTAINER (win), shell->priv->main_vbox); |
| 2112 | - |
| 2113 | - rb_profile_end ("constructing widgets"); |
| 2114 | -} |
| 2115 | - |
| 2116 | -static void |
| 2117 | -construct_sources (RBShell *shell) |
| 2118 | -{ |
| 2119 | - RBDisplayPage *page_group; |
| 2120 | - char *pathname; |
| 2121 | - |
| 2122 | - rb_profile_start ("constructing sources"); |
| 2123 | - |
| 2124 | - page_group = RB_DISPLAY_PAGE_GROUP_LIBRARY; |
| 2125 | - shell->priv->library_source = RB_LIBRARY_SOURCE (rb_library_source_new (shell)); |
| 2126 | - shell->priv->podcast_source = RB_PODCAST_SOURCE (rb_podcast_main_source_new (shell, shell->priv->podcast_manager)); |
| 2127 | - shell->priv->missing_files_source = rb_missing_files_source_new (shell, shell->priv->library_source); |
| 2128 | - |
| 2129 | - shell->priv->import_errors_source = rb_import_errors_source_new (shell, |
| 2130 | - RHYTHMDB_ENTRY_TYPE_IMPORT_ERROR, |
| 2131 | - RHYTHMDB_ENTRY_TYPE_SONG, |
| 2132 | - RHYTHMDB_ENTRY_TYPE_IGNORE); |
| 2133 | - |
| 2134 | - rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (shell->priv->library_source), page_group); |
| 2135 | - rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (shell->priv->podcast_source), page_group); |
| 2136 | - rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (shell->priv->missing_files_source), page_group); |
| 2137 | - rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (shell->priv->import_errors_source), page_group); |
| 2138 | - |
| 2139 | - rb_auto_playlist_source_create_actions (shell); |
| 2140 | - rb_static_playlist_source_create_actions (shell); |
| 2141 | - |
| 2142 | - rb_podcast_main_source_add_subsources (RB_PODCAST_MAIN_SOURCE (shell->priv->podcast_source)); |
| 2143 | - |
| 2144 | - /* Find the playlist name if none supplied */ |
| 2145 | - if (shell->priv->playlists_file) { |
| 2146 | - pathname = g_strdup (shell->priv->playlists_file); |
| 2147 | - } else { |
| 2148 | - pathname = rb_find_user_data_file ("playlists.xml"); |
| 2149 | - } |
| 2150 | - |
| 2151 | - /* Initialize playlist manager */ |
| 2152 | - rb_debug ("shell: creating playlist manager"); |
| 2153 | - shell->priv->playlist_manager = rb_playlist_manager_new (shell, |
| 2154 | - shell->priv->display_page_model, |
| 2155 | - shell->priv->display_page_tree, |
| 2156 | - pathname); |
| 2157 | - |
| 2158 | - g_object_set (shell->priv->clipboard_shell, |
| 2159 | - "playlist-manager", shell->priv->playlist_manager, |
| 2160 | - NULL); |
| 2161 | - |
| 2162 | - g_signal_connect_object (G_OBJECT (shell->priv->playlist_manager), "playlist_added", |
| 2163 | - G_CALLBACK (rb_shell_playlist_added_cb), shell, 0); |
| 2164 | - g_signal_connect_object (G_OBJECT (shell->priv->playlist_manager), "playlist_created", |
| 2165 | - G_CALLBACK (rb_shell_playlist_created_cb), shell, 0); |
| 2166 | - |
| 2167 | - /* Initialize removable media manager */ |
| 2168 | - rb_debug ("shell: creating removable media manager"); |
| 2169 | - shell->priv->removable_media_manager = rb_removable_media_manager_new (shell); |
| 2170 | - |
| 2171 | - g_signal_connect_object (G_OBJECT (shell->priv->removable_media_manager), "medium_added", |
| 2172 | - G_CALLBACK (rb_shell_medium_added_cb), shell, 0); |
| 2173 | - |
| 2174 | - |
| 2175 | - g_free (pathname); |
| 2176 | - |
| 2177 | - rb_profile_end ("constructing sources"); |
| 2178 | -} |
| 2179 | - |
| 2180 | -static void |
| 2181 | -construct_load_ui (RBShell *shell) |
| 2182 | -{ |
| 2183 | - GtkWidget *menubar; |
| 2184 | - GtkWidget *toolbar; |
| 2185 | - GtkToolItem *tool_item; |
| 2186 | - GError *error = NULL; |
| 2187 | - |
| 2188 | - rb_debug ("shell: loading ui"); |
| 2189 | - rb_profile_start ("loading ui"); |
| 2190 | - |
| 2191 | - gtk_ui_manager_insert_action_group (shell->priv->ui_manager, |
| 2192 | - shell->priv->actiongroup, 0); |
| 2193 | - gtk_ui_manager_add_ui_from_file (shell->priv->ui_manager, |
| 2194 | - rb_file ("rhythmbox-ui.xml"), &error); |
| 2195 | - |
| 2196 | - gtk_ui_manager_ensure_update (shell->priv->ui_manager); |
| 2197 | - gtk_window_add_accel_group (GTK_WINDOW (shell->priv->window), |
| 2198 | - gtk_ui_manager_get_accel_group (shell->priv->ui_manager)); |
| 2199 | - menubar = gtk_ui_manager_get_widget (shell->priv->ui_manager, "/MenuBar"); |
| 2200 | - |
| 2201 | - gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), menubar, FALSE, FALSE, 0); |
| 2202 | - gtk_box_reorder_child (GTK_BOX (shell->priv->main_vbox), menubar, 0); |
| 2203 | - |
| 2204 | - toolbar = gtk_ui_manager_get_widget (shell->priv->ui_manager, "/ToolBar"); |
| 2205 | - gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), |
| 2206 | - GTK_STYLE_CLASS_PRIMARY_TOOLBAR); |
| 2207 | - g_settings_bind (shell->priv->settings, "toolbar-visible", |
| 2208 | - toolbar, "visible", |
| 2209 | - G_SETTINGS_BIND_DEFAULT); |
| 2210 | - gtk_box_pack_start (GTK_BOX (shell->priv->main_vbox), toolbar, FALSE, FALSE, 0); |
| 2211 | - gtk_box_reorder_child (GTK_BOX (shell->priv->main_vbox), toolbar, 1); |
| 2212 | - |
| 2213 | - shell->priv->volume_button = gtk_volume_button_new (); |
| 2214 | - g_signal_connect (shell->priv->volume_button, "value-changed", |
| 2215 | - G_CALLBACK (rb_shell_volume_widget_changed_cb), |
| 2216 | - shell); |
| 2217 | - g_signal_connect (shell->priv->player_shell, "notify::volume", |
| 2218 | - G_CALLBACK (rb_shell_player_volume_changed_cb), |
| 2219 | - shell); |
| 2220 | - rb_shell_player_volume_changed_cb (shell->priv->player_shell, NULL, shell); |
| 2221 | - |
| 2222 | - tool_item = gtk_tool_item_new (); |
| 2223 | - gtk_tool_item_set_expand (tool_item, TRUE); |
| 2224 | - gtk_widget_show (GTK_WIDGET (tool_item)); |
| 2225 | - gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, -1); |
| 2226 | - |
| 2227 | - tool_item = gtk_tool_item_new (); |
| 2228 | - gtk_container_add (GTK_CONTAINER (tool_item), shell->priv->volume_button); |
| 2229 | - gtk_widget_show_all (GTK_WIDGET (tool_item)); |
| 2230 | - gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, -1); |
| 2231 | - |
| 2232 | - gtk_widget_set_tooltip_text (shell->priv->volume_button, |
| 2233 | - _("Change the music volume")); |
| 2234 | - |
| 2235 | - if (error != NULL) { |
| 2236 | - g_warning ("Couldn't merge %s: %s", |
| 2237 | - rb_file ("rhythmbox-ui.xml"), error->message); |
| 2238 | - g_clear_error (&error); |
| 2239 | - } |
| 2240 | - |
| 2241 | - rb_profile_end ("loading ui"); |
| 2242 | -} |
| 2243 | - |
| 2244 | -static void |
| 2245 | -extension_added_cb (PeasExtensionSet *set, PeasPluginInfo *info, PeasExtension *extension, RBShell *shell) |
| 2246 | -{ |
| 2247 | - rb_debug ("activating extension %s", peas_plugin_info_get_name (info)); |
| 2248 | - peas_extension_call (extension, "activate"); |
| 2249 | -} |
| 2250 | - |
| 2251 | -static void |
| 2252 | -extension_removed_cb (PeasExtensionSet *set, PeasPluginInfo *info, PeasExtension *extension, RBShell *shell) |
| 2253 | -{ |
| 2254 | - rb_debug ("deactivating extension %s", peas_plugin_info_get_name (info)); |
| 2255 | - peas_extension_call (extension, "deactivate"); |
| 2256 | -} |
| 2257 | - |
| 2258 | -static void |
| 2259 | -construct_plugins (RBShell *shell) |
| 2260 | -{ |
| 2261 | - char *typelib_dir; |
| 2262 | - char *plugindir; |
| 2263 | - char *plugindatadir; |
| 2264 | - const GList *plugins; |
| 2265 | - const GList *l; |
| 2266 | - GError *error = NULL; |
| 2267 | - |
| 2268 | - if (shell->priv->disable_plugins) { |
| 2269 | - return; |
| 2270 | - } |
| 2271 | - |
| 2272 | - rb_profile_start ("loading plugins"); |
| 2273 | - shell->priv->plugin_settings = g_settings_new ("org.gnome.rhythmbox.plugins"); |
| 2274 | - |
| 2275 | - shell->priv->plugin_engine = peas_engine_new (); |
| 2276 | - /* need an #ifdef for this? */ |
| 2277 | - peas_engine_enable_loader (shell->priv->plugin_engine, "python"); |
| 2278 | - |
| 2279 | - typelib_dir = g_build_filename (LIBDIR, |
| 2280 | - "girepository-1.0", |
| 2281 | - NULL); |
| 2282 | - if (g_irepository_require_private (g_irepository_get_default (), |
| 2283 | - typelib_dir, "MPID", "3.0", 0, &error) == FALSE) { |
| 2284 | - g_clear_error (&error); |
| 2285 | - if (g_irepository_require (g_irepository_get_default (), "MPID", "3.0", 0, &error) == FALSE) { |
| 2286 | - g_warning ("Could not load MPID typelib: %s", error->message); |
| 2287 | - g_clear_error (&error); |
| 2288 | - } |
| 2289 | - } |
| 2290 | - |
| 2291 | - if (g_irepository_require_private (g_irepository_get_default (), |
| 2292 | - typelib_dir, "RB", "3.0", 0, &error) == FALSE) { |
| 2293 | - g_clear_error (&error); |
| 2294 | - if (g_irepository_require (g_irepository_get_default (), "RB", "3.0", 0, &error) == FALSE) { |
| 2295 | - g_warning ("Could not load RB typelib: %s", error->message); |
| 2296 | - g_clear_error (&error); |
| 2297 | - } |
| 2298 | - } |
| 2299 | - g_free (typelib_dir); |
| 2300 | - |
| 2301 | - if (g_irepository_require (g_irepository_get_default (), "Peas", "1.0", 0, &error) == FALSE) { |
| 2302 | - g_warning ("Could not load Peas typelib: %s", error->message); |
| 2303 | - g_clear_error (&error); |
| 2304 | - } |
| 2305 | - |
| 2306 | - if (g_irepository_require (g_irepository_get_default (), "PeasGtk", "1.0", 0, &error) == FALSE) { |
| 2307 | - g_warning ("Could not load PeasGtk typelib: %s", error->message); |
| 2308 | - g_clear_error (&error); |
| 2309 | - } |
| 2310 | - |
| 2311 | - plugindir = g_build_filename (rb_user_data_dir (), "plugins", NULL); |
| 2312 | - rb_debug ("plugin search path: %s", plugindir); |
| 2313 | - peas_engine_add_search_path (shell->priv->plugin_engine, |
| 2314 | - plugindir, |
| 2315 | - plugindir); |
| 2316 | - g_free (plugindir); |
| 2317 | - |
| 2318 | - plugindir = g_build_filename (LIBDIR, "rhythmbox", "plugins", NULL); |
| 2319 | - plugindatadir = g_build_filename (DATADIR, "rhythmbox", "plugins", NULL); |
| 2320 | - rb_debug ("plugin search path: %s / %s", plugindir, plugindatadir); |
| 2321 | - peas_engine_add_search_path (shell->priv->plugin_engine, |
| 2322 | - plugindir, |
| 2323 | - plugindatadir); |
| 2324 | - g_free (plugindir); |
| 2325 | - g_free (plugindatadir); |
| 2326 | - |
| 2327 | -#ifdef USE_UNINSTALLED_DIRS |
| 2328 | - plugindir = g_build_filename (SHARE_UNINSTALLED_BUILDDIR, "..", UNINSTALLED_PLUGINS_LOCATION, NULL); |
| 2329 | - rb_debug ("plugin search path: %s", plugindir); |
| 2330 | - peas_engine_add_search_path (shell->priv->plugin_engine, |
| 2331 | - plugindir, |
| 2332 | - plugindir); |
| 2333 | - g_free (plugindir); |
| 2334 | -#endif |
| 2335 | - |
| 2336 | - shell->priv->activatable = peas_extension_set_new (shell->priv->plugin_engine, |
| 2337 | - PEAS_TYPE_ACTIVATABLE, |
| 2338 | - "object", shell, |
| 2339 | - NULL); |
| 2340 | - g_signal_connect (shell->priv->activatable, "extension-added", G_CALLBACK (extension_added_cb), shell); |
| 2341 | - g_signal_connect (shell->priv->activatable, "extension-removed", G_CALLBACK (extension_removed_cb), shell); |
| 2342 | - |
| 2343 | - g_settings_bind (shell->priv->plugin_settings, |
| 2344 | - "active-plugins", |
| 2345 | - shell->priv->plugin_engine, |
| 2346 | - "loaded-plugins", |
| 2347 | - G_SETTINGS_BIND_DEFAULT); |
| 2348 | - |
| 2349 | - /* load builtin plugins */ |
| 2350 | - plugins = peas_engine_get_plugin_list (shell->priv->plugin_engine); |
| 2351 | - for (l = plugins; l != NULL; l = l->next) { |
| 2352 | - PeasPluginInfo *info = PEAS_PLUGIN_INFO (l->data); |
| 2353 | - if (peas_plugin_info_is_builtin (info) && |
| 2354 | - g_strcmp0 (peas_plugin_info_get_module_name (info), "rb") != 0) { |
| 2355 | - peas_engine_load_plugin (shell->priv->plugin_engine, info); |
| 2356 | - } |
| 2357 | - } |
| 2358 | - |
| 2359 | - rb_profile_end ("loading plugins"); |
| 2360 | -} |
| 2361 | - |
| 2362 | -static void |
| 2363 | -emit_action_state_update (RBShell *shell, const char *action) |
| 2364 | -{ |
| 2365 | - GDBusConnection *bus; |
| 2366 | - GVariant *state; |
| 2367 | - |
| 2368 | - |
| 2369 | - bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); |
| 2370 | - |
| 2371 | - state = g_action_group_get_action_state (G_ACTION_GROUP (shell), action); |
| 2372 | - g_signal_emit_by_name (shell, "action-state-changed::LoadURI", "LoadURI", state); |
| 2373 | - if (bus != NULL) { |
| 2374 | - g_dbus_connection_emit_signal (bus, |
| 2375 | - NULL, |
| 2376 | - "/org/gnome/Rhythmbox3", |
| 2377 | - "org.gtk.Actions", |
| 2378 | - "StateChanged", |
| 2379 | - g_variant_new ("(sv)", action, state), |
| 2380 | - NULL); |
| 2381 | - g_object_unref (bus); |
| 2382 | - } |
| 2383 | - g_variant_unref (state); |
| 2384 | -} |
| 2385 | - |
| 2386 | -static gboolean |
| 2387 | -_scan_idle (RBShell *shell) |
| 2388 | -{ |
| 2389 | - gboolean loaded, scanned; |
| 2390 | - |
| 2391 | - GDK_THREADS_ENTER (); |
| 2392 | - rb_removable_media_manager_scan (shell->priv->removable_media_manager); |
| 2393 | - GDK_THREADS_LEAVE (); |
| 2394 | - |
| 2395 | - if (shell->priv->no_registration == FALSE) { |
| 2396 | - g_variant_get (g_action_group_get_action_state (G_ACTION_GROUP (shell), "LoadURI"), "(bb)", &loaded, &scanned); |
| 2397 | - g_action_group_change_action_state (G_ACTION_GROUP (shell), "LoadURI", g_variant_new ("(bb)", loaded, TRUE)); |
| 2398 | - emit_action_state_update (shell, "LoadURI"); |
| 2399 | - } |
| 2400 | - |
| 2401 | - return FALSE; |
| 2402 | -} |
| 2403 | - |
| 2404 | -static void |
| 2405 | -rb_shell_startup (GApplication *app) |
| 2406 | -{ |
| 2407 | - RBShell *shell = RB_SHELL (app); |
| 2408 | - GtkAction *gtkaction; |
| 2409 | - |
| 2410 | - rb_debug ("Constructing shell"); |
| 2411 | - rb_profile_start ("constructing shell"); |
| 2412 | - |
| 2413 | - g_signal_connect_object (shell->priv->settings, "changed", G_CALLBACK (settings_changed_cb), shell, 0); |
| 2414 | - |
| 2415 | - gtkaction = gtk_action_group_get_action (shell->priv->actiongroup, "ViewSidePane"); |
| 2416 | - g_settings_bind (shell->priv->settings, "display-page-tree-visible", |
| 2417 | - gtkaction, "active", |
| 2418 | - G_SETTINGS_BIND_DEFAULT); |
| 2419 | - g_settings_bind (shell->priv->settings, "display-page-tree-visible", |
| 2420 | - shell->priv->sidebar_container, "visible", |
| 2421 | - G_SETTINGS_BIND_DEFAULT); |
| 2422 | - |
| 2423 | - gtkaction = gtk_action_group_get_action (shell->priv->actiongroup, "ViewToolbar"); |
| 2424 | - g_settings_bind (shell->priv->settings, "toolbar-visible", |
| 2425 | - gtkaction, "active", |
| 2426 | - G_SETTINGS_BIND_DEFAULT); |
| 2427 | - |
| 2428 | - rb_debug ("shell: syncing with settings"); |
| 2429 | - rb_shell_sync_pane_visibility (shell); |
| 2430 | - |
| 2431 | - g_signal_connect_object (G_OBJECT (shell->priv->db), "save-error", |
| 2432 | - G_CALLBACK (rb_shell_db_save_error_cb), shell, 0); |
| 2433 | - |
| 2434 | - construct_sources (shell); |
| 2435 | - |
| 2436 | - construct_load_ui (shell); |
| 2437 | - |
| 2438 | - construct_plugins (shell); |
| 2439 | - |
| 2440 | - rb_shell_sync_window_state (shell, FALSE); |
| 2441 | - rb_shell_sync_smalldisplay (shell); |
| 2442 | - rb_shell_sync_party_mode (shell); |
| 2443 | - rb_shell_sync_toolbar_state (shell); |
| 2444 | - |
| 2445 | - rb_shell_select_page (shell, RB_DISPLAY_PAGE (shell->priv->library_source)); |
| 2446 | - |
| 2447 | - /* by now we've added the built in sources and any sources from plugins, |
| 2448 | - * so we can consider the fixed page groups loaded |
| 2449 | - */ |
| 2450 | - rb_display_page_group_loaded (RB_DISPLAY_PAGE_GROUP (RB_DISPLAY_PAGE_GROUP_LIBRARY)); |
| 2451 | - rb_display_page_group_loaded (RB_DISPLAY_PAGE_GROUP (RB_DISPLAY_PAGE_GROUP_STORES)); |
| 2452 | - |
| 2453 | - rb_missing_plugins_init (GTK_WINDOW (shell->priv->window)); |
| 2454 | - |
| 2455 | - g_idle_add ((GSourceFunc)_scan_idle, shell); |
| 2456 | - |
| 2457 | - /* GO GO GO! */ |
| 2458 | - rb_debug ("loading database"); |
| 2459 | - rhythmdb_load (shell->priv->db); |
| 2460 | - |
| 2461 | - rb_debug ("shell: syncing window state"); |
| 2462 | - rb_shell_sync_paned (shell); |
| 2463 | - |
| 2464 | - /* set initial visibility */ |
| 2465 | - rb_shell_set_visibility (shell, TRUE, TRUE); |
| 2466 | - |
| 2467 | - gdk_notify_startup_complete (); |
| 2468 | - |
| 2469 | - /* focus play if small, the entry view if not */ |
| 2470 | - if (g_settings_get_boolean (shell->priv->settings, "small-display")) { |
| 2471 | - GtkWidget *play_button; |
| 2472 | - |
| 2473 | - play_button = gtk_ui_manager_get_widget (shell->priv->ui_manager, "/ToolBar/Play"); |
| 2474 | - gtk_widget_grab_focus (play_button); |
| 2475 | - } else { |
| 2476 | - RBEntryView *view; |
| 2477 | - |
| 2478 | - view = rb_source_get_entry_view (RB_SOURCE (shell->priv->library_source)); |
| 2479 | - if (view != NULL) { |
| 2480 | - gtk_widget_grab_focus (GTK_WIDGET (view)); |
| 2481 | - } |
| 2482 | - } |
| 2483 | - |
| 2484 | - rb_profile_end ("constructing shell"); |
| 2485 | - |
| 2486 | - /* window-based usage counting doesn't work for us, just hold the app until |
| 2487 | - * we're asked to quit. |
| 2488 | - */ |
| 2489 | - g_application_hold (app); |
| 2490 | -} |
| 2491 | - |
| 2492 | -static gboolean |
| 2493 | -rb_shell_local_command_line (GApplication *app, gchar ***args, int *exit_status) |
| 2494 | -{ |
| 2495 | - RBShell *shell; |
| 2496 | - GError *error = NULL; |
| 2497 | - gboolean scanned; |
| 2498 | - gboolean loaded; |
| 2499 | - GPtrArray *files; |
| 2500 | - int n_files; |
| 2501 | - int i; |
| 2502 | - |
| 2503 | - n_files = g_strv_length (*args) - 1; |
| 2504 | - |
| 2505 | - shell = RB_SHELL (app); |
| 2506 | - if (shell->priv->no_registration) { |
| 2507 | - if (n_files > 0) { |
| 2508 | - g_warning ("Unable to open files on the commandline with --no-registration"); |
| 2509 | - } |
| 2510 | - rb_shell_startup (app); |
| 2511 | - return TRUE; |
| 2512 | - } |
| 2513 | - |
| 2514 | - if (!g_application_register (app, NULL, &error)) { |
| 2515 | - g_critical ("%s", error->message); |
| 2516 | - g_error_free (error); |
| 2517 | - *exit_status = 1; |
| 2518 | - return TRUE; |
| 2519 | - } |
| 2520 | - |
| 2521 | - if (n_files <= 0) { |
| 2522 | - g_application_activate (app); |
| 2523 | - *exit_status = 0; |
| 2524 | - return TRUE; |
| 2525 | - } |
| 2526 | - |
| 2527 | - files = g_ptr_array_new_with_free_func (g_object_unref); |
| 2528 | - for (i = 0; i < n_files; i++) { |
| 2529 | - g_ptr_array_add (files, g_file_new_for_commandline_arg ((*args)[i + 1])); |
| 2530 | - } |
| 2531 | - |
| 2532 | - g_variant_get (g_action_group_get_action_state (G_ACTION_GROUP (app), "LoadURI"), "(bb)", &loaded, &scanned); |
| 2533 | - if (loaded) { |
| 2534 | - rb_debug ("opening files immediately"); |
| 2535 | - g_application_open (app, (GFile **)files->pdata, files->len, ""); |
| 2536 | - g_ptr_array_free (files, TRUE); |
| 2537 | - } else { |
| 2538 | - rb_debug ("opening files once db is loaded"); |
| 2539 | - g_signal_connect (app, "action-state-changed::LoadURI", G_CALLBACK (load_state_changed_cb), files); |
| 2540 | - } |
| 2541 | - |
| 2542 | - return TRUE; |
| 2543 | -} |
| 2544 | -static void |
| 2545 | -rb_shell_class_init (RBShellClass *klass) |
| 2546 | -{ |
| 2547 | - GObjectClass *object_class = G_OBJECT_CLASS (klass); |
| 2548 | - GApplicationClass *app_class = G_APPLICATION_CLASS (klass); |
| 2549 | - |
| 2550 | - object_class->set_property = rb_shell_set_property; |
| 2551 | - object_class->get_property = rb_shell_get_property; |
| 2552 | - object_class->finalize = rb_shell_finalize; |
| 2553 | - object_class->constructed = rb_shell_constructed; |
| 2554 | - |
| 2555 | - app_class->activate = rb_shell_activate; |
| 2556 | - app_class->open = rb_shell_open; |
| 2557 | - app_class->local_command_line = rb_shell_local_command_line; |
| 2558 | - app_class->startup = rb_shell_startup; |
| 2559 | - |
| 2560 | - klass->visibility_changing = rb_shell_visibility_changing; |
| 2561 | - |
| 2562 | - /** |
| 2563 | - * RBShell:no-registration: |
| 2564 | - * |
| 2565 | - * If %TRUE, disable single-instance features. |
| 2566 | - */ |
| 2567 | - g_object_class_install_property (object_class, |
| 2568 | - PROP_NO_REGISTRATION, |
| 2569 | - g_param_spec_boolean ("no-registration", |
| 2570 | - "no-registration", |
| 2571 | - "Whether or not to register", |
| 2572 | - FALSE, |
| 2573 | - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
| 2574 | - /** |
| 2575 | - * RBShell:no-update: |
| 2576 | - * |
| 2577 | - * If %TRUE, don't update the database. |
| 2578 | - */ |
| 2579 | - g_object_class_install_property (object_class, |
| 2580 | - PROP_NO_UPDATE, |
| 2581 | - g_param_spec_boolean ("no-update", |
| 2582 | - "no-update", |
| 2583 | - "Whether or not to update the library", |
| 2584 | - FALSE, |
| 2585 | - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
| 2586 | - /** |
| 2587 | - * RBShell:dry-run: |
| 2588 | - * |
| 2589 | - * If TRUE, don't write back file metadata changes. |
| 2590 | - */ |
| 2591 | - g_object_class_install_property (object_class, |
| 2592 | - PROP_DRY_RUN, |
| 2593 | - g_param_spec_boolean ("dry-run", |
| 2594 | - "dry-run", |
| 2595 | - "Whether or not this is a dry run", |
| 2596 | - FALSE, |
| 2597 | - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
| 2598 | - /** |
| 2599 | - * RBShell:rhythmdb-file: |
| 2600 | - * |
| 2601 | - * The path to the rhythmdb file |
| 2602 | - */ |
| 2603 | - g_object_class_install_property (object_class, |
| 2604 | - PROP_RHYTHMDB_FILE, |
| 2605 | - g_param_spec_string ("rhythmdb-file", |
| 2606 | - "rhythmdb-file", |
| 2607 | - "The RhythmDB file to use", |
| 2608 | - "rhythmdb.xml", |
| 2609 | - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
| 2610 | - |
| 2611 | - /** |
| 2612 | - * RBShell:playlists-file: |
| 2613 | - * |
| 2614 | - * The path to the playlist file |
| 2615 | - */ |
| 2616 | - g_object_class_install_property (object_class, |
| 2617 | - PROP_PLAYLISTS_FILE, |
| 2618 | - g_param_spec_string ("playlists-file", |
| 2619 | - "playlists-file", |
| 2620 | - "The playlists file to use", |
| 2621 | - "playlists.xml", |
| 2622 | - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
| 2623 | - /** |
| 2624 | - * RBShell:selected-page: |
| 2625 | - * |
| 2626 | - * The currently selected display page |
| 2627 | - */ |
| 2628 | - g_object_class_install_property (object_class, |
| 2629 | - PROP_SELECTED_PAGE, |
| 2630 | - g_param_spec_object ("selected-page", |
| 2631 | - "selected-page", |
| 2632 | - "Display page which is currently selected", |
| 2633 | - RB_TYPE_DISPLAY_PAGE, |
| 2634 | - G_PARAM_READABLE)); |
| 2635 | - /** |
| 2636 | - * RBShell:db: |
| 2637 | - * |
| 2638 | - * The #RhythmDB instance |
| 2639 | - */ |
| 2640 | - g_object_class_install_property (object_class, |
| 2641 | - PROP_DB, |
| 2642 | - g_param_spec_object ("db", |
| 2643 | - "RhythmDB", |
| 2644 | - "RhythmDB object", |
| 2645 | - RHYTHMDB_TYPE, |
| 2646 | - G_PARAM_READABLE)); |
| 2647 | - /** |
| 2648 | - * RBShell:ui-manager: |
| 2649 | - * |
| 2650 | - * The #GtkUIManager instance |
| 2651 | - */ |
| 2652 | - g_object_class_install_property (object_class, |
| 2653 | - PROP_UI_MANAGER, |
| 2654 | - g_param_spec_object ("ui-manager", |
| 2655 | - "GtkUIManager", |
| 2656 | - "GtkUIManager object", |
| 2657 | - GTK_TYPE_UI_MANAGER, |
| 2658 | - G_PARAM_READABLE)); |
| 2659 | - /** |
| 2660 | - * RBShell:clipboard: |
| 2661 | - * |
| 2662 | - * The #RBShellClipboard instance |
| 2663 | - */ |
| 2664 | - g_object_class_install_property (object_class, |
| 2665 | - PROP_CLIPBOARD, |
| 2666 | - g_param_spec_object ("clipboard", |
| 2667 | - "RBShellClipboard", |
| 2668 | - "RBShellClipboard object", |
| 2669 | - RB_TYPE_SHELL_CLIPBOARD, |
| 2670 | - G_PARAM_READABLE)); |
| 2671 | - /** |
| 2672 | - * RBShell:playlist-manager: |
| 2673 | - * |
| 2674 | - * The #RBPlaylistManager instance |
| 2675 | - */ |
| 2676 | - g_object_class_install_property (object_class, |
| 2677 | - PROP_PLAYLIST_MANAGER, |
| 2678 | - g_param_spec_object ("playlist-manager", |
| 2679 | - "RBPlaylistManager", |
| 2680 | - "RBPlaylistManager object", |
| 2681 | - RB_TYPE_PLAYLIST_MANAGER, |
| 2682 | - G_PARAM_READABLE)); |
| 2683 | - /** |
| 2684 | - * RBShell:shell-player: |
| 2685 | - * |
| 2686 | - * The #RBShellPlayer instance |
| 2687 | - */ |
| 2688 | - g_object_class_install_property (object_class, |
| 2689 | - PROP_SHELL_PLAYER, |
| 2690 | - g_param_spec_object ("shell-player", |
| 2691 | - "RBShellPlayer", |
| 2692 | - "RBShellPlayer object", |
| 2693 | - RB_TYPE_SHELL_PLAYER, |
| 2694 | - G_PARAM_READABLE)); |
| 2695 | - /** |
| 2696 | - * RBShell:removable-media-manager: |
| 2697 | - * |
| 2698 | - * The #RBRemovableMediaManager instance |
| 2699 | - */ |
| 2700 | - g_object_class_install_property (object_class, |
| 2701 | - PROP_REMOVABLE_MEDIA_MANAGER, |
| 2702 | - g_param_spec_object ("removable-media-manager", |
| 2703 | - "RBRemovableMediaManager", |
| 2704 | - "RBRemovableMediaManager object", |
| 2705 | - RB_TYPE_REMOVABLE_MEDIA_MANAGER, |
| 2706 | - G_PARAM_READABLE)); |
| 2707 | - /** |
| 2708 | - * RBShell:window: |
| 2709 | - * |
| 2710 | - * The main Rhythmbox window. |
| 2711 | - */ |
| 2712 | - g_object_class_install_property (object_class, |
| 2713 | - PROP_WINDOW, |
| 2714 | - g_param_spec_object ("window", |
| 2715 | - "GtkWindow", |
| 2716 | - "GtkWindow object", |
| 2717 | - GTK_TYPE_WINDOW, |
| 2718 | - G_PARAM_READABLE)); |
| 2719 | - /** |
| 2720 | - * RBShell:prefs: |
| 2721 | - * |
| 2722 | - * The #RBShellPreferences instance |
| 2723 | - */ |
| 2724 | - g_object_class_install_property (object_class, |
| 2725 | - PROP_PREFS, |
| 2726 | - g_param_spec_object ("prefs", |
| 2727 | - "RBShellPreferences", |
| 2728 | - "RBShellPreferences object", |
| 2729 | - RB_TYPE_SHELL_PREFERENCES, |
| 2730 | - G_PARAM_READABLE)); |
| 2731 | - /** |
| 2732 | - * RBShell:queue-source: |
| 2733 | - * |
| 2734 | - * The play queue source |
| 2735 | - */ |
| 2736 | - g_object_class_install_property (object_class, |
| 2737 | - PROP_QUEUE_SOURCE, |
| 2738 | - g_param_spec_object ("queue-source", |
| 2739 | - "queue-source", |
| 2740 | - "Queue source", |
| 2741 | - RB_TYPE_PLAY_QUEUE_SOURCE, |
| 2742 | - G_PARAM_READABLE)); |
| 2743 | - /** |
| 2744 | - * RBShell:library-source: |
| 2745 | - * |
| 2746 | - * The library source |
| 2747 | - */ |
| 2748 | - g_object_class_install_property (object_class, |
| 2749 | - PROP_LIBRARY_SOURCE, |
| 2750 | - g_param_spec_object ("library-source", |
| 2751 | - "library-source", |
| 2752 | - "Library source", |
| 2753 | - RB_TYPE_LIBRARY_SOURCE, |
| 2754 | - G_PARAM_READABLE)); |
| 2755 | - /** |
| 2756 | - * RBShell:display-page-model: |
| 2757 | - * |
| 2758 | - * The model underlying the display page tree |
| 2759 | - */ |
| 2760 | - g_object_class_install_property (object_class, |
| 2761 | - PROP_DISPLAY_PAGE_MODEL, |
| 2762 | - g_param_spec_object ("display-page-model", |
| 2763 | - "display-page-model", |
| 2764 | - "RBDisplayPageModel", |
| 2765 | - RB_TYPE_DISPLAY_PAGE_MODEL, |
| 2766 | - G_PARAM_READABLE)); |
| 2767 | - |
| 2768 | - /** |
| 2769 | - * RBShell:display-page-tree: |
| 2770 | - * |
| 2771 | - * The #RBDisplayPageTree instance |
| 2772 | - */ |
| 2773 | - g_object_class_install_property (object_class, |
| 2774 | - PROP_DISPLAY_PAGE_TREE, |
| 2775 | - g_param_spec_object ("display-page-tree", |
| 2776 | - "display-page-tree", |
| 2777 | - "RBDisplayPageTree", |
| 2778 | - RB_TYPE_DISPLAY_PAGE_TREE, |
| 2779 | - G_PARAM_READABLE)); |
| 2780 | - |
| 2781 | - /** |
| 2782 | - * RBShell:visibility: |
| 2783 | - * |
| 2784 | - * Whether the main window is currently visible. |
| 2785 | - */ |
| 2786 | - g_object_class_install_property (object_class, |
| 2787 | - PROP_VISIBILITY, |
| 2788 | - g_param_spec_boolean ("visibility", |
| 2789 | - "visibility", |
| 2790 | - "Current window visibility", |
| 2791 | - TRUE, |
| 2792 | - G_PARAM_READWRITE)); |
| 2793 | - /** |
| 2794 | - * RBShell:track-transfer-queue: |
| 2795 | - * |
| 2796 | - * The #RBTrackTransferQueue instance |
| 2797 | - */ |
| 2798 | - g_object_class_install_property (object_class, |
| 2799 | - PROP_TRACK_TRANSFER_QUEUE, |
| 2800 | - g_param_spec_object ("track-transfer-queue", |
| 2801 | - "RBTrackTransferQueue", |
| 2802 | - "RBTrackTransferQueue object", |
| 2803 | - RB_TYPE_TRACK_TRANSFER_QUEUE, |
| 2804 | - G_PARAM_READABLE)); |
| 2805 | - /** |
| 2806 | - * RBShell:autostarted: |
| 2807 | - * |
| 2808 | - * Whether Rhythmbox was automatically started by the session manager |
| 2809 | - */ |
| 2810 | - g_object_class_install_property (object_class, |
| 2811 | - PROP_AUTOSTARTED, |
| 2812 | - g_param_spec_boolean ("autostarted", |
| 2813 | - "autostarted", |
| 2814 | - "TRUE if autostarted", |
| 2815 | - FALSE, |
| 2816 | - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
| 2817 | - /** |
| 2818 | - * RBShell:disable-plugins: |
| 2819 | - * |
| 2820 | - * If %TRUE, disable plugins |
| 2821 | - */ |
| 2822 | - g_object_class_install_property (object_class, |
| 2823 | - PROP_DISABLE_PLUGINS, |
| 2824 | - g_param_spec_boolean ("disable-plugins", |
| 2825 | - "disable-plugins", |
| 2826 | - "Whether or not to disable plugins", |
| 2827 | - FALSE, |
| 2828 | - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
| 2829 | - |
| 2830 | - /** |
| 2831 | - * RBShell::visibility-changed: |
| 2832 | - * @shell: the #RBShell |
| 2833 | - * @visibile: new visibility |
| 2834 | - * |
| 2835 | - * Emitted after the visibility of the main Rhythmbox window has |
| 2836 | - * changed. |
| 2837 | - */ |
| 2838 | - rb_shell_signals[VISIBILITY_CHANGED] = |
| 2839 | - g_signal_new ("visibility_changed", |
| 2840 | - G_OBJECT_CLASS_TYPE (object_class), |
| 2841 | - G_SIGNAL_RUN_LAST, |
| 2842 | - G_STRUCT_OFFSET (RBShellClass, visibility_changed), |
| 2843 | - NULL, NULL, |
| 2844 | - g_cclosure_marshal_VOID__BOOLEAN, |
| 2845 | - G_TYPE_NONE, |
| 2846 | - 1, |
| 2847 | - G_TYPE_BOOLEAN); |
| 2848 | - /** |
| 2849 | - * RBShell::visibility-changing: |
| 2850 | - * @shell: the #RBShell |
| 2851 | - * @initial: if %TRUE, this is the initial visibility for the window |
| 2852 | - * @visible: new shell visibility |
| 2853 | - * |
| 2854 | - * Emitted before the visibility of the main window changes. The return |
| 2855 | - * value overrides the visibility setting. If multiple signal handlers |
| 2856 | - * are attached, the last one wins. |
| 2857 | - */ |
| 2858 | - rb_shell_signals[VISIBILITY_CHANGING] = |
| 2859 | - g_signal_new ("visibility_changing", |
| 2860 | - G_OBJECT_CLASS_TYPE (object_class), |
| 2861 | - G_SIGNAL_RUN_LAST, |
| 2862 | - G_STRUCT_OFFSET (RBShellClass, visibility_changing), |
| 2863 | - NULL, NULL, |
| 2864 | - rb_marshal_BOOLEAN__BOOLEAN_BOOLEAN, |
| 2865 | - G_TYPE_BOOLEAN, |
| 2866 | - 2, |
| 2867 | - G_TYPE_BOOLEAN, |
| 2868 | - G_TYPE_BOOLEAN); |
| 2869 | - |
| 2870 | - /** |
| 2871 | - * RBShell::create-song-info: |
| 2872 | - * @shell: the #RBShell |
| 2873 | - * @song_info: the new #RBSongInfo window |
| 2874 | - * @multi: if %TRUE, the song info window is for multiple entries |
| 2875 | - * |
| 2876 | - * Emitted when creating a new #RBSongInfo window. Signal handlers can |
| 2877 | - * add pages to the song info window notebook to display additional |
| 2878 | - * information. |
| 2879 | - */ |
| 2880 | - rb_shell_signals[CREATE_SONG_INFO] = |
| 2881 | - g_signal_new ("create_song_info", |
| 2882 | - G_OBJECT_CLASS_TYPE (object_class), |
| 2883 | - G_SIGNAL_RUN_LAST, |
| 2884 | - G_STRUCT_OFFSET (RBShellClass, create_song_info), |
| 2885 | - NULL, NULL, |
| 2886 | - rb_marshal_VOID__OBJECT_BOOLEAN, |
| 2887 | - G_TYPE_NONE, |
| 2888 | - 2, |
| 2889 | - RB_TYPE_SONG_INFO, G_TYPE_BOOLEAN); |
| 2890 | - /** |
| 2891 | - * RBShell::notify-playing-entry: |
| 2892 | - * @shell: the #RBShell |
| 2893 | - * |
| 2894 | - * Emitted when a notification should be displayed showing the current |
| 2895 | - * playing entry. |
| 2896 | - */ |
| 2897 | - rb_shell_signals[NOTIFY_PLAYING_ENTRY] = |
| 2898 | - g_signal_new ("notify-playing-entry", |
| 2899 | - G_OBJECT_CLASS_TYPE (object_class), |
| 2900 | - G_SIGNAL_RUN_LAST, |
| 2901 | - 0, |
| 2902 | - NULL, NULL, |
| 2903 | - g_cclosure_marshal_VOID__BOOLEAN, |
| 2904 | - G_TYPE_NONE, |
| 2905 | - 1, |
| 2906 | - G_TYPE_BOOLEAN); |
| 2907 | - /** |
| 2908 | - * RBShell::notify-custom: |
| 2909 | - * @shell: the #RBShell |
| 2910 | - * @timeout: length of time (in seconds) to display the notification |
| 2911 | - * @primary: main notification text |
| 2912 | - * @secondary: secondary notification text |
| 2913 | - * @image_uri: URI for an image to include in the notification (optional) |
| 2914 | - * @requested: if %TRUE, the notification was triggered by an explicit user action |
| 2915 | - * |
| 2916 | - * Emitted when a custom notification should be displayed to the user. |
| 2917 | - */ |
| 2918 | - rb_shell_signals[NOTIFY_CUSTOM] = |
| 2919 | - g_signal_new ("notify-custom", |
| 2920 | - G_OBJECT_CLASS_TYPE (object_class), |
| 2921 | - G_SIGNAL_RUN_LAST, |
| 2922 | - 0, |
| 2923 | - NULL, NULL, |
| 2924 | - rb_marshal_VOID__UINT_STRING_STRING_STRING_BOOLEAN, |
| 2925 | - G_TYPE_NONE, |
| 2926 | - 5, |
| 2927 | - G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); |
| 2928 | - g_type_class_add_private (klass, sizeof (RBShellPrivate)); |
| 2929 | -} |
| 2930 | - |
| 2931 | -static void |
| 2932 | -rb_shell_init (RBShell *shell) |
| 2933 | -{ |
| 2934 | - shell->priv = G_TYPE_INSTANCE_GET_PRIVATE (shell, RB_TYPE_SHELL, RBShellPrivate); |
| 2935 | - |
| 2936 | - rb_user_data_dir (); |
| 2937 | - rb_refstring_system_init (); |
| 2938 | - |
| 2939 | -#ifdef USE_UNINSTALLED_DIRS |
| 2940 | - rb_file_helpers_init (TRUE); |
| 2941 | -#else |
| 2942 | - rb_file_helpers_init (FALSE); |
| 2943 | -#endif |
| 2944 | - rb_stock_icons_init (); |
| 2945 | - |
| 2946 | - rb_shell_session_init (shell); |
| 2947 | - |
| 2948 | - g_setenv ("PULSE_PROP_media.role", "music", TRUE); |
| 2949 | -} |
| 2950 | - |
| 2951 | -static void |
| 2952 | -rb_shell_set_property (GObject *object, |
| 2953 | - guint prop_id, |
| 2954 | - const GValue *value, |
| 2955 | - GParamSpec *pspec) |
| 2956 | -{ |
| 2957 | - RBShell *shell = RB_SHELL (object); |
| 2958 | - |
| 2959 | - switch (prop_id) |
| 2960 | - { |
| 2961 | - case PROP_NO_REGISTRATION: |
| 2962 | - shell->priv->no_registration = g_value_get_boolean (value); |
| 2963 | - break; |
| 2964 | - case PROP_NO_UPDATE: |
| 2965 | - shell->priv->no_update = g_value_get_boolean (value); |
| 2966 | - break; |
| 2967 | - case PROP_DRY_RUN: |
| 2968 | - shell->priv->dry_run = g_value_get_boolean (value); |
| 2969 | - if (shell->priv->dry_run) |
| 2970 | - shell->priv->no_registration = TRUE; |
| 2971 | - break; |
| 2972 | - case PROP_RHYTHMDB_FILE: |
| 2973 | - g_free (shell->priv->rhythmdb_file); |
| 2974 | - shell->priv->rhythmdb_file = g_value_dup_string (value); |
| 2975 | - break; |
| 2976 | - case PROP_PLAYLISTS_FILE: |
| 2977 | - g_free (shell->priv->playlists_file); |
| 2978 | - shell->priv->playlists_file = g_value_dup_string (value); |
| 2979 | - break; |
| 2980 | - case PROP_VISIBILITY: |
| 2981 | - rb_shell_set_visibility (shell, FALSE, g_value_get_boolean (value)); |
| 2982 | - break; |
| 2983 | - case PROP_AUTOSTARTED: |
| 2984 | - shell->priv->autostarted = g_value_get_boolean (value); |
| 2985 | - break; |
| 2986 | - case PROP_DISABLE_PLUGINS: |
| 2987 | - shell->priv->disable_plugins = g_value_get_boolean (value); |
| 2988 | - break; |
| 2989 | - default: |
| 2990 | - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 2991 | - break; |
| 2992 | - } |
| 2993 | -} |
| 2994 | - |
| 2995 | -static void |
| 2996 | -rb_shell_get_property (GObject *object, |
| 2997 | - guint prop_id, |
| 2998 | - GValue *value, |
| 2999 | - GParamSpec *pspec) |
| 3000 | -{ |
| 3001 | - RBShell *shell = RB_SHELL (object); |
| 3002 | - |
| 3003 | - switch (prop_id) |
| 3004 | - { |
| 3005 | - case PROP_NO_REGISTRATION: |
| 3006 | - g_value_set_boolean (value, shell->priv->no_registration); |
| 3007 | - break; |
| 3008 | - case PROP_NO_UPDATE: |
| 3009 | - g_value_set_boolean (value, shell->priv->no_update); |
| 3010 | - break; |
| 3011 | - case PROP_DRY_RUN: |
| 3012 | - g_value_set_boolean (value, shell->priv->dry_run); |
| 3013 | - break; |
| 3014 | - case PROP_RHYTHMDB_FILE: |
| 3015 | - g_value_set_string (value, shell->priv->rhythmdb_file); |
| 3016 | - break; |
| 3017 | - case PROP_PLAYLISTS_FILE: |
| 3018 | - g_value_set_string (value, shell->priv->playlists_file); |
| 3019 | - break; |
| 3020 | - case PROP_DB: |
| 3021 | - g_value_set_object (value, shell->priv->db); |
| 3022 | - break; |
| 3023 | - case PROP_UI_MANAGER: |
| 3024 | - g_value_set_object (value, shell->priv->ui_manager); |
| 3025 | - break; |
| 3026 | - case PROP_CLIPBOARD: |
| 3027 | - g_value_set_object (value, shell->priv->clipboard_shell); |
| 3028 | - break; |
| 3029 | - case PROP_PLAYLIST_MANAGER: |
| 3030 | - g_value_set_object (value, shell->priv->playlist_manager); |
| 3031 | - break; |
| 3032 | - case PROP_SHELL_PLAYER: |
| 3033 | - g_value_set_object (value, shell->priv->player_shell); |
| 3034 | - break; |
| 3035 | - case PROP_REMOVABLE_MEDIA_MANAGER: |
| 3036 | - g_value_set_object (value, shell->priv->removable_media_manager); |
| 3037 | - break; |
| 3038 | - case PROP_SELECTED_PAGE: |
| 3039 | - g_value_set_object (value, shell->priv->selected_page); |
| 3040 | - break; |
| 3041 | - case PROP_WINDOW: |
| 3042 | - g_value_set_object (value, shell->priv->window); |
| 3043 | - break; |
| 3044 | - case PROP_PREFS: |
| 3045 | - /* create the preferences window the first time we need it */ |
| 3046 | - if (shell->priv->prefs == NULL) { |
| 3047 | - GtkWidget *content; |
| 3048 | - |
| 3049 | - shell->priv->prefs = rb_shell_preferences_new (shell->priv->sources); |
| 3050 | - |
| 3051 | - gtk_window_set_transient_for (GTK_WINDOW (shell->priv->prefs), |
| 3052 | - GTK_WINDOW (shell->priv->window)); |
| 3053 | - content = gtk_dialog_get_content_area (GTK_DIALOG (shell->priv->prefs)); |
| 3054 | - gtk_widget_show_all (content); |
| 3055 | - } |
| 3056 | - g_value_set_object (value, shell->priv->prefs); |
| 3057 | - break; |
| 3058 | - case PROP_QUEUE_SOURCE: |
| 3059 | - g_value_set_object (value, shell->priv->queue_source); |
| 3060 | - break; |
| 3061 | - case PROP_LIBRARY_SOURCE: |
| 3062 | - g_value_set_object (value, shell->priv->library_source); |
| 3063 | - break; |
| 3064 | - case PROP_DISPLAY_PAGE_MODEL: |
| 3065 | - g_value_set_object (value, shell->priv->display_page_model); |
| 3066 | - break; |
| 3067 | - case PROP_DISPLAY_PAGE_TREE: |
| 3068 | - g_value_set_object (value, shell->priv->display_page_tree); |
| 3069 | - break; |
| 3070 | - case PROP_VISIBILITY: |
| 3071 | - g_value_set_boolean (value, rb_shell_get_visibility (shell)); |
| 3072 | - break; |
| 3073 | - case PROP_TRACK_TRANSFER_QUEUE: |
| 3074 | - g_value_set_object (value, shell->priv->track_transfer_queue); |
| 3075 | - break; |
| 3076 | - case PROP_AUTOSTARTED: |
| 3077 | - g_value_set_boolean (value, shell->priv->autostarted); |
| 3078 | - break; |
| 3079 | - case PROP_DISABLE_PLUGINS: |
| 3080 | - g_value_set_boolean (value, shell->priv->disable_plugins); |
| 3081 | - break; |
| 3082 | - default: |
| 3083 | - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 3084 | - break; |
| 3085 | - } |
| 3086 | -} |
| 3087 | - |
| 3088 | -static gboolean |
| 3089 | -rb_shell_sync_state (RBShell *shell) |
| 3090 | -{ |
| 3091 | - if (shell->priv->dry_run) { |
| 3092 | - rb_debug ("in dry-run mode, not syncing state"); |
| 3093 | - return FALSE; |
| 3094 | - } |
| 3095 | - |
| 3096 | - if (!shell->priv->load_complete) { |
| 3097 | - rb_debug ("load incomplete, not syncing state"); |
| 3098 | - return FALSE; |
| 3099 | - } |
| 3100 | - |
| 3101 | - rb_debug ("saving playlists"); |
| 3102 | - rb_playlist_manager_save_playlists (shell->priv->playlist_manager, |
| 3103 | - TRUE); |
| 3104 | - |
| 3105 | - rb_debug ("saving db"); |
| 3106 | - rhythmdb_save (shell->priv->db); |
| 3107 | - return FALSE; |
| 3108 | -} |
| 3109 | - |
| 3110 | -static gboolean |
| 3111 | -idle_save_rhythmdb (RBShell *shell) |
| 3112 | -{ |
| 3113 | - rhythmdb_save (shell->priv->db); |
| 3114 | - |
| 3115 | - shell->priv->save_db_id = 0; |
| 3116 | - |
| 3117 | - return FALSE; |
| 3118 | -} |
| 3119 | - |
| 3120 | -static gboolean |
| 3121 | -idle_save_playlist_manager (RBShell *shell) |
| 3122 | -{ |
| 3123 | - GDK_THREADS_ENTER (); |
| 3124 | - rb_playlist_manager_save_playlists (shell->priv->playlist_manager, |
| 3125 | - FALSE); |
| 3126 | - GDK_THREADS_LEAVE (); |
| 3127 | - |
| 3128 | - return TRUE; |
| 3129 | -} |
| 3130 | - |
| 3131 | -static void |
| 3132 | -rb_shell_shutdown (RBShell *shell) |
| 3133 | -{ |
| 3134 | - GdkDisplay *display; |
| 3135 | - |
| 3136 | - if (shell->priv->shutting_down) |
| 3137 | - return; |
| 3138 | - shell->priv->shutting_down = TRUE; |
| 3139 | - |
| 3140 | - /* Hide the main window and tray icon as soon as possible */ |
| 3141 | - display = gtk_widget_get_display (shell->priv->window); |
| 3142 | - gtk_widget_hide (shell->priv->window); |
| 3143 | - gdk_display_sync (display); |
| 3144 | - |
| 3145 | - if (shell->priv->plugin_engine != NULL) { |
| 3146 | - g_object_unref (shell->priv->plugin_engine); |
| 3147 | - shell->priv->plugin_engine = NULL; |
| 3148 | - } |
| 3149 | - if (shell->priv->activatable != NULL) { |
| 3150 | - g_object_unref (shell->priv->activatable); |
| 3151 | - shell->priv->activatable = NULL; |
| 3152 | - } |
| 3153 | - if (shell->priv->plugin_settings != NULL) { |
| 3154 | - g_object_unref (shell->priv->plugin_settings); |
| 3155 | - shell->priv->plugin_settings = NULL; |
| 3156 | - } |
| 3157 | -} |
| 3158 | - |
| 3159 | -static void |
| 3160 | -rb_shell_finalize (GObject *object) |
| 3161 | -{ |
| 3162 | - RBShell *shell = RB_SHELL (object); |
| 3163 | - |
| 3164 | - rb_debug ("Finalizing shell"); |
| 3165 | - |
| 3166 | - rb_shell_player_stop (shell->priv->player_shell); |
| 3167 | - |
| 3168 | - if (shell->priv->settings != NULL) { |
| 3169 | - rb_settings_delayed_sync (shell->priv->settings, NULL, NULL, NULL); |
| 3170 | - g_object_unref (shell->priv->settings); |
| 3171 | - } |
| 3172 | - |
| 3173 | - g_free (shell->priv->cached_title); |
| 3174 | - |
| 3175 | - if (shell->priv->save_playlist_id > 0) { |
| 3176 | - g_source_remove (shell->priv->save_playlist_id); |
| 3177 | - shell->priv->save_playlist_id = 0; |
| 3178 | - } |
| 3179 | - |
| 3180 | - if (shell->priv->save_db_id > 0) { |
| 3181 | - g_source_remove (shell->priv->save_db_id); |
| 3182 | - shell->priv->save_db_id = 0; |
| 3183 | - } |
| 3184 | - |
| 3185 | - if (shell->priv->queue_sidebar != NULL) { |
| 3186 | - g_object_unref (shell->priv->queue_sidebar); |
| 3187 | - } |
| 3188 | - |
| 3189 | - if (shell->priv->playlist_manager != NULL) { |
| 3190 | - rb_debug ("shutting down playlist manager"); |
| 3191 | - rb_playlist_manager_shutdown (shell->priv->playlist_manager); |
| 3192 | - |
| 3193 | - rb_debug ("unreffing playlist manager"); |
| 3194 | - g_object_unref (shell->priv->playlist_manager); |
| 3195 | - } |
| 3196 | - |
| 3197 | - if (shell->priv->removable_media_manager != NULL) { |
| 3198 | - rb_debug ("unreffing removable media manager"); |
| 3199 | - g_object_unref (shell->priv->removable_media_manager); |
| 3200 | - g_object_unref (shell->priv->track_transfer_queue); |
| 3201 | - } |
| 3202 | - |
| 3203 | - if (shell->priv->podcast_manager != NULL) { |
| 3204 | - rb_debug ("unreffing podcast manager"); |
| 3205 | - g_object_unref (shell->priv->podcast_manager); |
| 3206 | - } |
| 3207 | - |
| 3208 | - if (shell->priv->clipboard_shell != NULL) { |
| 3209 | - rb_debug ("unreffing clipboard shell"); |
| 3210 | - g_object_unref (shell->priv->clipboard_shell); |
| 3211 | - } |
| 3212 | - |
| 3213 | - if (shell->priv->prefs != NULL) { |
| 3214 | - rb_debug ("destroying prefs"); |
| 3215 | - gtk_widget_destroy (shell->priv->prefs); |
| 3216 | - } |
| 3217 | - |
| 3218 | - g_free (shell->priv->rhythmdb_file); |
| 3219 | - |
| 3220 | - g_free (shell->priv->playlists_file); |
| 3221 | - |
| 3222 | - rb_debug ("destroying window"); |
| 3223 | - gtk_widget_destroy (shell->priv->window); |
| 3224 | - |
| 3225 | - g_list_free (shell->priv->sources); |
| 3226 | - shell->priv->sources = NULL; |
| 3227 | - |
| 3228 | - if (shell->priv->sources_hash != NULL) { |
| 3229 | - g_hash_table_destroy (shell->priv->sources_hash); |
| 3230 | - } |
| 3231 | - |
| 3232 | - if (shell->priv->db != NULL) { |
| 3233 | - rb_debug ("shutting down DB"); |
| 3234 | - rhythmdb_shutdown (shell->priv->db); |
| 3235 | - |
| 3236 | - rb_debug ("unreffing DB"); |
| 3237 | - g_object_unref (shell->priv->db); |
| 3238 | - } |
| 3239 | - if (shell->priv->art_store != NULL) { |
| 3240 | - g_object_unref (shell->priv->art_store); |
| 3241 | - shell->priv->art_store = NULL; |
| 3242 | - } |
| 3243 | - |
| 3244 | - rb_file_helpers_shutdown (); |
| 3245 | - rb_stock_icons_shutdown (); |
| 3246 | - rb_refstring_system_shutdown (); |
| 3247 | - |
| 3248 | - G_OBJECT_CLASS (rb_shell_parent_class)->finalize (object); |
| 3249 | - |
| 3250 | - rb_debug ("shell shutdown complete"); |
| 3251 | -} |
| 3252 | - |
| 3253 | -/** |
| 3254 | - * rb_shell_new: |
| 3255 | - * @autostarted: %TRUE if autostarted by the session manager |
| 3256 | - * @argc: a pointer to the number of command line arguments |
| 3257 | - * @argv: a pointer to the array of command line arguments |
| 3258 | - * |
| 3259 | - * Creates the Rhythmbox shell. This is effectively a singleton, so it doesn't |
| 3260 | - * make sense to call this from anywhere other than main.c. |
| 3261 | - * |
| 3262 | - * Return value: the #RBShell instance |
| 3263 | - */ |
| 3264 | -RBShell * |
| 3265 | -rb_shell_new (gboolean autostarted, int *argc, char ***argv) |
| 3266 | -{ |
| 3267 | - GOptionContext *context; |
| 3268 | - gboolean debug = FALSE; |
| 3269 | - char *debug_match = NULL; |
| 3270 | - gboolean no_update = FALSE; |
| 3271 | - gboolean no_registration = FALSE; |
| 3272 | - gboolean dry_run = FALSE; |
| 3273 | - gboolean disable_plugins = FALSE; |
| 3274 | - char *rhythmdb_file = NULL; |
| 3275 | - char *playlists_file = NULL; |
| 3276 | - GError *error = NULL; |
| 3277 | - |
| 3278 | - const GOptionEntry options [] = { |
| 3279 | - { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, N_("Enable debug output"), NULL }, |
| 3280 | - { "debug-match", 'D', 0, G_OPTION_ARG_STRING, &debug_match, N_("Enable debug output matching a specified string"), NULL }, |
| 3281 | - { "no-update", 0, 0, G_OPTION_ARG_NONE, &no_update, N_("Do not update the library with file changes"), NULL }, |
| 3282 | - { "no-registration", 'n', 0, G_OPTION_ARG_NONE, &no_registration, N_("Do not register the shell"), NULL }, |
| 3283 | - { "dry-run", 0, 0, G_OPTION_ARG_NONE, &dry_run, N_("Don't save any data permanently (implies --no-registration)"), NULL }, |
| 3284 | - { "disable-plugins", 0, 0, G_OPTION_ARG_NONE, &disable_plugins, N_("Disable loading of plugins"), NULL }, |
| 3285 | - { "rhythmdb-file", 0, 0, G_OPTION_ARG_STRING, &rhythmdb_file, N_("Path for database file to use"), NULL }, |
| 3286 | - { "playlists-file", 0, 0, G_OPTION_ARG_STRING, &playlists_file, N_("Path for playlists file to use"), NULL }, |
| 3287 | - { NULL } |
| 3288 | - }; |
| 3289 | - |
| 3290 | - context = g_option_context_new (NULL); |
| 3291 | - g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); |
| 3292 | - g_option_context_add_group (context, gst_init_get_option_group ()); |
| 3293 | - g_option_context_add_group (context, egg_sm_client_get_option_group ()); |
| 3294 | - g_option_context_add_group (context, gtk_get_option_group (TRUE)); |
| 3295 | - |
| 3296 | - if (g_option_context_parse (context, argc, argv, &error) == FALSE) { |
| 3297 | - g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"), |
| 3298 | - error->message, (*argv)[0]); |
| 3299 | - g_error_free (error); |
| 3300 | - g_option_context_free (context); |
| 3301 | - exit (1); |
| 3302 | - } |
| 3303 | - g_option_context_free (context); |
| 3304 | - |
| 3305 | - if (!debug && debug_match) |
| 3306 | - rb_debug_init_match (debug_match); |
| 3307 | - else |
| 3308 | - rb_debug_init (debug); |
| 3309 | - |
| 3310 | - return g_object_new (RB_TYPE_SHELL, |
| 3311 | - "application-id", "org.gnome.Rhythmbox3", |
| 3312 | - "flags", G_APPLICATION_HANDLES_OPEN, |
| 3313 | - "autostarted", autostarted, |
| 3314 | - "no-registration", no_registration, |
| 3315 | - "no-update", no_update, |
| 3316 | - "dry-run", dry_run, |
| 3317 | - "rhythmdb-file", rhythmdb_file, |
| 3318 | - "playlists-file", playlists_file, |
| 3319 | - "disable-plugins", disable_plugins, |
| 3320 | - NULL); |
| 3321 | -} |
| 3322 | - |
| 3323 | -static void |
| 3324 | -load_uri_action_cb (GSimpleAction *action, GVariant *parameters, RBShell *shell) |
| 3325 | -{ |
| 3326 | - const char *uri; |
| 3327 | - gboolean play; |
| 3328 | - |
| 3329 | - g_variant_get (parameters, "(&sb)", &uri, &play); |
| 3330 | - |
| 3331 | - rb_shell_load_uri (shell, uri, play, NULL); |
| 3332 | -} |
| 3333 | - |
| 3334 | -static void |
| 3335 | -activate_source_action_cb (GSimpleAction *action, GVariant *parameters, RBShell *shell) |
| 3336 | -{ |
| 3337 | - const char *source; |
| 3338 | - guint play; |
| 3339 | - |
| 3340 | - g_variant_get (parameters, "(&su)", &source, &play); |
| 3341 | - rb_shell_activate_source_by_uri (shell, source, play, NULL); |
| 3342 | -} |
| 3343 | - |
| 3344 | -static void |
| 3345 | -quit_action_cb (GSimpleAction *action, GVariant *parameters, RBShell *shell) |
| 3346 | -{ |
| 3347 | - rb_shell_quit (shell, NULL); |
| 3348 | -} |
| 3349 | - |
| 3350 | -static void |
| 3351 | -rb_shell_constructed (GObject *object) |
| 3352 | -{ |
| 3353 | - RBShell *shell; |
| 3354 | - GSimpleActionGroup *actions; |
| 3355 | - GSimpleAction *action; |
| 3356 | - |
| 3357 | - gtk_init (NULL, NULL); |
| 3358 | - |
| 3359 | - RB_CHAIN_GOBJECT_METHOD (rb_shell_parent_class, constructed, object); |
| 3360 | - |
| 3361 | - shell = RB_SHELL (object); |
| 3362 | - |
| 3363 | - /* create application actions */ |
| 3364 | - actions = g_simple_action_group_new (); |
| 3365 | - action = g_simple_action_new_stateful ("LoadURI", G_VARIANT_TYPE ("(sb)"), g_variant_new ("(bb)", FALSE, FALSE)); |
| 3366 | - g_signal_connect_object (action, "activate", G_CALLBACK (load_uri_action_cb), shell, 0); |
| 3367 | - g_simple_action_group_insert (actions, G_ACTION (action)); |
| 3368 | - g_object_unref (action); |
| 3369 | - |
| 3370 | - action = g_simple_action_new ("ActivateSource", G_VARIANT_TYPE ("(su)")); |
| 3371 | - g_signal_connect_object (action, "activate", G_CALLBACK (activate_source_action_cb), shell, 0); |
| 3372 | - g_simple_action_group_insert (actions, G_ACTION (action)); |
| 3373 | - g_object_unref (action); |
| 3374 | - |
| 3375 | - action = g_simple_action_new ("Quit", NULL); |
| 3376 | - g_signal_connect_object (action, "activate", G_CALLBACK (quit_action_cb), shell, 0); |
| 3377 | - g_simple_action_group_insert (actions, G_ACTION (action)); |
| 3378 | - g_object_unref (action); |
| 3379 | - |
| 3380 | - g_application_set_action_group (G_APPLICATION (shell), G_ACTION_GROUP (actions)); |
| 3381 | - |
| 3382 | - /* construct enough of the rest of it to display the window if required */ |
| 3383 | - |
| 3384 | - shell->priv->settings = g_settings_new ("org.gnome.rhythmbox"); |
| 3385 | - |
| 3386 | - shell->priv->actiongroup = gtk_action_group_new ("MainActions"); |
| 3387 | - gtk_action_group_set_translation_domain (shell->priv->actiongroup, |
| 3388 | - GETTEXT_PACKAGE); |
| 3389 | - gtk_action_group_add_actions (shell->priv->actiongroup, |
| 3390 | - rb_shell_actions, |
| 3391 | - rb_shell_n_actions, shell); |
| 3392 | - gtk_action_group_add_toggle_actions (shell->priv->actiongroup, |
| 3393 | - rb_shell_toggle_entries, |
| 3394 | - rb_shell_n_toggle_entries, |
| 3395 | - shell); |
| 3396 | - |
| 3397 | - /* Translators: this is the short label for the 'import folder' action */ |
| 3398 | - gtk_action_set_short_label (gtk_action_group_get_action (shell->priv->actiongroup, "MusicImportFolder"), C_("Library", "Import")); |
| 3399 | - /* Translators: this is the short label for the 'view all tracks' action */ |
| 3400 | - gtk_action_set_short_label (gtk_action_group_get_action (shell->priv->actiongroup, "ViewAll"), _("Show All")); |
| 3401 | - |
| 3402 | - construct_db (shell); |
| 3403 | - |
| 3404 | - construct_widgets (shell); |
| 3405 | -} |
| 3406 | - |
| 3407 | -static gboolean |
| 3408 | -rb_shell_window_state_cb (GtkWidget *widget, |
| 3409 | - GdkEventWindowState *event, |
| 3410 | - RBShell *shell) |
| 3411 | -{ |
| 3412 | - shell->priv->iconified = ((event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) != 0); |
| 3413 | - |
| 3414 | - if (event->changed_mask & (GDK_WINDOW_STATE_WITHDRAWN | GDK_WINDOW_STATE_ICONIFIED)) { |
| 3415 | - g_signal_emit (shell, rb_shell_signals[VISIBILITY_CHANGED], 0, |
| 3416 | - rb_shell_get_visibility (shell)); |
| 3417 | - } |
| 3418 | - |
| 3419 | - /* don't save maximized state when is hidden */ |
| 3420 | - if (!gtk_widget_get_visible (shell->priv->window)) |
| 3421 | - return FALSE; |
| 3422 | - |
| 3423 | - if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) { |
| 3424 | - gboolean maximised = ((event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0); |
| 3425 | - |
| 3426 | - if (!g_settings_get_boolean (shell->priv->settings, "small-display")) { |
| 3427 | - g_settings_set_boolean (shell->priv->settings, |
| 3428 | - "maximized", |
| 3429 | - maximised); |
| 3430 | - } |
| 3431 | - rb_shell_sync_window_state (shell, TRUE); |
| 3432 | - rb_shell_sync_paned (shell); |
| 3433 | - } |
| 3434 | - |
| 3435 | - return FALSE; |
| 3436 | -} |
| 3437 | - |
| 3438 | -static gboolean |
| 3439 | -rb_shell_visibility_changing (RBShell *shell, gboolean initial, gboolean visible) |
| 3440 | -{ |
| 3441 | - return visible; |
| 3442 | -} |
| 3443 | - |
| 3444 | -static gboolean |
| 3445 | -rb_shell_get_visibility (RBShell *shell) |
| 3446 | -{ |
| 3447 | - GdkWindowState state; |
| 3448 | - |
| 3449 | - if (!gtk_widget_get_realized (shell->priv->window)) |
| 3450 | - return FALSE; |
| 3451 | - if (shell->priv->iconified) |
| 3452 | - return FALSE; |
| 3453 | - |
| 3454 | - state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (shell->priv->window))); |
| 3455 | - if (state & (GDK_WINDOW_STATE_WITHDRAWN | GDK_WINDOW_STATE_ICONIFIED)) |
| 3456 | - return FALSE; |
| 3457 | - |
| 3458 | - return TRUE; |
| 3459 | -} |
| 3460 | - |
| 3461 | -static void |
| 3462 | -rb_shell_set_visibility (RBShell *shell, |
| 3463 | - gboolean initial, |
| 3464 | - gboolean visible) |
| 3465 | -{ |
| 3466 | - gboolean really_visible; |
| 3467 | - |
| 3468 | - rb_profile_start ("changing shell visibility"); |
| 3469 | - |
| 3470 | - if (visible == rb_shell_get_visibility (shell)) { |
| 3471 | - rb_profile_end ("changing shell visibility"); |
| 3472 | - return; |
| 3473 | - } |
| 3474 | - |
| 3475 | - really_visible = visible; |
| 3476 | - g_signal_emit (shell, rb_shell_signals[VISIBILITY_CHANGING], 0, initial, visible, &really_visible); |
| 3477 | - |
| 3478 | - if (really_visible) { |
| 3479 | - rb_debug ("showing main window"); |
| 3480 | - rb_shell_sync_window_state (shell, FALSE); |
| 3481 | - |
| 3482 | - gtk_widget_show (GTK_WIDGET (shell->priv->window)); |
| 3483 | - gtk_window_deiconify (GTK_WINDOW (shell->priv->window)); |
| 3484 | - |
| 3485 | - if (gtk_widget_get_realized (GTK_WIDGET (shell->priv->window))) |
| 3486 | - rb_shell_present (shell, gtk_get_current_event_time (), NULL); |
| 3487 | - else |
| 3488 | - gtk_widget_show_all (GTK_WIDGET (shell->priv->window)); |
| 3489 | - |
| 3490 | - g_signal_emit (shell, rb_shell_signals[VISIBILITY_CHANGED], 0, visible); |
| 3491 | - } else { |
| 3492 | - rb_debug ("hiding main window"); |
| 3493 | - shell->priv->iconified = TRUE; |
| 3494 | - gtk_window_iconify (GTK_WINDOW (shell->priv->window)); |
| 3495 | - |
| 3496 | - g_signal_emit (shell, rb_shell_signals[VISIBILITY_CHANGED], 0, FALSE); |
| 3497 | - } |
| 3498 | - |
| 3499 | - rb_profile_end ("changing shell visibility"); |
| 3500 | -} |
| 3501 | - |
| 3502 | -static void |
| 3503 | -sync_window_settings (GSettings *settings, RBShell *shell) |
| 3504 | -{ |
| 3505 | - int width, height; |
| 3506 | - int oldx, oldy; |
| 3507 | - int x, y; |
| 3508 | - int pos; |
| 3509 | - |
| 3510 | - gtk_window_get_size (GTK_WINDOW (shell->priv->window), &width, &height); |
| 3511 | - if (g_settings_get_boolean (shell->priv->settings, "small-display")) { |
| 3512 | - if (width != g_settings_get_int (shell->priv->settings, "small-width")) { |
| 3513 | - rb_debug ("storing small window width of %d", width); |
| 3514 | - g_settings_set_int (shell->priv->settings, "small-width", width); |
| 3515 | - } |
| 3516 | - } else { |
| 3517 | - int oldwidth, oldheight; |
| 3518 | - |
| 3519 | - g_settings_get (shell->priv->settings, "size", "(ii)", &oldwidth, &oldheight); |
| 3520 | - if ((width != oldwidth) || (height != oldheight)) { |
| 3521 | - rb_debug ("storing window size of %d:%d", width, height); |
| 3522 | - g_settings_set (shell->priv->settings, "size", "(ii)", width, height); |
| 3523 | - } |
| 3524 | - } |
| 3525 | - |
| 3526 | - gtk_window_get_position (GTK_WINDOW(shell->priv->window), &x, &y); |
| 3527 | - g_settings_get (shell->priv->settings, "position", "(ii)", &oldx, &oldy); |
| 3528 | - if ((x != oldx) || (y != oldy)) { |
| 3529 | - rb_debug ("storing window position of %d:%d", x, y); |
| 3530 | - g_settings_set (shell->priv->settings, "position", "(ii)", x, y); |
| 3531 | - } |
| 3532 | - |
| 3533 | - pos = gtk_paned_get_position (GTK_PANED (shell->priv->paned)); |
| 3534 | - rb_debug ("paned position %d", pos); |
| 3535 | - |
| 3536 | - if (pos != g_settings_get_int (shell->priv->settings, "paned-position")) { |
| 3537 | - g_settings_set_int (shell->priv->settings, "paned-position", pos); |
| 3538 | - } |
| 3539 | - |
| 3540 | - pos = gtk_paned_get_position (GTK_PANED (shell->priv->right_paned)); |
| 3541 | - rb_debug ("right_paned position %d", pos); |
| 3542 | - |
| 3543 | - if (pos != g_settings_get_int (shell->priv->settings, "right-paned-position")) { |
| 3544 | - g_settings_set_int (shell->priv->settings, "right-paned-position", pos); |
| 3545 | - } |
| 3546 | - |
| 3547 | - pos = gtk_paned_get_position (GTK_PANED (shell->priv->queue_paned)); |
| 3548 | - rb_debug ("sidebar paned position %d", pos); |
| 3549 | - |
| 3550 | - if (pos != g_settings_get_int (shell->priv->settings, "display-page-tree-height")) { |
| 3551 | - g_settings_set_int (shell->priv->settings, "display-page-tree-height", pos); |
| 3552 | - } |
| 3553 | -} |
| 3554 | - |
| 3555 | -static gboolean |
| 3556 | -rb_shell_window_configure_cb (GtkWidget *win, |
| 3557 | - GdkEventConfigure *event, |
| 3558 | - RBShell *shell) |
| 3559 | -{ |
| 3560 | - if (g_settings_get_boolean (shell->priv->settings, "maximized") || shell->priv->iconified) |
| 3561 | - return FALSE; |
| 3562 | - |
| 3563 | - rb_settings_delayed_sync (shell->priv->settings, |
| 3564 | - (RBDelayedSyncFunc) sync_window_settings, |
| 3565 | - g_object_ref (shell), |
| 3566 | - g_object_unref); |
| 3567 | - return FALSE; |
| 3568 | -} |
| 3569 | - |
| 3570 | -static gboolean |
| 3571 | -rb_shell_window_delete_cb (GtkWidget *win, |
| 3572 | - GdkEventAny *event, |
| 3573 | - RBShell *shell) |
| 3574 | -{ |
| 3575 | - if (shell->priv->party_mode) { |
| 3576 | - return TRUE; |
| 3577 | - } |
| 3578 | - |
| 3579 | - rb_shell_quit (shell, NULL); |
| 3580 | - |
| 3581 | - return TRUE; |
| 3582 | -} |
| 3583 | - |
| 3584 | -static gboolean |
| 3585 | -rb_shell_key_press_event_cb (GtkWidget *win, |
| 3586 | - GdkEventKey *event, |
| 3587 | - RBShell *shell) |
| 3588 | -{ |
| 3589 | -#ifndef HAVE_MMKEYS |
| 3590 | - return FALSE; |
| 3591 | -#else |
| 3592 | - |
| 3593 | - gboolean retval = TRUE; |
| 3594 | - |
| 3595 | - switch (event->keyval) { |
| 3596 | - case XF86XK_Back: |
| 3597 | - rb_shell_player_do_previous (shell->priv->player_shell, NULL); |
| 3598 | - break; |
| 3599 | - case XF86XK_Forward: |
| 3600 | - rb_shell_player_do_next (shell->priv->player_shell, NULL); |
| 3601 | - break; |
| 3602 | - default: |
| 3603 | - retval = FALSE; |
| 3604 | - } |
| 3605 | - |
| 3606 | - return retval; |
| 3607 | -#endif /* !HAVE_MMKEYS */ |
| 3608 | -} |
| 3609 | - |
| 3610 | -static void |
| 3611 | -rb_shell_sync_window_state (RBShell *shell, |
| 3612 | - gboolean dont_maximise) |
| 3613 | -{ |
| 3614 | - GdkGeometry hints; |
| 3615 | - int x, y; |
| 3616 | - |
| 3617 | - rb_profile_start ("syncing window state"); |
| 3618 | - |
| 3619 | - if (g_settings_get_boolean (shell->priv->settings, "small-display")) { |
| 3620 | - int width; |
| 3621 | - |
| 3622 | - width = g_settings_get_int (shell->priv->settings, "small-width"); |
| 3623 | - hints.min_height = -1; |
| 3624 | - hints.min_width = -1; |
| 3625 | - hints.max_height = -1; |
| 3626 | - hints.max_width = 3000; |
| 3627 | - gtk_window_set_default_size (GTK_WINDOW (shell->priv->window), width, 0); |
| 3628 | - gtk_window_resize (GTK_WINDOW (shell->priv->window), width, 1); |
| 3629 | - gtk_window_set_geometry_hints (GTK_WINDOW (shell->priv->window), |
| 3630 | - NULL, |
| 3631 | - &hints, |
| 3632 | - GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE); |
| 3633 | - gtk_window_unmaximize (GTK_WINDOW (shell->priv->window)); |
| 3634 | - rb_debug ("syncing small window width to %d", width); |
| 3635 | - } else { |
| 3636 | - int width, height; |
| 3637 | - if (!dont_maximise) { |
| 3638 | - if (g_settings_get_boolean (shell->priv->settings, "maximized")) |
| 3639 | - gtk_window_maximize (GTK_WINDOW (shell->priv->window)); |
| 3640 | - else |
| 3641 | - gtk_window_unmaximize (GTK_WINDOW (shell->priv->window)); |
| 3642 | - } |
| 3643 | - |
| 3644 | - g_settings_get (shell->priv->settings, "size", "(ii)", &width, &height); |
| 3645 | - |
| 3646 | - gtk_window_set_default_size (GTK_WINDOW (shell->priv->window), width, height); |
| 3647 | - gtk_window_resize (GTK_WINDOW (shell->priv->window), width, height); |
| 3648 | - gtk_window_set_geometry_hints (GTK_WINDOW (shell->priv->window), |
| 3649 | - NULL, |
| 3650 | - &hints, |
| 3651 | - 0); |
| 3652 | - } |
| 3653 | - |
| 3654 | - g_settings_get (shell->priv->settings, "position", "(ii)", &x, &y); |
| 3655 | - gtk_window_move (GTK_WINDOW (shell->priv->window), x, y); |
| 3656 | - rb_profile_end ("syncing window state"); |
| 3657 | -} |
| 3658 | - |
| 3659 | -static void |
| 3660 | -display_page_selected_cb (RBDisplayPageTree *display_page_tree, |
| 3661 | - RBDisplayPage *page, |
| 3662 | - RBShell *shell) |
| 3663 | -{ |
| 3664 | - rb_debug ("page selected"); |
| 3665 | - rb_shell_select_page (shell, page); |
| 3666 | -} |
| 3667 | - |
| 3668 | -gboolean |
| 3669 | -rb_shell_activate_source (RBShell *shell, RBSource *source, guint play, GError **error) |
| 3670 | -{ |
| 3671 | - RhythmDBEntry *entry; |
| 3672 | - /* FIXME |
| 3673 | - * |
| 3674 | - * this doesn't work correctly yet, but it's still an improvement on the |
| 3675 | - * previous behaviour. |
| 3676 | - * |
| 3677 | - * with crossfading enabled, this fades out the current song, but |
| 3678 | - * doesn't start the new one. |
| 3679 | - */ |
| 3680 | - |
| 3681 | - /* Select the new one, and optionally start it playing */ |
| 3682 | - rb_shell_select_page (shell, RB_DISPLAY_PAGE (source)); |
| 3683 | - |
| 3684 | - switch (play) { |
| 3685 | - case RB_SHELL_ACTIVATION_SELECT: |
| 3686 | - return TRUE; |
| 3687 | - |
| 3688 | - case RB_SHELL_ACTIVATION_PLAY: |
| 3689 | - entry = rb_shell_player_get_playing_entry (shell->priv->player_shell); |
| 3690 | - if (entry != NULL) { |
| 3691 | - rhythmdb_entry_unref (entry); |
| 3692 | - return TRUE; |
| 3693 | - } |
| 3694 | - /* fall through */ |
| 3695 | - case RB_SHELL_ACTIVATION_ALWAYS_PLAY: |
| 3696 | - rb_shell_player_set_playing_source (shell->priv->player_shell, source); |
| 3697 | - return rb_shell_player_playpause (shell->priv->player_shell, FALSE, error); |
| 3698 | - |
| 3699 | - default: |
| 3700 | - return FALSE; |
| 3701 | - } |
| 3702 | -} |
| 3703 | - |
| 3704 | -static void |
| 3705 | -rb_shell_db_save_error_cb (RhythmDB *db, |
| 3706 | - const char *uri, const GError *error, |
| 3707 | - RBShell *shell) |
| 3708 | -{ |
| 3709 | - rb_error_dialog (GTK_WINDOW (shell->priv->window), |
| 3710 | - _("Error while saving song information"), |
| 3711 | - "%s", error->message); |
| 3712 | -} |
| 3713 | - |
| 3714 | -/** |
| 3715 | - * rb_shell_get_source_by_entry_type: |
| 3716 | - * @shell: the #RBShell |
| 3717 | - * @type: entry type for which to find a source |
| 3718 | - * |
| 3719 | - * Looks up and returns the source that owns entries of the specified |
| 3720 | - * type. |
| 3721 | - * |
| 3722 | - * Return value: (transfer none): source instance, if any |
| 3723 | - */ |
| 3724 | -RBSource * |
| 3725 | -rb_shell_get_source_by_entry_type (RBShell *shell, |
| 3726 | - RhythmDBEntryType *type) |
| 3727 | -{ |
| 3728 | - return g_hash_table_lookup (shell->priv->sources_hash, type); |
| 3729 | -} |
| 3730 | - |
| 3731 | -/** |
| 3732 | - * rb_shell_register_entry_type_for_source: |
| 3733 | - * @shell: the #RBShell |
| 3734 | - * @source: the #RBSource to register |
| 3735 | - * @type: the #RhythmDBEntryType to register for |
| 3736 | - * |
| 3737 | - * Registers a source as the owner of entries of the specified type. |
| 3738 | - * The main effect of this is that calling #rb_shell_get_source_by_entry_type |
| 3739 | - * with the same entry type will return the source. A source should only |
| 3740 | - * be registered as the owner of a single entry type. |
| 3741 | - */ |
| 3742 | -void |
| 3743 | -rb_shell_register_entry_type_for_source (RBShell *shell, |
| 3744 | - RBSource *source, |
| 3745 | - RhythmDBEntryType *type) |
| 3746 | -{ |
| 3747 | - if (shell->priv->sources_hash == NULL) { |
| 3748 | - shell->priv->sources_hash = g_hash_table_new (g_direct_hash, |
| 3749 | - g_direct_equal); |
| 3750 | - } |
| 3751 | - g_assert (g_hash_table_lookup (shell->priv->sources_hash, type) == NULL); |
| 3752 | - g_hash_table_insert (shell->priv->sources_hash, type, source); |
| 3753 | -} |
| 3754 | - |
| 3755 | -/** |
| 3756 | - * rb_shell_append_display_page: |
| 3757 | - * @shell: the #RBShell |
| 3758 | - * @page: the new #RBDisplayPage |
| 3759 | - * @parent: (allow-none): the parent page for the new page |
| 3760 | - * |
| 3761 | - * Adds a new display page to the shell. |
| 3762 | - */ |
| 3763 | -void |
| 3764 | -rb_shell_append_display_page (RBShell *shell, RBDisplayPage *page, RBDisplayPage *parent) |
| 3765 | -{ |
| 3766 | - if (RB_IS_SOURCE (page)) { |
| 3767 | - shell->priv->sources = g_list_append (shell->priv->sources, RB_SOURCE (page)); |
| 3768 | - } |
| 3769 | - |
| 3770 | - g_signal_connect_object (G_OBJECT (page), "deleted", |
| 3771 | - G_CALLBACK (rb_shell_display_page_deleted_cb), shell, 0); |
| 3772 | - |
| 3773 | - gtk_notebook_append_page (GTK_NOTEBOOK (shell->priv->notebook), |
| 3774 | - GTK_WIDGET (page), |
| 3775 | - gtk_label_new ("")); |
| 3776 | - gtk_widget_show (GTK_WIDGET (page)); |
| 3777 | - |
| 3778 | - rb_display_page_model_add_page (shell->priv->display_page_model, page, parent); |
| 3779 | -} |
| 3780 | - |
| 3781 | -static void |
| 3782 | -rb_shell_playlist_added_cb (RBPlaylistManager *mgr, |
| 3783 | - RBSource *source, |
| 3784 | - RBShell *shell) |
| 3785 | -{ |
| 3786 | - rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (source), RB_DISPLAY_PAGE_GROUP_PLAYLISTS); |
| 3787 | -} |
| 3788 | - |
| 3789 | -static void |
| 3790 | -rb_shell_playlist_created_cb (RBPlaylistManager *mgr, |
| 3791 | - RBSource *source, |
| 3792 | - RBShell *shell) |
| 3793 | -{ |
| 3794 | - g_settings_set_boolean (shell->priv->settings, "small-display", FALSE); |
| 3795 | - g_settings_set_boolean (shell->priv->settings, "display-page-tree-visible", TRUE); |
| 3796 | - |
| 3797 | - rb_shell_sync_window_state (shell, FALSE); |
| 3798 | -} |
| 3799 | - |
| 3800 | -static void |
| 3801 | -rb_shell_medium_added_cb (RBRemovableMediaManager *mgr, |
| 3802 | - RBSource *source, |
| 3803 | - RBShell *shell) |
| 3804 | -{ |
| 3805 | - rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (source), RB_DISPLAY_PAGE_GROUP_DEVICES); |
| 3806 | -} |
| 3807 | - |
| 3808 | -static void |
| 3809 | -rb_shell_display_page_deleted_cb (RBDisplayPage *page, RBShell *shell) |
| 3810 | -{ |
| 3811 | - |
| 3812 | - rb_debug ("display page deleted"); |
| 3813 | - |
| 3814 | - if (RB_IS_SOURCE (page)) { |
| 3815 | - RhythmDBEntryType *entry_type; |
| 3816 | - RBSource *source = RB_SOURCE (page); |
| 3817 | - |
| 3818 | - /* remove from the map if the source owns the type */ |
| 3819 | - g_object_get (source, "entry-type", &entry_type, NULL); |
| 3820 | - if (rb_shell_get_source_by_entry_type (shell, entry_type) == source) { |
| 3821 | - g_hash_table_remove (shell->priv->sources_hash, entry_type); |
| 3822 | - } |
| 3823 | - g_object_unref (entry_type); |
| 3824 | - |
| 3825 | - if (source == rb_shell_player_get_playing_source (shell->priv->player_shell) || |
| 3826 | - source == rb_shell_player_get_active_source (shell->priv->player_shell)) { |
| 3827 | - rb_shell_player_stop (shell->priv->player_shell); |
| 3828 | - } |
| 3829 | - |
| 3830 | - shell->priv->sources = g_list_remove (shell->priv->sources, source); |
| 3831 | - } |
| 3832 | - |
| 3833 | - if (page == shell->priv->selected_page) { |
| 3834 | - if (page != RB_DISPLAY_PAGE (shell->priv->library_source)) { |
| 3835 | - rb_shell_select_page (shell, RB_DISPLAY_PAGE (shell->priv->library_source)); |
| 3836 | - } else { |
| 3837 | - rb_shell_select_page (shell, NULL); |
| 3838 | - } |
| 3839 | - } |
| 3840 | - |
| 3841 | - rb_display_page_model_remove_page (shell->priv->display_page_model, page); |
| 3842 | - gtk_notebook_remove_page (GTK_NOTEBOOK (shell->priv->notebook), |
| 3843 | - gtk_notebook_page_num (GTK_NOTEBOOK (shell->priv->notebook), |
| 3844 | - GTK_WIDGET (page))); |
| 3845 | -} |
| 3846 | - |
| 3847 | -static void |
| 3848 | -rb_shell_playing_source_changed_cb (RBShellPlayer *player, |
| 3849 | - RBSource *source, |
| 3850 | - RBShell *shell) |
| 3851 | -{ |
| 3852 | - rb_debug ("playing source changed"); |
| 3853 | - if (source != RB_SOURCE (shell->priv->queue_source)) { |
| 3854 | - rb_display_page_model_set_playing_source (shell->priv->display_page_model, RB_DISPLAY_PAGE (source)); |
| 3855 | - } |
| 3856 | -} |
| 3857 | - |
| 3858 | -static void |
| 3859 | -rb_shell_playing_from_queue_cb (RBShellPlayer *player, |
| 3860 | - GParamSpec *param, |
| 3861 | - RBShell *shell) |
| 3862 | -{ |
| 3863 | - gboolean from_queue; |
| 3864 | - |
| 3865 | - g_object_get (player, "playing-from-queue", &from_queue, NULL); |
| 3866 | - if (!g_settings_get_boolean (shell->priv->settings, "queue-as-sidebar")) { |
| 3867 | - RBSource *source; |
| 3868 | - source = rb_shell_player_get_playing_source (shell->priv->player_shell); |
| 3869 | - rb_display_page_model_set_playing_source (shell->priv->display_page_model, RB_DISPLAY_PAGE (source)); |
| 3870 | - } else { |
| 3871 | - RBSource *source; |
| 3872 | - RhythmDBEntry *entry; |
| 3873 | - RhythmDBEntryType *entry_type; |
| 3874 | - |
| 3875 | - /* if playing from the queue, show the playing entry as playing in the |
| 3876 | - * registered source for its type, so it makes sense when 'jump to current' |
| 3877 | - * jumps to it there. |
| 3878 | - */ |
| 3879 | - entry = rb_shell_player_get_playing_entry (shell->priv->player_shell); |
| 3880 | - if (entry == NULL) |
| 3881 | - return; |
| 3882 | - |
| 3883 | - entry_type = rhythmdb_entry_get_entry_type (entry); |
| 3884 | - source = rb_shell_get_source_by_entry_type (shell, entry_type); |
| 3885 | - if (source != NULL) { |
| 3886 | - RBEntryViewState state; |
| 3887 | - RBEntryView *songs; |
| 3888 | - |
| 3889 | - songs = rb_source_get_entry_view (source); |
| 3890 | - if (songs != NULL) { |
| 3891 | - state = from_queue ? RB_ENTRY_VIEW_PLAYING : RB_ENTRY_VIEW_NOT_PLAYING; |
| 3892 | - rb_entry_view_set_state (songs, state); |
| 3893 | - } |
| 3894 | - } |
| 3895 | - rhythmdb_entry_unref (entry); |
| 3896 | - |
| 3897 | - source = rb_shell_player_get_active_source (shell->priv->player_shell); |
| 3898 | - rb_display_page_model_set_playing_source (shell->priv->display_page_model, RB_DISPLAY_PAGE (source)); |
| 3899 | - } |
| 3900 | -} |
| 3901 | - |
| 3902 | -static void |
| 3903 | -rb_shell_select_page (RBShell *shell, RBDisplayPage *page) |
| 3904 | -{ |
| 3905 | - int pagenum; |
| 3906 | - |
| 3907 | - if (shell->priv->selected_page == page) |
| 3908 | - return; |
| 3909 | - |
| 3910 | - rb_debug ("selecting page %p", page); |
| 3911 | - |
| 3912 | - if (shell->priv->selected_page) { |
| 3913 | - rb_display_page_deselected (shell->priv->selected_page); |
| 3914 | - gtk_ui_manager_remove_ui (shell->priv->ui_manager, shell->priv->source_ui_merge_id); |
| 3915 | - } |
| 3916 | - |
| 3917 | - shell->priv->selected_page = page; |
| 3918 | - rb_display_page_selected (shell->priv->selected_page); |
| 3919 | - |
| 3920 | - /* show page */ |
| 3921 | - pagenum = gtk_notebook_page_num (GTK_NOTEBOOK (shell->priv->notebook), |
| 3922 | - GTK_WIDGET (page)); |
| 3923 | - gtk_notebook_set_current_page (GTK_NOTEBOOK (shell->priv->notebook), pagenum); |
| 3924 | - |
| 3925 | - g_signal_handlers_block_by_func (shell->priv->display_page_tree, |
| 3926 | - G_CALLBACK (display_page_selected_cb), |
| 3927 | - shell); |
| 3928 | - rb_display_page_tree_select (shell->priv->display_page_tree, page); |
| 3929 | - g_signal_handlers_unblock_by_func (shell->priv->display_page_tree, |
| 3930 | - G_CALLBACK (display_page_selected_cb), |
| 3931 | - shell); |
| 3932 | - |
| 3933 | - /* update services */ |
| 3934 | - if (RB_IS_SOURCE (page)) { |
| 3935 | - RBSource *source = RB_SOURCE (page); |
| 3936 | - rb_shell_clipboard_set_source (shell->priv->clipboard_shell, source); |
| 3937 | - rb_shell_player_set_selected_source (shell->priv->player_shell, source); |
| 3938 | - g_object_set (shell->priv->playlist_manager, "source", source, NULL); |
| 3939 | - g_object_set (shell->priv->removable_media_manager, "source", source, NULL); |
| 3940 | - } else { |
| 3941 | - rb_shell_clipboard_set_source (shell->priv->clipboard_shell, NULL); |
| 3942 | - rb_shell_player_set_selected_source (shell->priv->player_shell, NULL); /* ? */ |
| 3943 | - |
| 3944 | - /* clear playlist-manager:source? */ |
| 3945 | - /* clear removable-media-manager:source? */ |
| 3946 | - } |
| 3947 | - rb_statusbar_set_page (shell->priv->statusbar, page); |
| 3948 | - |
| 3949 | - g_object_notify (G_OBJECT (shell), "selected-page"); |
| 3950 | -} |
| 3951 | - |
| 3952 | -static void |
| 3953 | -rb_shell_player_window_title_changed_cb (RBShellPlayer *player, |
| 3954 | - const char *window_title, |
| 3955 | - RBShell *shell) |
| 3956 | -{ |
| 3957 | - rb_shell_set_window_title (shell, window_title); |
| 3958 | -} |
| 3959 | - |
| 3960 | -static void |
| 3961 | -rb_shell_set_window_title (RBShell *shell, |
| 3962 | - const char *window_title) |
| 3963 | -{ |
| 3964 | - if (window_title == NULL) { |
| 3965 | - rb_debug ("clearing title"); |
| 3966 | - |
| 3967 | - g_free (shell->priv->cached_title); |
| 3968 | - shell->priv->cached_title = NULL; |
| 3969 | - |
| 3970 | - gtk_window_set_title (GTK_WINDOW (shell->priv->window), |
| 3971 | - _("Rhythmbox")); |
| 3972 | - } |
| 3973 | - else { |
| 3974 | - gboolean playing; |
| 3975 | - char *title; |
| 3976 | - |
| 3977 | - rb_shell_player_get_playing (shell->priv->player_shell, &playing, NULL); |
| 3978 | - |
| 3979 | - if (shell->priv->cached_title && |
| 3980 | - !strcmp (shell->priv->cached_title, window_title) && |
| 3981 | - playing == shell->priv->cached_playing) { |
| 3982 | - return; |
| 3983 | - } |
| 3984 | - g_free (shell->priv->cached_title); |
| 3985 | - shell->priv->cached_title = g_strdup (window_title); |
| 3986 | - shell->priv->cached_playing = playing; |
| 3987 | - |
| 3988 | - rb_debug ("setting title to \"%s\"", window_title); |
| 3989 | - if (!playing) { |
| 3990 | - /* Translators: %s is the song name */ |
| 3991 | - title = g_strdup_printf (_("%s (Paused)"), window_title); |
| 3992 | - gtk_window_set_title (GTK_WINDOW (shell->priv->window), |
| 3993 | - title); |
| 3994 | - g_free (title); |
| 3995 | - } else { |
| 3996 | - gtk_window_set_title (GTK_WINDOW (shell->priv->window), |
| 3997 | - window_title); |
| 3998 | - } |
| 3999 | - } |
| 4000 | -} |
| 4001 | - |
| 4002 | -static void |
| 4003 | -rb_shell_view_smalldisplay_changed_cb (GtkAction *action, |
| 4004 | - RBShell *shell) |
| 4005 | -{ |
| 4006 | - GTimeVal time; |
| 4007 | - |
| 4008 | - /* don't change more than once per second, it causes weirdness */ |
| 4009 | - g_get_current_time (&time); |
| 4010 | - if (time.tv_sec == shell->priv->last_small_time) |
| 4011 | - return; |
| 4012 | - |
| 4013 | - shell->priv->last_small_time = time.tv_sec; |
| 4014 | - |
| 4015 | - g_settings_set_boolean (shell->priv->settings, |
| 4016 | - "small-display", |
| 4017 | - gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); |
| 4018 | -} |
| 4019 | - |
| 4020 | -static void |
| 4021 | -rb_shell_view_statusbar_changed_cb (GtkAction *action, |
| 4022 | - RBShell *shell) |
| 4023 | -{ |
| 4024 | - g_settings_set_boolean (shell->priv->settings, |
| 4025 | - "statusbar-hidden", |
| 4026 | - !gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); |
| 4027 | - |
| 4028 | - rb_shell_sync_statusbar_visibility (shell); |
| 4029 | -} |
| 4030 | - |
| 4031 | -static void |
| 4032 | -rb_shell_view_queue_as_sidebar_changed_cb (GtkAction *action, |
| 4033 | - RBShell *shell) |
| 4034 | -{ |
| 4035 | - gboolean queue_as_sidebar = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); |
| 4036 | - /* maybe use a settings binding? */ |
| 4037 | - g_settings_set_boolean (shell->priv->settings, |
| 4038 | - "queue-as-sidebar", |
| 4039 | - queue_as_sidebar); |
| 4040 | - |
| 4041 | - if (queue_as_sidebar && |
| 4042 | - shell->priv->selected_page == RB_DISPLAY_PAGE (shell->priv->queue_source)) { |
| 4043 | - /* queue no longer exists as a source, so change to the library */ |
| 4044 | - rb_shell_select_page (shell, RB_DISPLAY_PAGE (shell->priv->library_source)); |
| 4045 | - } |
| 4046 | - |
| 4047 | - rb_shell_playing_from_queue_cb (shell->priv->player_shell, NULL, shell); |
| 4048 | - |
| 4049 | - rb_shell_sync_pane_visibility (shell); |
| 4050 | -} |
| 4051 | - |
| 4052 | -static void |
| 4053 | -rb_shell_view_party_mode_changed_cb (GtkAction *action, |
| 4054 | - RBShell *shell) |
| 4055 | -{ |
| 4056 | - shell->priv->party_mode = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); |
| 4057 | - rb_shell_sync_party_mode (shell); |
| 4058 | -} |
| 4059 | - |
| 4060 | -static void |
| 4061 | -rb_shell_cmd_about (GtkAction *action, |
| 4062 | - RBShell *shell) |
| 4063 | -{ |
| 4064 | - const char **tem; |
| 4065 | - GString *comment; |
| 4066 | - |
| 4067 | - const char *authors[] = { |
| 4068 | - "", |
| 4069 | -#include "MAINTAINERS.tab" |
| 4070 | - "", |
| 4071 | - NULL, |
| 4072 | -#include "MAINTAINERS.old.tab" |
| 4073 | - "", |
| 4074 | - NULL, |
| 4075 | -#include "AUTHORS.tab" |
| 4076 | - NULL |
| 4077 | - }; |
| 4078 | - |
| 4079 | - const char *documenters[] = { |
| 4080 | -#include "DOCUMENTERS.tab" |
| 4081 | - NULL |
| 4082 | - }; |
| 4083 | - |
| 4084 | - const char *translator_credits = _("translator-credits"); |
| 4085 | - |
| 4086 | - const char *license[] = { |
| 4087 | - N_("Rhythmbox is free software; you can redistribute it and/or modify\n" |
| 4088 | - "it under the terms of the GNU General Public License as published by\n" |
| 4089 | - "the Free Software Foundation; either version 2 of the License, or\n" |
| 4090 | - "(at your option) any later version.\n"), |
| 4091 | - N_("Rhythmbox is distributed in the hope that it will be useful,\n" |
| 4092 | - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" |
| 4093 | - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" |
| 4094 | - "GNU General Public License for more details.\n"), |
| 4095 | - N_("You should have received a copy of the GNU General Public License\n" |
| 4096 | - "along with Rhythmbox; if not, write to the Free Software Foundation, Inc.,\n" |
| 4097 | - "51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n") |
| 4098 | - }; |
| 4099 | - |
| 4100 | - char *license_trans; |
| 4101 | - |
| 4102 | - authors[0] = _("Maintainers:"); |
| 4103 | - for (tem = authors; *tem != NULL; tem++) |
| 4104 | - ; |
| 4105 | - *tem = _("Former Maintainers:"); |
| 4106 | - for (; *tem != NULL; tem++) |
| 4107 | - ; |
| 4108 | - *tem = _("Contributors:"); |
| 4109 | - |
| 4110 | - comment = g_string_new (_("Music management and playback software for GNOME.")); |
| 4111 | - |
| 4112 | - license_trans = g_strconcat (_(license[0]), "\n", _(license[1]), "\n", |
| 4113 | - _(license[2]), "\n", NULL); |
| 4114 | - |
| 4115 | - gtk_show_about_dialog (GTK_WINDOW (shell->priv->window), |
| 4116 | - "version", VERSION, |
| 4117 | - "copyright", "Copyright \xc2\xa9 2005 - 2009 The Rhythmbox authors\nCopyright \xc2\xa9 2003 - 2005 Colin Walters\nCopyright \xc2\xa9 2002, 2003 Jorn Baayen", |
| 4118 | - "license", license_trans, |
| 4119 | - "website-label", _("Rhythmbox Website"), |
| 4120 | - "website", "http://www.gnome.org/projects/rhythmbox", |
| 4121 | - "comments", comment->str, |
| 4122 | - "authors", (const char **) authors, |
| 4123 | - "documenters", (const char **) documenters, |
| 4124 | - "translator-credits", strcmp (translator_credits, "translator-credits") != 0 ? translator_credits : NULL, |
| 4125 | - "logo-icon-name", "rhythmbox", |
| 4126 | - NULL); |
| 4127 | - g_string_free (comment, TRUE); |
| 4128 | - g_free (license_trans); |
| 4129 | -} |
| 4130 | - |
| 4131 | -/** |
| 4132 | - * rb_shell_toggle_visibility: |
| 4133 | - * @shell: the #RBShell |
| 4134 | - * |
| 4135 | - * Toggles the visibility of the main Rhythmbox window. |
| 4136 | - */ |
| 4137 | -void |
| 4138 | -rb_shell_toggle_visibility (RBShell *shell) |
| 4139 | -{ |
| 4140 | - gboolean visible; |
| 4141 | - |
| 4142 | - visible = rb_shell_get_visibility (shell); |
| 4143 | - |
| 4144 | - rb_shell_set_visibility (shell, FALSE, !visible); |
| 4145 | -} |
| 4146 | - |
| 4147 | -static void |
| 4148 | -rb_shell_cmd_quit (GtkAction *action, |
| 4149 | - RBShell *shell) |
| 4150 | -{ |
| 4151 | - rb_shell_quit (shell, NULL); |
| 4152 | -} |
| 4153 | - |
| 4154 | -static void |
| 4155 | -rb_shell_cmd_contents (GtkAction *action, |
| 4156 | - RBShell *shell) |
| 4157 | -{ |
| 4158 | - GError *error = NULL; |
| 4159 | - |
| 4160 | - gtk_show_uri (gtk_widget_get_screen (shell->priv->window), |
| 4161 | - "ghelp:rhythmbox", |
| 4162 | - gtk_get_current_event_time (), |
| 4163 | - &error); |
| 4164 | - |
| 4165 | - if (error != NULL) { |
| 4166 | - rb_error_dialog (NULL, _("Couldn't display help"), |
| 4167 | - "%s", error->message); |
| 4168 | - g_error_free (error); |
| 4169 | - } |
| 4170 | -} |
| 4171 | - |
| 4172 | -static void |
| 4173 | -rb_shell_cmd_preferences (GtkAction *action, |
| 4174 | - RBShell *shell) |
| 4175 | -{ |
| 4176 | - RBShellPreferences *prefs; |
| 4177 | - |
| 4178 | - g_object_get (shell, "prefs", &prefs, NULL); |
| 4179 | - |
| 4180 | - gtk_window_present (GTK_WINDOW (prefs)); |
| 4181 | - g_object_unref (prefs); |
| 4182 | -} |
| 4183 | - |
| 4184 | -static gboolean |
| 4185 | -rb_shell_plugins_window_delete_cb (GtkWidget *window, |
| 4186 | - GdkEventAny *event, |
| 4187 | - gpointer data) |
| 4188 | -{ |
| 4189 | - gtk_widget_hide (window); |
| 4190 | - |
| 4191 | - return TRUE; |
| 4192 | -} |
| 4193 | - |
| 4194 | -static void |
| 4195 | -rb_shell_plugins_response_cb (GtkDialog *dialog, |
| 4196 | - int response_id, |
| 4197 | - gpointer data) |
| 4198 | -{ |
| 4199 | - if (response_id == GTK_RESPONSE_CLOSE) |
| 4200 | - gtk_widget_hide (GTK_WIDGET (dialog)); |
| 4201 | -} |
| 4202 | - |
| 4203 | -static void |
| 4204 | -rb_shell_cmd_plugins (GtkAction *action, |
| 4205 | - RBShell *shell) |
| 4206 | -{ |
| 4207 | - if (shell->priv->plugins == NULL) { |
| 4208 | - GtkWidget *content_area; |
| 4209 | - GtkWidget *manager; |
| 4210 | - |
| 4211 | - shell->priv->plugins = gtk_dialog_new_with_buttons (_("Configure Plugins"), |
| 4212 | - GTK_WINDOW (shell->priv->window), |
| 4213 | - GTK_DIALOG_DESTROY_WITH_PARENT, |
| 4214 | - GTK_STOCK_CLOSE, |
| 4215 | - GTK_RESPONSE_CLOSE, |
| 4216 | - NULL); |
| 4217 | - content_area = gtk_dialog_get_content_area (GTK_DIALOG (shell->priv->plugins)); |
| 4218 | - gtk_container_set_border_width (GTK_CONTAINER (shell->priv->plugins), 5); |
| 4219 | - gtk_box_set_spacing (GTK_BOX (content_area), 2); |
| 4220 | - |
| 4221 | - g_signal_connect_object (G_OBJECT (shell->priv->plugins), |
| 4222 | - "delete_event", |
| 4223 | - G_CALLBACK (rb_shell_plugins_window_delete_cb), |
| 4224 | - NULL, 0); |
| 4225 | - g_signal_connect_object (G_OBJECT (shell->priv->plugins), |
| 4226 | - "response", |
| 4227 | - G_CALLBACK (rb_shell_plugins_response_cb), |
| 4228 | - NULL, 0); |
| 4229 | - |
| 4230 | - manager = peas_gtk_plugin_manager_new (NULL); |
| 4231 | - gtk_widget_show_all (GTK_WIDGET (manager)); |
| 4232 | - gtk_box_pack_start (GTK_BOX (content_area), manager, TRUE, TRUE, 0); |
| 4233 | - gtk_window_set_default_size (GTK_WINDOW (shell->priv->plugins), 600, 400); |
| 4234 | - } |
| 4235 | - |
| 4236 | - gtk_window_present (GTK_WINDOW (shell->priv->plugins)); |
| 4237 | -} |
| 4238 | - |
| 4239 | -static void |
| 4240 | -add_to_library_response_cb (GtkDialog *dialog, |
| 4241 | - int response_id, |
| 4242 | - RBShell *shell) |
| 4243 | -{ |
| 4244 | - |
| 4245 | - char *current_dir = NULL; |
| 4246 | - GSList *uri_list = NULL, *uris = NULL; |
| 4247 | - GSettings *library_settings; |
| 4248 | - |
| 4249 | - if (response_id != GTK_RESPONSE_ACCEPT) { |
| 4250 | - gtk_widget_destroy (GTK_WIDGET (dialog)); |
| 4251 | - return; |
| 4252 | - } |
| 4253 | - |
| 4254 | - library_settings = g_settings_new ("org.gnome.rhythmbox.library"); |
| 4255 | - current_dir = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog)); |
| 4256 | - g_settings_set_string (library_settings, "add-dir", current_dir); |
| 4257 | - g_object_unref (library_settings); |
| 4258 | - |
| 4259 | - uri_list = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (dialog)); |
| 4260 | - if (uri_list == NULL) { |
| 4261 | - uri_list = g_slist_prepend (uri_list, g_strdup (current_dir)); |
| 4262 | - } |
| 4263 | - |
| 4264 | - for (uris = uri_list; uris; uris = uris->next) { |
| 4265 | - rb_shell_load_uri (shell, (char *)uris->data, FALSE, NULL); |
| 4266 | - g_free (uris->data); |
| 4267 | - } |
| 4268 | - g_slist_free (uri_list); |
| 4269 | - g_free (current_dir); |
| 4270 | - gtk_widget_destroy (GTK_WIDGET (dialog)); |
| 4271 | - |
| 4272 | - if (shell->priv->save_db_id > 0) { |
| 4273 | - g_source_remove (shell->priv->save_db_id); |
| 4274 | - } |
| 4275 | - shell->priv->save_db_id = g_timeout_add_seconds (10, (GSourceFunc) idle_save_rhythmdb, shell); |
| 4276 | -} |
| 4277 | - |
| 4278 | -static void |
| 4279 | -set_current_folder_uri (RBShell *shell, GtkWidget *dialog) |
| 4280 | -{ |
| 4281 | - GSettings *settings; |
| 4282 | - char *dir; |
| 4283 | - |
| 4284 | - settings = g_settings_new ("org.gnome.rhythmbox.library"); |
| 4285 | - dir = g_settings_get_string (settings, "add-dir"); |
| 4286 | - if (dir && dir[0] != '\0') { |
| 4287 | - gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), |
| 4288 | - dir); |
| 4289 | - } |
| 4290 | - g_free (dir); |
| 4291 | - g_object_unref (settings); |
| 4292 | -} |
| 4293 | - |
| 4294 | -static void |
| 4295 | -rb_shell_cmd_add_folder_to_library (GtkAction *action, |
| 4296 | - RBShell *shell) |
| 4297 | -{ |
| 4298 | - GtkWidget *dialog; |
| 4299 | - |
| 4300 | - dialog = rb_file_chooser_new (_("Import Folder into Library"), |
| 4301 | - GTK_WINDOW (shell->priv->window), |
| 4302 | - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, |
| 4303 | - FALSE); |
| 4304 | - gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE); |
| 4305 | - set_current_folder_uri (shell, dialog); |
| 4306 | - |
| 4307 | - g_signal_connect_object (G_OBJECT (dialog), |
| 4308 | - "response", |
| 4309 | - G_CALLBACK (add_to_library_response_cb), |
| 4310 | - shell, 0); |
| 4311 | -} |
| 4312 | - |
| 4313 | -static void |
| 4314 | -rb_shell_cmd_add_file_to_library (GtkAction *action, |
| 4315 | - RBShell *shell) |
| 4316 | -{ |
| 4317 | - GtkWidget *dialog; |
| 4318 | - |
| 4319 | - dialog = rb_file_chooser_new (_("Import File into Library"), |
| 4320 | - GTK_WINDOW (shell->priv->window), |
| 4321 | - GTK_FILE_CHOOSER_ACTION_OPEN, |
| 4322 | - FALSE); |
| 4323 | - gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE); |
| 4324 | - set_current_folder_uri (shell, dialog); |
| 4325 | - |
| 4326 | - g_signal_connect_object (G_OBJECT (dialog), |
| 4327 | - "response", |
| 4328 | - G_CALLBACK (add_to_library_response_cb), |
| 4329 | - shell, 0); |
| 4330 | -} |
| 4331 | - |
| 4332 | -static gboolean |
| 4333 | -quit_timeout (gpointer dummy) |
| 4334 | -{ |
| 4335 | - GDK_THREADS_ENTER (); |
| 4336 | - rb_debug ("quit damn you"); |
| 4337 | - gtk_main_quit (); |
| 4338 | - GDK_THREADS_LEAVE (); |
| 4339 | - return FALSE; |
| 4340 | -} |
| 4341 | - |
| 4342 | -/** |
| 4343 | - * rb_shell_quit: |
| 4344 | - * @shell: the #RBShell |
| 4345 | - * @error: not used |
| 4346 | - * |
| 4347 | - * Begins the process of shutting down Rhythmbox. This function will |
| 4348 | - * return. The error parameter and return value only exist because this |
| 4349 | - * function is part of the DBus interface. |
| 4350 | - * |
| 4351 | - * Return value: not important |
| 4352 | - */ |
| 4353 | -gboolean |
| 4354 | -rb_shell_quit (RBShell *shell, |
| 4355 | - GError **error) |
| 4356 | -{ |
| 4357 | - rb_debug ("Quitting"); |
| 4358 | - |
| 4359 | - /* Stop the playing source, if any */ |
| 4360 | - rb_shell_player_stop (shell->priv->player_shell); |
| 4361 | - |
| 4362 | - rb_podcast_manager_shutdown (shell->priv->podcast_manager); |
| 4363 | - |
| 4364 | - rb_shell_shutdown (shell); |
| 4365 | - rb_shell_sync_state (shell); |
| 4366 | - |
| 4367 | - g_application_release (G_APPLICATION (shell)); |
| 4368 | - |
| 4369 | - g_timeout_add_seconds (10, quit_timeout, NULL); |
| 4370 | - return TRUE; |
| 4371 | -} |
| 4372 | - |
| 4373 | -static gboolean |
| 4374 | -idle_handle_load_complete (RBShell *shell) |
| 4375 | -{ |
| 4376 | - gboolean loaded, scanned; |
| 4377 | - GDK_THREADS_ENTER (); |
| 4378 | - |
| 4379 | - rb_debug ("load complete"); |
| 4380 | - |
| 4381 | - rb_playlist_manager_load_playlists (shell->priv->playlist_manager); |
| 4382 | - rb_display_page_group_loaded (RB_DISPLAY_PAGE_GROUP (RB_DISPLAY_PAGE_GROUP_PLAYLISTS)); |
| 4383 | - shell->priv->load_complete = TRUE; |
| 4384 | - shell->priv->save_playlist_id = g_timeout_add_seconds (10, (GSourceFunc) idle_save_playlist_manager, shell); |
| 4385 | - |
| 4386 | - if (shell->priv->no_registration == FALSE) { |
| 4387 | - g_variant_get (g_action_group_get_action_state (G_ACTION_GROUP (shell), "LoadURI"), "(bb)", &loaded, &scanned); |
| 4388 | - g_action_group_change_action_state (G_ACTION_GROUP (shell), "LoadURI", g_variant_new ("(bb)", TRUE, scanned)); |
| 4389 | - emit_action_state_update (shell, "LoadURI"); |
| 4390 | - } |
| 4391 | - |
| 4392 | - rhythmdb_start_action_thread (shell->priv->db); |
| 4393 | - |
| 4394 | - GDK_THREADS_LEAVE (); |
| 4395 | - |
| 4396 | - return FALSE; |
| 4397 | -} |
| 4398 | - |
| 4399 | -static void |
| 4400 | -rb_shell_load_complete_cb (RhythmDB *db, |
| 4401 | - RBShell *shell) |
| 4402 | -{ |
| 4403 | - g_idle_add ((GSourceFunc) idle_handle_load_complete, shell); |
| 4404 | -} |
| 4405 | - |
| 4406 | -static void |
| 4407 | -rb_shell_sync_pane_visibility (RBShell *shell) |
| 4408 | -{ |
| 4409 | - GtkAction *action; |
| 4410 | - gboolean queue_as_sidebar = g_settings_get_boolean (shell->priv->settings, "queue-as-sidebar"); |
| 4411 | - |
| 4412 | - if (shell->priv->queue_source != NULL) { |
| 4413 | - g_object_set (shell->priv->queue_source, "visibility", !queue_as_sidebar, NULL); |
| 4414 | - } |
| 4415 | - |
| 4416 | - if (queue_as_sidebar) { |
| 4417 | - gtk_widget_show (shell->priv->queue_sidebar); |
| 4418 | - } else { |
| 4419 | - gtk_widget_hide (shell->priv->queue_sidebar); |
| 4420 | - } |
| 4421 | - |
| 4422 | - action = gtk_action_group_get_action (shell->priv->actiongroup, |
| 4423 | - "ViewQueueAsSidebar"); |
| 4424 | - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), queue_as_sidebar); |
| 4425 | -} |
| 4426 | - |
| 4427 | -static void |
| 4428 | -rb_shell_sync_toolbar_state (RBShell *shell) |
| 4429 | -{ |
| 4430 | - GtkWidget *toolbar; |
| 4431 | - guint toolbar_style; |
| 4432 | - |
| 4433 | - toolbar = gtk_ui_manager_get_widget (shell->priv->ui_manager, "/ToolBar"); |
| 4434 | - |
| 4435 | - /* icons-only in small mode */ |
| 4436 | - if (g_settings_get_boolean (shell->priv->settings, "small-display")) |
| 4437 | - toolbar_style = 3; |
| 4438 | - else |
| 4439 | - toolbar_style = g_settings_get_int (shell->priv->settings, "toolbar-style"); |
| 4440 | - |
| 4441 | - switch (toolbar_style) { |
| 4442 | - case 0: |
| 4443 | - /* default*/ |
| 4444 | - gtk_toolbar_unset_style (GTK_TOOLBAR (toolbar)); |
| 4445 | - break; |
| 4446 | - case 1: |
| 4447 | - /* text below icons */ |
| 4448 | - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH); |
| 4449 | - break; |
| 4450 | - case 2: |
| 4451 | - /* text beside icons */ |
| 4452 | - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ); |
| 4453 | - break; |
| 4454 | - case 3: |
| 4455 | - /* icons only */ |
| 4456 | - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS); |
| 4457 | - break; |
| 4458 | - case 4: |
| 4459 | - /* text only */ |
| 4460 | - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_TEXT); |
| 4461 | - break; |
| 4462 | - default: |
| 4463 | - g_warning ("unknown toolbar style type"); |
| 4464 | - gtk_toolbar_unset_style (GTK_TOOLBAR (toolbar)); |
| 4465 | - } |
| 4466 | -} |
| 4467 | - |
| 4468 | -static gboolean |
| 4469 | -window_state_event_cb (GtkWidget *widget, |
| 4470 | - GdkEventWindowState *event, |
| 4471 | - RBShell *shell) |
| 4472 | -{ |
| 4473 | - if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) { |
| 4474 | - rb_shell_present (shell, gtk_get_current_event_time (), NULL); |
| 4475 | - } |
| 4476 | - |
| 4477 | - return TRUE; |
| 4478 | -} |
| 4479 | - |
| 4480 | -static void |
| 4481 | -rb_shell_sync_party_mode (RBShell *shell) |
| 4482 | -{ |
| 4483 | - GtkAction *action; |
| 4484 | - |
| 4485 | - /* party mode does not use gsettings as a model since it |
| 4486 | - should not be persistent */ |
| 4487 | - |
| 4488 | - /* disable/enable quit action */ |
| 4489 | - action = gtk_action_group_get_action (shell->priv->actiongroup, "MusicQuit"); |
| 4490 | - g_object_set (action, "sensitive", !shell->priv->party_mode, NULL); |
| 4491 | - action = gtk_action_group_get_action (shell->priv->actiongroup, "ViewSmallDisplay"); |
| 4492 | - g_object_set (action, "sensitive", !shell->priv->party_mode, NULL); |
| 4493 | - |
| 4494 | - /* show/hide queue as sidebar ? */ |
| 4495 | - |
| 4496 | - g_object_set (shell->priv->player_shell, "queue-only", shell->priv->party_mode, NULL); |
| 4497 | - |
| 4498 | - /* Set playlist manager source to the current source to update properties */ |
| 4499 | - if (shell->priv->selected_page && RB_IS_SOURCE (shell->priv->selected_page)) { |
| 4500 | - RBSource *source = RB_SOURCE (shell->priv->selected_page); |
| 4501 | - g_object_set (shell->priv->playlist_manager, "source", source, NULL); |
| 4502 | - rb_shell_clipboard_set_source (shell->priv->clipboard_shell, source); |
| 4503 | - } |
| 4504 | - |
| 4505 | - gtk_window_set_keep_above (GTK_WINDOW (shell->priv->window), shell->priv->party_mode); |
| 4506 | - if (shell->priv->party_mode) { |
| 4507 | - gtk_window_fullscreen (GTK_WINDOW (shell->priv->window)); |
| 4508 | - gtk_window_stick (GTK_WINDOW (shell->priv->window)); |
| 4509 | - g_signal_connect (shell->priv->window, "window-state-event", G_CALLBACK (window_state_event_cb), shell); |
| 4510 | - } else { |
| 4511 | - gtk_window_unstick (GTK_WINDOW (shell->priv->window)); |
| 4512 | - gtk_window_unfullscreen (GTK_WINDOW (shell->priv->window)); |
| 4513 | - g_signal_handlers_disconnect_by_func (shell->priv->window, window_state_event_cb, shell); |
| 4514 | - } |
| 4515 | -} |
| 4516 | - |
| 4517 | -static void |
| 4518 | -rb_shell_sync_smalldisplay (RBShell *shell) |
| 4519 | -{ |
| 4520 | - GtkAction *action; |
| 4521 | - GtkAction *queue_action; |
| 4522 | - GtkAction *party_mode_action; |
| 4523 | - GtkAction *jump_to_playing_action; |
| 4524 | - |
| 4525 | - rb_shell_sync_window_state (shell, FALSE); |
| 4526 | - |
| 4527 | - action = gtk_action_group_get_action (shell->priv->actiongroup, |
| 4528 | - "ViewSidePane"); |
| 4529 | - queue_action = gtk_action_group_get_action (shell->priv->actiongroup, |
| 4530 | - "ViewQueueAsSidebar"); |
| 4531 | - party_mode_action = gtk_action_group_get_action (shell->priv->actiongroup, |
| 4532 | - "ViewPartyMode"); |
| 4533 | - jump_to_playing_action = gtk_action_group_get_action (shell->priv->actiongroup, |
| 4534 | - "ViewJumpToPlaying"); |
| 4535 | - |
| 4536 | - if (g_settings_get_boolean (shell->priv->settings, "small-display")) { |
| 4537 | - g_object_set (action, "sensitive", FALSE, NULL); |
| 4538 | - g_object_set (queue_action, "sensitive", FALSE, NULL); |
| 4539 | - g_object_set (party_mode_action, "sensitive", FALSE, NULL); |
| 4540 | - g_object_set (jump_to_playing_action, "sensitive", FALSE, NULL); |
| 4541 | - |
| 4542 | - gtk_widget_hide (GTK_WIDGET (shell->priv->paned)); |
| 4543 | - } else { |
| 4544 | - RhythmDBEntry *playing; |
| 4545 | - |
| 4546 | - g_object_set (action, "sensitive", TRUE, NULL); |
| 4547 | - g_object_set (queue_action, "sensitive", TRUE, NULL); |
| 4548 | - g_object_set (party_mode_action, "sensitive", TRUE, NULL); |
| 4549 | - |
| 4550 | - playing = rb_shell_player_get_playing_entry (shell->priv->player_shell); |
| 4551 | - g_object_set (jump_to_playing_action, "sensitive", playing != NULL, NULL); |
| 4552 | - if (playing) |
| 4553 | - rhythmdb_entry_unref (playing); |
| 4554 | - |
| 4555 | - gtk_widget_show (GTK_WIDGET (shell->priv->paned)); |
| 4556 | - } |
| 4557 | - rb_shell_sync_statusbar_visibility (shell); |
| 4558 | - rb_shell_sync_toolbar_state (shell); |
| 4559 | - |
| 4560 | - action = gtk_action_group_get_action (shell->priv->actiongroup, |
| 4561 | - "ViewSmallDisplay"); |
| 4562 | - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), |
| 4563 | - g_settings_get_boolean (shell->priv->settings, "small-display")); |
| 4564 | -} |
| 4565 | - |
| 4566 | -static void |
| 4567 | -rb_shell_sync_statusbar_visibility (RBShell *shell) |
| 4568 | -{ |
| 4569 | - gboolean visible; |
| 4570 | - GtkAction *action; |
| 4571 | - |
| 4572 | - visible = !g_settings_get_boolean (shell->priv->settings, "statusbar-hidden"); |
| 4573 | - |
| 4574 | - action = gtk_action_group_get_action (shell->priv->actiongroup, "ViewStatusbar"); |
| 4575 | - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible); |
| 4576 | - |
| 4577 | - gtk_widget_set_visible (GTK_WIDGET (shell->priv->statusbar), |
| 4578 | - visible && !g_settings_get_boolean (shell->priv->settings, "small-display")); |
| 4579 | -} |
| 4580 | - |
| 4581 | -static void |
| 4582 | -settings_changed_cb (GSettings *settings, const char *key, RBShell *shell) |
| 4583 | -{ |
| 4584 | - if (g_strcmp0 (key, "toolbar-style") == 0) { |
| 4585 | - rb_debug ("toolbar state changed"); |
| 4586 | - rb_shell_sync_toolbar_state (shell); |
| 4587 | - } else if (g_strcmp0 (key, "small-display") == 0) { |
| 4588 | - rb_debug ("small display mode changed"); |
| 4589 | - rb_shell_sync_smalldisplay (shell); |
| 4590 | - } |
| 4591 | -} |
| 4592 | - |
| 4593 | -static void |
| 4594 | -rb_shell_sync_paned (RBShell *shell) |
| 4595 | -{ |
| 4596 | - gtk_paned_set_position (GTK_PANED (shell->priv->right_paned), |
| 4597 | - g_settings_get_int (shell->priv->settings, "right-paned-position")); |
| 4598 | - gtk_paned_set_position (GTK_PANED (shell->priv->paned), |
| 4599 | - g_settings_get_int (shell->priv->settings, "paned-position")); |
| 4600 | - gtk_paned_set_position (GTK_PANED (shell->priv->queue_paned), |
| 4601 | - g_settings_get_int (shell->priv->settings, "display-page-tree-height")); |
| 4602 | -} |
| 4603 | - |
| 4604 | -static void |
| 4605 | -paned_size_allocate_cb (GtkWidget *widget, |
| 4606 | - GtkAllocation *allocation, |
| 4607 | - RBShell *shell) |
| 4608 | -{ |
| 4609 | - rb_settings_delayed_sync (shell->priv->settings, |
| 4610 | - (RBDelayedSyncFunc) sync_window_settings, |
| 4611 | - g_object_ref (shell), |
| 4612 | - g_object_unref); |
| 4613 | -} |
| 4614 | - |
| 4615 | -static void |
| 4616 | -display_page_tree_drag_received_cb (RBDisplayPageTree *display_page_tree, |
| 4617 | - RBDisplayPage *page, |
| 4618 | - GtkSelectionData *data, |
| 4619 | - RBShell *shell) |
| 4620 | -{ |
| 4621 | - if (page == NULL) { |
| 4622 | - RBSource *source; |
| 4623 | - source = rb_playlist_manager_new_playlist_from_selection_data (shell->priv->playlist_manager, |
| 4624 | - data); |
| 4625 | - page = RB_DISPLAY_PAGE (source); |
| 4626 | - } |
| 4627 | - |
| 4628 | - if (page != NULL) { |
| 4629 | - rb_display_page_receive_drag (page, data); |
| 4630 | - } |
| 4631 | - |
| 4632 | -} |
| 4633 | - |
| 4634 | -static void |
| 4635 | -rb_shell_cmd_current_song (GtkAction *action, |
| 4636 | - RBShell *shell) |
| 4637 | -{ |
| 4638 | - rb_debug ("current song"); |
| 4639 | - |
| 4640 | - rb_shell_jump_to_current (shell); |
| 4641 | -} |
| 4642 | - |
| 4643 | -static void |
| 4644 | -rb_shell_cmd_view_all (GtkAction *action, |
| 4645 | - RBShell *shell) |
| 4646 | -{ |
| 4647 | - if (RB_IS_SOURCE (shell->priv->selected_page)) { |
| 4648 | - RBSource *source = RB_SOURCE (shell->priv->selected_page); |
| 4649 | - rb_debug ("view all"); |
| 4650 | - |
| 4651 | - rb_source_reset_filters (source); |
| 4652 | - } |
| 4653 | -} |
| 4654 | - |
| 4655 | -static void |
| 4656 | -rb_shell_jump_to_entry_with_source (RBShell *shell, |
| 4657 | - RBSource *source, |
| 4658 | - RhythmDBEntry *entry) |
| 4659 | -{ |
| 4660 | - RBEntryView *songs; |
| 4661 | - |
| 4662 | - g_return_if_fail (entry != NULL); |
| 4663 | - |
| 4664 | - if ((source == RB_SOURCE (shell->priv->queue_source) && |
| 4665 | - g_settings_get_boolean (shell->priv->settings, "queue-as-sidebar")) || |
| 4666 | - source == NULL) { |
| 4667 | - RhythmDBEntryType *entry_type; |
| 4668 | - entry_type = rhythmdb_entry_get_entry_type (entry); |
| 4669 | - source = rb_shell_get_source_by_entry_type (shell, entry_type); |
| 4670 | - } |
| 4671 | - if (source == NULL) |
| 4672 | - return; |
| 4673 | - |
| 4674 | - songs = rb_source_get_entry_view (source); |
| 4675 | - rb_shell_select_page (shell, RB_DISPLAY_PAGE (source)); |
| 4676 | - |
| 4677 | - if (songs != NULL) { |
| 4678 | - rb_entry_view_scroll_to_entry (songs, entry); |
| 4679 | - rb_entry_view_select_entry (songs, entry); |
| 4680 | - } |
| 4681 | -} |
| 4682 | - |
| 4683 | -static void |
| 4684 | -rb_shell_play_entry (RBShell *shell, |
| 4685 | - RhythmDBEntry *entry) |
| 4686 | -{ |
| 4687 | - rb_shell_player_stop (shell->priv->player_shell); |
| 4688 | - rb_shell_jump_to_entry_with_source (shell, NULL, entry); |
| 4689 | - rb_shell_player_play_entry (shell->priv->player_shell, entry, NULL); |
| 4690 | -} |
| 4691 | - |
| 4692 | -static void |
| 4693 | -rb_shell_jump_to_current (RBShell *shell) |
| 4694 | -{ |
| 4695 | - RBSource *source; |
| 4696 | - RhythmDBEntry *playing; |
| 4697 | - |
| 4698 | - source = rb_shell_player_get_playing_source (shell->priv->player_shell); |
| 4699 | - |
| 4700 | - g_return_if_fail (source != NULL); |
| 4701 | - |
| 4702 | - playing = rb_shell_player_get_playing_entry (shell->priv->player_shell); |
| 4703 | - |
| 4704 | - rb_shell_jump_to_entry_with_source (shell, source, playing); |
| 4705 | - rhythmdb_entry_unref (playing); |
| 4706 | -} |
| 4707 | - |
| 4708 | -void |
| 4709 | -rb_shell_notify_custom (RBShell *shell, |
| 4710 | - guint timeout, |
| 4711 | - const char *primary, |
| 4712 | - const char *secondary, |
| 4713 | - const char *image_uri, |
| 4714 | - gboolean requested) |
| 4715 | -{ |
| 4716 | - g_signal_emit (shell, rb_shell_signals[NOTIFY_CUSTOM], 0, timeout, primary, secondary, image_uri, requested); |
| 4717 | -} |
| 4718 | - |
| 4719 | -/** |
| 4720 | - * rb_shell_do_notify: |
| 4721 | - * @shell: the #RBShell |
| 4722 | - * @requested: if %TRUE, the notification was requested by some explicit user action |
| 4723 | - * @error: not used |
| 4724 | - * |
| 4725 | - * Displays a notification of the current playing track. |
| 4726 | - * |
| 4727 | - * Return value: not important |
| 4728 | - */ |
| 4729 | -gboolean |
| 4730 | -rb_shell_do_notify (RBShell *shell, gboolean requested, GError **error) |
| 4731 | -{ |
| 4732 | - g_signal_emit (shell, rb_shell_signals[NOTIFY_PLAYING_ENTRY], 0, requested); |
| 4733 | - return TRUE; |
| 4734 | -} |
| 4735 | - |
| 4736 | -/** |
| 4737 | - * rb_shell_error_quark: |
| 4738 | - * |
| 4739 | - * Returns the #GQuark used for #RBShell errors |
| 4740 | - * |
| 4741 | - * Return value: shell error #GQuark |
| 4742 | - */ |
| 4743 | -GQuark |
| 4744 | -rb_shell_error_quark (void) |
| 4745 | -{ |
| 4746 | - static GQuark quark = 0; |
| 4747 | - if (!quark) |
| 4748 | - quark = g_quark_from_static_string ("rb_shell_error"); |
| 4749 | - |
| 4750 | - return quark; |
| 4751 | -} |
| 4752 | - |
| 4753 | -static void |
| 4754 | -session_save_state_cb (EggSMClient *client, |
| 4755 | - GKeyFile *key_file, |
| 4756 | - RBShell *shell) |
| 4757 | -{ |
| 4758 | - rb_debug ("session save-state"); |
| 4759 | - rb_shell_sync_state (shell); |
| 4760 | -} |
| 4761 | - |
| 4762 | -static void |
| 4763 | -session_quit_cb (EggSMClient *client, |
| 4764 | - RBShell *shell) |
| 4765 | -{ |
| 4766 | - rb_debug ("session quit"); |
| 4767 | - rb_shell_quit (shell, NULL); |
| 4768 | -} |
| 4769 | - |
| 4770 | -static void |
| 4771 | -rb_shell_session_init (RBShell *shell) |
| 4772 | -{ |
| 4773 | - EggSMClient *sm_client; |
| 4774 | - |
| 4775 | - sm_client = egg_sm_client_get (); |
| 4776 | - g_signal_connect (sm_client, "save-state", G_CALLBACK (session_save_state_cb), shell); |
| 4777 | - g_signal_connect (sm_client, "quit", G_CALLBACK (session_quit_cb), shell); |
| 4778 | -} |
| 4779 | - |
| 4780 | -/** |
| 4781 | - * rb_shell_guess_source_for_uri: |
| 4782 | - * @shell: the #RBSource |
| 4783 | - * @uri: the URI to guess a source for |
| 4784 | - * |
| 4785 | - * Attempts to locate the source that should handle the specified URI. |
| 4786 | - * This iterates through all sources, calling #rb_source_want_uri, |
| 4787 | - * returning the source that returns the highest value. |
| 4788 | - * |
| 4789 | - * Return value: (transfer none): the most appropriate #RBSource for the uri |
| 4790 | - */ |
| 4791 | -RBSource * |
| 4792 | -rb_shell_guess_source_for_uri (RBShell *shell, |
| 4793 | - const char *uri) |
| 4794 | -{ |
| 4795 | - GList *t; |
| 4796 | - RBSource *best = NULL; |
| 4797 | - guint strength = 0; |
| 4798 | - |
| 4799 | - for (t = shell->priv->sources; t != NULL; t = t->next) { |
| 4800 | - guint s; |
| 4801 | - RBSource *source; |
| 4802 | - |
| 4803 | - source = (RBSource *)t->data; |
| 4804 | - s = rb_source_want_uri (source, uri); |
| 4805 | - if (s > strength) { |
| 4806 | - gchar *name; |
| 4807 | - |
| 4808 | - g_object_get (source, "name", &name, NULL); |
| 4809 | - rb_debug ("source %s returned strength %u for uri %s", |
| 4810 | - name, s, uri); |
| 4811 | - g_free (name); |
| 4812 | - |
| 4813 | - strength = s; |
| 4814 | - best = source; |
| 4815 | - } |
| 4816 | - } |
| 4817 | - |
| 4818 | - return best; |
| 4819 | -} |
| 4820 | - |
| 4821 | -/* Load a URI representing an element of the given type, with |
| 4822 | - * optional metadata |
| 4823 | - */ |
| 4824 | -/** |
| 4825 | - * rb_shell_add_uri: |
| 4826 | - * @shell: the #RBShell |
| 4827 | - * @uri: the URI to add |
| 4828 | - * @title: optional title value for the URI |
| 4829 | - * @genre: optional genre value for the URI |
| 4830 | - * @error: returns error information |
| 4831 | - * |
| 4832 | - * Adds the specified URI to the Rhythmbox database. Whether the |
| 4833 | - * title and genre specified are actually used is up to the source |
| 4834 | - * that handles the URI |
| 4835 | - * |
| 4836 | - * Return value: TRUE if the URI was added successfully |
| 4837 | - */ |
| 4838 | -gboolean |
| 4839 | -rb_shell_add_uri (RBShell *shell, |
| 4840 | - const char *uri, |
| 4841 | - const char *title, |
| 4842 | - const char *genre, |
| 4843 | - GError **error) |
| 4844 | -{ |
| 4845 | - RBSource *source; |
| 4846 | - |
| 4847 | - source = rb_shell_guess_source_for_uri (shell, uri); |
| 4848 | - if (source == NULL) { |
| 4849 | - g_set_error (error, |
| 4850 | - RB_SHELL_ERROR, |
| 4851 | - RB_SHELL_ERROR_NO_SOURCE_FOR_URI, |
| 4852 | - _("No registered source can handle URI %s"), |
| 4853 | - uri); |
| 4854 | - return FALSE; |
| 4855 | - } |
| 4856 | - |
| 4857 | - rb_source_add_uri (source, uri, title, genre, NULL, NULL, NULL); |
| 4858 | - return TRUE; |
| 4859 | -} |
| 4860 | - |
| 4861 | -typedef struct { |
| 4862 | - RBShell *shell; |
| 4863 | - char *uri; |
| 4864 | - gboolean play; |
| 4865 | - RBSource *playlist_source; |
| 4866 | - gboolean can_use_playlist; |
| 4867 | - gboolean source_is_entry; |
| 4868 | -} PlaylistParseData; |
| 4869 | - |
| 4870 | -static void |
| 4871 | -handle_playlist_entry_cb (TotemPlParser *playlist, |
| 4872 | - const char *uri, |
| 4873 | - GHashTable *metadata, |
| 4874 | - PlaylistParseData *data) |
| 4875 | -{ |
| 4876 | - RBSource *source; |
| 4877 | - |
| 4878 | - /* |
| 4879 | - * Track whether the same playlist-handling source |
| 4880 | - * wants all the URIs from the playlist; if it does, |
| 4881 | - * then we'll just give the playlist URI to the source. |
| 4882 | - */ |
| 4883 | - if (data->can_use_playlist == FALSE) |
| 4884 | - return; |
| 4885 | - |
| 4886 | - source = rb_shell_guess_source_for_uri (data->shell, uri); |
| 4887 | - if (data->playlist_source == NULL) { |
| 4888 | - if (source != NULL && rb_source_try_playlist (source)) { |
| 4889 | - data->playlist_source = RB_SOURCE (g_object_ref (source)); |
| 4890 | - data->source_is_entry = rb_source_uri_is_source (source, uri); |
| 4891 | - } else { |
| 4892 | - data->can_use_playlist = FALSE; |
| 4893 | - } |
| 4894 | - } else if (data->playlist_source != source) { |
| 4895 | - g_object_unref (data->playlist_source); |
| 4896 | - data->playlist_source = NULL; |
| 4897 | - data->can_use_playlist = FALSE; |
| 4898 | - data->source_is_entry = FALSE; |
| 4899 | - } |
| 4900 | -} |
| 4901 | - |
| 4902 | -static void |
| 4903 | -shell_load_uri_done (RBSource *source, const char *uri, RBShell *shell) |
| 4904 | -{ |
| 4905 | - RhythmDBEntry *entry; |
| 4906 | - |
| 4907 | - entry = rhythmdb_entry_lookup_by_location (shell->priv->db, uri); |
| 4908 | - if (entry) { |
| 4909 | - rb_shell_play_entry (shell, entry); |
| 4910 | - } else { |
| 4911 | - rb_debug ("unable to find entry for uri %s", uri); |
| 4912 | - } |
| 4913 | -} |
| 4914 | - |
| 4915 | -static void |
| 4916 | -load_uri_finish (RBShell *shell, RBSource *entry_source, RhythmDBEntry *entry, gboolean play) |
| 4917 | -{ |
| 4918 | - if (play == FALSE) { |
| 4919 | - rb_debug ("didn't want to do anything anyway"); |
| 4920 | - } else if (entry != NULL) { |
| 4921 | - rb_debug ("found an entry to play"); |
| 4922 | - rb_shell_play_entry (shell, entry); |
| 4923 | - } else if (entry_source != NULL) { |
| 4924 | - char *name; |
| 4925 | - GError *error = NULL; |
| 4926 | - |
| 4927 | - g_object_get (entry_source, "name", &name, NULL); |
| 4928 | - if (rb_shell_activate_source (shell, entry_source, RB_SHELL_ACTIVATION_ALWAYS_PLAY, &error) == FALSE) { |
| 4929 | - rb_debug ("couldn't activate source %s: %s", name, error->message); |
| 4930 | - g_clear_error (&error); |
| 4931 | - } else { |
| 4932 | - rb_debug ("activated source '%s'", name); |
| 4933 | - } |
| 4934 | - g_free (name); |
| 4935 | - } else { |
| 4936 | - rb_debug ("couldn't do anything"); |
| 4937 | - } |
| 4938 | -} |
| 4939 | - |
| 4940 | -static void |
| 4941 | -load_uri_parser_finished_cb (GObject *parser, GAsyncResult *res, PlaylistParseData *data) |
| 4942 | -{ |
| 4943 | - TotemPlParserResult result; |
| 4944 | - RBSource *entry_source = NULL; |
| 4945 | - GError *error = NULL; |
| 4946 | - |
| 4947 | - result = totem_pl_parser_parse_finish (TOTEM_PL_PARSER (parser), res, &error); |
| 4948 | - g_object_unref (parser); |
| 4949 | - |
| 4950 | - if (error != NULL) { |
| 4951 | - rb_debug ("parsing %s as a playlist failed: %s", data->uri, error->message); |
| 4952 | - g_clear_error (&error); |
| 4953 | - } else if (result == TOTEM_PL_PARSER_RESULT_UNHANDLED) { |
| 4954 | - rb_debug ("%s unhandled", data->uri); |
| 4955 | - } else if (result == TOTEM_PL_PARSER_RESULT_IGNORED) { |
| 4956 | - rb_debug ("%s ignored", data->uri); |
| 4957 | - } |
| 4958 | - |
| 4959 | - if (result == TOTEM_PL_PARSER_RESULT_SUCCESS) { |
| 4960 | - |
| 4961 | - if (data->can_use_playlist && data->playlist_source) { |
| 4962 | - rb_debug ("adding playlist %s to source", data->uri); |
| 4963 | - rb_source_add_uri (data->playlist_source, data->uri, NULL, NULL, NULL, NULL, NULL); |
| 4964 | - |
| 4965 | - /* FIXME: We need some way to determine whether the URI as |
| 4966 | - * given will appear in the db, or whether something else will. |
| 4967 | - * This hack assumes we'll never add local playlists to the db |
| 4968 | - * directly. |
| 4969 | - */ |
| 4970 | - if (rb_uri_is_local (data->uri) && (data->source_is_entry == FALSE)) { |
| 4971 | - data->play = FALSE; |
| 4972 | - } |
| 4973 | - |
| 4974 | - if (data->source_is_entry != FALSE) { |
| 4975 | - entry_source = data->playlist_source; |
| 4976 | - } |
| 4977 | - } else { |
| 4978 | - rb_debug ("adding %s as a static playlist", data->uri); |
| 4979 | - if (!rb_playlist_manager_parse_file (data->shell->priv->playlist_manager, |
| 4980 | - data->uri, |
| 4981 | - &error)) { |
| 4982 | - rb_debug ("unable to parse %s as a static playlist: %s", data->uri, error->message); |
| 4983 | - g_clear_error (&error); |
| 4984 | - } |
| 4985 | - data->play = FALSE; /* maybe we should play the new playlist? */ |
| 4986 | - } |
| 4987 | - } else { |
| 4988 | - RBSource *source; |
| 4989 | - |
| 4990 | - source = rb_shell_guess_source_for_uri (data->shell, data->uri); |
| 4991 | - if (source != NULL) { |
| 4992 | - char *name; |
| 4993 | - g_object_get (source, "name", &name, NULL); |
| 4994 | - if (rb_source_uri_is_source (source, data->uri)) { |
| 4995 | - rb_debug ("%s identifies source %s", data->uri, name); |
| 4996 | - entry_source = source; |
| 4997 | - } else if (data->play) { |
| 4998 | - rb_debug ("adding %s to source %s, will play it when it shows up", data->uri, name); |
| 4999 | - rb_source_add_uri (source, data->uri, NULL, NULL, (RBSourceAddCallback) shell_load_uri_done, g_object_ref (data->shell), g_object_unref); |
| 5000 | - data->play = FALSE; |
The diff has been truncated for viewing.


Thanks! Merging with using Breaks: instead of Conflicts:.