static void
impl_deactivate	(PeasActivatable *bplugin)
{
	RBAudioscrobblerPlugin *plugin = RB_AUDIOSCROBBLER_PLUGIN (bplugin);

	if (plugin->config_dialog != NULL) {
		gtk_widget_destroy (plugin->config_dialog);
		plugin->config_dialog = NULL;
	}

	if (plugin->lastfm_settings != NULL) {
		g_object_unref (plugin->lastfm_settings);
		plugin->lastfm_settings = NULL;
	}

	if (plugin->lastfm_page != NULL) {
		rb_display_page_delete_thyself (plugin->lastfm_page);
		g_object_unref (plugin->lastfm_page);
		plugin->lastfm_page = NULL;
	}

	if (plugin->librefm_settings != NULL) {
		g_object_unref (plugin->librefm_settings);
		plugin->librefm_settings = NULL;
	}

	if (plugin->librefm_page != NULL) {
		rb_display_page_delete_thyself (plugin->librefm_page);
		g_object_unref (plugin->librefm_page);
		plugin->librefm_page = NULL;
	}
}
Example #2
0
static void
impl_deactivate	(PeasActivatable *bplugin)
{
	RBGriloPlugin *plugin = RB_GRILO_PLUGIN (bplugin);
	GHashTableIter iter;
	gpointer key, value;

	g_signal_handler_disconnect (plugin->registry, plugin->handler_id_source_added);
	g_signal_handler_disconnect (plugin->registry, plugin->handler_id_source_removed);

	g_hash_table_iter_init (&iter, plugin->sources);
	while (g_hash_table_iter_next (&iter, &key, &value)) {
		grl_registry_unregister_source (plugin->registry, GRL_SOURCE (key), NULL);
		rb_display_page_delete_thyself (RB_DISPLAY_PAGE (value));
	}
	g_hash_table_destroy (plugin->sources);
	plugin->sources = NULL;
	plugin->registry = NULL;

	if (plugin->emit_cover_art_id != 0) {
		g_source_remove (plugin->emit_cover_art_id);
		plugin->emit_cover_art_id = 0;
	}
	g_signal_handlers_disconnect_by_func (plugin->shell_player, G_CALLBACK (playing_song_changed_cb), plugin);
	g_object_unref (plugin->shell_player);
	plugin->shell_player = NULL;

	g_object_unref (plugin->art_store);
	plugin->art_store = NULL;
}
static void
librefm_settings_changed_cb (GSettings *settings,
			     const char *key,
			     RBAudioscrobblerPlugin *plugin)
{
	gboolean enabled;
	if (g_strcmp0 (key, AUDIOSCROBBLER_SERVICE_ENABLED_KEY) != 0) {
		return;
	}

	enabled = g_settings_get_boolean (settings, key);
	if (enabled == TRUE && plugin->librefm_page == NULL) {
		RBAudioscrobblerService *librefm;
		RBShell *shell;

		librefm = rb_audioscrobbler_service_new_librefm ();
		g_object_get (plugin, "object", &shell, NULL);
		plugin->librefm_page = rb_audioscrobbler_profile_page_new (shell,
		                                                           G_OBJECT (plugin),
		                                                           librefm);
		g_object_unref (librefm);
		g_object_unref (shell);
	} else if (enabled == FALSE && plugin->librefm_page != NULL) {
		rb_display_page_delete_thyself (plugin->librefm_page);
		g_object_unref (plugin->librefm_page);
		plugin->librefm_page = NULL;
	}
}
Example #4
0
static gboolean
device_open_ignore_idle (DeviceOpenedData *data)
{
	rb_display_page_delete_thyself (RB_DISPLAY_PAGE (data->source));
	g_object_unref (data->source);
	free (data->types);
	g_free (data->name);
	g_free (data);
	return FALSE;
}
Example #5
0
static void
_delete_cb (GrlSource *grilo_source,
	    RBSource *source,
	    RBGriloPlugin *plugin)
{
	/* block the source deleted handler so we don't modify the hash table
	 * while iterating it.
	 */
	g_signal_handlers_block_by_func (source, rb_grilo_plugin_source_deleted, plugin);
	rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
}
Example #6
0
static void
grilo_source_removed_cb (GrlRegistry *registry, GrlSource *grilo_source, RBGriloPlugin *plugin)
{
	RBSource *source;

	source = g_hash_table_lookup (plugin->sources, grilo_source);

	if (source) {
		rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
		g_hash_table_remove (plugin->sources, grilo_source);
	}
}
static void
impl_delete_thyself (RBDisplayPage *page)
{
	RBAndroidSourcePrivate *priv = GET_PRIVATE (page);

	if (priv->import_errors != NULL) {
		rb_display_page_delete_thyself (RB_DISPLAY_PAGE (priv->import_errors));
		priv->import_errors = NULL;
	}

	RB_DISPLAY_PAGE_CLASS (rb_android_source_parent_class)->delete_thyself (page);
}
static void
rb_removable_media_manager_remove_volume (RBRemovableMediaManager *mgr, GVolume *volume)
{
	RBRemovableMediaManagerPrivate *priv = GET_PRIVATE (mgr);
	RBSource *source;

	g_assert (volume != NULL);

	rb_debug ("volume removed");
	source = g_hash_table_lookup (priv->volume_mapping, volume);
	if (source) {
		rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
	}
}
static void
rb_removable_media_manager_remove_mount (RBRemovableMediaManager *mgr, GMount *mount)
{
	RBRemovableMediaManagerPrivate *priv = GET_PRIVATE (mgr);
	RBSource *source;

	g_assert (mount != NULL);

	rb_debug ("mount removed");
	source = g_hash_table_lookup (priv->mount_mapping, mount);
	if (source) {
		rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
	}
}
static void
impl_delete_thyself (RBDisplayPage *page)
{
	GList *pl;
	GList *p;
	RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (page);

	/* take a copy of the list first, as playlist_deleted_cb modifies priv->playlists */
	pl = g_list_copy (priv->playlists);
	for (p = pl; p != NULL; p = p->next) {
		RBDisplayPage *playlist_page = RB_DISPLAY_PAGE (p->data);
		rb_display_page_delete_thyself (playlist_page);
	}
	g_list_free (priv->playlists);
	g_list_free (pl);
	priv->playlists = NULL;

	if (priv->import_errors != NULL) {
		rb_display_page_delete_thyself (RB_DISPLAY_PAGE (priv->import_errors));
		priv->import_errors = NULL;
	}

	RB_DISPLAY_PAGE_CLASS (rb_generic_player_source_parent_class)->delete_thyself (page);
}
static void
impl_remove_playlists (RBMediaPlayerSource *source)
{
	RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (source);
	GList *playlists;
	GList *t;

	playlists = g_list_copy (priv->playlists);
	for (t = playlists; t != NULL; t = t->next) {
		RBGenericPlayerPlaylistSource *p = RB_GENERIC_PLAYER_PLAYLIST_SOURCE (t->data);
		rb_generic_player_playlist_delete_from_player (p);
		rb_display_page_delete_thyself (RB_DISPLAY_PAGE (p));
	}

	g_list_free (playlists);
}
Example #12
0
static gboolean
device_open_failed_idle (RBMtpSource *source)
{
	/* libmtp doesn't give us a useful error message in this case, so
	 * all we can offer is this generic message.
	 */
	RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
	rb_error_dialog (NULL,
			 _("Media player device error"),
			 /* Translators: first %s is the device manufacturer,
			  * second is the product name.
			  */
			 _("Unable to open the %s %s device"),
			 priv->raw_device.device_entry.vendor,
			 priv->raw_device.device_entry.product);
	rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
	g_object_unref (source);
	return FALSE;
}
Example #13
0
static void
rb_mtp_plugin_device_removed (LibHalContext *context, const char *udi)
{
	RBMtpPlugin *plugin = (RBMtpPlugin *) libhal_ctx_get_user_data (context);
	GList *list = plugin->mtp_sources;
	GList *tmp;

	for (tmp = list; tmp != NULL; tmp = tmp->next) {
		RBSource *source = (RBSource *)tmp->data;
		char *source_udi;

		g_object_get (source, "udi", &source_udi, NULL);
		if (strcmp (udi, source_udi) == 0) {
			rb_debug ("removing device %s, %p", udi, source);
			plugin->mtp_sources = g_list_remove (plugin->mtp_sources, source);
			rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
		}
		g_free (source_udi);
	}
}
static void
impl_remove (RBDisplayPage *page)
{
	RBGenericPlayerPlaylistSourcePrivate *priv = GET_PRIVATE (page);

	if (priv->playlist_path != NULL) {
		GError *error = NULL;
		GFile *playlist;

		playlist = g_file_new_for_path (priv->playlist_path);
		g_file_delete (playlist, NULL, &error);
		if (error != NULL) {
			g_warning ("Deleting playlist %s failed: %s", priv->playlist_path, error->message);
			g_clear_error (&error);
		}
		g_object_unref (playlist);
	} else {
		rb_debug ("playlist was never saved: nothing to delete");
	}

	rb_display_page_delete_thyself (page);
}
Example #15
0
static void
impl_deactivate	(PeasActivatable *activatable)
{
	RBVisualizerPlugin *pi = RB_VISUALIZER_PLUGIN (activatable);

	if (pi->page != NULL) {
		stop_visualizer_cb (pi->page, pi);

		rb_display_page_delete_thyself (RB_DISPLAY_PAGE (pi->page));
		pi->page = NULL;
	}

	if (pi->sink != NULL) {
		g_object_unref (pi->sink);
		pi->sink = NULL;
	}

	if (pi->settings != NULL) {
		g_object_unref (pi->settings);
		pi->settings = NULL;
	}
}
static void
uevent_cb (GUdevClient *client, const char *action, GUdevDevice *device, RBRemovableMediaManager *mgr)
{
	RBRemovableMediaManagerPrivate *priv = GET_PRIVATE (mgr);
	guint64 devnum;

	devnum = (guint64) g_udev_device_get_device_number (device);
	rb_debug ("%s event for %s (%"G_GINT64_MODIFIER"x)", action,
                  g_udev_device_get_sysfs_path (device), devnum);

	if (g_str_equal (action, "add")) {
		RBSource *source = NULL;

		/* probably need to filter out devices related to things we've already seen.. */
		if (g_hash_table_lookup (priv->device_mapping, &devnum) != NULL) {
			rb_debug ("already have a source for this device");
		} else {
			g_signal_emit (mgr, rb_removable_media_manager_signals[CREATE_SOURCE_DEVICE], 0, device, &source);
			if (source != NULL) {
				guint64 *key = g_new0 (guint64, 1);
				rb_debug ("created a source for this device");
				key[0] = devnum;
				g_hash_table_insert (priv->device_mapping, key, source);
				rb_removable_media_manager_append_media_source (mgr, source);
			}
		}
	} else if (g_str_equal (action, "remove")) {
		RBSource *source;

		source = g_hash_table_lookup (priv->device_mapping, &devnum);
		if (source) {
			rb_debug ("removing the source created for this device");
			rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
		}
	}
}
Example #17
0
static void
impl_eject (RBDeviceSource *source)
{
	rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
}
Example #18
0
void
impl_remove (RBDisplayPage *page)
{
	rb_display_page_delete_thyself (page);
}