[Goodies-commits] r7850 - in parole/trunk: . data/interfaces parole po

Ali Abdallah aliov at xfce.org
Mon Jul 27 18:06:37 CEST 2009


Author: aliov
Date: 2009-07-27 16:06:36 +0000 (Mon, 27 Jul 2009)
New Revision: 7850

Added:
   parole/trunk/parole/parole-subtitle-encoding.c
   parole/trunk/parole/parole-subtitle-encoding.h
Modified:
   parole/trunk/ChangeLog
   parole/trunk/TODO
   parole/trunk/data/interfaces/mediachooser.ui
   parole/trunk/data/interfaces/parole-settings.ui
   parole/trunk/data/interfaces/parole.ui
   parole/trunk/parole/Makefile.am
   parole/trunk/parole/parole-conf-dialog.c
   parole/trunk/parole/parole-conf.c
   parole/trunk/parole/parole-gst.c
   parole/trunk/parole/parole-plugins-manager.c
   parole/trunk/po/POTFILES.in
   parole/trunk/po/parole-media-player.pot
Log:
	* Don't show notebook tabs if we have one page.
	* Added subtitle font encoding support, encodings code taken from
	gnome-terminal
	* Fix changing state to play when user select another
	visualization plugin.
	* data/interfaces/mediachooser.ui Remove empty box.
	* Update TODO and pot file.

Modified: parole/trunk/ChangeLog
===================================================================
--- parole/trunk/ChangeLog	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/ChangeLog	2009-07-27 16:06:36 UTC (rev 7850)
@@ -1,3 +1,12 @@
+2009-07-27: 18:00 Ali aliov at xfce.org
+	* Don't show notebook tabs if we have one page.
+	* Added subtitle font encoding support, encodings code taken from
+	gnome-terminal
+	* Fix changing state to play when user select another
+	visualization plugin.
+	* data/interfaces/mediachooser.ui Remove empty box.
+	* Update TODO and pot file.
+
 2009-07-27: 15:36 Ali aliov at xfce.org
 	* Added system tray icon plugin, with optional notification
 	support.

Modified: parole/trunk/TODO
===================================================================
--- parole/trunk/TODO	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/TODO	2009-07-27 16:06:36 UTC (rev 7850)
@@ -2,11 +2,11 @@
 * Better statusbar information.
 * Complete the settings dialog.
 * Complete the shortcut keys.
-* Encoding support for subtitles.
 * Better support for cdda.
+* Move to next chapter in movie.
+* Brightness and contrast support.
 * Probably something like totem-fullscreen?
 * Support some playlist title entity.
-* Move to next chapter in movie.
 * ...
 
 === Plugins === 

Modified: parole/trunk/data/interfaces/mediachooser.ui
===================================================================
--- parole/trunk/data/interfaces/mediachooser.ui	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/data/interfaces/mediachooser.ui	2009-07-27 16:06:36 UTC (rev 7850)
@@ -7,9 +7,6 @@
     <property name="orientation">vertical</property>
     <property name="spacing">10</property>
     <child>
-      <placeholder/>
-    </child>
-    <child>
       <object class="GtkFileChooserWidget" id="filechooserwidget">
         <property name="visible">True</property>
         <property name="border_width">5</property>
@@ -18,7 +15,7 @@
         <signal name="current_folder_changed" handler="media_chooser_folder_changed_cb"/>
       </object>
       <packing>
-        <property name="position">1</property>
+        <property name="position">0</property>
       </packing>
     </child>
     <child>
@@ -59,7 +56,7 @@
       </object>
       <packing>
         <property name="expand">False</property>
-        <property name="position">2</property>
+        <property name="position">1</property>
       </packing>
     </child>
   </object>

Modified: parole/trunk/data/interfaces/parole-settings.ui
===================================================================
--- parole/trunk/data/interfaces/parole-settings.ui	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/data/interfaces/parole-settings.ui	2009-07-27 16:06:36 UTC (rev 7850)
@@ -5,8 +5,11 @@
   <!-- interface-naming-policy project-wide -->
   <object class="XfceTitledDialog" id="settings-dialog">
     <property name="border_width">5</property>
+    <property name="title" translatable="yes">Parole Settings</property>
+    <property name="icon_name">parole</property>
     <property name="type_hint">normal</property>
     <property name="has_separator">False</property>
+    <property name="subtitle" translatable="yes">Media Player Settings</property>
     <signal name="response" handler="parole_conf_dialog_response_cb"/>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox1">
@@ -17,6 +20,7 @@
           <object class="GtkVBox" id="vbox1">
             <property name="visible">True</property>
             <property name="orientation">vertical</property>
+            <property name="spacing">10</property>
             <child>
               <object class="GtkFrame" id="frame1">
                 <property name="visible">True</property>
@@ -30,7 +34,7 @@
                       <object class="GtkVBox" id="vbox2">
                         <property name="visible">True</property>
                         <property name="orientation">vertical</property>
-                        <property name="spacing">2</property>
+                        <property name="spacing">5</property>
                         <child>
                           <object class="GtkCheckButton" id="enable-vis">
                             <property name="label" translatable="yes">Enable visualization when playing audio file</property>
@@ -107,7 +111,59 @@
                     <property name="visible">True</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <placeholder/>
+                      <object class="GtkTable" id="table1">
+                        <property name="visible">True</property>
+                        <property name="n_rows">2</property>
+                        <property name="n_columns">2</property>
+                        <property name="column_spacing">5</property>
+                        <property name="row_spacing">5</property>
+                        <child>
+                          <object class="GtkLabel" id="label7">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Brightness:</property>
+                          </object>
+                          <packing>
+                            <property name="x_options"></property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label8">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Contrast:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options"></property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHScale" id="brightness">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="draw_value">False</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHScale" id="contrast">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="draw_value">False</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                          </packing>
+                        </child>
+                      </object>
                     </child>
                   </object>
                 </child>
@@ -136,6 +192,7 @@
                       <object class="GtkVBox" id="vbox3">
                         <property name="visible">True</property>
                         <property name="orientation">vertical</property>
+                        <property name="spacing">5</property>
                         <child>
                           <object class="GtkCheckButton" id="enable-subtitle">
                             <property name="label" translatable="yes">Automatically load subtitle when playing movie file</property>
@@ -196,8 +253,9 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkComboBox" id="encoding-combo">
+                              <object class="GtkComboBox" id="encoding">
                                 <property name="visible">True</property>
+                                <signal name="changed" handler="parole_conf_dialog_subtitle_encoding_changed_cb"/>
                               </object>
                               <packing>
                                 <property name="position">1</property>
@@ -234,7 +292,7 @@
             <property name="visible">True</property>
             <child>
               <object class="GtkButton" id="help">
-                <property name="label" translatable="no">gtk-help</property>
+                <property name="label">gtk-help</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -248,7 +306,7 @@
             </child>
             <child>
               <object class="GtkButton" id="close">
-                <property name="label" translatable="no">gtk-close</property>
+                <property name="label">gtk-close</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>

