* #28047: gnome: update ringtone preview seek slider

Also guarantee that playback has stopped once we've destroyd the widget.
This commit is contained in:
Tristan Matthews
2013-08-08 11:51:20 -04:00
parent 9728bddc59
commit aeb3c19c89
6 changed files with 26 additions and 5 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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);
}