[Xfce4-commits] <parole:ochosi/comments> Add a few initial comments
Simon Steinbeiss
noreply at xfce.org
Thu Sep 20 19:06:01 CEST 2012
Updating branch refs/heads/ochosi/comments
to f06ff6c539a8448495306348d3f93f25a2ebf8f0 (commit)
from 1201f19a53e87fbf99018eaef4bbe8d832f114c2 (commit)
commit f06ff6c539a8448495306348d3f93f25a2ebf8f0
Author: Simon Steinbeiss <ochosi at xfce.org>
Date: Mon Sep 17 19:12:24 2012 +0200
Add a few initial comments
src/main.c | 13 ++++++++++---
src/parole-about.c | 3 +++
src/parole-builder.c | 1 +
src/parole-conf-dialog.c | 23 ++++++++++++++++++++++-
src/parole-conf.c | 15 +++++++++++++--
5 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/src/main.c b/src/main.c
index 7f64524..2724f37 100644
--- a/src/main.c
+++ b/src/main.c
@@ -69,6 +69,7 @@ parole_sig_handler (gint sig, gpointer data)
parole_player_terminate (player);
}
+/* Load discs that are passed as cli arguments to Parole */
static void
parole_send_play_disc (const gchar *uri, const gchar *device)
{
@@ -104,6 +105,7 @@ parole_send_play_disc (const gchar *uri, const gchar *device)
g_object_unref (proxy);
}
+/* Load files that are passed as cli arguments to Parole */
static void
parole_send_files (gchar **filenames, gboolean enqueue)
{
@@ -222,6 +224,7 @@ int main (int argc, char **argv)
gboolean enqueue = FALSE;
gchar *client_id = NULL;
+/* Command-line options */
GOptionEntry option_entries[] =
{
{ "new-instance", 'i', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &new_instance, N_("Open a new instance"), NULL },
@@ -274,7 +277,8 @@ int main (int argc, char **argv)
if ( version )
show_version ();
-
+
+/* Check for cli options if there is an instance of Parole already */
if ( !new_instance && parole_dbus_name_has_owner (PAROLE_DBUS_NAME) )
{
if (!enqueue)
@@ -312,7 +316,8 @@ int main (int argc, char **argv)
if ( mute )
parole_send_message ("Mute");
}
-
+
+/* Create a new instance because Parole isn't running */
else
{
builder = parole_builder_get_main_interface ();
@@ -362,10 +367,12 @@ int main (int argc, char **argv)
g_error_free (error);
}
+/* Initialize the plugin-manager and load the plugins */
plugins = parole_plugins_manager_new (!no_plugins);
parole_plugins_manager_load (plugins);
g_object_unref (builder);
-
+
+/* Start main process */
gdk_notify_startup_complete ();
gtk_main ();
diff --git a/src/parole-about.c b/src/parole-about.c
index 5b1d7c4..3e3173d 100644
--- a/src/parole-about.c
+++ b/src/parole-about.c
@@ -34,8 +34,10 @@
#include "parole-about.h"
+/* About dialog */
void parole_about (GtkWindow *parent)
{
+/* List of authors */
static const gchar *authors[] =
{
"Ali Abdallah <aliov at xfce.org>",
@@ -44,6 +46,7 @@ void parole_about (GtkWindow *parent)
NULL,
};
+/* List of translators */
static const gchar *documenters[] =
{
"Ali Abdallah <aliov at xfce.org>",
diff --git a/src/parole-builder.c b/src/parole-builder.c
index cc1752c..237429f 100644
--- a/src/parole-builder.c
+++ b/src/parole-builder.c
@@ -31,6 +31,7 @@
#include "interfaces/parole_ui.h"
#include "parole-builder.h"
+/* Build Parole's UI from the interface-file */
GtkBuilder *
parole_builder_get_main_interface (void)
{
diff --git a/src/parole-conf-dialog.c b/src/parole-conf-dialog.c
index 3158cb1..d86face 100644
--- a/src/parole-conf-dialog.c
+++ b/src/parole-conf-dialog.c
@@ -117,6 +117,7 @@ struct ParoleConfDialogPrivate
G_DEFINE_TYPE (ParoleConfDialog, parole_conf_dialog, G_TYPE_OBJECT)
+/* Destroy the dialog */
static void
parole_conf_dialog_destroy (GtkWidget *widget, ParoleConfDialog *self)
{
@@ -124,13 +125,15 @@ parole_conf_dialog_destroy (GtkWidget *widget, ParoleConfDialog *self)
g_object_unref (self);
}
+/* Replace the playlist with newly opened files */
void replace_playlist_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self)
{
g_object_set (G_OBJECT (self->priv->conf),
"replace-playlist", gtk_toggle_button_get_active (widget),
NULL);
}
-
+
+/* Remove duplicate entries from the playlist FIXME */
void remove_duplicated_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self)
{
g_object_set (G_OBJECT (self->priv->conf),
@@ -138,6 +141,7 @@ void remove_duplicated_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *se
NULL);
}
+/* Automatically start playing opened files (vs. just adding them to the playlist) */
void start_playing_opened_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self)
{
g_object_set (G_OBJECT (self->priv->conf),
@@ -145,6 +149,7 @@ void start_playing_opened_toggled_cb (GtkToggleButton *widget, ParoleConfDialog
NULL);
}
+/* Remember whether the playlist was visible in the previous session */
void remember_playlist_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self)
{
g_object_set (G_OBJECT (self->priv->conf),
@@ -159,6 +164,7 @@ void multimedia_keys_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self
NULL);
}
+/* Change the various image properties */
void reset_color_clicked_cb (GtkButton *button, ParoleConfDialog *self)
{
gtk_range_set_value (GTK_RANGE (self->priv->brightness), 0);
@@ -186,6 +192,7 @@ void parole_conf_dialog_subtitle_encoding_changed_cb (GtkComboBox *widget, Parol
NULL);
}
+/* Enable visualisations */
void parole_conf_dialog_enable_vis_changed_cb (GtkToggleButton *widget, ParoleConfDialog *self)
{
gboolean active;
@@ -199,6 +206,7 @@ void parole_conf_dialog_enable_vis_changed_cb (GtkToggleButton *widget, ParoleCo
gtk_widget_set_sensitive (self->priv->vis_combox, active);
}
+/* Generic function to change all image properties */
static void
set_effect_value (ParoleConfDialog *self, GtkRange *range, const gchar *name)
{
@@ -211,21 +219,25 @@ set_effect_value (ParoleConfDialog *self, GtkRange *range, const gchar *name)
NULL);
}
+/* Change brightness */
void brightness_value_changed_cb (GtkRange *range, ParoleConfDialog *self)
{
set_effect_value (self, range, "brightness");
}
+/* Change contrast */
void contrast_value_changed_cb (GtkRange *range, ParoleConfDialog *self)
{
set_effect_value (self, range, "contrast");
}
+/* Change hue */
void hue_value_changed_cb (GtkRange *range, ParoleConfDialog *self)
{
set_effect_value (self, range, "hue");
}
+/* Change saturation */
void saturation_value_changed_cb (GtkRange *range, ParoleConfDialog *self)
{
set_effect_value (self, range, "saturation");
@@ -257,6 +269,7 @@ void parole_conf_dialog_reset_saver_changed_cb (GtkToggleButton *widget, ParoleC
NULL);
}
+/* Change subtitle font */
void parole_conf_dialog_font_set_cb (GtkFontButton *button, ParoleConfDialog *self)
{
g_object_set (G_OBJECT (self->priv->conf),
@@ -264,6 +277,7 @@ void parole_conf_dialog_font_set_cb (GtkFontButton *button, ParoleConfDialog *se
NULL);
}
+/* Enable subtitles by default */
void parole_conf_dialog_enable_subtitle_changed_cb (GtkToggleButton *widget, ParoleConfDialog *self)
{
gboolean active;
@@ -275,6 +289,7 @@ void parole_conf_dialog_enable_subtitle_changed_cb (GtkToggleButton *widget, Par
NULL);
}
+/* Finalize the dialog */
static void
parole_conf_dialog_finalize (GObject *object)
{
@@ -288,6 +303,7 @@ parole_conf_dialog_finalize (GObject *object)
G_OBJECT_CLASS (parole_conf_dialog_parent_class)->finalize (object);
}
+/* Initialize the config-dialog class */
static void
parole_conf_dialog_class_init (ParoleConfDialogClass *klass)
{
@@ -298,6 +314,7 @@ parole_conf_dialog_class_init (ParoleConfDialogClass *klass)
g_type_class_add_private (klass, sizeof (ParoleConfDialogPrivate));
}
+/* Initialize the dialog */
static void
parole_conf_dialog_init (ParoleConfDialog *self)
{
@@ -307,12 +324,14 @@ parole_conf_dialog_init (ParoleConfDialog *self)
self->priv->vis_plugins = parole_vis_get_plugins ();
}
+/* Fill the combobox with visualisations */
static void
parole_conf_dialog_add_vis_plugins (gpointer key, gpointer value, GtkWidget *combox)
{
gtk_combo_box_append_text (GTK_COMBO_BOX (combox), (const gchar *) key);
}
+/* Set the combobox to the default visualisation plugin */
static gboolean
parole_conf_dialog_set_default_vis_plugin (GtkTreeModel *model, GtkTreePath *path,
GtkTreeIter *iter, ParoleConfDialog *self)
@@ -407,6 +426,7 @@ parole_conf_dialog_set_defaults_general (ParoleConfDialog *self, GtkBuilder *bui
}
+/* Load the settings stored in the rc file */
static void
parole_conf_dialog_set_defaults (ParoleConfDialog *self)
{
@@ -423,6 +443,7 @@ parole_conf_dialog_set_defaults (ParoleConfDialog *self)
"subtitle-encoding", &subtitle_encoding,
NULL);
+/* Update widget-states according to settings */
gtk_widget_set_sensitive (self->priv->vis_combox, vis_enabled);
gtk_widget_set_sensitive (self->priv->font_button, subtitle);
diff --git a/src/parole-conf.c b/src/parole-conf.c
index 2fb96e6..24bb630 100644
--- a/src/parole-conf.c
+++ b/src/parole-conf.c
@@ -50,22 +50,29 @@ G_DEFINE_TYPE (ParoleConf, parole_conf, G_TYPE_OBJECT)
enum
{
PROP_0,
+ /*Visualisations*/
PROP_VIS_ENABLED,
PROP_VIS_NAME,
+ /*Screensaver*/
PROP_DISABLE_SCREEN_SAVER,
+ /*Subtitles*/
PROP_SUBTITLE_ENABLED,
PROP_SUBTITLE_FONT,
PROP_SUBTITLE_ENCODING,
+ /*Playback*/
PROP_REPEAT,
PROP_SHUFFLE,
+ /*Video properties*/
PROP_BRIGHTNESS,
PROP_CONTRAST,
PROP_HUE,
PROP_SATURATION,
PROP_ASPECT_RATIO,
+ /*Window properties*/
PROP_WINDOW_WIDTH,
PROP_WINDOW_HEIGHT,
PROP_MINIMIZED,
+ /*Grab Multimedia keys*/
PROP_MULTIMEDIA_KEYS,
/*Playlist*/
PROP_SHOWHIDE_PLAYLIST,
@@ -77,6 +84,7 @@ enum
N_PROP
};
+/* Write property-values to the rc file */
static void parole_conf_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -122,6 +130,7 @@ static void parole_conf_set_property (GObject *object,
}
}
+/* Read property-values from the rc file */
static void parole_conf_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -385,7 +394,6 @@ parole_conf_class_init (ParoleConfClass *klass)
G_PARAM_READWRITE));
/**
- *
* Remove duplicated entries from the playlist.
**/
g_object_class_install_property (object_class,
@@ -398,6 +406,7 @@ parole_conf_class_init (ParoleConfClass *klass)
g_type_class_add_private (klass, sizeof (ParoleConfPrivate));
}
+/* Load the rc file */
static void
parole_conf_load (ParoleConf *conf)
{
@@ -410,6 +419,7 @@ parole_conf_load (ParoleConf *conf)
rc = parole_get_resource_file (PAROLE_RC_GROUP_GENERAL, TRUE);
+/* Check whether rc file exists */
if ( G_UNLIKELY (rc == NULL ) )
{
g_debug ("Unable to lookup rc file in : %s\n", PAROLE_RESOURCE_FILE);
@@ -421,7 +431,8 @@ parole_conf_load (ParoleConf *conf)
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (conf), &nspecs);
g_value_init (&src, G_TYPE_STRING);
-
+
+/* Load each property */
for ( i = 0; i < nspecs; i++)
{
pspec = pspecs[i];
More information about the Xfce4-commits
mailing list