Modified: parole/trunk/data/interfaces/parole.ui
===================================================================
--- parole/trunk/data/interfaces/parole.ui	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/data/interfaces/parole.ui	2009-07-27 16:06:36 UTC (rev 7850)
@@ -376,32 +376,10 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkVBox" id="albums-box">
-                    <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <object class="GtkLabel" id="label5">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">Nothing yet.</property>
-                      </object>
-                      <packing>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
+                  <placeholder/>
                 </child>
                 <child type="tab">
-                  <object class="GtkLabel" id="album">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">Albums</property>
-                  </object>
-                  <packing>
-                    <property name="position">1</property>
-                    <property name="tab_fill">False</property>
-                  </packing>
+                  <placeholder/>
                 </child>
                 <child>
                   <placeholder/>

Modified: parole/trunk/parole/Makefile.am
===================================================================
--- parole/trunk/parole/Makefile.am	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/parole/Makefile.am	2009-07-27 16:06:36 UTC (rev 7850)
@@ -75,7 +75,8 @@
 	parole-module.h				\
 	parole-pl-parser.h			\
 	parole-about.h				\
-	parole-builder.h
+	parole-builder.h			\
+	parole-subtitle-encoding.h
 
 libparole_headers =				\
 	$(INST_HFILES)
@@ -112,7 +113,8 @@
 	parole-module.c				\
 	parole-pl-parser.c			\
 	parole-about.c				\
-	parole-builder.c
+	parole-builder.c			\
+	parole-subtitle-encoding.c
 
 libparole_la_LDFLAGS =				\
 	$(PAROLE_LDFLAGS)

Modified: parole/trunk/parole/parole-conf-dialog.c
===================================================================
--- parole/trunk/parole/parole-conf-dialog.c	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/parole/parole-conf-dialog.c	2009-07-27 16:06:36 UTC (rev 7850)
@@ -32,6 +32,7 @@
 #include "parole-conf-dialog.h"
 #include "parole-conf.h"
 #include "parole-vis.h"
+#include "parole-subtitle-encoding.h"
 
 /*
  * GtkBuilder Callbacks
@@ -52,7 +53,9 @@
 
 void		parole_conf_dialog_enable_subtitle_changed_cb 	(GtkToggleButton *widget,
 							         ParoleConfDialog *self);
-							       
+	
+void		parole_conf_dialog_subtitle_encoding_changed_cb (GtkComboBox *widget,
+								 ParoleConfDialog *self);
 /*
  * End of GtkBuilder callbacks
  */
@@ -70,6 +73,7 @@
     GtkWidget  *toggle_vis;
     GtkWidget  *toggle_subtitle;
     GtkWidget  *font_button;
+    GtkWidget  *encoding;
 };
 
 G_DEFINE_TYPE (ParoleConfDialog, parole_conf_dialog, G_TYPE_OBJECT)
@@ -93,6 +97,13 @@
     }
 }
 
+void parole_conf_dialog_subtitle_encoding_changed_cb (GtkComboBox *widget, ParoleConfDialog *self)
+{
+    g_object_set (G_OBJECT (self->priv->conf), 
+		  "subtitle-encoding", parole_subtitle_encoding_get_selected (widget),
+		  NULL);
+}
+
 void parole_conf_dialog_enable_vis_changed_cb (GtkToggleButton *widget, ParoleConfDialog *self)
 {
     gboolean active;
@@ -226,11 +237,13 @@
     gboolean vis_enabled;
     gboolean subtitle;
     gchar *subtitle_font;
+    gchar *subtitle_encoding;
     
     g_object_get (G_OBJECT (self->priv->conf),
 		  "vis-enabled", &vis_enabled,
 		  "enable-subtitle", &subtitle,
 		  "subtitle-font", &subtitle_font,
+		  "subtitle-encoding", &subtitle_encoding,
 		  NULL);
 
     gtk_widget_set_sensitive (self->priv->vis_combox, vis_enabled);
@@ -245,8 +258,12 @@
 			    (GtkTreeModelForeachFunc) parole_conf_dialog_set_default_vis_plugin,
 			    self);
 			    
+    parole_subtitle_encoding_set (GTK_COMBO_BOX (self->priv->encoding), subtitle_encoding);
+    
     gtk_font_button_set_font_name (GTK_FONT_BUTTON (self->priv->font_button), subtitle_font);
+    
     g_free (subtitle_font);
+    g_free (subtitle_encoding);
 }
 
 ParoleConfDialog *
@@ -271,7 +288,10 @@
     self->priv->toggle_vis = GTK_WIDGET (gtk_builder_get_object (builder, "enable-vis"));
     self->priv->toggle_subtitle = GTK_WIDGET (gtk_builder_get_object (builder, "enable-subtitle"));
     self->priv->font_button = GTK_WIDGET (gtk_builder_get_object (builder, "fontbutton"));
+    self->priv->encoding = GTK_WIDGET (gtk_builder_get_object (builder, "encoding"));
     
+    parole_subtitle_encoding_init (GTK_COMBO_BOX (self->priv->encoding));
+    
     g_hash_table_foreach (self->priv->vis_plugins, (GHFunc) parole_conf_dialog_add_vis_plugins, combox);
     
     gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));

Modified: parole/trunk/parole/parole-conf.c
===================================================================
--- parole/trunk/parole/parole-conf.c	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/parole/parole-conf.c	2009-07-27 16:06:36 UTC (rev 7850)
@@ -40,6 +40,7 @@
     gboolean 	 enable_vis;
     gboolean	 enable_subtitle;
     gchar	*subtitle_font;
+    gchar       *subtitle_encoding;
 };
 
 static gpointer parole_conf_object = NULL;
@@ -53,6 +54,7 @@
     PROP_VIS_NAME,
     PROP_SUBTITLE_ENABLED,
     PROP_SUBTITLE_FONT,
