Send commitlog mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r3262 - in
trunk/src/target/OM-2007.2/applications/openmoko-appearance: .
src ([EMAIL PROTECTED])
2. r3263 - in
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2: .
src ([EMAIL PROTECTED])
--- Begin Message ---
Author: thomas
Date: 2007-10-24 12:02:43 +0200 (Wed, 24 Oct 2007)
New Revision: 3262
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-appearance/ChangeLog
trunk/src/target/OM-2007.2/applications/openmoko-appearance/src/appearance-background.c
Log:
* src/appearance-background.c: Fix indentation to match existing project
style
Modified: trunk/src/target/OM-2007.2/applications/openmoko-appearance/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appearance/ChangeLog
2007-10-24 09:46:50 UTC (rev 3261)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appearance/ChangeLog
2007-10-24 10:02:43 UTC (rev 3262)
@@ -1,3 +1,8 @@
+2007-10-24 Thomas Wood <[EMAIL PROTECTED]>
+
+ * src/appearance-background.c: Fix indentation to match existing project
+ style
+
2007-10-22 Chris Lord <[EMAIL PROTECTED]>
* src/Makefile.am:
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-appearance/src/appearance-background.c
===================================================================
---
trunk/src/target/OM-2007.2/applications/openmoko-appearance/src/appearance-background.c
2007-10-24 09:46:50 UTC (rev 3261)
+++
trunk/src/target/OM-2007.2/applications/openmoko-appearance/src/appearance-background.c
2007-10-24 10:02:43 UTC (rev 3262)
@@ -26,182 +26,182 @@
static gboolean
unselect_file_idle (GtkFileChooser *chooser)
{
- gtk_file_chooser_unselect_all (chooser);
- return FALSE;
+ gtk_file_chooser_unselect_all (chooser);
+ return FALSE;
}
/* Following three functions taken from openmoko-today2 */
static void
wallpaper_notify (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, AppearanceData *data)
+ GConfEntry *entry, AppearanceData *data)
{
- gint width, height, pwidth, pheight;
- GdkPixbuf *pixbuf, *pixbuf_scaled;
- GConfValue *value;
- const gchar *path = NULL;
- gfloat scale;
+ gint width, height, pwidth, pheight;
+ GdkPixbuf *pixbuf, *pixbuf_scaled;
+ GConfValue *value;
+ const gchar *path = NULL;
+ gfloat scale;
- if (!GTK_WIDGET_REALIZED (data->bg_ebox))
- gtk_widget_realize (data->bg_ebox);
+ if (!GTK_WIDGET_REALIZED (data->bg_ebox))
+ gtk_widget_realize (data->bg_ebox);
- /* Return if the background is tiny, we'll get called again when it
- * resizes anyway.
- */
- width = data->bg_ebox->allocation.width;
- height = data->bg_ebox->allocation.height;
- if ((width <= 0) || (height <= 0)) return;
-
- value = gconf_entry_get_value (entry);
- if (value) path = gconf_value_get_string (value);
- if (!path || (!(pixbuf = gdk_pixbuf_new_from_file (path, NULL)))) {
- /* We need to do this in an idle, otherwise there's some weird
- * race condition where it won't work...
- */
- g_idle_add_full (G_PRIORITY_HIGH_IDLE, (GSourceFunc)
- unselect_file_idle, data->bg_chooser, NULL);
- if (data->wallpaper) {
- g_object_unref (data->wallpaper);
- data->wallpaper = NULL;
- gtk_widget_queue_draw (data->bg_ebox);
- }
- return;
- }
-
- /* Select the file in the background chooser, if it isn't already */
- gtk_file_chooser_set_filename (
- GTK_FILE_CHOOSER (data->bg_chooser), path);
+ /* Return if the background is tiny, we'll get called again when it
+ * resizes anyway.
+ */
+ width = data->bg_ebox->allocation.width;
+ height = data->bg_ebox->allocation.height;
+ if ((width <= 0) || (height <= 0)) return;
+
+ value = gconf_entry_get_value (entry);
+ if (value) path = gconf_value_get_string (value);
+ if (!path || (!(pixbuf = gdk_pixbuf_new_from_file (path, NULL)))) {
+ /* We need to do this in an idle, otherwise there's some weird
+ * race condition where it won't work...
+ */
+ g_idle_add_full (G_PRIORITY_HIGH_IDLE, (GSourceFunc)
+ unselect_file_idle, data->bg_chooser, NULL);
+ if (data->wallpaper) {
+ g_object_unref (data->wallpaper);
+ data->wallpaper = NULL;
+ gtk_widget_queue_draw (data->bg_ebox);
+ }
+ return;
+ }
+
+ /* Select the file in the background chooser, if it isn't already */
+ gtk_file_chooser_set_filename (
+ GTK_FILE_CHOOSER (data->bg_chooser), path);
- /* Create background pixmap */
- if (data->wallpaper) g_object_unref (data->wallpaper);
- data->wallpaper = gdk_pixmap_new (data->bg_ebox->window,
- width, height, -1);
-
- /* Scale and draw pixbuf */
- pwidth = gdk_pixbuf_get_width (pixbuf);
- pheight = gdk_pixbuf_get_height (pixbuf);
- if (((gfloat)pwidth / (gfloat)pheight) >
- ((gfloat)width / (gfloat)height))
- scale = (gfloat)height/(gfloat)pheight;
- else
- scale = (gfloat)width/(gfloat)pwidth;
- pwidth *= scale;
- pheight *= scale;
- pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, pwidth, pheight,
- GDK_INTERP_BILINEAR);
- if (pixbuf_scaled) {
- gdk_draw_pixbuf (data->wallpaper, NULL, pixbuf_scaled,
- 0, 0, 0, 0, -1, -1, GDK_RGB_DITHER_MAX, 0, 0);
- g_object_unref (pixbuf_scaled);
- }
- g_object_unref (pixbuf);
-
- /* Redraw */
- gtk_widget_queue_draw (data->bg_ebox);
+ /* Create background pixmap */
+ if (data->wallpaper) g_object_unref (data->wallpaper);
+ data->wallpaper = gdk_pixmap_new (data->bg_ebox->window,
+ width, height, -1);
+
+ /* Scale and draw pixbuf */
+ pwidth = gdk_pixbuf_get_width (pixbuf);
+ pheight = gdk_pixbuf_get_height (pixbuf);
+ if (((gfloat)pwidth / (gfloat)pheight) >
+ ((gfloat)width / (gfloat)height))
+ scale = (gfloat)height/(gfloat)pheight;
+ else
+ scale = (gfloat)width/(gfloat)pwidth;
+ pwidth *= scale;
+ pheight *= scale;
+ pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, pwidth, pheight,
+ GDK_INTERP_BILINEAR);
+ if (pixbuf_scaled) {
+ gdk_draw_pixbuf (data->wallpaper, NULL, pixbuf_scaled,
+ 0, 0, 0, 0, -1, -1, GDK_RGB_DITHER_MAX, 0, 0);
+ g_object_unref (pixbuf_scaled);
+ }
+ g_object_unref (pixbuf);
+
+ /* Redraw */
+ gtk_widget_queue_draw (data->bg_ebox);
}
static gboolean
bg_expose_cb (GtkWidget *widget, GdkEventExpose *event, AppearanceData *data)
{
- if (data->wallpaper)
- gdk_draw_drawable (widget->window, widget->style->black_gc,
- data->wallpaper, 0, 0, 0, 0, -1, -1);
-
- return FALSE;
+ if (data->wallpaper)
+ gdk_draw_drawable (widget->window, widget->style->black_gc,
+ data->wallpaper, 0, 0, 0, 0, -1, -1);
+
+ return FALSE;
}
static void
bg_size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation,
- AppearanceData *data)
+ AppearanceData *data)
{
- static gint width = 0, height = 0;
-
- /* Re-scale wallpaper */
- if ((width != allocation->width) || (height != allocation->height)) {
- width = allocation->width;
- height = allocation->height;
- gconf_client_notify (gconf_client_get_default (),
- GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_WALLPAPER);
- }
+ static gint width = 0, height = 0;
+
+ /* Re-scale wallpaper */
+ if ((width != allocation->width) || (height != allocation->height)) {
+ width = allocation->width;
+ height = allocation->height;
+ gconf_client_notify (gconf_client_get_default (),
+ GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_WALLPAPER);
+ }
}
static void
bg_response_cb (GtkDialog *dialog, gint response, AppearanceData *data)
{
- gchar *file;
-
- switch (response) {
- case GTK_RESPONSE_NO :
- gconf_client_unset (gconf_client_get_default (),
- GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_WALLPAPER,
- NULL);
- break;
- case GTK_RESPONSE_ACCEPT :
- file = gtk_file_chooser_get_filename (
- GTK_FILE_CHOOSER (data->bg_chooser));
- gconf_client_set_string (gconf_client_get_default (),
- GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_WALLPAPER,
- file, NULL);
- g_free (file);
- break;
- case GTK_RESPONSE_CANCEL :
- default :
- break;
- }
+ gchar *file;
+
+ switch (response) {
+ case GTK_RESPONSE_NO :
+ gconf_client_unset (gconf_client_get_default (),
+ GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_WALLPAPER,
+ NULL);
+ break;
+ case GTK_RESPONSE_ACCEPT :
+ file = gtk_file_chooser_get_filename (
+ GTK_FILE_CHOOSER (data->bg_chooser));
+ gconf_client_set_string (gconf_client_get_default (),
+ GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_WALLPAPER,
+ file, NULL);
+ g_free (file);
+ break;
+ case GTK_RESPONSE_CANCEL :
+ default :
+ break;
+ }
}
GtkWidget *
background_page_new (AppearanceData *data)
{
- GtkWidget *button, *align;
-
- /* Create an event box so we can draw a background for the page */
- data->bg_ebox = gtk_event_box_new ();
-
- /* Tell GTK we want to paint on this widget */
- gtk_widget_set_app_paintable (data->bg_ebox, TRUE);
-
- /* Connect to the 'expose' event to know when we should draw */
- g_signal_connect (data->bg_ebox, "expose-event",
- G_CALLBACK (bg_expose_cb), data);
-
- /* Connect to the 'size-allocate' event so we can resize the image to
- * fit the background.
- */
- g_signal_connect (data->bg_ebox, "size-allocate",
- G_CALLBACK (bg_size_allocate_cb), data);
-
- /* Create a file-chooser dialog */
- data->bg_chooser = gtk_file_chooser_dialog_new ("Choose an image",
- GTK_WINDOW (data->window), GTK_FILE_CHOOSER_ACTION_OPEN,
- "No image", GTK_RESPONSE_NO,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
-
- /* Connect to the 'response' signal for the file chooser */
- g_signal_connect (data->bg_chooser, "response",
- G_CALLBACK (bg_response_cb), data);
-
- /* Create a file-chooser button */
- button = gtk_file_chooser_button_new_with_dialog (data->bg_chooser);
-
- /* Create an alignment so we can squish the button to the bottom of
- * the page, with padding
- */
- align = gtk_alignment_new (0.5, 1, 1, 0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 12, 12, 12);
-
- /* Pack widgets into the page/each other and show them */
- gtk_container_add (GTK_CONTAINER (align), button);
- gtk_container_add (GTK_CONTAINER (data->bg_ebox), align);
- gtk_widget_show_all (data->bg_ebox);
-
- /* Connect to GConf signals */
- gconf_client_add_dir (gconf_client_get_default (),
- GCONF_POKY_INTERFACE_PREFIX, GCONF_CLIENT_PRELOAD_NONE, NULL);
- gconf_client_notify_add (gconf_client_get_default (),
- GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_WALLPAPER,
- (GConfClientNotifyFunc)wallpaper_notify,
- data, NULL, NULL);
+ GtkWidget *button, *align;
+
+ /* Create an event box so we can draw a background for the page */
+ data->bg_ebox = gtk_event_box_new ();
+
+ /* Tell GTK we want to paint on this widget */
+ gtk_widget_set_app_paintable (data->bg_ebox, TRUE);
+
+ /* Connect to the 'expose' event to know when we should draw */
+ g_signal_connect (data->bg_ebox, "expose-event",
+ G_CALLBACK (bg_expose_cb), data);
+
+ /* Connect to the 'size-allocate' event so we can resize the image to
+ * fit the background.
+ */
+ g_signal_connect (data->bg_ebox, "size-allocate",
+ G_CALLBACK (bg_size_allocate_cb), data);
+
+ /* Create a file-chooser dialog */
+ data->bg_chooser = gtk_file_chooser_dialog_new ("Choose an image",
+ GTK_WINDOW (data->window), GTK_FILE_CHOOSER_ACTION_OPEN,
+ "No image", GTK_RESPONSE_NO,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
+
+ /* Connect to the 'response' signal for the file chooser */
+ g_signal_connect (data->bg_chooser, "response",
+ G_CALLBACK (bg_response_cb), data);
+
+ /* Create a file-chooser button */
+ button = gtk_file_chooser_button_new_with_dialog (data->bg_chooser);
+
+ /* Create an alignment so we can squish the button to the bottom of
+ * the page, with padding
+ */
+ align = gtk_alignment_new (0.5, 1, 1, 0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 12, 12, 12);
+
+ /* Pack widgets into the page/each other and show them */
+ gtk_container_add (GTK_CONTAINER (align), button);
+ gtk_container_add (GTK_CONTAINER (data->bg_ebox), align);
+ gtk_widget_show_all (data->bg_ebox);
+
+ /* Connect to GConf signals */
+ gconf_client_add_dir (gconf_client_get_default (),
+ GCONF_POKY_INTERFACE_PREFIX, GCONF_CLIENT_PRELOAD_NONE, NULL);
+ gconf_client_notify_add (gconf_client_get_default (),
+ GCONF_POKY_INTERFACE_PREFIX GCONF_POKY_WALLPAPER,
+ (GConfClientNotifyFunc)wallpaper_notify,
+ data, NULL, NULL);
- return data->bg_ebox;
+ return data->bg_ebox;
}
--- End Message ---
--- Begin Message ---
Author: abraxa
Date: 2007-10-25 03:09:17 +0200 (Thu, 25 Oct 2007)
New Revision: 3263
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/openmoko-mediaplayer.schemas
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.c
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.h
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.h
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.c
Log:
Fix GConf schemas file
Add GConf support, part II
Correct some indenting where tabs were wrongfully used
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/openmoko-mediaplayer.schemas
===================================================================
---
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/openmoko-mediaplayer.schemas
2007-10-24 10:02:43 UTC (rev 3262)
+++
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/openmoko-mediaplayer.schemas
2007-10-25 01:09:17 UTC (rev 3263)
@@ -8,8 +8,8 @@
<type>bool</type>
<default>FALSE</default>
<locale name="C">
- <short>Shuffle on/off</short>
- <long>Play tracks in random order on/off</long>
+ <short>Shuffle</short>
+ <long>Play tracks in random order?</long>
</locale>
</schema>
@@ -32,7 +32,7 @@
<type>bool</type>
<default>TRUE</default>
<locale name="C">
- <short>Resume playback on startup on/off</short>
+ <short>Resume playback on startup?</short>
<long>Should the media player resume playback where it left off the
last time it ran?</long>
</locale>
</schema>
@@ -69,7 +69,7 @@
<default>TRUE</default>
<locale name="C">
<short>Should the cover art be shown or not?</short>
- <long><Should the cover art be shown or not?/long>
+ <long>Should the cover art be shown or not?</long>
</locale>
</schema>
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c
===================================================================
---
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c
2007-10-24 10:02:43 UTC (rev 3262)
+++
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c
2007-10-25 01:09:17 UTC (rev 3263)
@@ -84,7 +84,7 @@
GTimeVal start_time;
guint x_origin, y_origin;
guint last_x, last_y;
- gboolean cursor_idle; // TRUE
if cursor isn't moving
+ gboolean cursor_idle; // TRUE if cursor isn't moving
gint radius, angle;
omp_main_gesture gesture;
@@ -737,9 +737,13 @@
g_signal_connect(G_OBJECT(omp_window),
OMP_EVENT_PLAYBACK_VOLUME_CHANGED,
G_CALLBACK(omp_main_update_volume), NULL);
+ // Update UI with current configuration values
+ omp_main_update_shuffle_state(NULL, omp_config_get_shuffle_state(),
NULL);
+ omp_main_update_repeat_mode(NULL, omp_config_get_repeat_mode(), NULL);
+
// Set up gesture recognition handlers
gtk_widget_add_events(eventbox,
- GDK_POINTER_MOTION_MASK |
+ GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
main_gesture_data.pressed = FALSE;
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h
===================================================================
---
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h
2007-10-24 10:02:43 UTC (rev 3262)
+++
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h
2007-10-25 01:09:17 UTC (rev 3263)
@@ -42,7 +42,7 @@
typedef enum
{
OMP_MAIN_LABEL_HIDDEN,
- OMP_MAIN_LABEL_EMPTY, // Visible but empty -
only makes sense for label #1 as it affects UI layout
+ OMP_MAIN_LABEL_EMPTY, // Visible but empty - only makes sense for
label #1 as it affects UI layout
OMP_MAIN_LABEL_ARTIST,
OMP_MAIN_LABEL_TITLE,
OMP_MAIN_LABEL_ALBUM
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.c
===================================================================
---
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.c
2007-10-24 10:02:43 UTC (rev 3262)
+++
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.c
2007-10-25 01:09:17 UTC (rev 3263)
@@ -46,24 +46,24 @@
/// The literal de-fault configuration, will only be used if gconf is
unavailable or schema file wasn't installed
struct _omp_config omp_default_config =
{
- FALSE,
// shuffle
- OMP_REPEAT_OFF, //
repeat_mode
- TRUE,
// resume_playback
- 10000,
// prev_track_treshold
- TRUE,
// show_numbers_in_pl
- 500000,
// pulsesink_buffer_time
- 100000,
// pulsesink_latency_time
- TRUE,
// main_ui_show_cover
- OMP_MAIN_LABEL_HIDDEN, // main_ui_label1
- OMP_MAIN_LABEL_ARTIST, // main_ui_label2
- OMP_MAIN_LABEL_TITLE, // main_ui_label3
- 15,
// main_min_gesture_radius
- 750,
// main_gesture_repeat_tresh
- 1000,
// main_gesture_repeat_intv
+ FALSE, // shuffle
+ OMP_REPEAT_OFF, // repeat_mode
+ TRUE, // resume_playback
+ 10000, // prev_track_treshold
+ TRUE, // show_numbers_in_pl
+ 500000, // pulsesink_buffer_time
+ 100000, // pulsesink_latency_time
+ TRUE, // main_ui_show_cover
+ OMP_MAIN_LABEL_HIDDEN, // main_ui_label1
+ OMP_MAIN_LABEL_ARTIST, // main_ui_label2
+ OMP_MAIN_LABEL_TITLE, // main_ui_label3
+ 15, // min_gesture_radius
+ 750, // gesture_repeat_tresh
+ 1000, // gesture_repeat_intv
};
-struct _omp_config *omp_config = NULL; ///< Global and
persistent configuration data
-struct _omp_session *omp_session = NULL; ///< Global and
persistent session data
+struct _omp_config *omp_config = NULL; ///< Global and persistent
configuration data
+struct _omp_session *omp_session = NULL; ///< Global and persistent session
data
/// The GConf instance we'll use
GConfClient *omp_gconf_client;
@@ -71,6 +71,97 @@
/**
+ * Handler for GConf change notifications
+ */
+static void
+omp_config_gconf_notification(GConfClient *client, guint cnxn_id, GConfEntry
*entry, gpointer user_data)
+{
+ GConfValue *value;
+ gboolean v_bool;
+
+ value = gconf_entry_get_value(entry);
+
+ switch ((omp_config_options)user_data)
+ {
+ case OMP_CONFIG_SHUFFLE:
+ {
+ // Update value in config struct and submit new state
to the UI
+ omp_config->shuffle = gconf_value_get_bool(value);
+ g_signal_emit_by_name(G_OBJECT(omp_window),
OMP_EVENT_CONFIG_SHUFFLE_STATE_CHANGED, omp_config->shuffle);
+ break;
+ }
+
+ case OMP_CONFIG_REPEAT_MODE:
+ {
+ // Update value in config struct and submit new state
to the UI
+ omp_config->repeat_mode = gconf_value_get_int(value);
+ g_signal_emit_by_name(G_OBJECT(omp_window),
OMP_EVENT_CONFIG_REPEAT_MODE_CHANGED, omp_config->repeat_mode);
+ break;
+ }
+
+ case OMP_CONFIG_RESUME_PLAYBACK:
+ {
+ omp_config->resume_playback =
gconf_value_get_bool(value);
+ break;
+ }
+
+ case OMP_CONFIG_PREV_TRACK_TRESHOLD:
+ {
+ omp_config->prev_track_treshold =
gconf_value_get_int(value);
+ break;
+ }
+
+ case OMP_CONFIG_SHOW_NUMBERS_IN_PL:
+ {
+ omp_config->show_numbers_in_pl =
gconf_value_get_bool(value);
+ break;
+ }
+
+ case OMP_CONFIG_MAIN_UI_SHOW_COVER:
+ {
+ omp_config->main_ui_show_cover =
gconf_value_get_bool(value);
+ break;
+ }
+
+ case OMP_CONFIG_MAIN_UI_LABEL1:
+ {
+ omp_config->main_ui_label1 = gconf_value_get_int(value);
+ break;
+ }
+
+ case OMP_CONFIG_MAIN_UI_LABEL2:
+ {
+ omp_config->main_ui_label2 = gconf_value_get_int(value);
+ break;
+ }
+
+ case OMP_CONFIG_MAIN_UI_LABEL3:
+ {
+ omp_config->main_ui_label3 = gconf_value_get_int(value);
+ break;
+ }
+
+ case OMP_CONFIG_MIN_GESTURE_RADIUS:
+ {
+ omp_config->min_gesture_radius =
gconf_value_get_int(value);
+ break;
+ }
+
+ case OMP_CONFIG_GESTURE_REPEAT_TRESH:
+ {
+ omp_config->gesture_repeat_tresh =
gconf_value_get_int(value);
+ break;
+ }
+
+ case OMP_CONFIG_GESTURE_REPEAT_INTV:
+ {
+ omp_config->gesture_repeat_intv =
gconf_value_get_int(value);
+ break;
+ }
+ }
+}
+
+/**
* Initalize and load application configuration data
*/
void
@@ -98,53 +189,78 @@
G_TYPE_OBJECT, G_SIGNAL_RUN_FIRST, 0, 0, NULL,
g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
- // Fetch values from GConf
+ // Set up GConf, fetch default values and attach notification handler
omp_gconf_client = gconf_client_get_default();
- gconf_client_preload(omp_gconf_client, OMP_GCONF_PATH,
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ gconf_client_add_dir(omp_gconf_client, OMP_GCONF_PATH,
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
omp_config->shuffle =
gconf_client_get_bool(omp_gconf_client, OMP_GCONF_PATH
"/shuffle", &error);
if (error)
{
- g_printerr("GConf error: %s\nWill continue execution, though
program might behave abnormal.\n", error->message);
+ g_printerr("GConf error: %s\nWill continue execution, though
program will have limited functionality.\n", error->message);
g_error_free(error);
return;
}
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH "/shuffle",
+ (GConfClientNotifyFunc)omp_config_gconf_notification,
(gpointer)OMP_CONFIG_SHUFFLE, NULL, &error);
+
omp_config->repeat_mode =
gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH
"/repeat_mode", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH "/repeat_mode",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_REPEAT_MODE, NULL, NULL);
omp_config->resume_playback =
gconf_client_get_bool(omp_gconf_client, OMP_GCONF_PATH
"/resume_playback", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/resume_playback",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_RESUME_PLAYBACK, NULL, NULL);
omp_config->prev_track_treshold =
gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH
"/prev_track_treshold", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/prev_track_treshold",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_PREV_TRACK_TRESHOLD, NULL, NULL);
omp_config->show_numbers_in_pl =
gconf_client_get_bool(omp_gconf_client, OMP_GCONF_PATH
"/show_numbers_in_playlist", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/show_numbers_in_playlist",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_SHOW_NUMBERS_IN_PL, NULL, NULL);
omp_config->main_ui_show_cover =
gconf_client_get_bool(omp_gconf_client, OMP_GCONF_PATH
"/show_cover_art", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/show_cover_art",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_MAIN_UI_SHOW_COVER, NULL, NULL);
omp_config->main_ui_label1 =
gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH
"/main_label1_type", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/main_label1_type",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_MAIN_UI_LABEL1, NULL, NULL);
omp_config->main_ui_label2 =
gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH
"/main_label2_type", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/main_label2_type",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_MAIN_UI_LABEL2, NULL, NULL);
omp_config->main_ui_label3 =
gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH
"/main_label3_type", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/main_label3_type",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_MAIN_UI_LABEL3, NULL, NULL);
- omp_config->main_min_gesture_radius =
+ omp_config->min_gesture_radius =
gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH
"/min_gesture_radius", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/min_gesture_radius",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_MIN_GESTURE_RADIUS, NULL, NULL);
- omp_config->main_gesture_repeat_tresh =
+ omp_config->gesture_repeat_tresh =
gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH
"/gesture_repeat_tresh", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/gesture_repeat_tresh",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_GESTURE_REPEAT_TRESH, NULL, NULL);
- omp_config->main_gesture_repeat_intv =
+ omp_config->gesture_repeat_intv =
gconf_client_get_int(omp_gconf_client, OMP_GCONF_PATH
"/gesture_repeat_intv", NULL);
+ gconf_client_notify_add(omp_gconf_client, OMP_GCONF_PATH
"/gesture_repeat_intv",
+ omp_config_gconf_notification,
(gpointer)OMP_CONFIG_GESTURE_REPEAT_INTV, NULL, NULL);
}
/**
@@ -158,25 +274,13 @@
}
/**
- * Saves the current application configuration data to persistent storage
- */
-void
-omp_config_save()
-{
-}
-
-/**
* Sets state of shuffle flag
*/
void
omp_config_set_shuffle_state(gboolean state)
{
omp_config->shuffle = state;
- omp_config_save();
-
- // Submit new state to the UI
- g_signal_emit_by_name(G_OBJECT(omp_window),
OMP_EVENT_CONFIG_SHUFFLE_STATE_CHANGED,
- state);
+ gconf_client_set_bool(omp_gconf_client, OMP_GCONF_PATH "/shuffle",
state, NULL);
}
/**
@@ -195,11 +299,7 @@
omp_config_set_repeat_mode(guint mode)
{
omp_config->repeat_mode = mode;
- omp_config_save();
-
- // Submit new state to the UI
- g_signal_emit_by_name(G_OBJECT(omp_window),
OMP_EVENT_CONFIG_REPEAT_MODE_CHANGED,
- mode);
+ gconf_client_set_int(omp_gconf_client, OMP_GCONF_PATH "/repeat_mode",
mode, NULL);
}
/**
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.h
===================================================================
---
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.h
2007-10-24 10:02:43 UTC (rev 3262)
+++
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.h
2007-10-25 01:09:17 UTC (rev 3263)
@@ -57,33 +57,50 @@
/// @note Update that struct as well if you make changes here!
struct _omp_config
{
- gboolean shuffle;
///< Shuffle on/off
- guint repeat_mode;
///< Repeat mode @see omp_repeat_modes
- gboolean resume_playback; ///<
Resume playback on startup where it left off?
- guint prev_track_treshold; ///< Amount of
milliseconds a track must have been playing to jump back to track beginning on
"prev track" event
- gboolean show_numbers_in_pl; ///< Show numbers in
playlist?
- gulong pulsesink_buffer_time; ///< Value to set
pulsesink's buffer-time property to
- gulong pulsesink_latency_time; ///< Value to set pulsesink's
latency-time property to
- gboolean main_ui_show_cover; ///< Flag determining
whether cover is shown or not
- guint main_ui_label1;
///< Contents of main UI's label #1
- guint main_ui_label2;
///< Contents of main UI's label #2
- guint main_ui_label3;
///< Contents of main UI's label #3
- guint main_min_gesture_radius; ///< If a gesture stroke's
length is shorter than this the gesture is dismissed
- guint main_gesture_repeat_tresh; ///< If a gesture was made its
action will be repeated if the finger is still down after this time (msec)
- guint main_gesture_repeat_intv; ///< Gesture will be repeated
every X milliseconds
+ gboolean shuffle; ///< Shuffle on/off
+ guint repeat_mode; ///< Repeat mode @see omp_repeat_modes
+ gboolean resume_playback; ///< Resume playback on startup where
it left off?
+ guint prev_track_treshold; ///< Amount of milliseconds a track
must have been playing to jump back to track beginning on "prev track" event
+ gboolean show_numbers_in_pl; ///< Show numbers in playlist?
+ gulong pulsesink_buffer_time; ///< Value to set pulsesink's
buffer-time property to
+ gulong pulsesink_latency_time; ///< Value to set pulsesink's
latency-time property to
+ gboolean main_ui_show_cover; ///< Flag determining whether cover
is shown or not
+ guint main_ui_label1; ///< Contents of main UI's label #1
+ guint main_ui_label2; ///< Contents of main UI's label #2
+ guint main_ui_label3; ///< Contents of main UI's label #3
+ guint min_gesture_radius; ///< If a gesture stroke's length is
shorter than this the gesture is dismissed
+ guint gesture_repeat_tresh; ///< If a gesture was made its action
will be repeated if the finger is still down after this time (msec)
+ guint gesture_repeat_intv; ///< Gesture will be repeated every X
milliseconds
};
+/// Enumeration of all configuration options - we use it to distinguish fields
on GConf change notifications
+typedef enum
+{
+ OMP_CONFIG_SHUFFLE,
+ OMP_CONFIG_REPEAT_MODE,
+ OMP_CONFIG_RESUME_PLAYBACK,
+ OMP_CONFIG_PREV_TRACK_TRESHOLD,
+ OMP_CONFIG_SHOW_NUMBERS_IN_PL,
+ OMP_CONFIG_MAIN_UI_SHOW_COVER,
+ OMP_CONFIG_MAIN_UI_LABEL1,
+ OMP_CONFIG_MAIN_UI_LABEL2,
+ OMP_CONFIG_MAIN_UI_LABEL3,
+ OMP_CONFIG_MIN_GESTURE_RADIUS,
+ OMP_CONFIG_GESTURE_REPEAT_TRESH,
+ OMP_CONFIG_GESTURE_REPEAT_INTV
+} omp_config_options;
+
/// Session-persistent data
/// @note Default values are set in omp_session_reset()
struct _omp_session
{
- guint volume;
///< Playback volume in percent (0..100)
- guint fade_speed;
///< Volume fading speed in milliseconds
- guint playlist_position; ///<
Position within the playlist
- gulong track_position; ///<
Position to resume playback from within the last played track
- gboolean was_playing;
///< Set to TRUE of track was being played as the player was closed
- gchar file_chooser_path[256]; ///< Last path used in
the file selection dialog
- gchar playlist_file[256]; ///<
Path and file name of current (=last used) playlist
+ guint volume; ///< Playback volume in percent
(0..100)
+ guint fade_speed; ///< Volume fading speed in
milliseconds
+ guint playlist_position; ///< Position within the playlist
+ gulong track_position; ///< Position to resume playback from
within the last played track
+ gboolean was_playing; ///< Set to TRUE of track was being
played as the player was closed
+ gchar file_chooser_path[256]; ///< Last path used in the file
selection dialog
+ gchar playlist_file[256]; ///< Path and file name of current
(=last used) playlist
};
extern struct _omp_config *omp_config;
@@ -91,7 +108,6 @@
void omp_config_init();
void omp_config_free();
-void omp_config_save();
void omp_config_set_shuffle_state(gboolean state);
gboolean omp_config_get_shuffle_state();
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.h
===================================================================
---
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.h
2007-10-24 10:02:43 UTC (rev 3262)
+++
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.h
2007-10-25 01:09:17 UTC (rev 3263)
@@ -49,11 +49,11 @@
/// Modes available for repetitive track playback
enum omp_repeat_modes
{
- OMP_REPEAT_OFF = 0,
///< Repeat off
- OMP_REPEAT_ONCE,
///< Repeat current track once, then proceed with next track
- OMP_REPEAT_CURRENT,
///< Repeat current track forever
- OMP_REPEAT_ALL,
///< Repeat entire playlist
- OMP_REPEAT_COUNT
///< End-of-list marker for mode iteration
+ OMP_REPEAT_OFF = 0, ///< Repeat off
+ OMP_REPEAT_ONCE, ///< Repeat current track once, then proceed
with next track
+ OMP_REPEAT_CURRENT, ///< Repeat current track forever
+ OMP_REPEAT_ALL, ///< Repeat entire playlist
+ OMP_REPEAT_COUNT ///< End-of-list marker for mode iteration
};
extern omp_spiff_list *omp_playlist;
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.c
===================================================================
---
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.c
2007-10-24 10:02:43 UTC (rev 3262)
+++
trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.c
2007-10-25 01:09:17 UTC (rev 3263)
@@ -44,7 +44,7 @@
TYPE_COLUMN,
NAME_COLUMN,
ACT_DELETE_COLUMN,
- FILE_NAME_COLUMN, // This one isn't shown, it's for
internal storage only
+ FILE_NAME_COLUMN, // This one isn't shown, it's for internal storage
only
COLUMN_COUNT
};
--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog