108
112
object_class->set_property = sfl_seekslider_set_property;
109
113
object_class->get_property = sfl_seekslider_get_property;
115
obj_properties[PROP_FILE_PATH] = g_param_spec_string("file-path", "File path",
116
"Set file path for playback", "" /* default value */, G_PARAM_READWRITE);
118
g_object_class_install_properties(object_class, N_PROPERTIES, obj_properties);
111
119
g_type_class_add_private(klass, sizeof(SFLSeekSliderPrivate));
199
208
seekslider = SFL_SEEKSLIDER(object);
200
209
g_return_if_fail(seekslider->priv != NULL);
211
/* Ensure that we've stopped playback */
212
sfl_seekslider_stop_playback_record_cb(NULL, seekslider);
202
214
G_OBJECT_CLASS(sfl_seekslider_parent_class)->finalize(object);
207
219
sfl_seekslider_set_property (GObject *object, guint prop_id, const GValue *value G_GNUC_UNUSED, GParamSpec *pspec)
209
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
221
SFLSeekSlider *self = SFL_SEEKSLIDER(object);
227
if (g_strcmp0(self->priv->file_path, g_value_get_string(value)) == 0)
230
/* cache is_playing as it will be modified */
231
const gboolean resume_playing = self->priv->is_playing;
233
sfl_seekslider_stop_playback_record_cb(NULL, self);
235
g_free(self->priv->file_path);
236
self->priv->file_path = g_value_dup_string(value);
237
g_debug("filepath: %s\n", self->priv->file_path);
240
sfl_seekslider_play_playback_record_cb(NULL, self);
244
/* We don't have any other property... */
245
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
213
251
sfl_seekslider_get_property (GObject *object, guint prop_id, GValue *value G_GNUC_UNUSED, GParamSpec *pspec)
215
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
253
SFLSeekSlider *self = SFL_SEEKSLIDER(object);
258
g_value_set_string(value, self->priv->file_path);
262
/* We don't have any other property... */
263
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
219
270
* sfl_seekslider_new:
220
271
* @shell_player: the #RBShellPlayer instance
299
350
static void sfl_seekslider_play_playback_record_cb (GtkButton *button G_GNUC_UNUSED, gpointer user_data)
301
SFLSeekSlider *seekslider = SFL_SEEKSLIDER(user_data);
352
SFLSeekSlider *self = SFL_SEEKSLIDER(user_data);
303
callable_obj_t *selectedCall = calltab_get_selected_call(history_tab);
304
if (selectedCall == NULL)
354
if (self->priv->file_path == NULL || (*self->priv->file_path == 0))
307
g_debug("Start selected call file playback %s", selectedCall->_recordfile);
308
seekslider->priv->is_playing = selectedCall->_record_is_playing =
309
dbus_start_recorded_file_playback(selectedCall->_recordfile);
357
g_debug("Start file playback %s", self->priv->file_path);
358
self->priv->is_playing = dbus_start_recorded_file_playback(self->priv->file_path);
311
if (seekslider->priv->is_playing)
312
sfl_seekslider_set_display(seekslider, SFL_SEEKSLIDER_DISPLAY_PAUSE);
360
if (self->priv->is_playing)
361
sfl_seekslider_set_display(self, SFL_SEEKSLIDER_DISPLAY_PAUSE);
315
static void sfl_seekslider_stop_playback_record_cb (GtkButton *button G_GNUC_UNUSED, gpointer user_data)
364
static void sfl_seekslider_stop_playback_record_cb(GtkButton *button G_GNUC_UNUSED, gpointer user_data)
317
SFLSeekSlider *seekslider = SFL_SEEKSLIDER(user_data);
319
callable_obj_t *selectedCall = calltab_get_selected_call(history_tab);
320
if (selectedCall == NULL)
323
if (selectedCall->_recordfile == NULL ||
324
strlen(selectedCall->_recordfile) == 0)
327
dbus_stop_recorded_file_playback(selectedCall->_recordfile);
328
g_debug("Stop selected call file playback %s", selectedCall->_recordfile);
329
seekslider->priv->is_playing = selectedCall->_record_is_playing = FALSE;
331
sfl_seekslider_set_display(seekslider, SFL_SEEKSLIDER_DISPLAY_PLAY);
366
SFLSeekSlider *self = SFL_SEEKSLIDER(user_data);
368
if (self->priv->file_path == NULL || (*self->priv->file_path == 0))
371
if (self->priv->is_playing) {
372
dbus_stop_recorded_file_playback(self->priv->file_path);
373
g_debug("Stop file playback %s", self->priv->file_path);
374
self->priv->is_playing = FALSE;
377
sfl_seekslider_set_display(self, SFL_SEEKSLIDER_DISPLAY_PLAY);
334
380
void sfl_seekslider_update_timelabel(SFLSeekSlider *seekslider, guint current, guint size)
408
456
seekslider->priv->can_update_scale = FALSE;
409
457
gtk_range_set_value(GTK_RANGE(seekslider->priv->hscale), 0.0);
410
458
sfl_seekslider_set_display(seekslider, SFL_SEEKSLIDER_DISPLAY_PLAY);
411
sfl_seekslider_stop_playback_record_cb(NULL, seekslider);
459
if (seekslider->priv->is_playing)
460
sfl_seekslider_stop_playback_record_cb(NULL, seekslider);
412
461
gtk_label_set_text(GTK_LABEL(seekslider->priv->timeLabel), "");
413
462
seekslider->priv->current = 0;
414
463
seekslider->priv->size = 0;
415
464
seekslider->priv->is_playing = FALSE;
416
465
seekslider->priv->can_update_scale = TRUE;
469
sfl_seekslider_has_path(SFLSeekSlider *seekslider, const gchar *file_path)
471
return g_strcmp0(seekslider->priv->file_path, file_path) == 0;