Commit b63c5f7f authored by Ali Abdallah's avatar Ali Abdallah

* Support for Recent played media files.

	* Better configuration loading based GValues.
	* Register posix signal handler.
	* Much better cdda support.
	* Patch the makefile by Enrico Tröger to fix issue with 
	generating the enum types.
	* Fix the sound image menu items size.
	* Double clicks a file close the media chooser dialog.
	* Remove grey border in fullscreen mode.
	* Set the main window name to Parole Media Player.
	* Fix the expander packing style in the savelist chooser.
	

(Old svn revision: 7882)
parent dfedf6f6
2009-07-31: 11:30 Ali aliov@xfce.org
* Support for Recent played media files.
* Better configuration loading based GValues.
* Register posix signal handler.
* Much better cdda support.
* Patch the makefile by Enrico Tröger to fix issue with
generating the enum types.
* Fix the sound image menu items size.
* Double clicks a file close the media chooser dialog.
* Remove grey border in fullscreen mode.
* Set the main window name to Parole Media Player.
* Fix the expander packing style in the savelist chooser.
2009-07-30: Ali aliov@xfce.org
* Supports for Aspect ratio views.
* Remember the size of the main window set.
......
......@@ -2,7 +2,6 @@
* Complete the shortcut keys.
* Handle missing gstreamer plugins.
* Support scale ratio view.
* Better support for cdda.
* Support some playlist title entity.
* Use pixel-aspect-ratio info when calculating the
aspect ratio.
......
......@@ -12,6 +12,7 @@
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">1</property>
<signal name="file_activated" handler="media_chooser_file_activate_cb"/>
<signal name="current_folder_changed" handler="media_chooser_folder_changed_cb"/>
</object>
<packing>
......
......@@ -21,86 +21,6 @@
<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>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="orientation">vertical</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>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Changing this will take effect after parole is restarted or a new media file is loaded.</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="parole_conf_dialog_enable_vis_changed_cb"/>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">Visualization type:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="vis-combobox">
<property name="visible">True</property>
<property name="model">liststore1</property>
<signal name="changed" handler="parole_conf_dialog_vis_plugin_changed_cb"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Audio&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame-display">
<property name="visible">True</property>
......@@ -262,6 +182,85 @@
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="orientation">vertical</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>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="parole_conf_dialog_enable_vis_changed_cb"/>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">Visualization type:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="vis-combobox">
<property name="visible">True</property>
<property name="model">liststore1</property>
<signal name="changed" handler="parole_conf_dialog_vis_plugin_changed_cb"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Audio&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
......@@ -282,7 +281,7 @@
<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>
<property name="label" translatable="yes">Automatically load subtitles when playing movie file</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
......
......@@ -3,6 +3,7 @@
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="main-window">
<property name="title" translatable="yes">Parole Media Player</property>
<property name="window_position">center</property>
<property name="default_width">780</property>
<property name="default_height">480</property>
......@@ -219,7 +220,7 @@
<object class="GtkMenu" id="menu1">
<property name="visible">True</property>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem1">
<object class="GtkImageMenuItem" id="volume-mute-menu">
<property name="label" translatable="yes">Mute</property>
<property name="visible">True</property>
<property name="image">image12</property>
......@@ -227,7 +228,7 @@
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem2">
<object class="GtkImageMenuItem" id="volume-up-menu">
<property name="label" translatable="yes">Volume Up</property>
<property name="visible">True</property>
<property name="image">image11</property>
......@@ -237,7 +238,7 @@
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem3">
<object class="GtkImageMenuItem" id="volume-down-menu">
<property name="label" translatable="yes">Volume Down</property>
<property name="visible">True</property>
<property name="image">image10</property>
......@@ -286,6 +287,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<property name="scrollable">True</property>
<property name="group_id">0</property>
<child>
......@@ -378,13 +380,18 @@
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
<object class="GtkEventBox" id="eventboxinfo">
<property name="no_show_all">True</property>
<child>
<object class="GtkLabel" id="info">
<property name="no_show_all">True</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
......
......@@ -21,8 +21,6 @@
</object>
<object class="GtkFileChooserDialog" id="filechooserdialog">
<property name="border_width">5</property>
<property name="default_width">480</property>
<property name="default_height">300</property>
<property name="type_hint">normal</property>
<property name="has_separator">False</property>
<property name="action">save</property>
......@@ -74,6 +72,8 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
......
......@@ -10,18 +10,11 @@ INCLUDES = \
-DLOCALEDIR=\"$(localedir)\" \
-DG_LOG_DOMAIN=\"parole\" \
-DPAROLE_PLUGINS_DIR=\"$(libdir)/parole-$(PAROLE_VERSION_API)\"\
$(GTK_CFLAGS) \
$(GLIB_CFLAGS) \
$(GOBJECT_CFLAGS) \
$(GTHREAD_CFLAGS) \
$(GIO_CFLAGS) \
$(DBUS_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(LIBXFCE4GUI_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(GST_CFLAGS) \
$(GST_VIDEO_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_INTERFACES_CFLAGS)
PAROLE_LDFLAGS = \
......@@ -30,17 +23,10 @@ PAROLE_LDFLAGS = \
-export-symbols-regex "^[[^_]].*"
PAROLE_LIBS = \
$(GTK_LIBS) \
$(GLIB_LIBS) \
$(GOBJECT_LIBS) \
$(GTHREAD_LIBS) \
$(GIO_LIBS) \
$(DBUS_LIBS) \
$(DBUS_GLIB_LIBS) \
$(LIBXFCE4GUI_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(GST_LIBS) \
$(GST_BASE_LIBS) \
$(GST_VIDEO_LIBS) \
$(GST_INTERFACES_LIBS)
......@@ -134,8 +120,7 @@ parole_media_player_SOURCES = \
main.c
parole_media_player_LDADD = \
libparole.la \
$(PAROLE_LIBS)
libparole.la
parole_media_player_LDFLAGS = \
$(PAROLE_LDFLAGS)
......@@ -167,9 +152,9 @@ stamp-enum-gtypes.h: $(parole_glib_enum_headers) Makefile
--fprod "/* enumerations from \"@filename@\" */\n" \
--vhead "GType @enum_name@_get_type (void);\n#define ENUM_GTYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* __ENUM_GTYPES_H__ */" \
$(parole_glib_enum_headers) ) > xgen-enum \
&& (cmp -s xgen-enum enum-gtypes.h || cp xgen-enum enum-gtypes.h) \
&& rm -f xgen-enum \
$(parole_glib_enum_headers) ) > xgen-enum.h \
&& (cmp -s xgen-enum.h enum-gtypes.h || cp xgen-enum.h enum-gtypes.h) \
&& rm -f xgen-enum.h \
&& echo timestamp > $(@F)
enum-gtypes.c: $(parole_glib_enum_headers) Makefile
......@@ -184,9 +169,9 @@ enum-gtypes.c: $(parole_glib_enum_headers) Makefile
--vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
$(parole_glib_enum_headers) ) >> xgen-enum \
&& cp xgen-enum enum-gtypes.c \
&& rm -f xgen-enum
$(parole_glib_enum_headers) ) >> xgen-enum.c \
&& cp xgen-enum.c enum-gtypes.c \
&& rm -f xgen-enum.c
org.parole.media.list.h: $(srcdir)/org.parole.media.list.xml
dbus-binding-tool --mode=glib-server --prefix=parole_media_list $< >$@
......
......@@ -58,6 +58,14 @@ show_version (void)
exit (EXIT_SUCCESS);
}
static void
parole_sig_handler (gint sig, gpointer data)
{
ParolePlayer *player = (ParolePlayer *) data;
parole_player_terminate (player);
}
static void
parole_send_play_disc (DBusGProxy *proxy, const gchar *uri)
{
......@@ -203,6 +211,27 @@ int main (int argc, char **argv)
parole_media_list_add_files (list, filenames);
}
}
if ( xfce_posix_signal_handler_init (&error))
{
xfce_posix_signal_handler_set_handler(SIGHUP,
parole_sig_handler,
player, NULL);
xfce_posix_signal_handler_set_handler(SIGINT,
parole_sig_handler,
player, NULL);
xfce_posix_signal_handler_set_handler(SIGTERM,
parole_sig_handler,
player, NULL);
}
else
{
g_warning ("Unable to set up POSIX signal handlers: %s", error->message);
g_error_free (error);
}
plugins = parole_plugins_manager_new ();
parole_plugins_manager_load_plugins (plugins);
g_object_unref (builder);
......
......@@ -37,22 +37,7 @@
struct ParoleConfPrivate
{
gchar *vis_sink;
gboolean enable_vis;
gboolean enable_subtitle;
gchar *subtitle_font;
gchar *subtitle_encoding;
gboolean repeat;
gboolean shuffle;
gint brightness;
gint contrast;
gint hue;
gint saturation;
ParoleAspectRatio aspect_ratio;
gint window_width;
gint window_height;
GValue *values;
};
static gpointer parole_conf_object = NULL;
......@@ -85,81 +70,43 @@ static void parole_conf_set_property (GObject *object,
GParamSpec *pspec)
{
ParoleConf *conf;
GValue *dst;
GValue save_dst = { 0, };
conf = PAROLE_CONF (object);
dst = conf->priv->values + prop_id;
switch (prop_id)
if ( !G_IS_VALUE (dst) )
{
case PROP_VIS_ENABLED:
conf->priv->enable_vis = g_value_get_boolean (value);
g_object_notify (G_OBJECT (conf), pspec->name);
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);
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_value_dup_string (value);
parole_rc_write_entry_string ("VIS_NAME", PAROLE_RC_GROUP_GENERAL, conf->priv->vis_sink);
break;
case PROP_SUBTITLE_ENABLED:
conf->priv->enable_subtitle = g_value_get_boolean (value);
parole_rc_write_entry_bool ("ENABLE_SUBTITLE", PAROLE_RC_GROUP_GENERAL, conf->priv->enable_subtitle);
break;
case PROP_SUBTITLE_FONT:
if ( conf->priv->subtitle_font )
g_free (conf->priv->subtitle_font);
conf->priv->subtitle_font = g_value_dup_string (value);
parole_rc_write_entry_string ("SUBTITLE_FONT", PAROLE_RC_GROUP_GENERAL, conf->priv->subtitle_font);
break;
case PROP_REPEAT:
conf->priv->repeat = g_value_get_boolean (value);
parole_rc_write_entry_bool ("REPEAT", PAROLE_RC_GROUP_GENERAL, conf->priv->repeat);
break;
case PROP_SHUFFLE:
conf->priv->shuffle = g_value_get_boolean (value);
parole_rc_write_entry_bool ("SHUFFLE", PAROLE_RC_GROUP_GENERAL, conf->priv->shuffle);
break;
case PROP_SATURATION:
conf->priv->saturation = g_value_get_int (value);
parole_rc_write_entry_int ("SATURATION", PAROLE_RC_GROUP_GENERAL, conf->priv->saturation);
break;
case PROP_HUE:
conf->priv->hue = g_value_get_int (value);
parole_rc_write_entry_int ("HUE", PAROLE_RC_GROUP_GENERAL, conf->priv->hue);
break;
case PROP_CONTRAST:
conf->priv->contrast = g_value_get_int (value);
parole_rc_write_entry_int ("CONTRAST", PAROLE_RC_GROUP_GENERAL, conf->priv->contrast);
break;
case PROP_BRIGHTNESS:
conf->priv->brightness = g_value_get_int (value);
parole_rc_write_entry_int ("BRIGHTNESS", PAROLE_RC_GROUP_GENERAL, conf->priv->brightness);
break;
case PROP_ASPECT_RATIO:
conf->priv->aspect_ratio = g_value_get_enum (value);
parole_rc_write_entry_int ("ASPECT_RATIO", PAROLE_RC_GROUP_GENERAL, conf->priv->aspect_ratio);
break;
case PROP_WINDOW_WIDTH:
conf->priv->window_width = g_value_get_int (value);
parole_rc_write_entry_int ("WINDOW_WIDTH", PAROLE_RC_GROUP_GENERAL, conf->priv->window_width);
break;
case PROP_WINDOW_HEIGHT:
conf->priv->window_height = g_value_get_int (value);
parole_rc_write_entry_int ("WINDOW_HEIGHT", PAROLE_RC_GROUP_GENERAL, conf->priv->window_height);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
goto out;
g_value_init (dst, pspec->value_type);
g_param_value_set_default (pspec, dst);
}
if ( g_param_values_cmp (pspec, value, dst) != 0 )
{
g_value_copy (value, dst);
g_object_notify (object, pspec->name);
if ( pspec->value_type != G_TYPE_STRING )
{
g_value_init (&save_dst, G_TYPE_STRING);
if ( G_LIKELY (g_value_transform (value, &save_dst)) )
{
g_object_set_property (G_OBJECT (conf), pspec->name, &save_dst);
parole_rc_write_entry_string (pspec->name, PAROLE_RC_GROUP_GENERAL, g_value_get_string (&save_dst));
}
else
g_warning ("Unable to save property : %s", pspec->name);
g_value_unset (&save_dst);
}
else
{
parole_rc_write_entry_string (pspec->name, PAROLE_RC_GROUP_GENERAL, g_value_get_string (value));
}
}
g_object_notify (G_OBJECT (conf), pspec->name);
out:
;
}
static void parole_conf_get_property (GObject *object,
......@@ -168,55 +115,22 @@ static void parole_conf_get_property (GObject *object,
GParamSpec *pspec)
{
ParoleConf *conf;
GValue *src;
conf = PAROLE_CONF (object);
switch (prop_id)
src = conf->priv->values + prop_id;
if (G_VALUE_HOLDS (src, pspec->value_type))
{
if (G_LIKELY (pspec->value_type == G_TYPE_STRING))
g_value_set_static_string (value, g_value_get_string (src));
else
g_value_copy (src, value);
}
else
{
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;
case PROP_VIS_NAME:
g_value_set_string (value, conf->priv->vis_sink);
break;
case PROP_SUBTITLE_ENABLED:
g_value_set_boolean (value, conf->priv->enable_subtitle);
break;
case PROP_SUBTITLE_FONT:
g_value_set_string (value, conf->priv->subtitle_font);
break;
case PROP_REPEAT:
g_value_set_boolean (value, conf->priv->repeat);
break;
case PROP_SHUFFLE:
g_value_set_boolean (value, conf->priv->shuffle);
break;
case PROP_SATURATION:
g_value_set_int (value, conf->priv->saturation);
break;
case PROP_HUE:
g_value_set_int (value, conf->priv->hue);
break;
case PROP_CONTRAST:
g_value_set_int (value, conf->priv->contrast);
break;
case PROP_BRIGHTNESS:
g_value_set_int (value, conf->priv->brightness);
break;
case PROP_ASPECT_RATIO:
g_value_set_enum (value, conf->priv->aspect_ratio);
break;
case PROP_WINDOW_WIDTH:
g_value_set_int (value, conf->priv->window_width);
break;
case PROP_WINDOW_HEIGHT:
g_value_set_int (value, conf->priv->window_height);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
g_param_value_set_default (pspec, value);
}
}
......@@ -224,14 +138,49 @@ static void
parole_conf_finalize (GObject *object)
{
ParoleConf *conf;
guint i;
conf = PAROLE_CONF (object);
g_free (conf->priv->vis_sink);
g_free (conf->priv->subtitle_font);
g_free (conf->priv->subtitle_encoding);
for ( i = 0; i < N_PROP; i++)
{
if ( G_IS_VALUE (conf->priv->values + i) )
g_value_unset (conf->priv->values + i);
}