+    PROP_SUBTITLE_ENCODING
 };
 
 static void parole_conf_set_property (GObject *object,
@@ -70,10 +72,17 @@
 	    g_object_notify (G_OBJECT (conf), "vis-enabled");
 	    parole_rc_write_entry_bool ("VIS_ENABLED", PAROLE_RC_GROUP_GENERAL, conf->priv->enable_vis);
 	    break;
+	case PROP_SUBTITLE_ENCODING:
+	    if ( conf->priv->subtitle_encoding )
+		g_free (conf->priv->subtitle_encoding);
+	    conf->priv->subtitle_encoding = g_value_dup_string (value);
+	    g_object_notify (G_OBJECT (conf), "subtitle-encoding");
+	    parole_rc_write_entry_string ("SUBTITLE_ENCODING", PAROLE_RC_GROUP_GENERAL, conf->priv->subtitle_encoding);
+	    break;
 	case PROP_VIS_NAME:
 	    if ( conf->priv->vis_sink )
 		g_free (conf->priv->vis_sink);
-	    conf->priv->vis_sink = g_strdup (g_value_get_string (value));
+	    conf->priv->vis_sink = g_value_dup_string (value);
 	    g_object_notify (G_OBJECT (conf), "vis-name");
 	    parole_rc_write_entry_string ("VIS_NAME", PAROLE_RC_GROUP_GENERAL, conf->priv->vis_sink);
 	    break;
@@ -85,7 +94,7 @@
 	case PROP_SUBTITLE_FONT:
 	    if ( conf->priv->subtitle_font )
 		g_free (conf->priv->subtitle_font);
-	    conf->priv->subtitle_font = g_strdup (g_value_get_string (value));
+	    conf->priv->subtitle_font = g_value_dup_string (value);
 	    g_object_notify (G_OBJECT (conf), "subtitle-font");
 	    parole_rc_write_entry_string ("SUBTITLE_FONT", PAROLE_RC_GROUP_GENERAL, conf->priv->subtitle_font);
 	    break;
@@ -105,6 +114,9 @@
 
     switch (prop_id)
     {
+	case PROP_SUBTITLE_ENCODING:
+	    g_value_set_string (value, conf->priv->subtitle_encoding);
+	    break;
 	case PROP_VIS_ENABLED:
 	    g_value_set_boolean (value, conf->priv->enable_vis);
 	    break;
@@ -161,6 +173,13 @@
                                                            G_PARAM_READWRITE));
 
     g_object_class_install_property (object_class,
+                                     PROP_SUBTITLE_ENCODING,
+                                     g_param_spec_string  ("subtitle-encoding",
+                                                           NULL, NULL,
+                                                           NULL,
+                                                           G_PARAM_READWRITE));
+
+    g_object_class_install_property (object_class,
                                      PROP_SUBTITLE_ENABLED,
                                      g_param_spec_boolean ("enable-subtitle",
                                                            NULL, NULL,
@@ -186,6 +205,7 @@
     conf->priv->vis_sink   = g_strdup (parole_rc_read_entry_string ("VIS_NAME", PAROLE_RC_GROUP_GENERAL, "none"));
     conf->priv->enable_subtitle = parole_rc_read_entry_bool ("ENABLE_SUBTITLE", PAROLE_RC_GROUP_GENERAL, TRUE);
     conf->priv->subtitle_font = g_strdup (parole_rc_read_entry_string ("SUBTITLE_FONT", PAROLE_RC_GROUP_GENERAL, "Sans 12"));
+    conf->priv->subtitle_encoding = g_strdup (parole_rc_read_entry_string ("SUBTITLE_ENCODING", PAROLE_RC_GROUP_GENERAL, "UTF8"));
 }
 
 ParoleConf *

Modified: parole/trunk/parole/parole-gst.c
===================================================================
--- parole/trunk/parole/parole-gst.c	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/parole/parole-gst.c	2009-07-27 16:06:36 UTC (rev 7850)
@@ -424,9 +424,17 @@
 static void
 parole_gst_set_subtitle_encoding (ParoleGst *gst)
 {
+    gchar *encoding;
+    
+    g_object_get (G_OBJECT (gst->priv->conf),
+		  "subtitle-encoding", &encoding,
+		  NULL);
+    
     g_object_set (G_OBJECT (gst->priv->playbin), 
-                  "subtitle-encoding", "UTF-8",
+                  "subtitle-encoding", encoding,
 		  NULL);
+		  
+    g_free (encoding);
 }
 
 static void
@@ -516,6 +524,7 @@
 {
     gchar *vis_name;
     
+    TRACE ("start");
     g_object_get (G_OBJECT (gst->priv->conf),
 		  "vis-enabled", &gst->priv->with_vis,
 		  "vis-name", &vis_name,
@@ -540,6 +549,7 @@
 
     gst->priv->update = FALSE;
     g_free (vis_name);
+    TRACE ("end");
 }
 
 static void
@@ -551,15 +561,9 @@
 
     parole_gst_tick (gst);
 
-    if ( gst->priv->update && new == GST_STATE_NULL)
-	parole_gst_update_vis (gst);
-    
     if ( gst->priv->target == new )
 	parole_gst_set_window_cursor (GTK_WIDGET (gst)->window, NULL);
 
-    if ( gst->priv->target == GST_STATE_PLAYING && pending >= GST_STATE_READY)
-	parole_gst_set_x_overlay (gst);
-    
     switch (gst->priv->state)
     {
 	case GST_STATE_PLAYING:
@@ -576,6 +580,12 @@
 			   gst->priv->stream, PAROLE_MEDIA_STATE_PAUSED);
 	    break;
 	case GST_STATE_READY:
+	    if ( gst->priv->update)
+		parole_gst_update_vis (gst);
+		
+	    if ( gst->priv->target == GST_STATE_PLAYING)
+		parole_gst_set_x_overlay (gst);
+	
 	    gst->priv->media_state = PAROLE_MEDIA_STATE_STOPPED;
 	    g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0, 
 			   gst->priv->stream, PAROLE_MEDIA_STATE_STOPPED);
@@ -956,12 +966,23 @@
 static void
 parole_gst_conf_notify_cb (GObject *object, GParamSpec *spec, ParoleGst *gst)
 {
-    if ( !g_strcmp0 ("vis-enabled", spec->name) || !g_strcmp0 ("vis-name", spec->name))
+    TRACE ("spec->name=%s\n", spec->name);
+    
+    if ( !g_strcmp0 ("vis-enabled", spec->name) || !g_strcmp0 ("vis-name", spec->name) )
     {
 	gst->priv->update = TRUE;
     }
-    else if ( !g_strcmp0 ("subtitle-font", spec->name ) && gst->priv->state >= GST_STATE_PAUSED )
+    else if ( !g_strcmp0 ("subtitle-font", spec->name) || !g_strcmp0 ("enable-subtitle", spec->name)  )
+    {
 	parole_gst_set_subtitle_font (gst);
+    }
+    else if (!g_strcmp0 ("subtitle-encoding", spec->name) )
+    {
+	parole_gst_set_subtitle_encoding (gst);
+    }
+    
+    
+
 }
 
 static void
@@ -1099,8 +1120,6 @@
     
     if ( gst->priv->state < GST_STATE_PAUSED )
 	parole_gst_play_file_internal (gst);
-    else if ( gst->priv->update )
-	parole_gst_change_state (gst, GST_STATE_NULL);
     else 
 	parole_gst_change_state (gst, GST_STATE_READY);
 }

Modified: parole/trunk/parole/parole-plugins-manager.c
===================================================================
--- parole/trunk/parole/parole-plugins-manager.c	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/parole/parole-plugins-manager.c	2009-07-27 16:06:36 UTC (rev 7850)
@@ -315,62 +315,27 @@
     gtk_tree_path_free (path);
 }
 
