Changeset 3274


Ignore:
Timestamp:
10/25/07 20:24:42 (6 years ago)
Author:
abraxa
Message:

Substitute sqrt(a2+b2) by appromixation to speed up gesture recognition
Add GConf support, part III (mission complete)
Update GConf schema
Use omp prefix for global variables in main_page.c as well

Location:
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/TODO

    r3260 r3274  
    2525        Search alphabetically 
    2626        Jump to track 
     27        Sort music by BPM 
     28        Dynamic playlists: 
     29          fetching songs from last.fm 
     30          audioscrobbler recommendations 
  • trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/openmoko-mediaplayer.schemas

    r3263 r3274  
    3535        <short>Resume playback on startup?</short> 
    3636        <long>Should the media player resume playback where it left off the last time it ran?</long> 
     37      </locale> 
     38    </schema> 
     39 
     40    <schema> 
     41      <key>/schemas/apps/openmoko/mediaplayer/seek_distance</key> 
     42      <applyto>/apps/openmoko/mediaplayer/seek_distance</applyto> 
     43      <owner>openmoko-mediaplayer</owner> 
     44      <type>int</type> 
     45      <default>10000</default> 
     46      <locale name="C"> 
     47        <short>Determines how many milliseconds the engine will seek when FFWD/REW'ing</short> 
     48        <long>Determines how many milliseconds the engine will seek when FFWD/REW'ing</long> 
    3749      </locale> 
    3850    </schema> 
  • trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c

    r3263 r3274  
    2929#endif 
    3030 
     31#include <math.h> 
     32 
    3133#include <glib.h> 
    3234#include <glib/gprintf.h> 
     
    3537#include <gtk/gtk.h> 
    3638 
     39#include "guitools.h" 
    3740#include "main_page.h" 
    3841#include "main.h" 
    39 #include "guitools.h" 
    4042#include "playlist.h" 
    4143#include "playback.h" 
    4244#include "persistent.h" 
    4345 
    44  
    45  
    46 #include <math.h> 
     46// This is the amount the cursor must have moved in either direction to be considered moving 
     47// If we don't do this then it will constantly trigger gesture recognition due to jitter on the touchscreen 
     48#define OMP_MAIN_MIN_CURSOR_DELTA 3 
     49 
     50 
    4751 
    4852/// Contains all main window widgets that need to be changeable 
     
    6468        GtkWidget *shuffle_button_image; 
    6569        GtkWidget *repeat_button_image; 
    66 } main_widgets; 
     70} omp_main_widgets; 
    6771 
    6872GtkWidget *omp_main_window = NULL; 
     
    100104void omp_main_update_shuffle_state(gpointer instance, gboolean state, gpointer user_data); 
    101105void omp_main_update_repeat_mode(gpointer instance, guint mode, gpointer user_data); 
     106void omp_main_update_show_cover_art(gpointer instance, gboolean flag, gpointer user_data); 
    102107void omp_main_update_status_change(gpointer instance, gpointer user_data); 
    103108void omp_main_update_track_position(gpointer instance, gpointer user_data); 
    104109void omp_main_update_volume(gpointer instance, gpointer user_data); 
     110void omp_main_update_label_type(gpointer instance, guint new_type, gpointer user_data); 
    105111 
    106112 
     
    109115 * Self-explanatory :) 
    110116 */ 
    111 gint min(gint a, gint b) 
     117gint 
     118min(gint a, gint b) 
    112119{ 
    113120        return (a > b) ? b : a; 
     
    117124 * Self-explanatory :) 
    118125 */ 
    119 gint max(gint a, gint b) 
     126gint 
     127max(gint a, gint b) 
    120128{ 
    121129        return (a > b) ? a : b; 
     
    123131 
    124132/** 
     133 * Find length of vector a+ib using the alpha min + beta max approximation 
     134 * @param a X dimension of vector (real) 
     135 * @param b Y dimension of vector (imaginary) 
     136 * @return Length of vector a+ib 
     137 * @note We use this approximation because a) finger movement is never more precise than our approximation; 
     138 * @note b) we need speed and sqrt(a^2 + b^2) is too slow without an FPU while providing unnecessary precision 
     139 */ 
     140guint 
     141approx_radius(gint a, gint b) 
     142{ 
     143        guint a_abs, b_abs, a_max, b_min; 
     144 
     145        a_abs = abs(a); 
     146        b_abs = abs(b); 
     147 
     148        a_max = max(a_abs, b_abs); 
     149        b_min = min(a_abs, b_abs); 
     150 
     151        // Formula is |a+ib| = alpha*a_max + beta*b_min 
     152        // We use alpha=15/16 and beta=15/32 
     153 
     154        return ((a_max*15) >> 4) + ((b_min*15) >> 5); 
     155} 
     156 
     157/** 
    125158 * Event handler for the expand button 
    126159 */ 
     
    129162{ 
    130163        // Toggle visibility of extended controls 
    131         if (GTK_WIDGET_VISIBLE(main_widgets.extended_controls)) 
    132                 gtk_widget_hide(main_widgets.extended_controls); 
     164        if (GTK_WIDGET_VISIBLE(omp_main_widgets.extended_controls)) 
     165                gtk_widget_hide(omp_main_widgets.extended_controls); 
    133166        else 
    134                 gtk_widget_show(main_widgets.extended_controls); 
     167                gtk_widget_show(omp_main_widgets.extended_controls); 
    135168} 
    136169 
     
    141174omp_main_fast_forward_clicked(GtkWidget *widget, gpointer data) 
    142175{ 
    143         omp_playback_set_track_position(omp_playback_get_track_position()+BUTTON_SEEK_DISTANCE); 
     176        omp_playback_set_track_position(omp_playback_get_track_position()+omp_config_get_seek_distance()); 
    144177} 
    145178 
     
    150183omp_main_rewind_clicked(GtkWidget *widget, gpointer data) 
    151184{ 
    152         omp_playback_set_track_position(omp_playback_get_track_position()-BUTTON_SEEK_DISTANCE); 
     185        omp_playback_set_track_position(omp_playback_get_track_position()-omp_config_get_seek_distance()); 
    153186} 
    154187 
     
    160193{ 
    161194        if (omp_playback_get_state() != OMP_PLAYBACK_STATE_PLAYING) 
    162         { 
    163195                omp_playback_play(); 
    164  
    165         } else { 
    166  
     196        else 
    167197                omp_playback_pause(); 
    168         } 
    169198} 
    170199 
     
    189218        mode = omp_config_get_repeat_mode()+1; 
    190219 
    191         if (mode == OMP_REPEAT_COUNT) 
    192         { 
    193                 mode = 0; 
    194         } 
     220        if (mode >= OMP_REPEAT_COUNT) mode = 0; 
    195221 
    196222        omp_config_set_repeat_mode(mode); 
     
    214240omp_main_gesture_identify(guint x, guint y) 
    215241{ 
    216         #define MIN_RADIUS 15 
    217  
    218242        gint delta_x, delta_y, gamma; 
    219243 
     
    222246        delta_y = y - main_gesture_data.y_origin; 
    223247 
    224         main_gesture_data.radius = sqrt(delta_x * delta_x + delta_y * delta_y); 
     248        main_gesture_data.radius = approx_radius(delta_x, delta_y); 
    225249 
    226250        // angle = arccos(gamma) but arccos() is too slow to compute -> range comparison 
     
    228252        gamma = delta_x*1000 / main_gesture_data.radius; 
    229253 
    230         if (main_gesture_data.radius > MIN_RADIUS) 
     254        if (main_gesture_data.radius > omp_config_get_min_gesture_radius()) 
    231255        { 
    232256 
     
    312336omp_main_gesture_check_repeat() 
    313337{ 
    314         #define REPEAT_TIME_TRESHOLD_USEC 0750000 
    315         #define REPEAT_INTERVAL_MSEC 1000 
    316  
    317338        GTimeVal current_time, delta_t; 
    318339 
     
    324345                delta_t.tv_usec = current_time.tv_usec - main_gesture_data.start_time.tv_usec; 
    325346 
    326                 if (delta_t.tv_usec >= REPEAT_TIME_TRESHOLD_USEC) 
     347                if (delta_t.tv_usec >= omp_config_get_gesture_repeat_tresh()*1000) 
    327348                { 
    328349                        main_gesture_data.repeating = TRUE; 
    329                         g_timeout_add(REPEAT_INTERVAL_MSEC, omp_main_gesture_repeat_callback, NULL); 
     350                        g_timeout_add(omp_config_get_gesture_repeat_intv(), omp_main_gesture_repeat_callback, NULL); 
    330351                } 
    331352 
     
    339360omp_main_pointer_moved(GtkWidget *widget, GdkEventMotion *event, gpointer user_data) 
    340361{ 
    341         #define MAX_DELTA_LAST 3 
    342362        gint delta_last_x, delta_last_y; 
    343363 
     
    348368 
    349369                // Did the cursor move a substantial amount? 
    350                 if ( (delta_last_x > MAX_DELTA_LAST) && (delta_last_y > MAX_DELTA_LAST) ) 
     370                if ( (delta_last_x > OMP_MAIN_MIN_CURSOR_DELTA) && (delta_last_y > OMP_MAIN_MIN_CURSOR_DELTA) ) 
    351371                { 
    352372                        // Yes it did, so it's most likely being moved 
     
    421441        if (omp_config_get_main_ui_show_cover()) 
    422442        { 
    423                 gtk_image_set_from_stock(GTK_IMAGE(main_widgets.cover_image), "no_cover", -1); 
    424                 gtk_widget_queue_draw(main_widgets.cover_image);        // Re-draw the cover as it might have been used as video display before 
     443                gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.cover_image), "no_cover", -1); 
     444                gtk_widget_queue_draw(omp_main_widgets.cover_image);    // Re-draw the cover as it might have been used as video display before 
    425445        } 
    426446 
     
    431451        if (omp_config_get_main_ui_label2() != OMP_MAIN_LABEL_HIDDEN) 
    432452        { 
    433                 gtk_label_set_text(GTK_LABEL(main_widgets.label1), NULL); 
    434                 gtk_label_set_text(GTK_LABEL(main_widgets.label2), _("No track information")); 
    435                 gtk_label_set_text(GTK_LABEL(main_widgets.label3), NULL); 
     453                gtk_label_set_text(GTK_LABEL(omp_main_widgets.label1), NULL); 
     454                gtk_label_set_text(GTK_LABEL(omp_main_widgets.label2), _("No track information")); 
     455                gtk_label_set_text(GTK_LABEL(omp_main_widgets.label3), NULL); 
    436456 
    437457        } else { 
     
    439459                if (omp_config_get_main_ui_label1() != OMP_MAIN_LABEL_HIDDEN) 
    440460                { 
    441                         gtk_label_set_text(GTK_LABEL(main_widgets.label1), NULL); 
    442                         gtk_label_set_text(GTK_LABEL(main_widgets.label2), NULL); 
    443                         gtk_label_set_text(GTK_LABEL(main_widgets.label3), _("No track information")); 
     461                        gtk_label_set_text(GTK_LABEL(omp_main_widgets.label1), NULL); 
     462                        gtk_label_set_text(GTK_LABEL(omp_main_widgets.label2), NULL); 
     463                        gtk_label_set_text(GTK_LABEL(omp_main_widgets.label3), _("No track information")); 
    444464                } else { 
    445                         gtk_label_set_text(GTK_LABEL(main_widgets.label1), _("No track information")); 
    446                         gtk_label_set_text(GTK_LABEL(main_widgets.label2), NULL); 
    447                         gtk_label_set_text(GTK_LABEL(main_widgets.label3), NULL); 
     465                        gtk_label_set_text(GTK_LABEL(omp_main_widgets.label1), _("No track information")); 
     466                        gtk_label_set_text(GTK_LABEL(omp_main_widgets.label2), NULL); 
     467                        gtk_label_set_text(GTK_LABEL(omp_main_widgets.label3), NULL); 
    448468                } 
    449469 
     
    451471 
    452472        caption = g_strdup_printf(OMP_WIDGET_CAPTION_TRACK_NUM, 0, 0); 
    453         gtk_label_set_text(GTK_LABEL(main_widgets.track_number_label), caption); 
     473        gtk_label_set_text(GTK_LABEL(omp_main_widgets.track_number_label), caption); 
    454474        g_free(caption); 
    455475 
    456476        caption = g_strdup_printf(OMP_WIDGET_CAPTION_TRACK_TIME, 0, 0, 0, 0); 
    457         gtk_label_set_text(GTK_LABEL(main_widgets.time_label), caption); 
     477        gtk_label_set_text(GTK_LABEL(omp_main_widgets.time_label), caption); 
    458478        g_free(caption); 
    459479 
    460         gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(main_widgets.time_bar), 0); 
     480        gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(omp_main_widgets.time_bar), 0); 
    461481} 
    462482 
     
    480500 
    481501        // Pack the image into an eventbox (for video playback) and that into another frame to give it a black border 
    482         main_widgets.cover_eventbox = gtk_event_box_new(); 
    483  
    484         main_widgets.cover_image = gtk_image_new(); 
    485         gtk_widget_set_name(GTK_WIDGET(main_widgets.cover_image), "omp-main-top-cover"); 
    486         gtk_container_add(GTK_CONTAINER(main_widgets.cover_eventbox), main_widgets.cover_image); 
    487  
    488         main_widgets.cover_frame = widget_wrap(main_widgets.cover_eventbox, "omp-main-top-cover"); 
    489         gtk_frame_set_shadow_type(GTK_FRAME(main_widgets.cover_frame), GTK_SHADOW_IN); 
    490         gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(main_widgets.cover_frame), FALSE, FALSE, 0); 
     502        omp_main_widgets.cover_eventbox = gtk_event_box_new(); 
     503 
     504        omp_main_widgets.cover_image = gtk_image_new(); 
     505        gtk_widget_set_name(GTK_WIDGET(omp_main_widgets.cover_image), "omp-main-top-cover"); 
     506        gtk_container_add(GTK_CONTAINER(omp_main_widgets.cover_eventbox), omp_main_widgets.cover_image); 
     507 
     508        omp_main_widgets.cover_frame = widget_wrap(omp_main_widgets.cover_eventbox, "omp-main-top-cover"); 
     509        gtk_frame_set_shadow_type(GTK_FRAME(omp_main_widgets.cover_frame), GTK_SHADOW_IN); 
     510        gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(omp_main_widgets.cover_frame), FALSE, FALSE, 0); 
    491511 
    492512        // Add the placeholder that makes sure the vbox retains its height even when the cover image is hidden 
     513        // We do this so the background image is still present and can be used for the labels 
    493514        image = gtk_image_new(); 
    494515        gtk_widget_set_name(GTK_WIDGET(image), "omp-main-top-cover-placeholder"); 
     
    506527        gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0); 
    507528 
    508         main_widgets.label1 = gtk_label_new(NULL); 
    509         gtk_widget_set_name(GTK_WIDGET(main_widgets.label1), "omp-main-top-label1"); 
    510         gtk_label_set_ellipsize(GTK_LABEL(main_widgets.label1), PANGO_ELLIPSIZE_END); 
    511         gtk_misc_set_alignment(GTK_MISC(main_widgets.label1), 0, 0); 
    512         main_widgets.label1_frame = widget_wrap(main_widgets.label1, NULL); 
    513         gtk_box_pack_start(GTK_BOX(vbox), main_widgets.label1_frame, FALSE, FALSE, 0); 
    514  
    515         main_widgets.label2 = gtk_label_new(NULL); 
    516         gtk_widget_set_name(GTK_WIDGET(main_widgets.label2), "omp-main-top-label2"); 
    517         gtk_label_set_ellipsize(GTK_LABEL(main_widgets.label2), PANGO_ELLIPSIZE_END); 
    518         gtk_misc_set_alignment(GTK_MISC(main_widgets.label2), 0, 0); 
    519         label = widget_wrap(main_widgets.label2, NULL); 
     529        omp_main_widgets.label1 = gtk_label_new(NULL); 
     530        gtk_widget_set_name(GTK_WIDGET(omp_main_widgets.label1), "omp-main-top-label1"); 
     531        gtk_label_set_ellipsize(GTK_LABEL(omp_main_widgets.label1), PANGO_ELLIPSIZE_END); 
     532        gtk_misc_set_alignment(GTK_MISC(omp_main_widgets.label1), 0, 0); 
     533        omp_main_widgets.label1_frame = widget_wrap(omp_main_widgets.label1, NULL); 
     534        gtk_box_pack_start(GTK_BOX(vbox), omp_main_widgets.label1_frame, FALSE, FALSE, 0); 
     535 
     536        omp_main_widgets.label2 = gtk_label_new(NULL); 
     537        gtk_widget_set_name(GTK_WIDGET(omp_main_widgets.label2), "omp-main-top-label2"); 
     538        gtk_label_set_ellipsize(GTK_LABEL(omp_main_widgets.label2), PANGO_ELLIPSIZE_END); 
     539        gtk_misc_set_alignment(GTK_MISC(omp_main_widgets.label2), 0, 0); 
     540        label = widget_wrap(omp_main_widgets.label2, NULL); 
    520541        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); 
    521542 
     
    525546 
    526547        // Title label 
    527         main_widgets.label3 = gtk_label_new(NULL); 
    528         gtk_widget_set_name(GTK_WIDGET(main_widgets.label3), "omp-main-top-label3"); 
    529         gtk_label_set_ellipsize(GTK_LABEL(main_widgets.label3), PANGO_ELLIPSIZE_END); 
    530         label3 = widget_wrap(main_widgets.label3, NULL); 
     548        omp_main_widgets.label3 = gtk_label_new(NULL); 
     549        gtk_widget_set_name(GTK_WIDGET(omp_main_widgets.label3), "omp-main-top-label3"); 
     550        gtk_label_set_ellipsize(GTK_LABEL(omp_main_widgets.label3), PANGO_ELLIPSIZE_END); 
     551        label3 = widget_wrap(omp_main_widgets.label3, NULL); 
    531552        gtk_box_pack_start(GTK_BOX(parent), label3, FALSE, FALSE, 0); 
    532553 
     
    535556        gtk_widget_show_all(GTK_WIDGET(frame)); 
    536557 
    537         if (omp_config_get_main_ui_label1() == OMP_MAIN_LABEL_HIDDEN) gtk_widget_hide(main_widgets.label1_frame); 
    538         if (omp_config_get_main_ui_label2() == OMP_MAIN_LABEL_HIDDEN) gtk_widget_hide(main_widgets.label2); 
     558        if (omp_config_get_main_ui_label1() == OMP_MAIN_LABEL_HIDDEN) gtk_widget_hide(omp_main_widgets.label1_frame); 
     559        if (omp_config_get_main_ui_label2() == OMP_MAIN_LABEL_HIDDEN) gtk_widget_hide(omp_main_widgets.label2); 
    539560 
    540561        if (omp_config_get_main_ui_label3() != OMP_MAIN_LABEL_HIDDEN) gtk_widget_show_all(label3); 
    541562 
    542563        if (!omp_config_get_main_ui_show_cover()) 
    543                 gtk_widget_hide(main_widgets.cover_frame); 
     564                gtk_widget_hide(omp_main_widgets.cover_frame); 
    544565} 
    545566 
     
    566587 
    567588        // Playlist counter label 
    568         main_widgets.track_number_label = gtk_label_new(NULL); 
    569         gtk_widget_set_name(main_widgets.track_number_label, "omp-main-btm-info-bar"); 
    570         label = widget_wrap(main_widgets.track_number_label, NULL); 
     589        omp_main_widgets.track_number_label = gtk_label_new(NULL); 
     590        gtk_widget_set_name(omp_main_widgets.track_number_label, "omp-main-btm-info-bar"); 
     591        label = widget_wrap(omp_main_widgets.track_number_label, NULL); 
    571592        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); 
    572593 
    573594        // Track time label 
    574         main_widgets.time_label = gtk_label_new(NULL); 
    575         gtk_widget_set_name(main_widgets.time_label, "omp-main-btm-info-bar"); 
    576         label = widget_wrap(main_widgets.time_label, NULL); 
     595        omp_main_widgets.time_label = gtk_label_new(NULL); 
     596        gtk_widget_set_name(omp_main_widgets.time_label, "omp-main-btm-info-bar"); 
     597        label = widget_wrap(omp_main_widgets.time_label, NULL); 
    577598        gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 0); 
    578599 
     
    586607 
    587608        // Progress bar 
    588         main_widgets.time_bar = gtk_progress_bar_new(); 
    589         gtk_widget_set_name(main_widgets.time_bar, "omp-main-btm-progressbar"); 
    590         gtk_box_pack_start(GTK_BOX(main_vbox), main_widgets.time_bar, FALSE, FALSE, 0); 
     609        omp_main_widgets.time_bar = gtk_progress_bar_new(); 
     610        gtk_widget_set_name(omp_main_widgets.time_bar, "omp-main-btm-progressbar"); 
     611        gtk_box_pack_start(GTK_BOX(main_vbox), omp_main_widgets.time_bar, FALSE, FALSE, 0); 
    591612 
    592613 
     
    616637        // Play/pause button 
    617638        button = button_create_with_image("omp-main-btm-buttons", "play", 
    618                 &main_widgets.play_pause_button_image, 
     639                &omp_main_widgets.play_pause_button_image, 
    619640                G_CALLBACK(omp_main_play_pause_clicked)); 
    620641        button = widget_wrap(button, "omp-main-btm-button-padding-xy"); 
     
    629650 
    630651        // Volume indicator 
    631         main_widgets.volume_image = gtk_image_new(); 
    632         gtk_widget_set_name(main_widgets.volume_image, "omp-main-btm-volume"); 
    633         icon = widget_wrap(main_widgets.volume_image, NULL); 
     652        omp_main_widgets.volume_image = gtk_image_new(); 
     653        gtk_widget_set_name(omp_main_widgets.volume_image, "omp-main-btm-volume"); 
     654        icon = widget_wrap(omp_main_widgets.volume_image, NULL); 
    634655        gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0); 
    635656 
    636657 
    637658        // Button container - second row 
    638         main_widgets.extended_controls = gtk_event_box_new(); 
    639         gtk_widget_set_name(main_widgets.extended_controls, "omp-main-btm-button-box2"); 
    640         gtk_box_pack_start(GTK_BOX(main_vbox), main_widgets.extended_controls, FALSE, FALSE, 0); 
     659        omp_main_widgets.extended_controls = gtk_event_box_new(); 
     660        gtk_widget_set_name(omp_main_widgets.extended_controls, "omp-main-btm-button-box2"); 
     661        gtk_box_pack_start(GTK_BOX(main_vbox), omp_main_widgets.extended_controls, FALSE, FALSE, 0); 
    641662 
    642663        hbox = gtk_hbox_new(FALSE, 0); 
    643664        btn_box = widget_wrap(hbox, "omp-main-btm-button-box2"); 
    644         gtk_container_add(GTK_CONTAINER(main_widgets.extended_controls), btn_box); 
     665        gtk_container_add(GTK_CONTAINER(omp_main_widgets.extended_controls), btn_box); 
    645666 
    646667        // Expand button placeholder 
     
    653674        // Shuffle button 
    654675        button = button_create_with_image("omp-main-btm-buttons", "shuffle_off", 
    655                 &main_widgets.shuffle_button_image, 
     676                &omp_main_widgets.shuffle_button_image, 
    656677                G_CALLBACK(omp_main_shuffle_clicked)); 
    657678        button = widget_wrap(button, "omp-main-btm-button-padding-xy"); 
     
    660681        // Play/pause button 
    661682        button = button_create_with_image("omp-main-btm-buttons", "repeat_off", 
    662                 &main_widgets.repeat_button_image, 
     683                &omp_main_widgets.repeat_button_image, 
    663684                G_CALLBACK(omp_main_repeat_clicked)); 
    664685        button = widget_wrap(button, "omp-main-btm-button-padding-xy"); 
     
    682703        // Show all widgets except the extended controls 
    683704        gtk_widget_show_all(main_vbox); 
    684         gtk_widget_hide(main_widgets.extended_controls); 
     705        gtk_widget_hide(omp_main_widgets.extended_controls); 
    685706} 
    686707 
     
    724745        g_signal_connect(G_OBJECT(omp_window), OMP_EVENT_CONFIG_REPEAT_MODE_CHANGED, 
    725746                G_CALLBACK(omp_main_update_repeat_mode), NULL); 
     747 
     748        g_signal_connect(G_OBJECT(omp_window), OMP_EVENT_CONFIG_MAIN_UI_SHOW_COVER_CHANGED, 
     749                G_CALLBACK(omp_main_update_show_cover_art), NULL); 
     750 
     751        g_signal_connect(G_OBJECT(omp_window), OMP_EVENT_CONFIG_MAIN_LABEL1_TYPE_CHANGED, 
     752                G_CALLBACK(omp_main_update_label_type), (gpointer)1); 
     753 
     754        g_signal_connect(G_OBJECT(omp_window), OMP_EVENT_CONFIG_MAIN_LABEL2_TYPE_CHANGED, 
     755                G_CALLBACK(omp_main_update_label_type), (gpointer)2); 
     756 
     757        g_signal_connect(G_OBJECT(omp_window), OMP_EVENT_CONFIG_MAIN_LABEL3_TYPE_CHANGED, 
     758                G_CALLBACK(omp_main_update_label_type), (gpointer)3); 
    726759 
    727760        // Set up playback signal handlers 
     
    769802{ 
    770803        if (omp_config_get_main_ui_label1() == label_type) 
    771                 gtk_label_set_text(GTK_LABEL(main_widgets.label1), caption); 
     804                gtk_label_set_text(GTK_LABEL(omp_main_widgets.label1), caption); 
    772805 
    773806        if (omp_config_get_main_ui_label2() == label_type) 
    774                 gtk_label_set_text(GTK_LABEL(main_widgets.label2), caption); 
     807                gtk_label_set_text(GTK_LABEL(omp_main_widgets.label2), caption); 
    775808 
    776809        if (omp_config_get_main_ui_label3() == label_type) 
    777                 gtk_label_set_text(GTK_LABEL(main_widgets.label3), caption); 
     810                gtk_label_set_text(GTK_LABEL(omp_main_widgets.label3), caption); 
    778811} 
    779812 
     
    784817omp_main_get_video_window() 
    785818{ 
    786         if (GTK_WIDGET_NO_WINDOW(main_widgets.cover_eventbox)) 
     819        if (GTK_WIDGET_NO_WINDOW(omp_main_widgets.cover_eventbox)) 
    787820                g_error(_("Video display widget has no window!\n")); 
    788821 
    789         return GDK_WINDOW_XWINDOW(main_widgets.cover_eventbox->window); 
     822        return GDK_WINDOW_XWINDOW(omp_main_widgets.cover_eventbox->window); 
    790823} 
    791824 
     
    821854        if (omp_config_get_main_ui_show_cover()) 
    822855        { 
    823                 gtk_image_set_from_stock(GTK_IMAGE(main_widgets.cover_image), "no_cover", -1); 
    824                 gtk_widget_queue_draw(main_widgets.cover_image);        // Re-draw the default cover 
     856                gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.cover_image), "no_cover", -1); 
     857                gtk_widget_queue_draw(omp_main_widgets.cover_image);    // Re-draw the default cover 
    825858        } 
    826859 
    827860        // Set preliminary artist/title strings (updated on incoming metadata) 
    828         omp_playlist_get_track_info(omp_playlist_current_track_id, &artist, &title, &track_length); 
     861        omp_playlist_get_track_info(-1, &artist, &title, &track_length); 
    829862        omp_main_set_label(OMP_MAIN_LABEL_ARTIST, artist); 
    830863        omp_main_set_label(OMP_MAIN_LABEL_TITLE, title); 
     
    844877                track_id = (omp_playlist_track_count) ? omp_playlist_current_track_id+1 : 0; 
    845878                text = g_strdup_printf(OMP_WIDGET_CAPTION_TRACK_NUM, track_id, omp_playlist_track_count); 
    846                 gtk_label_set_text(GTK_LABEL(main_widgets.track_number_label), text); 
     879                gtk_label_set_text(GTK_LABEL(omp_main_widgets.track_number_label), text); 
    847880                g_free(text); 
    848881        } 
     
    858891                        (guint)(track_position / 60000), (guint)(track_position/1000) % 60, 
    859892                        (guint)(track_length / 60000), (guint)(track_length/1000) % 60); 
    860                 gtk_label_set_text(GTK_LABEL(main_widgets.time_label), text); 
     893 
     894                gtk_label_set_text(GTK_LABEL(omp_main_widgets.time_label), text); 
    861895                g_free(text); 
    862896 
    863                 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(main_widgets.time_bar), (gdouble)track_position/(gdouble)track_length); 
     897                gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(omp_main_widgets.time_bar), (gdouble)track_position/(gdouble)track_length); 
    864898        } 
    865899} 
     
    881915{ 
    882916        if (state) 
    883         { 
    884                 gtk_image_set_from_stock(GTK_IMAGE(main_widgets.shuffle_button_image), "shuffle_on", -1); 
    885         } else { 
    886                 gtk_image_set_from_stock(GTK_IMAGE(main_widgets.shuffle_button_image), "shuffle_off", -1); 
    887         } 
     917                gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.shuffle_button_image), "shuffle_on", -1); 
     918        else 
     919                gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.shuffle_button_image), "shuffle_off", -1); 
    888920} 
    889921 
     
    897929        { 
    898930                case OMP_REPEAT_OFF: 
    899                         gtk_image_set_from_stock(GTK_IMAGE(main_widgets.repeat_button_image), "repeat_off", -1); 
     931                        gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.repeat_button_image), "repeat_off", -1); 
    900932                        break; 
    901933 
    902934                case OMP_REPEAT_ONCE: 
    903                         gtk_image_set_from_stock(GTK_IMAGE(main_widgets.repeat_button_image), "repeat_once", -1); 
     935                        gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.repeat_button_image), "repeat_once", -1); 
    904936                        break; 
    905937 
    906938                case OMP_REPEAT_CURRENT: 
    907                         gtk_image_set_from_stock(GTK_IMAGE(main_widgets.repeat_button_image), "repeat_current", -1); 
     939                        gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.repeat_button_image), "repeat_current", -1); 
    908940                        break; 
    909941 
    910942                case OMP_REPEAT_ALL: 
    911                         gtk_image_set_from_stock(GTK_IMAGE(main_widgets.repeat_button_image), "repeat_all", -1); 
    912         } 
     943                        gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.repeat_button_image), "repeat_all", -1); 
     944        } 
     945} 
     946 
     947/** 
     948 * Updates the UI after the "show cover art" flag changed 
     949 */ 
     950void 
     951omp_main_update_show_cover_art(gpointer instance, gboolean flag, gpointer user_data) 
     952{ 
     953/*      if (flag) 
     954                gtk_widget_show(omp_main_widgets.cover_frame); 
     955        else 
     956                gtk_widget_hide(omp_main_widgets.cover_frame); */ 
    913957} 
    914958 
     
    922966        if (omp_playback_get_state() == OMP_PLAYBACK_STATE_PAUSED) 
    923967        { 
    924                 gtk_image_set_from_stock(GTK_IMAGE(main_widgets.play_pause_button_image), "play", -1); 
     968                gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.play_pause_button_image), "play", -1); 
    925969        } else { 
    926                 gtk_image_set_from_stock(GTK_IMAGE(main_widgets.play_pause_button_image), "pause", -1); 
     970                gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.play_pause_button_image), "pause", -1); 
    927971        } 
    928972} 
     
    951995                        (guint)(track_position / 60000), (guint)(track_position/1000) % 60, 
    952996                        (guint)(track_length / 60000), (guint)(track_length/1000) % 60); 
    953                 gtk_label_set_text(GTK_LABEL(main_widgets.time_label), text); 
     997 
     998                gtk_label_set_text(GTK_LABEL(omp_main_widgets.time_label), text); 
    954999                g_free(text); 
    9551000 
    956                 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(main_widgets.time_bar), (gdouble)track_position/(gdouble)track_length); 
     1001                gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(omp_main_widgets.time_bar), (gdouble)track_position/(gdouble)track_length); 
    9571002        } 
    9581003 
     
    9711016 
    9721017        image = g_strdup_printf("volume%02d", volume/10); 
    973         gtk_image_set_from_stock(GTK_IMAGE(main_widgets.volume_image), image, -1); 
     1018        gtk_image_set_from_stock(GTK_IMAGE(omp_main_widgets.volume_image), image, -1); 
    9741019        g_free(image); 
    9751020} 
     1021 
     1022/** 
     1023 * Updates the UI when the type of the first dynamic label changed 
     1024 * @param instance Unused 
     1025 * @param new_type The new type to set for the label 
     1026 * @param user_data Contains the number of the label to update (1..3) 
     1027 */ 
     1028void 
     1029omp_main_update_label_type(gpointer instance, guint new_type, gpointer user_data) 
     1030{ 
     1031        GtkWidget *label, *frame; 
     1032        gchar *artist = NULL; 
     1033        gchar *title = NULL; 
     1034 
     1035        g_return_if_fail( (user_data > 0) && (user_data < 4) ); 
     1036 
     1037        switch ((gint)user_data) 
     1038        { 
     1039                case 1: 
     1040                { 
     1041                        label = omp_main_widgets.label1; 
     1042                        frame = omp_main_widgets.label1_frame; 
     1043                        break; 
     1044                } 
     1045 
     1046                case 2: 
     1047                { 
     1048                        label = omp_main_widgets.label2; 
     1049                        frame = NULL;   // Can't be hidden 
     1050                        break; 
     1051                } 
     1052 
     1053                case 3: 
     1054                { 
     1055                        label = omp_main_widgets.label3; 
     1056                        frame = NULL;   // Can't be hidden 
     1057                        break; 
     1058                } 
     1059        } 
     1060 
     1061        // Fetch track information if needed 
     1062        if ( (new_type != OMP_MAIN_LABEL_HIDDEN) && (new_type != OMP_MAIN_LABEL_EMPTY) ) 
     1063         omp_playlist_get_track_info(-1, &artist, &title, NULL); 
     1064 
     1065        // Update label 
     1066        switch ((omp_main_label_type)new_type) 
     1067        { 
     1068                case OMP_MAIN_LABEL_HIDDEN: 
     1069                { 
     1070                        if (frame) gtk_widget_hide(frame); 
     1071                        break; 
     1072                } 
     1073 
     1074                case OMP_MAIN_LABEL_EMPTY: 
     1075                { 
     1076                        gtk_label_set_text(GTK_LABEL(label), NULL); 
     1077                        break; 
     1078                } 
     1079 
     1080                case OMP_MAIN_LABEL_ARTIST: 
     1081                { 
     1082                        gtk_label_set_text(GTK_LABEL(label), artist); 
     1083                        break; 
     1084                } 
     1085 
     1086                case OMP_MAIN_LABEL_TITLE: 
     1087                { 
     1088                        gtk_label_set_text(GTK_LABEL(label), title); 
     1089                        break; 
     1090                } 
     1091        } 
     1092 
     1093        if (artist) g_free(artist); 
     1094        if (title) g_free(title); 
     1095 
     1096        // Make sure label is visible - it might have been hidden previously 
     1097        if ( (frame) && (new_type != OMP_MAIN_LABEL_HIDDEN) ) 
     1098                gtk_widget_show(frame); 
     1099} 
     1100 
  • trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h

    r3263 r3274  
    3434#define OMP_WIDGET_CAPTION_VOLUME "%u%%" 
    3535 
    36 // Determines how many milliseconds the engine will seek if the FFWD/REW buttons are clicked 
    37 #define BUTTON_SEEK_DISTANCE 10000 
    38  
    3936 
    4037 
  • trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.c

    r3263 r3274  
    5050        OMP_REPEAT_OFF,             // repeat_mode 
    5151        TRUE,                       // resume_playback 
     52        10000,                      // seek_distance 
    5253        10000,                      // prev_track_treshold 
    5354        TRUE,                       // show_numbers_in_pl 
     
    6768 
    6869/// The GConf instance we'll use 
    69 GConfClient *omp_gconf_client; 
     70GConfClient *omp_gconf_client = NULL; 
    7071 
    7172 
     
    7879{ 
    7980        GConfValue *value; 
    80         gboolean v_bool; 
    8181 
    8282        value = gconf_entry_get_value(entry); 
     
    8686                case OMP_CONFIG_SHUFFLE: 
    8787                { 
    88                         // Update value in config struct and submit new state to the UI 
    8988                        omp_config->shuffle = gconf_value_get_bool(value); 
    9089                        g_signal_emit_by_name(G_OBJECT(omp_window), OMP_EVENT_CONFIG_SHUFFLE_STATE_CHANGED, omp_config->shuffle); 
     
    9493                case OMP_CONFIG_REPEAT_MODE: 
    9594                { 
    96                         // Update value in config struct and submit new state to the UI 
    9795                        omp_config->repeat_mode = gconf_value_get_int(value); 
    9896                        g_signal_emit_by_name(G_OBJECT(omp_window), OMP_EVENT_CONFIG_REPEAT_MODE_CHANGED, omp_config->repeat_mode); 
     
    103101                { 
    104102                        omp_config->resume_playback = gconf_value_get_bool(value); 
     103                        // No notification needed, value is used on demand 
     104                        break; 
     105                } 
     106 
     107                case OMP_CONFIG_SEEK_DISTANCE: 
     108                { 
     109                        omp_config->seek_distance = gconf_value_get_int(value); 
     110                        // No notification needed, value is used on demand 
    105111                        break; 
    106112                } 
     
    109115                { 
    110116                        omp_config->prev_track_treshold = gconf_value_get_int(value); 
     117                        // No notification needed, value is used on demand 
    111118                        break; 
    112119                } 
     
    115122                { 
    116123                        omp_config->show_numbers_in_pl = gconf_value_get_bool(value); 
     124                        g_signal_emit_by_name(G_OBJECT(omp_window), OMP_EVENT_CONFIG_SHOW_NUMBERS_IN_PL_CHANGED, omp_config->show_numbers_in_pl); 
    117125                        break; 
    118126                } 
     
    121129                { 
    122130                        omp_config->main_ui_show_cover = gconf_value_get_bool(value); 
     131                        g_signal_emit_by_name(G_OBJECT(omp_window), OMP_EVENT_CONFIG_MAIN_UI_SHOW_COVER_CHANGED, omp_config->main_ui_show_cover); 
    123132                        break; 
    124133                } 
     
    127136                { 
    128137                        omp_config->main_ui_label1 = gconf_value_get_int(value); 
     138                        g_signal_emit_by_name(G_OBJECT(omp_window), OMP_EVENT_CONFIG_MAIN_LABEL1_TYPE_CHANGED, omp_config->main_ui_label1); 
    129139                        break; 
    130140                } 
     
    133143                { 
    134144                        omp_config->main_ui_label2 = gconf_value_get_int(value); 
     145                        g_signal_emit_by_name(G_OBJECT(omp_window), OMP_EVENT_CONFIG_MAIN_LABEL2_TYPE_CHANGED, omp_config->main_ui_label2); 
    135146                        break; 
    136147                } 
     
    139150                { 
    140151                        omp_config->main_ui_label3 = gconf_value_get_int(value); 
     152                        g_signal_emit_by_name(G_OBJECT(omp_window), OMP_EVENT_CONFIG_MAIN_LABEL3_TYPE_CHANGED, omp_config->main_ui_label3); 
    141153                        break; 
    142154                } 
     
    145157                { 
    146158                        omp_config->min_gesture_radius = gconf_value_get_int(value); 
     159                        // No notification needed, value is used on demand 
    147160                        break; 
    148161                } 
     
    151164                { 
    152165                        omp_config->gesture_repeat_tresh = gconf_value_get_int(value); 
     166                        // No notification needed, value is used on demand 
    153167                        break; 
    154168                } 
     
    157171                { 
    158172                        omp_config->gesture_repeat_intv = gconf_value_get_int(value); 
     173                        // No notification needed, value is used on demand 
    159174                        break; 
    160175                } 
     
    190205                g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); 
    191206 
     207        g_signal_new(OMP_EVENT_CONFIG_MAIN_UI_SHOW_COVER_CHANGED, 
     208                G_TYPE_OBJECT, G_SIGNAL_RUN_FIRST, 0, 0, NULL, 
     209                g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); 
     210 
     211        g_signal_new(OMP_EVENT_CONFIG_SHOW_NUMBERS_IN_PL_CHANGED, 
     212                G_TYPE_OBJECT, G_SIGNAL_RUN_FIRST, 0, 0, NULL, 
     213                g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); 
     214 
     215        g_signal_new(OMP_EVENT_CONFIG_MAIN_LABEL1_TYPE_CHANGED, 
     216                G_TYPE_OBJECT, G_SIGNAL_RUN_FIRST, 0, 0, NULL, 
     217                g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); 
     218 
     219        g_signal_new(OMP_EVENT_CONFIG_MAIN_LABEL2_TYPE_CHANGED, 
     220                G_TYPE_OBJECT, G_SIGNAL_RUN_FIRST, 0, 0, NULL, 
     221                g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); 
     222 
     223        g_signal_new(OMP_EVENT_CONFIG_MAIN_LABEL3_TYPE_CHANGED, 
     224                G_TYPE_OBJECT, G_SIGNAL_RUN_FIRST, 0, 0, NULL, 
     225                g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); 
     226 
    192227        // Set up GConf, fetch default values and attach notification handler 
    193228        omp_gconf_client = gconf_client_get_default(); 
     
    219254 
    220255        omp_config->prev_track_treshold = 
     256                gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH "/seek_distance", NULL); 
     257        gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH "/seek_distance", 
     258                omp_config_gconf_notification, (gpointer)OMP_CONFIG_SEEK_DISTANCE, NULL, NULL); 
     259 
     260        omp_config->prev_track_treshold = 
    221261                gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH "/prev_track_treshold", NULL); 
    222262        gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH "/prev_track_treshold", 
     
    270310omp_config_free() 
    271311{ 
    272         g_object_unref(G_OBJECT(omp_gconf_client)); 
     312        if (omp_gconf_client) g_object_unref(G_OBJECT(omp_gconf_client)); 
    273313        g_free(omp_config); 
    274314} 
     
    313353 
    314354/** 
     355 * Returns amount of milliseconds the playback engine should seek on FFWD/REW'ing 
     356 */ 
     357guint 
     358omp_config_get_seek_distance() 
     359{ 
     360        return omp_config->seek_distance; 
     361} 
     362 
     363/** 
    315364 * Returns amount of milliseconds that determine behavior of the "prev track" event 
    316365 */ 
     
    373422{ 
    374423        return omp_config->main_ui_label3; 
     424} 
     425 
     426/** 
     427 * Returns the minimum length of a gesture stroke in order to consider it a valid gesture 
     428 */ 
     429guint 
     430omp_config_get_min_gesture_radius() 
     431{ 
     432        return omp_config->min_gesture_radius; 
     433} 
     434 
     435/** 
     436 * Returns the time after which a gesture's action will be repeated for as long as the finger is down 
     437 */ 
     438guint 
     439omp_config_get_gesture_repeat_tresh() 
     440{ 
     441        return omp_config->gesture_repeat_tresh; 
     442} 
     443 
     444/** 
     445 * Returns the interval at which a gesture's action will be repeated 
     446 */ 
     447guint 
     448omp_config_get_gesture_repeat_intv() 
     449{ 
     450        return omp_config->gesture_repeat_intv; 
    375451} 
    376452 
  • trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.h

    r3263 r3274  
    3131#include "main.h" 
    3232 
     33// Configuratin data notification events 
    3334#define OMP_EVENT_CONFIG_SHUFFLE_STATE_CHANGED "config_shuffle_state_changed" 
    3435#define OMP_EVENT_CONFIG_REPEAT_MODE_CHANGED "config_repeat_mode_changed" 
     36#define OMP_EVENT_CONFIG_SHOW_NUMBERS_IN_PL_CHANGED "config_show_numbers_in_pl_changed" 
     37#define OMP_EVENT_CONFIG_MAIN_UI_SHOW_COVER_CHANGED "config_main_show_cover_changed" 
     38#define OMP_EVENT_CONFIG_MAIN_LABEL1_TYPE_CHANGED "config_main_label1_type_changed" 
     39#define OMP_EVENT_CONFIG_MAIN_LABEL2_TYPE_CHANGED "config_main_label2_type_changed" 
     40#define OMP_EVENT_CONFIG_MAIN_LABEL3_TYPE_CHANGED "config_main_label3_type_changed" 
    3541 
     42// Session data notification events 
    3643#define OMP_EVENT_SESSION_FILE_CHOOSER_PATH_CHANGED "session_file_chooser_path_changed" 
    3744 
     
    6168        guint repeat_mode;                ///< Repeat mode @see omp_repeat_modes 
    6269        gboolean resume_playback;         ///< Resume playback on startup where it left off? 
     70        gint seek_distance;               ///< Determines how many milliseconds the engine will seek when FFWD/REW'ing 
    6371        guint prev_track_treshold;        ///< Amount of milliseconds a track must have been playing to jump back to track beginning on "prev track" event 
    6472        gboolean show_numbers_in_pl;      ///< Show numbers in playlist? 
     
    7078        guint main_ui_label3;             ///< Contents of main UI's label #3 
    7179        guint min_gesture_radius;         ///< If a gesture stroke's length is shorter than this the gesture is dismissed 
    72         guint gesture_repeat_tresh;       ///< If a gesture was made its action will be repeated if the finger is still down after this time (msec) 
     80        guint gesture_repeat_tresh;       ///< If a gesture was recognized its action will be repeated if the finger is still down after this time (msec) 
    7381        guint gesture_repeat_intv;        ///< Gesture will be repeated every X milliseconds 
    7482}; 
     
    8088        OMP_CONFIG_REPEAT_MODE, 
    8189        OMP_CONFIG_RESUME_PLAYBACK, 
     90        OMP_CONFIG_SEEK_DISTANCE, 
    8291        OMP_CONFIG_PREV_TRACK_TRESHOLD, 
    8392        OMP_CONFIG_SHOW_NUMBERS_IN_PL, 
     
    116125guint omp_config_get_repeat_mode(); 
    117126 
     127guint omp_config_get_seek_distance(); 
    118128guint omp_config_get_prev_track_treshold(); 
    119129gulong omp_config_get_pulsesink_buffer_time(); 
    120130gulong omp_config_get_pulsesink_latency_time(); 
     131 
    121132gboolean omp_config_get_main_ui_show_cover(); 
    122133guint omp_config_get_main_ui_label1(); 
    123134guint omp_config_get_main_ui_label2(); 
    124135guint omp_config_get_main_ui_label3(); 
     136 
     137guint omp_config_get_min_gesture_radius(); 
     138guint omp_config_get_gesture_repeat_tresh(); 
     139guint omp_config_get_gesture_repeat_intv(); 
    125140 
    126141void omp_session_init(); 
  • trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.c

    r3232 r3274  
    419419        if (volume > 100) 
    420420        { 
    421                 g_warning("Attempted to set invalid volume!"); 
     421                g_warning("Attempted to set invalid volume!\n"); 
    422422                volume = 100; 
    423423        } 
  • trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.c

    r2960 r3274  
    777777/** 
    778778 * Retrieves a track's meta data if possible 
    779  * @param track_id Track ID to get meta data of, starting at 0 
     779 * @param track_id Track ID to get meta data of, starting at 0; set to -1 to use current track 
    780780 * @param artist Destination for the artist string, can be NULL; must be freed after use 
    781781 * @param title Destination for the title string, can be NULL; must be freed after use 
     
    784784 */ 
    785785void 
    786 omp_playlist_get_track_info(guint track_id, gchar **artist, gchar **title, gulong *duration) 
    787 { 
    788         if (track_id == omp_playlist_current_track_id) 
     786omp_playlist_get_track_info(gint track_id, gchar **artist, gchar **title, gulong *duration) 
     787{ 
     788        if ( (track_id == omp_playlist_current_track_id) || (track_id == -1) ) 
    789789        { 
    790790                if (!omp_playlist_current_track) return; 
  • trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.h

    r3263 r3274  
    8484gchar *omp_playlist_resolve_track(omp_spiff_track *track); 
    8585gboolean omp_playlist_load_current_track(); 
    86 void omp_playlist_get_track_info(guint track_id, gchar **artist, gchar **title, gulong *duration); 
     86void omp_playlist_get_track_info(gint track_id, gchar **artist, gchar **title, gulong *duration); 
    8787void omp_playlist_update_track_count(); 
    8888 
Note: See TracChangeset for help on using the changeset viewer.