void ol_osd_toolbar_set_player (OlOsdToolbar *toolbar, OlPlayer *player) { ol_assert (OL_IS_OSD_TOOLBAR (toolbar)); OlOsdToolbarPriv *priv = OL_OSD_TOOLBAR_GET_PRIVATE (toolbar); if (player == priv->player) return; if (player != NULL) { g_object_ref (player); g_signal_connect (player, "status-changed", G_CALLBACK (_status_changed_cb), toolbar); g_signal_connect (player, "caps-changed", G_CALLBACK (_caps_changed_cb), toolbar); } if (priv->player != NULL) { g_signal_handlers_disconnect_by_func (priv->player, _status_changed_cb, toolbar); g_signal_handlers_disconnect_by_func (priv->player, _caps_changed_cb, toolbar); g_object_unref (priv->player); } priv->player = player; _update_caps (toolbar); _update_status (toolbar); }
static void ol_osd_toolbar_init (OlOsdToolbar *toolbar) { OlOsdToolbarPriv *priv = OL_OSD_TOOLBAR_GET_PRIVATE (toolbar); gtk_alignment_set (GTK_ALIGNMENT (toolbar), 0.5, 0.5, 0.0, 0.0); toolbar->center_box = GTK_HBOX (gtk_hbox_new (FALSE, 0)); gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (toolbar->center_box)); toolbar->prev_button = _add_button (toolbar, &btn_spec[BTN_PREV]); toolbar->play_button = _add_button (toolbar, &btn_spec[BTN_PLAY]); toolbar->pause_button = _add_button (toolbar, &btn_spec[BTN_PAUSE]); toolbar->stop_button = _add_button (toolbar, &btn_spec[BTN_STOP]); toolbar->next_button = _add_button (toolbar, &btn_spec[BTN_NEXT]); priv->player = NULL; _update_status (toolbar); _update_caps (toolbar); }
OlScrollModule* ol_scroll_module_new (struct OlDisplayModule *module, OlPlayer *player) { OlScrollModule *priv = g_new (OlScrollModule, 1); g_object_ref (player); priv->player = player; priv->scroll = NULL; priv->lrc = NULL; priv->metadata = ol_metadata_new (); priv->config_bindings = NULL; ol_scroll_module_init_scroll (priv); g_signal_connect (player, "track-changed", G_CALLBACK (_metadata_changed_cb), priv); _update_metadata (priv); g_signal_connect (player, "caps-changed", G_CALLBACK (_caps_changed_cb), priv); _update_caps (priv); return priv; }
static void _caps_changed_cb (OlPlayer *player, OlOsdToolbar *toolbar) { _update_caps (toolbar); }
static void _caps_changed_cb (OlPlayer *player, OlScrollModule *module) { _update_caps (module); }