-void 
-parole_plugins_manager_load_plugins (ParolePluginsManager *manager)
+static void
+parole_plugins_manager_set_show_tabs (GtkNotebook *nt)
 {
-    ParoleModule *module;
-    GDir *dir;
-    const gchar *name;
-    gchar *path;
-    GError *error = NULL;
-    gchar **plugins_rc;
-    guint len = 0, i = 0;
-    
-    plugins_rc = parole_rc_read_entry_list ("plugins", PAROLE_RC_GROUP_PLUGINS);
-    
-    if ( plugins_rc && plugins_rc[0] )
-	len = g_strv_length (plugins_rc);
-    
-    dir = g_dir_open (PAROLE_PLUGINS_DIR, 0, &error);
-    
-    if ( error )
-    {
-	g_critical ("Error opening plugins dir: %s", error->message);
-	g_error_free (error);
-	return;
-    }
-    
-    while ( (name = g_dir_read_name (dir) ))
-    {
-	if ( g_str_has_suffix (name, "." G_MODULE_SUFFIX) )
-	{
-	    path = g_build_filename (PAROLE_PLUGINS_DIR, name, NULL);
-	    TRACE ("loading module with path %s", path);
-	    
-	    module = parole_module_new (path);
+    gint npages;
+    npages = gtk_notebook_get_n_pages (nt);
+    gtk_notebook_set_show_tabs (nt, npages > 1);
+}
 
-	    if ( g_type_module_use (G_TYPE_MODULE (module)) )
-	    {
-		g_ptr_array_add (manager->priv->array, module);
-		
-		for ( i = 0; i < len; i++)
-		{
-		    if ( !g_strcmp0 (plugins_rc[i], path) )
-		    {
-			parole_module_set_active (module, TRUE);
-			break;
-		    }
-		}
-	    }
-	    else
-		g_object_unref (module);
-	    g_free (path);
-	}
-    }
-    g_dir_close (dir);
+static void
+parole_plugins_manager_page_added_cb (GtkContainer *container, GtkWidget *widget, gpointer data)
+{
+    parole_plugins_manager_set_show_tabs (GTK_NOTEBOOK (container));
 }
 
 static void
+parole_plugins_manager_page_removed_cb (GtkContainer *container, GtkWidget *widget, gpointer data)
+{
+    parole_plugins_manager_set_show_tabs (GTK_NOTEBOOK (container));
+}
+
+static void
 parole_plugins_manager_class_init (ParolePluginsManagerClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -395,9 +360,24 @@
     manager->priv->list_nt = GTK_WIDGET (gtk_builder_get_object (builder, "notebook-playlist"));
     manager->priv->main_nt = GTK_WIDGET (gtk_builder_get_object (builder, "main-notebook"));
     
+    g_signal_connect (manager->priv->list_nt, "page-added",
+		      G_CALLBACK (parole_plugins_manager_page_added_cb), NULL);
+    
+    g_signal_connect (manager->priv->list_nt, "page-removed",
+		      G_CALLBACK (parole_plugins_manager_page_removed_cb), NULL);
+		      
+    g_signal_connect (manager->priv->main_nt, "page-added",
+		      G_CALLBACK (parole_plugins_manager_page_added_cb), NULL);
+    
+    g_signal_connect (manager->priv->main_nt, "page-removed",
+		      G_CALLBACK (parole_plugins_manager_page_removed_cb), NULL);
+		      
     g_signal_connect (gtk_builder_get_object (builder, "plugins-menu-item"), "activate",
 		      G_CALLBACK (parole_plugins_manager_show_plugins_pref), manager);
 		     
+    parole_plugins_manager_set_show_tabs (GTK_NOTEBOOK (manager->priv->list_nt));
+    parole_plugins_manager_set_show_tabs (GTK_NOTEBOOK (manager->priv->main_nt));
+    
     g_object_unref (builder);
     
     plugin = parole_plugin_new (NULL, NULL, NULL);
@@ -436,6 +416,61 @@
     return PAROLE_PLUGINS_MANAGER (parole_plugins_manager_object);
 }
 
