⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hxstatus.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 2 页
字号:
            status->player_status_signal_handlers_array_len++;        }    }}static voidhxstatus_display_unrealize (GtkWidget* widget){    HXStatusDisplay* status = HX_STATUS_DISPLAY(widget);    if(status->player)    {        hxstatus_display_set_player(status, NULL);    }        GTK_WIDGET_CLASS(g_parent_class)->unrealize(widget);}static voidhxstatus_display_finalize(GObject* object){    HXStatusDisplay* status = HX_STATUS_DISPLAY(object);    g_return_if_fail(status != NULL);    if(status->title_override)    {        g_free(status->title_override);        status->title_override = NULL;    }    if(status->author_override)    {        g_free(status->author_override);        status->author_override = NULL;    }    if(status->copyright_override)    {        g_free(status->copyright_override);        status->copyright_override = NULL;    }    if(status->player_status_signal_handlers_array)    {        g_array_free(status->player_status_signal_handlers_array, TRUE);    }    status->player_status_signal_handlers_array_len = 0;    hxstatus_display_stop_timer(status);    G_OBJECT_CLASS(g_parent_class)->finalize(object);}static voidhxstatus_display_get_property(GObject         *object,                              guint            prop_id,                              GValue          *value,                              GParamSpec      *pspec){    HXStatusDisplay* status = HX_STATUS_DISPLAY(object);        switch(prop_id)    {        case PROP_TITLE_OVERRIDE:            g_value_set_string(value, status->title_override);            break;                    case PROP_AUTHOR_OVERRIDE:            g_value_set_string(value, status->author_override);            break;                    case PROP_COPYRIGHT_OVERRIDE:            g_value_set_string(value, status->copyright_override);            break;                    default:            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);            break;     }}static voidhxstatus_display_set_property(GObject         *object,                              guint            prop_id,                              const GValue    *value,                              GParamSpec      *pspec){    HXStatusDisplay* status = HX_STATUS_DISPLAY(object);    switch(prop_id)    {        case PROP_TITLE_OVERRIDE:            if(status->title_override)            {                g_free(status->title_override);            }               status->title_override = g_strdup(g_value_get_string(value));            break;                    case PROP_AUTHOR_OVERRIDE:            if(status->author_override)            {                g_free(status->author_override);            }               status->author_override = g_strdup(g_value_get_string(value));            break;                    case PROP_COPYRIGHT_OVERRIDE:            if(status->copyright_override)            {                g_free(status->copyright_override);            }               status->copyright_override = g_strdup(g_value_get_string(value));            break;                    default:            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);            break;     }    }voidhxstatus_display_start_timer(HXStatusDisplay* status){    g_return_if_fail(status->player != NULL);    g_return_if_fail(status->timer_function != NULL);        HXContentStateType state;    gboolean play_contact_buffer = FALSE;        state = hx_player_get_content_state(status->player);    play_contact_buffer = (state == HX_CONTENT_STATE_PLAYING ||                           state == HX_CONTENT_STATE_CONTACTING ||                           state == HX_CONTENT_STATE_BUFFERING);        if(!status->timer_is_running &&       GTK_WIDGET_VISIBLE(GTK_WIDGET(status)) &&       (play_contact_buffer ||        !status->timer_disable_while_not_playing)       )    {        g_assert(status->timer_id == 0);        status->timer_is_running = TRUE;        status->timer_id =            gtk_timeout_add(status->timer_interval,                            status->timer_function,                            status->timer_data);         }}voidhxstatus_display_stop_timer(HXStatusDisplay* status){    if(status->timer_is_running)    {        status->timer_is_running = FALSE;        gtk_timeout_remove(status->timer_id);        status->timer_id = 0;    }}voidhsd_destroy(HXStatusDisplay* status, HXPlayer* player){    hxstatus_display_set_player(status, NULL);}static voidhsd_play_buffer_contact(HXStatusDisplay* status){    if(status->timer_function)    {        hxstatus_display_start_timer(status);        if(status->timer_fire_on_state_changes)        {            /* Fire the timer once when we initially play */            (*status->timer_function) (status->timer_data);        }    }}static voidhsd_pause(HXStatusDisplay* status){    if(status->timer_function)    {        hxstatus_display_stop_timer(status);        if(status->timer_fire_on_state_changes)        {            /* Fire the timer once when we initially pause */            (*status->timer_function) (status->timer_data);        }    }}static voidhsd_stop(HXStatusDisplay* status){    if(status->timer_function)    {        hxstatus_display_stop_timer(status);        if(status->timer_fire_on_state_changes)        {            /* Fire the timer once when we initially stop */            (*status->timer_function) (status->timer_data);        }    }}static voidhsd_unmap(HXStatusDisplay* status){    if(status->timer_function)    {        /* Stop the update timer */        hxstatus_display_stop_timer(status);    }}static voidhsd_map(HXStatusDisplay* status){    if(status->timer_function)    {        /* Try to start the update timer */        hxstatus_display_start_timer(status);    }}voidhxstatus_display_set_timer(HXStatusDisplay* status,                           guint            interval,                           GtkFunction      function,                           gpointer         data,                           gboolean         disable_while_not_playing,                           gboolean         fire_on_state_changes){    if(status->timer_is_running)    {        /* We only support one update timer. Stop the current timer. */       hxstatus_display_stop_timer(status);    }    status->timer_interval = interval;    status->timer_function = function;    status->timer_disable_while_not_playing = disable_while_not_playing;    status->timer_fire_on_state_changes = fire_on_state_changes;    status->timer_data = data;        hxstatus_display_start_timer(status);}voidhxstatus_display_change_timer_interval(HXStatusDisplay* status,                                       guint            interval){        status->timer_interval = interval;        if(status->timer_is_running)    {        hxstatus_display_stop_timer(status);        hxstatus_display_start_timer(status);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -