changeset 893:ca9907354db6 trunk

[svn] - aosd: added an option to enable/disable utf8 text conversion done by the plugin
author giacomo
date Fri, 23 Mar 2007 06:46:04 -0700
parents d0b558bcf704
children f19e6748d8eb
files ChangeLog src/aosd/aosd_cfg.c src/aosd/aosd_cfg.h src/aosd/aosd_trigger.c src/aosd/aosd_ui.c
diffstat 5 files changed, 66 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 22 22:19:41 2007 -0700
+++ b/ChangeLog	Fri Mar 23 06:46:04 2007 -0700
@@ -1,3 +1,11 @@
+2007-03-23 05:19:41 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [1884]
+  - initial support for writing relative path.
+  
+  trunk/src/xspf/xspf.c |  204 +++++++++++++++++++++++++++++++++++++++++++++-----
+  1 file changed, 184 insertions(+), 20 deletions(-)
+
+
 2007-03-23 05:17:15 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [1882]
   justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
--- a/src/aosd/aosd_cfg.c	Thu Mar 22 22:19:41 2007 -0700
+++ b/src/aosd/aosd_cfg.c	Fri Mar 23 06:46:04 2007 -0700
@@ -70,7 +70,6 @@
   aosd_cfg_osd_t *cfg_osd = aosd_cfg_osd_new();
   cfg->set = FALSE;
   cfg->osd = cfg_osd;
-  cfg->osd->trigger.active = g_array_new( FALSE , TRUE , sizeof(gint) );
   return cfg;
 }
 
@@ -82,7 +81,6 @@
   {
     if ( cfg->osd != NULL )
       aosd_cfg_osd_delete( cfg->osd );
-    g_array_free( cfg->osd->trigger.active , TRUE );
     g_free( cfg );
   }
   return;
@@ -96,6 +94,7 @@
   cfg_osd->decoration.colors = g_array_sized_new( FALSE , TRUE , sizeof(aosd_color_t) ,
                                                   aosd_deco_style_get_max_numcol() );
   cfg_osd->decoration.skin_file = NULL; /* TODO paranoid, remove me when implemented */
+  cfg_osd->trigger.active = g_array_new( FALSE , TRUE , sizeof(gint) );
   return cfg_osd;
 }
 
@@ -118,6 +117,8 @@
     */
     if ( cfg_osd->decoration.colors != NULL )
       g_array_free( cfg_osd->decoration.colors , TRUE );
+    if ( cfg_osd->trigger.active != NULL )
+      g_array_free( cfg_osd->trigger.active , TRUE );
   }
   g_free( cfg_osd );
   return;
@@ -146,6 +147,7 @@
     cfg_osd_copy->text.fonts_draw_shadow[i] = cfg_osd->text.fonts_draw_shadow[i];
     cfg_osd_copy->text.fonts_shadow_color[i] = cfg_osd->text.fonts_shadow_color[i];
   }
+  cfg_osd_copy->text.utf8conv_disable = cfg_osd->text.utf8conv_disable;
   cfg_osd_copy->decoration.code = cfg_osd->decoration.code;
   cfg_osd_copy->decoration.skin_file = g_strdup( cfg_osd->decoration.skin_file );
   for ( i = 0 ; i < cfg_osd->decoration.colors->len ; i++ )
@@ -153,6 +155,11 @@
     aosd_color_t color = g_array_index( cfg_osd->decoration.colors , aosd_color_t , i );
     g_array_insert_val( cfg_osd_copy->decoration.colors , i , color );
   }
+  for ( i = 0 ; i < cfg_osd->trigger.active->len ; i++ )
+  {
+    gint trigger_id = g_array_index( cfg_osd->trigger.active , gint , i );
+    g_array_insert_val( cfg_osd_copy->trigger.active , i , trigger_id );
+  }
   return cfg_osd_copy;
 }
 
@@ -186,6 +193,7 @@
       cfg->osd->text.fonts_shadow_color[i].red, cfg->osd->text.fonts_shadow_color[i].green,
       cfg->osd->text.fonts_shadow_color[i].blue, cfg->osd->text.fonts_shadow_color[i].alpha);
   }
+  g_print("  disable utf8 conversion: %i\n", cfg->osd->text.utf8conv_disable);
   g_print("\nDECORATION\n");
   g_print("  code: %i\n", cfg->osd->decoration.code);
   /*g_print("  custom skin file: %s\n", cfg->osd->decoration.skin_file);*/
@@ -278,6 +286,10 @@
     g_free( color_str );
   }
 
+  if ( !bmp_cfg_db_get_bool( cfgfile , "aosd" ,
+       "text_utf8conv_disable" , &(cfg->osd->text.utf8conv_disable) ) )
+    cfg->osd->text.utf8conv_disable = FALSE;
+
   /* decoration */
   if ( !bmp_cfg_db_get_int( cfgfile , "aosd" ,
        "decoration_code" , &(cfg->osd->decoration.code) ) )
@@ -412,6 +424,9 @@
     g_free( color_str );
   }
 
+  bmp_cfg_db_set_bool( cfgfile , "aosd" ,
+    "text_utf8conv_disable" , cfg->osd->text.utf8conv_disable );
+
   /* decoration */
   bmp_cfg_db_set_int( cfgfile , "aosd" ,
     "decoration_code" , cfg->osd->decoration.code );
--- a/src/aosd/aosd_cfg.h	Thu Mar 22 22:19:41 2007 -0700
+++ b/src/aosd/aosd_cfg.h	Fri Mar 23 06:46:04 2007 -0700
@@ -68,6 +68,7 @@
   aosd_color_t fonts_color[AOSD_TEXT_FONTS_NUM];
   gboolean fonts_draw_shadow[AOSD_TEXT_FONTS_NUM];
   aosd_color_t fonts_shadow_color[AOSD_TEXT_FONTS_NUM];
+  gboolean utf8conv_disable;
 }
 aosd_cfg_osd_text_t;
 
@@ -94,7 +95,7 @@
 aosd_cfg_osd_position_t;
 
 
-/* config portion containing osd position information */
+/* config portion containing osd trigger information */
 typedef struct
 {
   GArray *active;
--- a/src/aosd/aosd_trigger.c	Thu Mar 22 22:19:41 2007 -0700
+++ b/src/aosd/aosd_trigger.c	Fri Mar 23 06:46:04 2007 -0700
@@ -132,6 +132,18 @@
 }
 
 
+/* HELPER FUNCTIONS */
+
+static gchar *
+aosd_trigger_utf8convert ( gchar * str )
+{
+  if ( global_config->osd->text.utf8conv_disable == FALSE )
+    return str_to_utf8( str );
+  else
+    return g_strdup( str );
+}
+
+
 /* TRIGGER FUNCTIONS */
 
 static void
@@ -163,7 +175,7 @@
       gint pos = playlist_get_position(active);
       title = playlist_get_songtitle(active, pos);
     }
-    gchar *utf8_title = str_to_utf8( title );
+    gchar *utf8_title = aosd_trigger_utf8convert( title );
     if ( g_utf8_validate( utf8_title , -1 , NULL ) == TRUE )
     {
       gchar *utf8_title_markup = g_markup_printf_escaped(
@@ -230,7 +242,7 @@
         if ( ( pl_entry->title != NULL ) && ( strcmp(pl_entry->title,prevs->title) ) )
         {
           /* string formatting is done here a.t.m. - TODO - improve this area */
-          gchar *utf8_title = str_to_utf8( pl_entry->title );
+          gchar *utf8_title = aosd_trigger_utf8convert( pl_entry->title );
           if ( g_utf8_validate( utf8_title , -1 , NULL ) == TRUE )
           {
             gchar *utf8_title_markup = g_markup_printf_escaped(
--- a/src/aosd/aosd_ui.c	Thu Mar 22 22:19:41 2007 -0700
+++ b/src/aosd/aosd_ui.c	Fri Mar 23 06:46:04 2007 -0700
@@ -364,6 +364,15 @@
 }
 
 
+static void
+aosd_cb_configure_text_inte_commit ( GtkWidget *utf8conv_togglebt , aosd_cfg_t * cfg )
+{
+  cfg->osd->text.utf8conv_disable = gtk_toggle_button_get_active(
+    GTK_TOGGLE_BUTTON(utf8conv_togglebt) );
+  return;
+}
+
+
 static GtkWidget *
 aosd_ui_configure_text ( aosd_cfg_t * cfg , GList ** cb_list )
 {
@@ -372,7 +381,7 @@
   GtkWidget *tex_font_label[3], *tex_font_fontbt[3];
   GtkWidget *tex_font_colorbt[3], *tex_font_shadow_togglebt[3];
   GtkWidget *tex_font_shadow_colorbt[3];
-  GtkWidget *other_vbox;
+  GtkWidget *tex_inte_frame, *tex_inte_table, *tex_inte_utf8conv_togglebt;
   gint i = 0;
 
   tex_vbox = gtk_vbox_new( FALSE , 4 );
@@ -438,6 +447,21 @@
   gtk_container_add( GTK_CONTAINER(tex_font_frame) , tex_font_table );
   gtk_box_pack_start( GTK_BOX(tex_vbox) , tex_font_frame , FALSE , FALSE , 0 );
 
+  tex_inte_frame = gtk_frame_new( _("Internationalization") );
+  tex_inte_table = gtk_table_new( 1 , 1 , FALSE );
+  gtk_container_set_border_width( GTK_CONTAINER(tex_inte_table) , 6 );
+  gtk_table_set_row_spacings( GTK_TABLE(tex_inte_table) , 4 );
+  gtk_table_set_col_spacings( GTK_TABLE(tex_inte_table) , 4 );
+  tex_inte_utf8conv_togglebt = gtk_check_button_new_with_label(
+    _("Disable UTF-8 conversion of text (in aosd)") );
+  gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(tex_inte_utf8conv_togglebt) ,
+    cfg->osd->text.utf8conv_disable );
+  gtk_table_attach( GTK_TABLE(tex_inte_table) , tex_inte_utf8conv_togglebt ,
+    0 , 1 , 0 , 1 , GTK_FILL , GTK_FILL , 0 , 0 );
+  aosd_callback_list_add( cb_list , tex_inte_utf8conv_togglebt , aosd_cb_configure_text_inte_commit );
+  gtk_container_add( GTK_CONTAINER(tex_inte_frame) , tex_inte_table );
+  gtk_box_pack_start( GTK_BOX(tex_vbox) , tex_inte_frame , FALSE , FALSE , 0 );
+
   return tex_vbox;
 }