+void 
+parole_plugins_manager_load_plugins (ParolePluginsManager *manager)
+{
+    ParoleModule *module;
+    GDir *dir;
+    const gchar *name;
+    gchar *path;
+    GError *error = NULL;
+    gchar **plugins_rc;
+    guint len = 0, i = 0;
+    
+    plugins_rc = parole_rc_read_entry_list ("plugins", PAROLE_RC_GROUP_PLUGINS);
+    
+    if ( plugins_rc && plugins_rc[0] )
+	len = g_strv_length (plugins_rc);
+    
+    dir = g_dir_open (PAROLE_PLUGINS_DIR, 0, &error);
+    
+    if ( error )
+    {
+	g_critical ("Error opening plugins dir: %s", error->message);
+	g_error_free (error);
+	return;
+    }
+    
+    while ( (name = g_dir_read_name (dir) ))
+    {
+	if ( g_str_has_suffix (name, "." G_MODULE_SUFFIX) )
+	{
+	    path = g_build_filename (PAROLE_PLUGINS_DIR, name, NULL);
+	    TRACE ("loading module with path %s", path);
+	    
+	    module = parole_module_new (path);
+
+	    if ( g_type_module_use (G_TYPE_MODULE (module)) )
+	    {
+		g_ptr_array_add (manager->priv->array, module);
+		
+		for ( i = 0; i < len; i++)
+		{
+		    if ( !g_strcmp0 (plugins_rc[i], path) )
+		    {
+			parole_module_set_active (module, TRUE);
+			break;
+		    }
+		}
+	    }
+	    else
+		g_object_unref (module);
+	    g_free (path);
+	}
+    }
+    g_dir_close (dir);
+}
+
 void parole_plugins_manager_pack (ParolePluginsManager *manager, ParolePlugin *plugin,
 				  GtkWidget *widget, ParolePluginContainer container)
 {

Added: parole/trunk/parole/parole-subtitle-encoding.c
===================================================================
--- parole/trunk/parole/parole-subtitle-encoding.c	                        (rev 0)
+++ parole/trunk/parole/parole-subtitle-encoding.c	2009-07-27 16:06:36 UTC (rev 7850)
@@ -0,0 +1,544 @@
+/* 
+ * Copyright (C) 2001-2006 Bastien Nocera <hadess at hadess.net>
+ *
+ * encoding list copied from gnome-terminal/encoding.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * The Totem project hereby grant permission for non-gpl compatible GStreamer
+ * plugins to be used and distributed together with GStreamer and Totem. This
+ * permission are above and beyond the permissions granted by the GPL license
+ * Totem is covered by.
+ *
+ * Monday 7th February 2005: Christian Schaller: Add exception clause.
+ * See license_change file for details.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+#include <libxfce4util/libxfce4util.h>
+
+#include "parole-subtitle-encoding.h"
+
+typedef enum
+{
+  SUBTITLE_ENCODING_CURRENT_LOCALE,
+
+  SUBTITLE_ENCODING_ISO_8859_6,
+  SUBTITLE_ENCODING_IBM_864,
+  SUBTITLE_ENCODING_MAC_ARABIC,
+  SUBTITLE_ENCODING_WINDOWS_1256,
+
+  SUBTITLE_ENCODING_ARMSCII_8,
+
+  SUBTITLE_ENCODING_ISO_8859_4,
+  SUBTITLE_ENCODING_ISO_8859_13,
+  SUBTITLE_ENCODING_WINDOWS_1257,
+
+  SUBTITLE_ENCODING_ISO_8859_14,
+
+  SUBTITLE_ENCODING_ISO_8859_2,
+  SUBTITLE_ENCODING_IBM_852,
+  SUBTITLE_ENCODING_MAC_CE,
+  SUBTITLE_ENCODING_WINDOWS_1250,
+
+  SUBTITLE_ENCODING_GB18030,
+  SUBTITLE_ENCODING_GB2312,
+  SUBTITLE_ENCODING_GBK,
+  SUBTITLE_ENCODING_HZ,
+
+  SUBTITLE_ENCODING_BIG5,
+  SUBTITLE_ENCODING_BIG5_HKSCS,
+  SUBTITLE_ENCODING_EUC_TW,
+
+  SUBTITLE_ENCODING_MAC_CROATIAN,
+
+  SUBTITLE_ENCODING_ISO_8859_5,
+  SUBTITLE_ENCODING_IBM_855,
+  SUBTITLE_ENCODING_ISO_IR_111,
+  SUBTITLE_ENCODING_KOI8_R,
+  SUBTITLE_ENCODING_MAC_CYRILLIC,
+  SUBTITLE_ENCODING_WINDOWS_1251,
+
+  SUBTITLE_ENCODING_CP_866,
+
+  SUBTITLE_ENCODING_MAC_UKRAINIAN,
+  SUBTITLE_ENCODING_KOI8_U,
+
+  SUBTITLE_ENCODING_GEOSTD8,
+
+  SUBTITLE_ENCODING_ISO_8859_7,
+  SUBTITLE_ENCODING_MAC_GREEK,
+  SUBTITLE_ENCODING_WINDOWS_1253,
+
+  SUBTITLE_ENCODING_MAC_GUJARATI,
+
+  SUBTITLE_ENCODING_MAC_GURMUKHI,
+
+  SUBTITLE_ENCODING_ISO_8859_8_I,
+  SUBTITLE_ENCODING_IBM_862,
+  SUBTITLE_ENCODING_MAC_HEBREW,
+  SUBTITLE_ENCODING_WINDOWS_1255,
+
+  SUBTITLE_ENCODING_ISO_8859_8,
+
+  SUBTITLE_ENCODING_MAC_DEVANAGARI,
+
+  SUBTITLE_ENCODING_MAC_ICELANDIC,
+
+  SUBTITLE_ENCODING_EUC_JP,
+  SUBTITLE_ENCODING_ISO_2022_JP,
+  SUBTITLE_ENCODING_SHIFT_JIS,
+
+  SUBTITLE_ENCODING_EUC_KR,
+  SUBTITLE_ENCODING_ISO_2022_KR,
+  SUBTITLE_ENCODING_JOHAB,
+  SUBTITLE_ENCODING_UHC,
+
+  SUBTITLE_ENCODING_ISO_8859_10,
+
+  SUBTITLE_ENCODING_MAC_FARSI,
+
+  SUBTITLE_ENCODING_ISO_8859_16,
+  SUBTITLE_ENCODING_MAC_ROMANIAN,
+
+  SUBTITLE_ENCODING_ISO_8859_3,
+
+  SUBTITLE_ENCODING_TIS_620,
+
+  SUBTITLE_ENCODING_ISO_8859_9,
+  SUBTITLE_ENCODING_IBM_857,
+  SUBTITLE_ENCODING_MAC_TURKISH,
+  SUBTITLE_ENCODING_WINDOWS_1254,
+
+  SUBTITLE_ENCODING_UTF_7,
+  SUBTITLE_ENCODING_UTF_8,
+  SUBTITLE_ENCODING_UTF_16,
+  SUBTITLE_ENCODING_UCS_2,
+  SUBTITLE_ENCODING_UCS_4,
+
+  SUBTITLE_ENCODING_ISO_8859_1,
+  SUBTITLE_ENCODING_ISO_8859_15,
+  SUBTITLE_ENCODING_IBM_850,
+  SUBTITLE_ENCODING_MAC_ROMAN,
+  SUBTITLE_ENCODING_WINDOWS_1252,
+
+  SUBTITLE_ENCODING_TCVN,
+  SUBTITLE_ENCODING_VISCII,
+  SUBTITLE_ENCODING_WINDOWS_1258,
+
+  SUBTITLE_ENCODING_LAST
+} SubtitleEncodingIndex;
+
+
+typedef struct
+{
+  int index;
+  const char *charset;
+  char *name;
+} SubtitleEncoding;
+
+
+static SubtitleEncoding encodings[] = {
+
+  {SUBTITLE_ENCODING_CURRENT_LOCALE,
+      NULL, N_("Current Locale")},
+
+  {SUBTITLE_ENCODING_ISO_8859_6,
+      "ISO-8859-6", N_("Arabic")},
+  {SUBTITLE_ENCODING_IBM_864,
+      "IBM864", N_("Arabic")},
+  {SUBTITLE_ENCODING_MAC_ARABIC,
+      "MAC_ARABIC", N_("Arabic")},
+  {SUBTITLE_ENCODING_WINDOWS_1256,
+      "WINDOWS-1256", N_("Arabic")},
+
+  {SUBTITLE_ENCODING_ARMSCII_8,
+      "ARMSCII-8", N_("Armenian")},
+
+  {SUBTITLE_ENCODING_ISO_8859_4,
+      "ISO-8859-4", N_("Baltic")},
+  {SUBTITLE_ENCODING_ISO_8859_13,
+      "ISO-8859-13", N_("Baltic")},
+  {SUBTITLE_ENCODING_WINDOWS_1257,
+      "WINDOWS-1257", N_("Baltic")},
+
+  {SUBTITLE_ENCODING_ISO_8859_14,
+      "ISO-8859-14", N_("Celtic")},
+
+  {SUBTITLE_ENCODING_ISO_8859_2,
+      "ISO-8859-2", N_("Central European")},
+  {SUBTITLE_ENCODING_IBM_852,
+      "IBM852", N_("Central European")},
+  {SUBTITLE_ENCODING_MAC_CE,
+      "MAC_CE", N_("Central European")},
+  {SUBTITLE_ENCODING_WINDOWS_1250,
+      "WINDOWS-1250", N_("Central European")},
+
+  {SUBTITLE_ENCODING_GB18030,
+      "GB18030", N_("Chinese Simplified")},
+  {SUBTITLE_ENCODING_GB2312,
+      "GB2312", N_("Chinese Simplified")},
+  {SUBTITLE_ENCODING_GBK,
+      "GBK", N_("Chinese Simplified")},
+  {SUBTITLE_ENCODING_HZ,
+      "HZ", N_("Chinese Simplified")},
+
+  {SUBTITLE_ENCODING_BIG5,
+      "BIG5", N_("Chinese Traditional")},
+  {SUBTITLE_ENCODING_BIG5_HKSCS,
+      "BIG5-HKSCS", N_("Chinese Traditional")},
+  {SUBTITLE_ENCODING_EUC_TW,
+      "EUC-TW", N_("Chinese Traditional")},
+
+  {SUBTITLE_ENCODING_MAC_CROATIAN,
+      "MAC_CROATIAN", N_("Croatian")},
+
+  {SUBTITLE_ENCODING_ISO_8859_5,
+      "ISO-8859-5", N_("Cyrillic")},
+  {SUBTITLE_ENCODING_IBM_855,
+      "IBM855", N_("Cyrillic")},
+  {SUBTITLE_ENCODING_ISO_IR_111,
+      "ISO-IR-111", N_("Cyrillic")},
+  {SUBTITLE_ENCODING_KOI8_R,
+      "KOI8-R", N_("Cyrillic")},
+  {SUBTITLE_ENCODING_MAC_CYRILLIC,
+      "MAC-CYRILLIC", N_("Cyrillic")},
+  {SUBTITLE_ENCODING_WINDOWS_1251,
+      "WINDOWS-1251", N_("Cyrillic")},
+
+  {SUBTITLE_ENCODING_CP_866,
+      "CP866", N_("Cyrillic/Russian")},
+
+  {SUBTITLE_ENCODING_MAC_UKRAINIAN,
+      "MAC_UKRAINIAN", N_("Cyrillic/Ukrainian")},
+  {SUBTITLE_ENCODING_KOI8_U,
+      "KOI8-U", N_("Cyrillic/Ukrainian")},
+
+  {SUBTITLE_ENCODING_GEOSTD8,
+      "GEORGIAN-PS", N_("Georgian")},
+
+  {SUBTITLE_ENCODING_ISO_8859_7,
+      "ISO-8859-7", N_("Greek")},
+  {SUBTITLE_ENCODING_MAC_GREEK,
+      "MAC_GREEK", N_("Greek")},
+  {SUBTITLE_ENCODING_WINDOWS_1253,
+      "WINDOWS-1253", N_("Greek")},
+
+  {SUBTITLE_ENCODING_MAC_GUJARATI,
+      "MAC_GUJARATI", N_("Gujarati")},
+
+  {SUBTITLE_ENCODING_MAC_GURMUKHI,
+      "MAC_GURMUKHI", N_("Gurmukhi")},
+
+  {SUBTITLE_ENCODING_ISO_8859_8_I,
+      "ISO-8859-8-I", N_("Hebrew")},
+  {SUBTITLE_ENCODING_IBM_862,
+      "IBM862", N_("Hebrew")},
+  {SUBTITLE_ENCODING_MAC_HEBREW,
+      "MAC_HEBREW", N_("Hebrew")},
+  {SUBTITLE_ENCODING_WINDOWS_1255,
+      "WINDOWS-1255", N_("Hebrew")},
+
+  {SUBTITLE_ENCODING_ISO_8859_8,
+      "ISO-8859-8", N_("Hebrew Visual")},
+
+  {SUBTITLE_ENCODING_MAC_DEVANAGARI,
+      "MAC_DEVANAGARI", N_("Hindi")},
+
+  {SUBTITLE_ENCODING_MAC_ICELANDIC,
+      "MAC_ICELANDIC", N_("Icelandic")},
+
+  {SUBTITLE_ENCODING_EUC_JP,
+      "EUC-JP", N_("Japanese")},
+  {SUBTITLE_ENCODING_ISO_2022_JP,
+      "ISO2022JP", N_("Japanese")},
+  {SUBTITLE_ENCODING_SHIFT_JIS,
+      "SHIFT-JIS", N_("Japanese")},
+
+  {SUBTITLE_ENCODING_EUC_KR,
+      "EUC-KR", N_("Korean")},
+  {SUBTITLE_ENCODING_ISO_2022_KR,
+      "ISO2022KR", N_("Korean")},
+  {SUBTITLE_ENCODING_JOHAB,
+      "JOHAB", N_("Korean")},
+  {SUBTITLE_ENCODING_UHC,
+      "UHC", N_("Korean")},
+
+  {SUBTITLE_ENCODING_ISO_8859_10,
+      "ISO-8859-10", N_("Nordic")},
+
+  {SUBTITLE_ENCODING_MAC_FARSI,
+      "MAC_FARSI", N_("Persian")},
+
+  {SUBTITLE_ENCODING_ISO_8859_16,
+      "ISO-8859-16", N_("Romanian")},
+  {SUBTITLE_ENCODING_MAC_ROMANIAN,
+      "MAC_ROMANIAN", N_("Romanian")},
+
+  {SUBTITLE_ENCODING_ISO_8859_3,
+      "ISO-8859-3", N_("South European")},
+
+  {SUBTITLE_ENCODING_TIS_620,
+      "TIS-620", N_("Thai")},
+
+  {SUBTITLE_ENCODING_ISO_8859_9,
+      "ISO-8859-9", N_("Turkish")},
+  {SUBTITLE_ENCODING_IBM_857,
+      "IBM857", N_("Turkish")},
+  {SUBTITLE_ENCODING_MAC_TURKISH,
+      "MAC_TURKISH", N_("Turkish")},
+  {SUBTITLE_ENCODING_WINDOWS_1254,
+      "WINDOWS-1254", N_("Turkish")},
+
+  {SUBTITLE_ENCODING_UTF_7,
+      "UTF-7", N_("Unicode")},
+  {SUBTITLE_ENCODING_UTF_8,
+      "UTF-8", N_("Unicode")},
+  {SUBTITLE_ENCODING_UTF_16,
+      "UTF-16", N_("Unicode")},
+  {SUBTITLE_ENCODING_UCS_2,
+      "UCS-2", N_("Unicode")},
+  {SUBTITLE_ENCODING_UCS_4,
+      "UCS-4", N_("Unicode")},
+
+  {SUBTITLE_ENCODING_ISO_8859_1,
+      "ISO-8859-1", N_("Western")},
+  {SUBTITLE_ENCODING_ISO_8859_15,
+      "ISO-8859-15", N_("Western")},
+  {SUBTITLE_ENCODING_IBM_850,
+      "IBM850", N_("Western")},
+  {SUBTITLE_ENCODING_MAC_ROMAN,
+      "MAC_ROMAN", N_("Western")},
+  {SUBTITLE_ENCODING_WINDOWS_1252,
+      "WINDOWS-1252", N_("Western")},
+
+  {SUBTITLE_ENCODING_TCVN,
+      "TCVN", N_("Vietnamese")},
+  {SUBTITLE_ENCODING_VISCII,
+      "VISCII", N_("Vietnamese")},
+  {SUBTITLE_ENCODING_WINDOWS_1258,
+      "WINDOWS-1258", N_("Vietnamese")}
+};
+
+static const SubtitleEncoding *
+find_encoding_by_charset (const char *charset)
+{
+  int i;
+
+  i = 1;                        /* skip current locale */
+  while (i < SUBTITLE_ENCODING_LAST) {
+    if (strcasecmp (charset, encodings[i].charset) == 0)
+      return &encodings[i];
+
+    ++i;
+  }
+
+  if (strcasecmp (charset,
+          encodings[SUBTITLE_ENCODING_CURRENT_LOCALE].charset) == 0)
+    return &encodings[SUBTITLE_ENCODING_CURRENT_LOCALE];
+
+  return NULL;
+}
+
+static void
+subtitle_encoding_init (void)
+{
+  guint i;
+
+  g_get_charset ((const char **)
+      &encodings[SUBTITLE_ENCODING_CURRENT_LOCALE].charset);
+
+  g_assert (G_N_ELEMENTS (encodings) == SUBTITLE_ENCODING_LAST);
+
+  for (i = 0; i < SUBTITLE_ENCODING_LAST; i++) {
+    /* Translate the names */
+    encodings[i].name = _(encodings[i].name);
+  }
+}
+
+static int
+subtitle_encoding_get_index (const char *charset)
+{
+  const SubtitleEncoding *e;
+
+  e = find_encoding_by_charset (charset);
+  if (e != NULL)
+    return e->index;
+  else
+    return SUBTITLE_ENCODING_CURRENT_LOCALE;
+}
+
+static const char *
+subtitle_encoding_get_charset (int index_i)
+{
+  const SubtitleEncoding *e;
+
+  if (index_i >= SUBTITLE_ENCODING_LAST)
+    e = &encodings[SUBTITLE_ENCODING_CURRENT_LOCALE];
+  else if (index_i < SUBTITLE_ENCODING_CURRENT_LOCALE)
+    e = &encodings[SUBTITLE_ENCODING_CURRENT_LOCALE];
+  else
+    e = &encodings[index_i];
+  return e->charset;
+}
+
+enum
+{
+  INDEX_COL,
+  NAME_COL
+};
+
+static gint
+compare (GtkTreeModel * model, GtkTreeIter * a, GtkTreeIter * b, gpointer data)
+{
+  gchar *str_a, *str_b;
+  gint result;
+
+  gtk_tree_model_get (model, a, NAME_COL, &str_a, -1);
+  gtk_tree_model_get (model, b, NAME_COL, &str_b, -1);
+
+  result = strcmp (str_a, str_b);
+
+  g_free (str_a);
+  g_free (str_b);
+
+  return result;
+}
+
+static void
+is_encoding_sensitive (GtkCellLayout * cell_layout,
+    GtkCellRenderer * cell,
+    GtkTreeModel * tree_model, GtkTreeIter * iter, gpointer data)
+{
+
+  gboolean sensitive;
+
+  sensitive = !gtk_tree_model_iter_has_child (tree_model, iter);
+  g_object_set (cell, "sensitive", sensitive, NULL);
+}
+
+static GtkTreeModel *
+subtitle_encoding_create_store (void)
+{
+  gchar *label;
+  gchar *lastlang = "";
+  GtkTreeIter iter, iter2;
+  GtkTreeStore *store;
+  int i;
+
+  store = gtk_tree_store_new (2, G_TYPE_INT, G_TYPE_STRING);
+
+  for (i = 0; i < SUBTITLE_ENCODING_LAST; i++) {
+    if (strcmp (lastlang, encodings[i].name)) {
+      lastlang = encodings[i].name;
+      gtk_tree_store_append (store, &iter, NULL);
+      gtk_tree_store_set (store, &iter, INDEX_COL,
+          -1, NAME_COL, lastlang, -1);
+    }
+    label = g_strdup_printf("%s (%s)", lastlang, encodings[i].charset);
+    gtk_tree_store_append (store, &iter2, &iter);
+    gtk_tree_store_set (store, &iter2, INDEX_COL,
+        encodings[i].index, NAME_COL, label, -1);
+    g_free(label);
+  }
+  gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
+      compare, NULL, NULL);
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+      NAME_COL, GTK_SORT_ASCENDING);
+  return GTK_TREE_MODEL (store);
+}
+
+static void
+subtitle_encoding_combo_render (GtkComboBox * combo)
+{
+  GtkCellRenderer *renderer;
+
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
+      "text", NAME_COL, NULL);
+  gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
+      renderer, is_encoding_sensitive, NULL, NULL);
+}
+
+const char *
+parole_subtitle_encoding_get_selected (GtkComboBox * combo)
+{
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  gint index_i = -1;
+
+  model = gtk_combo_box_get_model (combo);
+  if (gtk_combo_box_get_active_iter (combo, &iter)) {
+    gtk_tree_model_get (model, &iter, INDEX_COL, &index_i, -1);
+  }
+  if (index_i == -1)
+    return NULL;
+    
+  return subtitle_encoding_get_charset (index_i);
+}
+
+void
+parole_subtitle_encoding_set (GtkComboBox * combo, const char *encoding)
+{
+  GtkTreeModel *model;
+  GtkTreeIter iter, iter2;
+  gint index_i, i;
+
+  g_return_if_fail (encoding != NULL);
+
+  model = gtk_combo_box_get_model (combo);
+  index_i = subtitle_encoding_get_index (encoding);
+  gtk_tree_model_get_iter_first (model, &iter);
+  
+  do {
+    if (!gtk_tree_model_iter_has_child (model, &iter))
+      continue;
+    if (!gtk_tree_model_iter_children (model, &iter2, &iter))
+      continue;
+    do {
+      gtk_tree_model_get (model, &iter2, INDEX_COL, &i, -1);
+      if (i == index_i)
+        break;
+    } while (gtk_tree_model_iter_next (model, &iter2));
+    if (i == index_i)
+      break;
+  } while (gtk_tree_model_iter_next (model, &iter));
+  gtk_combo_box_set_active_iter (combo, &iter2);
+}
+
+void
+parole_subtitle_encoding_init (GtkComboBox *combo)
+{
+  GtkTreeModel *model;
+  subtitle_encoding_init ();
+  model = subtitle_encoding_create_store ();
+  gtk_combo_box_set_model (combo, model);
+  g_object_unref (model);
+  subtitle_encoding_combo_render (combo);
+}
+
+/*
+ * vim: sw=2 ts=8 cindent noai bs=2
+ */

