diff --git a/gnome/src/config/accountconfigdialog.c b/gnome/src/config/accountconfigdialog.c index 450174f7a..cf891ea83 100644 --- a/gnome/src/config/accountconfigdialog.c +++ b/gnome/src/config/accountconfigdialog.c @@ -96,6 +96,7 @@ static GtkWidget *file_chooser; static GtkWidget *security_tab; static GtkWidget *advanced_tab; static GtkWidget *overrtp; +static GtkWidget *ringtone_seekslider; typedef struct OptionsData { account_t *account; @@ -1061,6 +1062,12 @@ static void ringtone_enabled_cb(G_GNUC_UNUSED GtkWidget *widget, gpointer data, gtk_widget_set_sensitive(data, !gtk_widget_is_sensitive(data)); } +void update_ringtone_slider(guint position, guint size) +{ + if (ringtone_seekslider) + sfl_seekslider_update_scale(SFL_SEEKSLIDER(ringtone_seekslider), position, size); +} + static void ringtone_changed_cb(GtkWidget *widget, gpointer data) { GtkFileChooser *chooser = GTK_FILE_CHOOSER(widget); @@ -1126,7 +1133,7 @@ create_audiocodecs_configuration(const account_t *account) gtk_widget_set_sensitive(file_chooser, ringtone_enabled); // button to preview ringtones - GtkWidget *ringtone_seekslider = GTK_WIDGET(sfl_seekslider_new()); + ringtone_seekslider = GTK_WIDGET(sfl_seekslider_new()); g_object_set(G_OBJECT(ringtone_seekslider), "file-path", ptr, NULL); g_signal_connect(G_OBJECT(file_chooser), "selection-changed", G_CALLBACK(ringtone_changed_cb), ringtone_seekslider); diff --git a/gnome/src/config/accountconfigdialog.h b/gnome/src/config/accountconfigdialog.h index 79dbced49..ff7ec1cac 100644 --- a/gnome/src/config/accountconfigdialog.h +++ b/gnome/src/config/accountconfigdialog.h @@ -53,4 +53,10 @@ show_account_window(account_t *a, SFLPhoneClient *client, gboolean is_new); */ void update_account_from_dialog(GtkWidget *dialog, account_t *a); +/* + * @param position The position of the slider + * @param size The size of the slider + */ +void update_ringtone_slider(guint position, guint size); + #endif diff --git a/gnome/src/dbus/dbus.c b/gnome/src/dbus/dbus.c index 61ac743e5..fb18177b2 100644 --- a/gnome/src/dbus/dbus.c +++ b/gnome/src/dbus/dbus.c @@ -50,6 +50,7 @@ #include "assistant.h" #include "accountlist.h" #include "accountlistconfigdialog.h" +#include "accountconfigdialog.h" #include "messaging/message_tab.h" #include "sflphone_client.h" @@ -415,7 +416,8 @@ static void update_playback_scale_cb(G_GNUC_UNUSED DBusGProxy *proxy, const gchar *file_path, guint position, guint size) { - main_window_update_playback_scale(file_path, position, size); + if (!main_window_update_playback_scale(file_path, position, size)) + update_ringtone_slider(position, size); } static void diff --git a/gnome/src/mainwindow.c b/gnome/src/mainwindow.c index 6982eb8c6..68d0a7555 100644 --- a/gnome/src/mainwindow.c +++ b/gnome/src/mainwindow.c @@ -546,11 +546,14 @@ main_window_confirm_go_clear(callable_obj_t * c, SFLPhoneClient *client) add_error_dialog(GTK_WIDGET(mini_dialog)); } -void +gboolean main_window_update_playback_scale(const gchar *file_path, guint current, guint size) { - if (sfl_seekslider_has_path(SFL_SEEKSLIDER(seekslider), file_path)) + if (sfl_seekslider_has_path(SFL_SEEKSLIDER(seekslider), file_path)) { sfl_seekslider_update_scale(SFL_SEEKSLIDER(seekslider), current, size); + return TRUE; + } + return FALSE; } void diff --git a/gnome/src/mainwindow.h b/gnome/src/mainwindow.h index 147ffbfa1..b183ca644 100644 --- a/gnome/src/mainwindow.h +++ b/gnome/src/mainwindow.h @@ -107,7 +107,7 @@ void focus_on_searchbar_in(); * if the size is 0 or if the current value is larger than the size, the cursor position * is moved at the end of the scale. */ -void main_window_update_playback_scale(const gchar *file_path, guint current, guint size); +gboolean main_window_update_playback_scale(const gchar *file_path, guint current, guint size); void main_window_set_playback_scale_sensitive(); diff --git a/gnome/src/seekslider.c b/gnome/src/seekslider.c index 7b387225d..b770f3719 100644 --- a/gnome/src/seekslider.c +++ b/gnome/src/seekslider.c @@ -208,6 +208,9 @@ sfl_seekslider_finalize(GObject *object) seekslider = SFL_SEEKSLIDER(object); g_return_if_fail(seekslider->priv != NULL); + /* Ensure that we've stopped playback */ + sfl_seekslider_stop_playback_record_cb(NULL, seekslider); + G_OBJECT_CLASS(sfl_seekslider_parent_class)->finalize(object); }