Added: parole/trunk/parole/parole-subtitle-encoding.h
===================================================================
--- parole/trunk/parole/parole-subtitle-encoding.h	                        (rev 0)
+++ parole/trunk/parole/parole-subtitle-encoding.h	2009-07-27 16:06:36 UTC (rev 7850)
@@ -0,0 +1,41 @@
+/* 
+ * Copyright (C) 2001-2006 Bastien Nocera <hadess at hadess.net>
+ *
+ * encoding list copied from gnome-terminal/encoding.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * The Totem project hereby grant permission for non-gpl compatible GStreamer
+ * plugins to be used and distributed together with GStreamer and Totem. This
+ * permission are above and beyond the permissions granted by the GPL license
+ * Totem is covered by.
+ *
+ * Monday 7th February 2005: Christian Schaller: Add exception clause.
+ * See license_change file for details.
+ *
+ */
+
+#ifndef PAROLE_SUBTITLE_ENCODING_H
+#define PAROLE_SUBTITLE_ENCODING_H
+
+#include <gtk/gtk.h>
+
+void 		parole_subtitle_encoding_init 		(GtkComboBox *combo);
+
+void 		parole_subtitle_encoding_set 		(GtkComboBox *combo, const char *encoding);
+
+const char     *parole_subtitle_encoding_get_selected   (GtkComboBox *combo);
+
+#endif /* PAROLE_SUBTITLE_ENCODING_H */

Modified: parole/trunk/po/POTFILES.in
===================================================================
--- parole/trunk/po/POTFILES.in	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/po/POTFILES.in	2009-07-27 16:06:36 UTC (rev 7850)
@@ -16,5 +16,6 @@
 parole/parole-pl-parser.c
 parole/parole-about.c
 parole/parole-disc.c
+parole/parole-subtitle-encoding.c
 plugins/properties/stream-properties.c
 plugins/tray/tray-icon.c

Modified: parole/trunk/po/parole-media-player.pot
===================================================================
--- parole/trunk/po/parole-media-player.pot	2009-07-27 14:50:47 UTC (rev 7849)
+++ parole/trunk/po/parole-media-player.pot	2009-07-27 16:06:36 UTC (rev 7850)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-07-27 16:47+0200\n"
+"POT-Creation-Date: 2009-07-27 18:02+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -17,34 +17,26 @@
 "Content-Transfer-Encoding: 8bit\n"
 
 #: ../data/interfaces/parole.ui.h:1
-msgid "Albums"
+msgid "Media player"
 msgstr ""
 
 #: ../data/interfaces/parole.ui.h:2
-msgid "Media player"
+msgid "Plugins"
 msgstr ""
 
 #: ../data/interfaces/parole.ui.h:3
-msgid "Nothing yet."
+msgid "_Edit"
 msgstr ""
 
 #: ../data/interfaces/parole.ui.h:4
-msgid "Plugins"
+msgid "_Help"
 msgstr ""
 
 #: ../data/interfaces/parole.ui.h:5
-msgid "_Edit"
+msgid "_Media"
 msgstr ""
 
 #: ../data/interfaces/parole.ui.h:6
-msgid "_Help"
-msgstr ""
-
-#: ../data/interfaces/parole.ui.h:7
-msgid "_Media"
-msgstr ""
-
-#: ../data/interfaces/parole.ui.h:8
 msgid "_View"
 msgstr ""
 
@@ -97,24 +89,40 @@
 msgstr ""
 
 #: ../data/interfaces/parole-settings.ui.h:5
+msgid "Brightness:"
+msgstr ""
+
+#: ../data/interfaces/parole-settings.ui.h:6
 msgid ""
 "Changing this will take effect after parole is restarted or a new media file "
 "is loaded."
 msgstr ""
 
-#: ../data/interfaces/parole-settings.ui.h:6
+#: ../data/interfaces/parole-settings.ui.h:7
+msgid "Contrast:"
+msgstr ""
+
+#: ../data/interfaces/parole-settings.ui.h:8
 msgid "Enable visualization when playing audio file"
 msgstr ""
 
-#: ../data/interfaces/parole-settings.ui.h:7
+#: ../data/interfaces/parole-settings.ui.h:9
 msgid "Encoding: "
 msgstr ""
 
-#: ../data/interfaces/parole-settings.ui.h:8
+#: ../data/interfaces/parole-settings.ui.h:10
 msgid "Font:"
 msgstr ""
 
-#: ../data/interfaces/parole-settings.ui.h:9
+#: ../data/interfaces/parole-settings.ui.h:11
+msgid "Media Player Settings"
+msgstr ""
+
+#: ../data/interfaces/parole-settings.ui.h:12
+msgid "Parole Settings"
+msgstr ""
+
+#: ../data/interfaces/parole-settings.ui.h:13
 msgid "Visualization type:"
 msgstr ""
 
@@ -143,16 +151,16 @@
 msgid "Type '%s --help' for usage."
 msgstr ""
 
-#: ../parole/parole-gst.c:796
+#: ../parole/parole-gst.c:806
 msgid "Error in changing state to ready"
 msgstr ""
 
-#: ../parole/parole-gst.c:845
+#: ../parole/parole-gst.c:855
 msgid ""
 "Unable to load playbin GStreamer plugin, check your GStreamer installation"
 msgstr ""
 
-#: ../parole/parole-gst.c:860
+#: ../parole/parole-gst.c:870
 msgid ""
 "Unable to load video GStreamer plugin, check your GStreamer installation"
 msgstr ""
@@ -266,6 +274,173 @@
 msgid "Play Disc"
 msgstr ""
 
+#: ../parole/parole-subtitle-encoding.c:165
+msgid "Current Locale"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:168
+#: ../parole/parole-subtitle-encoding.c:170
+#: ../parole/parole-subtitle-encoding.c:172
+#: ../parole/parole-subtitle-encoding.c:174
+msgid "Arabic"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:177
+msgid "Armenian"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:180
+#: ../parole/parole-subtitle-encoding.c:182
+#: ../parole/parole-subtitle-encoding.c:184
+msgid "Baltic"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:187
+msgid "Celtic"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:190
+#: ../parole/parole-subtitle-encoding.c:192
+#: ../parole/parole-subtitle-encoding.c:194
+#: ../parole/parole-subtitle-encoding.c:196
+msgid "Central European"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:199
+#: ../parole/parole-subtitle-encoding.c:201
+#: ../parole/parole-subtitle-encoding.c:203
+#: ../parole/parole-subtitle-encoding.c:205
+msgid "Chinese Simplified"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:208
+#: ../parole/parole-subtitle-encoding.c:210
+#: ../parole/parole-subtitle-encoding.c:212
+msgid "Chinese Traditional"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:215
+msgid "Croatian"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:218
+#: ../parole/parole-subtitle-encoding.c:220
+#: ../parole/parole-subtitle-encoding.c:222
+#: ../parole/parole-subtitle-encoding.c:224
+#: ../parole/parole-subtitle-encoding.c:226
+#: ../parole/parole-subtitle-encoding.c:228
+msgid "Cyrillic"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:231
+msgid "Cyrillic/Russian"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:234
+#: ../parole/parole-subtitle-encoding.c:236
+msgid "Cyrillic/Ukrainian"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:239
+msgid "Georgian"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:242
+#: ../parole/parole-subtitle-encoding.c:244
+#: ../parole/parole-subtitle-encoding.c:246
+msgid "Greek"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:249
+msgid "Gujarati"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:252
+msgid "Gurmukhi"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:255
+#: ../parole/parole-subtitle-encoding.c:257
+#: ../parole/parole-subtitle-encoding.c:259
+#: ../parole/parole-subtitle-encoding.c:261
+msgid "Hebrew"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:264
+msgid "Hebrew Visual"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:267
+msgid "Hindi"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:270
+msgid "Icelandic"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:273
+#: ../parole/parole-subtitle-encoding.c:275
+#: ../parole/parole-subtitle-encoding.c:277
+msgid "Japanese"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:280
+#: ../parole/parole-subtitle-encoding.c:282
+#: ../parole/parole-subtitle-encoding.c:284
+#: ../parole/parole-subtitle-encoding.c:286
+msgid "Korean"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:289
+msgid "Nordic"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:292
+msgid "Persian"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:295
+#: ../parole/parole-subtitle-encoding.c:297
+msgid "Romanian"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:300
+msgid "South European"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:303
+msgid "Thai"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:306
+#: ../parole/parole-subtitle-encoding.c:308
+#: ../parole/parole-subtitle-encoding.c:310
+#: ../parole/parole-subtitle-encoding.c:312
+msgid "Turkish"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:315
+#: ../parole/parole-subtitle-encoding.c:317
+#: ../parole/parole-subtitle-encoding.c:319
+#: ../parole/parole-subtitle-encoding.c:321
+#: ../parole/parole-subtitle-encoding.c:323
+msgid "Unicode"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:326
+#: ../parole/parole-subtitle-encoding.c:328
+#: ../parole/parole-subtitle-encoding.c:330
+#: ../parole/parole-subtitle-encoding.c:332
+#: ../parole/parole-subtitle-encoding.c:334
+msgid "Western"
+msgstr ""
+
+#: ../parole/parole-subtitle-encoding.c:337
+#: ../parole/parole-subtitle-encoding.c:339
+#: ../parole/parole-subtitle-encoding.c:341
+msgid "Vietnamese"
+msgstr ""
+
 #: ../plugins/properties/stream-properties.c:44
 #: ../plugins/properties/stream-properties.c:45
 #: ../plugins/properties/stream-properties.c:46




More information about the Goodies-commits mailing list