[Xfce4-commits] <xfce4-mixer:master> Cleanup
Guido Berhoerster
noreply at xfce.org
Thu Sep 27 16:46:33 CEST 2012
Updating branch refs/heads/master
to 69ea8a3321eb316642873441df7386b6ca02320e (commit)
from 6c88d1adf7dc933a678e4fd47f7912958f1c3426 (commit)
commit 69ea8a3321eb316642873441df7386b6ca02320e
Author: Guido Berhoerster <guido+xfce at berhoerster.name>
Date: Thu Sep 27 16:31:09 2012 +0200
Cleanup
Remove toggle_action_entries empty array which is invalid C.
Remove incorrect semicolon from G_BEGIN_DECLS/G_END_DECLS macros.
Properly chain up the constructed virtual method in XfceMixer.
Use enums instead of macros for columns which show up in debuggers.
Use G_DEFINE_TYPE macro.
Renamed XfceMixer to XfceMixerContainer to solve namespace clash with
libxfce4mixer.
Use correct type for the handler id of
g_signal_handler_connect/g_signal_handler_disconnect in
xfce_mixer_bus_connect/xfce_mixer_bus_disconnect.
Rename _xfce_mixer_bus_message parameter in order not to shadow a global
variable.
libxfce4mixer/libxfce4mixer.c | 6 +-
libxfce4mixer/libxfce4mixer.h | 8 +-
libxfce4mixer/xfce-mixer-card-combo.c | 45 +----
libxfce4mixer/xfce-mixer-card-combo.h | 4 +-
libxfce4mixer/xfce-mixer-preferences.c | 36 +---
libxfce4mixer/xfce-mixer-preferences.h | 4 +-
libxfce4mixer/xfce-mixer-track-combo.c | 47 +----
libxfce4mixer/xfce-mixer-track-combo.h | 4 +-
libxfce4mixer/xfce-mixer-track-type.h | 4 +-
panel-plugin/xfce-mixer-plugin.c | 2 +-
panel-plugin/xfce-mixer-plugin.h | 4 +-
panel-plugin/xfce-plugin-dialog.c | 36 +---
panel-plugin/xfce-plugin-dialog.h | 4 +-
panel-plugin/xfce-volume-button.c | 36 +---
panel-plugin/xfce-volume-button.h | 4 +-
po/POTFILES.in | 4 +-
xfce4-mixer/Makefile.am | 4 +-
.../{xfce-mixer.c => xfce-mixer-container.c} | 226 +++++++++-----------
xfce4-mixer/xfce-mixer-container.h | 47 ++++
xfce4-mixer/xfce-mixer-controls-dialog.c | 45 +----
xfce4-mixer/xfce-mixer-controls-dialog.h | 4 +-
xfce4-mixer/xfce-mixer-option.c | 43 +----
xfce4-mixer/xfce-mixer-option.h | 4 +-
xfce4-mixer/xfce-mixer-switch.c | 36 +---
xfce4-mixer/xfce-mixer-switch.h | 4 +-
xfce4-mixer/xfce-mixer-track.c | 36 +---
xfce4-mixer/xfce-mixer-track.h | 4 +-
xfce4-mixer/xfce-mixer-window.c | 61 +-----
xfce4-mixer/xfce-mixer-window.h | 4 +-
xfce4-mixer/xfce-mixer.h | 47 ----
30 files changed, 222 insertions(+), 591 deletions(-)
diff --git a/libxfce4mixer/libxfce4mixer.c b/libxfce4mixer/libxfce4mixer.c
index 244196c..26683b8 100644
--- a/libxfce4mixer/libxfce4mixer.c
+++ b/libxfce4mixer/libxfce4mixer.c
@@ -355,7 +355,7 @@ xfce_mixer_get_track_label (GstMixerTrack *track)
-guint
+gulong
xfce_mixer_bus_connect (GCallback callback,
gpointer user_data)
{
@@ -366,7 +366,7 @@ xfce_mixer_bus_connect (GCallback callback,
void
-xfce_mixer_bus_disconnect (guint signal_handler_id)
+xfce_mixer_bus_disconnect (gulong signal_handler_id)
{
g_return_if_fail (refcount > 0);
@@ -514,7 +514,7 @@ _xfce_mixer_destroy_mixer (GstMixer *mixer)
static void
-_xfce_mixer_bus_message (GstBus *bus,
+_xfce_mixer_bus_message (GstBus *bus_,
GstMessage *message,
gpointer user_data)
{
diff --git a/libxfce4mixer/libxfce4mixer.h b/libxfce4mixer/libxfce4mixer.h
index 59b7a1e..ad74ba0 100644
--- a/libxfce4mixer/libxfce4mixer.h
+++ b/libxfce4mixer/libxfce4mixer.h
@@ -36,7 +36,7 @@
#define XFCE_MIXER_TYPE_VALUE_ARRAY (xfce_mixer_value_array_get_type ())
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
void xfce_mixer_init (void);
void xfce_mixer_shutdown (void);
@@ -52,15 +52,15 @@ GstMixerTrack *xfce_mixer_get_track (GstElement *card,
GstMixerTrack *xfce_mixer_get_default_track (GstElement *card);
GList *xfce_mixer_get_default_track_list (GstElement *card);
const gchar *xfce_mixer_get_track_label (GstMixerTrack *track);
-guint xfce_mixer_bus_connect (GCallback callback,
+gulong xfce_mixer_bus_connect (GCallback callback,
gpointer user_data);
-void xfce_mixer_bus_disconnect (guint signal_handler_id);
+void xfce_mixer_bus_disconnect (gulong signal_handler_id);
gint xfce_mixer_get_max_volume (gint *volumes,
gint num_channels);
int xfce_mixer_utf8_cmp (const gchar *s1,
const gchar *s2);
GType xfce_mixer_value_array_get_type (void);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__LIBXFCE4MIXER_H__ */
diff --git a/libxfce4mixer/xfce-mixer-card-combo.c b/libxfce4mixer/xfce-mixer-card-combo.c
index e75d6ab..f0ced37 100644
--- a/libxfce4mixer/xfce-mixer-card-combo.c
+++ b/libxfce4mixer/xfce-mixer-card-combo.c
@@ -31,10 +31,11 @@
-#define NAME_COLUMN 0
-#define CARD_COLUMN 1
-
-
+enum
+{
+ NAME_COLUMN,
+ CARD_COLUMN
+};
enum
{
@@ -48,8 +49,6 @@ static guint combo_signals[LAST_SIGNAL];
-static void xfce_mixer_card_combo_class_init (XfceMixerCardComboClass *klass);
-static void xfce_mixer_card_combo_init (XfceMixerCardCombo *combo);
static void xfce_mixer_card_combo_finalize (GObject *object);
static void xfce_mixer_card_combo_changed (XfceMixerCardCombo *combo);
@@ -69,36 +68,7 @@ struct _XfceMixerCardCombo
-static GObjectClass *xfce_mixer_card_combo_parent_class = NULL;
-
-
-
-GType
-xfce_mixer_card_combo_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceMixerCardComboClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_mixer_card_combo_class_init,
- NULL,
- NULL,
- sizeof (XfceMixerCardCombo),
- 0,
- (GInstanceInitFunc) xfce_mixer_card_combo_init,
- NULL,
- };
-
- type = g_type_register_static (GTK_TYPE_COMBO_BOX, "XfceMixerCardCombo", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceMixerCardCombo, xfce_mixer_card_combo, GTK_TYPE_COMBO_BOX)
@@ -107,9 +77,6 @@ xfce_mixer_card_combo_class_init (XfceMixerCardComboClass *klass)
{
GObjectClass *gobject_class;
- /* Determine parent type class */
- xfce_mixer_card_combo_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = xfce_mixer_card_combo_finalize;
diff --git a/libxfce4mixer/xfce-mixer-card-combo.h b/libxfce4mixer/xfce-mixer-card-combo.h
index 90b959a..8d592f2 100644
--- a/libxfce4mixer/xfce-mixer-card-combo.h
+++ b/libxfce4mixer/xfce-mixer-card-combo.h
@@ -23,7 +23,7 @@
#include <gtk/gtk.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceMixerCardComboClass XfceMixerCardComboClass;
typedef struct _XfceMixerCardCombo XfceMixerCardCombo;
@@ -42,6 +42,6 @@ GstElement *xfce_mixer_card_combo_get_active_card (XfceMixerCardCombo *combo);
void xfce_mixer_card_combo_set_active_card (XfceMixerCardCombo *combo,
GstElement *card);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_MIXER_CARD_COMBO_H__ */
diff --git a/libxfce4mixer/xfce-mixer-preferences.c b/libxfce4mixer/xfce-mixer-preferences.c
index 7f939b2..117ebcf 100644
--- a/libxfce4mixer/xfce-mixer-preferences.c
+++ b/libxfce4mixer/xfce-mixer-preferences.c
@@ -44,8 +44,6 @@ enum
-static void xfce_mixer_preferences_class_init (XfceMixerPreferencesClass *klass);
-static void xfce_mixer_preferences_init (XfceMixerPreferences *preferences);
static void xfce_mixer_preferences_finalize (GObject *object);
static void xfce_mixer_preferences_get_property (GObject *object,
guint prop_id,
@@ -82,36 +80,7 @@ struct _XfceMixerPreferences
-static GObjectClass *xfce_mixer_preferences_parent_class = NULL;
-
-
-
-GType
-xfce_mixer_preferences_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceMixerPreferencesClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_mixer_preferences_class_init,
- NULL,
- NULL,
- sizeof (XfceMixerPreferences),
- 0,
- (GInstanceInitFunc) xfce_mixer_preferences_init,
- NULL,
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "XfceMixerPreferences", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceMixerPreferences, xfce_mixer_preferences, G_TYPE_OBJECT)
@@ -120,9 +89,6 @@ xfce_mixer_preferences_class_init (XfceMixerPreferencesClass *klass)
{
GObjectClass *gobject_class;
- /* Determine parent type class */
- xfce_mixer_preferences_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = xfce_mixer_preferences_get_property;
gobject_class->set_property = xfce_mixer_preferences_set_property;
diff --git a/libxfce4mixer/xfce-mixer-preferences.h b/libxfce4mixer/xfce-mixer-preferences.h
index c4aa5c8..ad9e06c 100644
--- a/libxfce4mixer/xfce-mixer-preferences.h
+++ b/libxfce4mixer/xfce-mixer-preferences.h
@@ -27,7 +27,7 @@
#include <gst/gst.h>
#include <gst/interfaces/mixer.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceMixerPreferencesClass XfceMixerPreferencesClass;
typedef struct _XfceMixerPreferences XfceMixerPreferences;
@@ -48,6 +48,6 @@ GPtrArray *xfce_mixer_preferences_get_controls (XfceMixerPref
gboolean xfce_mixer_preferences_get_control_visible (XfceMixerPreferences *preferences,
const gchar *track_label);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_MIXER_PREFERENCES_H__ */
diff --git a/libxfce4mixer/xfce-mixer-track-combo.c b/libxfce4mixer/xfce-mixer-track-combo.c
index d0c52d1..c679a99 100644
--- a/libxfce4mixer/xfce-mixer-track-combo.c
+++ b/libxfce4mixer/xfce-mixer-track-combo.c
@@ -36,10 +36,11 @@
-#define NAME_COLUMN 0
-#define TRACK_COLUMN 1
-
-
+enum
+{
+ NAME_COLUMN,
+ TRACK_COLUMN
+};
enum
{
@@ -53,8 +54,6 @@ static guint combo_signals[LAST_SIGNAL];
-static void xfce_mixer_track_combo_class_init (XfceMixerTrackComboClass *klass);
-static void xfce_mixer_track_combo_init (XfceMixerTrackCombo *combo);
static void xfce_mixer_track_combo_finalize (GObject *object);
static void xfce_mixer_track_combo_update_track_list (XfceMixerTrackCombo *combo);
static void xfce_mixer_track_combo_bus_message (GstBus *bus,
@@ -77,41 +76,12 @@ struct _XfceMixerTrackCombo
GstElement *card;
GstMixerTrack *track;
- guint signal_handler_id;
+ gulong signal_handler_id;
};
-static GObjectClass *xfce_mixer_track_combo_parent_class = NULL;
-
-
-
-GType
-xfce_mixer_track_combo_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceMixerTrackComboClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_mixer_track_combo_class_init,
- NULL,
- NULL,
- sizeof (XfceMixerTrackCombo),
- 0,
- (GInstanceInitFunc) xfce_mixer_track_combo_init,
- NULL,
- };
-
- type = g_type_register_static (GTK_TYPE_COMBO_BOX, "XfceMixerTrackCombo", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceMixerTrackCombo, xfce_mixer_track_combo, GTK_TYPE_COMBO_BOX)
@@ -120,9 +90,6 @@ xfce_mixer_track_combo_class_init (XfceMixerTrackComboClass *klass)
{
GObjectClass *gobject_class;
- /* Determine parent type class */
- xfce_mixer_track_combo_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = xfce_mixer_track_combo_finalize;
diff --git a/libxfce4mixer/xfce-mixer-track-combo.h b/libxfce4mixer/xfce-mixer-track-combo.h
index 73a4a21..a6bd948 100644
--- a/libxfce4mixer/xfce-mixer-track-combo.h
+++ b/libxfce4mixer/xfce-mixer-track-combo.h
@@ -27,7 +27,7 @@
#include <gst/gst.h>
#include <gst/interfaces/mixer.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceMixerTrackComboClass XfceMixerTrackComboClass;
typedef struct _XfceMixerTrackCombo XfceMixerTrackCombo;
@@ -50,6 +50,6 @@ GstMixerTrack *xfce_mixer_track_combo_get_active_track (XfceMixerTrackCombo *com
void xfce_mixer_track_combo_set_active_track (XfceMixerTrackCombo *combo,
GstMixerTrack *track);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_MIXER_TRACK_COMBO_H__ */
diff --git a/libxfce4mixer/xfce-mixer-track-type.h b/libxfce4mixer/xfce-mixer-track-type.h
index 3695289..bbaf416 100644
--- a/libxfce4mixer/xfce-mixer-track-type.h
+++ b/libxfce4mixer/xfce-mixer-track-type.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gst/interfaces/mixer.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef enum
{
@@ -40,6 +40,6 @@ GType xfce_mixer_track_type_get_type (void) G_GNUC_CONST G_GNUC_INT
XfceMixerTrackType xfce_mixer_track_type_new (GstMixerTrack *track);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_TRACK_TYPE_H__ */
diff --git a/panel-plugin/xfce-mixer-plugin.c b/panel-plugin/xfce-mixer-plugin.c
index ae64f6c..2cb25c8 100644
--- a/panel-plugin/xfce-mixer-plugin.c
+++ b/panel-plugin/xfce-mixer-plugin.c
@@ -154,7 +154,7 @@ struct _XfceMixerPlugin
gboolean ignore_bus_messages;
/* GstBus connection id */
- guint message_handler_id;
+ gulong message_handler_id;
};
diff --git a/panel-plugin/xfce-mixer-plugin.h b/panel-plugin/xfce-mixer-plugin.h
index 3017b5d..0ab5e06 100644
--- a/panel-plugin/xfce-mixer-plugin.h
+++ b/panel-plugin/xfce-mixer-plugin.h
@@ -23,7 +23,7 @@
#include <gtk/gtk.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceMixerPluginClass XfceMixerPluginClass;
typedef struct _XfceMixerPlugin XfceMixerPlugin;
@@ -39,6 +39,6 @@ GType xfce_mixer_plugin_get_type (void) G_GNUC_CONST;
void xfce_mixer_plugin_register_type (XfcePanelTypeModule *type_module);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_MIXER_PLUGIN_H__ */
diff --git a/panel-plugin/xfce-plugin-dialog.c b/panel-plugin/xfce-plugin-dialog.c
index a8845f0..1680834 100644
--- a/panel-plugin/xfce-plugin-dialog.c
+++ b/panel-plugin/xfce-plugin-dialog.c
@@ -40,8 +40,6 @@
-static void xfce_plugin_dialog_class_init (XfcePluginDialogClass *klass);
-static void xfce_plugin_dialog_init (XfcePluginDialog *dialog);
static void xfce_plugin_dialog_dispose (GObject *object);
static void xfce_plugin_dialog_finalize (GObject *object);
static void xfce_plugin_dialog_create_contents (XfcePluginDialog *dialog);
@@ -79,36 +77,7 @@ struct _XfcePluginDialog
-static GObjectClass *xfce_plugin_dialog_parent_class = NULL;
-
-
-
-GType
-xfce_plugin_dialog_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfcePluginDialogClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_plugin_dialog_class_init,
- NULL,
- NULL,
- sizeof (XfcePluginDialog),
- 0,
- (GInstanceInitFunc) xfce_plugin_dialog_init,
- NULL,
- };
-
- type = g_type_register_static (XFCE_TYPE_TITLED_DIALOG, "XfcePluginDialog", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfcePluginDialog, xfce_plugin_dialog, XFCE_TYPE_TITLED_DIALOG)
@@ -117,9 +86,6 @@ xfce_plugin_dialog_class_init (XfcePluginDialogClass *klass)
{
GObjectClass *gobject_class;
- /* Determine parent type class */
- xfce_plugin_dialog_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = xfce_plugin_dialog_dispose;
gobject_class->finalize = xfce_plugin_dialog_finalize;
diff --git a/panel-plugin/xfce-plugin-dialog.h b/panel-plugin/xfce-plugin-dialog.h
index 3588400..890fe3f 100644
--- a/panel-plugin/xfce-plugin-dialog.h
+++ b/panel-plugin/xfce-plugin-dialog.h
@@ -27,7 +27,7 @@
#include <gst/gst.h>
#include <gst/interfaces/mixer.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfcePluginDialogClass XfcePluginDialogClass;
typedef struct _XfcePluginDialog XfcePluginDialog;
@@ -45,6 +45,6 @@ GType xfce_plugin_dialog_get_type (void) G_GNUC_CONST;
GtkWidget *xfce_plugin_dialog_new (XfcePanelPlugin *plugin);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_PLUGIN_DIALOG_H__ */
diff --git a/panel-plugin/xfce-volume-button.c b/panel-plugin/xfce-volume-button.c
index 188e4a6..4a25fb3 100644
--- a/panel-plugin/xfce-volume-button.c
+++ b/panel-plugin/xfce-volume-button.c
@@ -84,8 +84,6 @@ static const char *icons[] = {
-static void xfce_volume_button_class_init (XfceVolumeButtonClass *klass);
-static void xfce_volume_button_init (XfceVolumeButton *button);
static void xfce_volume_button_dispose (GObject *object);
static void xfce_volume_button_finalize (GObject *object);
static void xfce_volume_button_set_property (GObject *object,
@@ -177,36 +175,7 @@ struct _XfceVolumeButton
-static GObjectClass *xfce_volume_button_parent_class = NULL;
-
-
-
-GType
-xfce_volume_button_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceVolumeButtonClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_volume_button_class_init,
- NULL,
- NULL,
- sizeof (XfceVolumeButton),
- 0,
- (GInstanceInitFunc) xfce_volume_button_init,
- NULL,
- };
-
- type = g_type_register_static (GTK_TYPE_TOGGLE_BUTTON, "XfceVolumeButton", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceVolumeButton, xfce_volume_button, GTK_TYPE_TOGGLE_BUTTON)
@@ -217,9 +186,6 @@ xfce_volume_button_class_init (XfceVolumeButtonClass *klass)
GtkWidgetClass *gtk_widget_class;
GtkToggleButtonClass *gtk_toggle_button_class;
- /* Determine parent type class */
- xfce_volume_button_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = xfce_volume_button_dispose;
gobject_class->finalize = xfce_volume_button_finalize;
diff --git a/panel-plugin/xfce-volume-button.h b/panel-plugin/xfce-volume-button.h
index 2514d57..8de0d17 100644
--- a/panel-plugin/xfce-volume-button.h
+++ b/panel-plugin/xfce-volume-button.h
@@ -26,7 +26,7 @@
#include <libxfce4panel/libxfce4panel.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceVolumeButtonClass XfceVolumeButtonClass;
typedef struct _XfceVolumeButton XfceVolumeButton;
@@ -62,6 +62,6 @@ void xfce_volume_button_set_screen_position (XfceVolumeButton *b
XfceScreenPosition screen_position);
XfceScreenPosition xfce_volume_button_get_screen_position (XfceVolumeButton *button);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_VOLUME_BUTTON_H__ */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0a7c7c3..94e7dbb 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -14,14 +14,14 @@ libxfce4mixer/xfce-mixer-preferences.h
libxfce4mixer/xfce-mixer-track-combo.h
libxfce4mixer/xfce-mixer-track-type.h
xfce4-mixer/main.c
-xfce4-mixer/xfce-mixer.c
+xfce4-mixer/xfce-mixer-container.c
xfce4-mixer/xfce-mixer-controls-dialog.c
xfce4-mixer/xfce-mixer-option.c
xfce4-mixer/xfce-mixer-switch.c
xfce4-mixer/xfce-mixer-track.c
xfce4-mixer/xfce-mixer-window.c
xfce4-mixer/xfce-mixer-controls-dialog.h
-xfce4-mixer/xfce-mixer.h
+xfce4-mixer/xfce-mixer-container.h
xfce4-mixer/xfce-mixer-option.h
xfce4-mixer/xfce-mixer-switch.h
xfce4-mixer/xfce-mixer-track.h
diff --git a/xfce4-mixer/Makefile.am b/xfce4-mixer/Makefile.am
index 820711f..4af69e9 100644
--- a/xfce4-mixer/Makefile.am
+++ b/xfce4-mixer/Makefile.am
@@ -11,8 +11,8 @@ xfce4_mixer_SOURCES = \
xfce-mixer-switch.h \
xfce-mixer-option.c \
xfce-mixer-option.h \
- xfce-mixer.c \
- xfce-mixer.h \
+ xfce-mixer-container.c \
+ xfce-mixer-container.h \
xfce-mixer-controls-dialog.c \
xfce-mixer-controls-dialog.h \
xfce-mixer-window.h \
diff --git a/xfce4-mixer/xfce-mixer.c b/xfce4-mixer/xfce-mixer-container.c
similarity index 65%
rename from xfce4-mixer/xfce-mixer.c
rename to xfce4-mixer/xfce-mixer-container.c
index 9f72d68..d20f949 100644
--- a/xfce4-mixer/xfce-mixer.c
+++ b/xfce4-mixer/xfce-mixer-container.c
@@ -31,7 +31,7 @@
#include "libxfce4mixer/libxfce4mixer.h"
-#include "xfce-mixer.h"
+#include "xfce-mixer-container.h"
#include "xfce-mixer-track.h"
#include "xfce-mixer-switch.h"
#include "xfce-mixer-option.h"
@@ -46,89 +46,55 @@ enum
-static void xfce_mixer_class_init (XfceMixerClass *klass);
-static void xfce_mixer_instance_init (XfceMixer *mixer);
-static void xfce_mixer_constructed (GObject *object);
-static void xfce_mixer_finalize (GObject *object);
-static void xfce_mixer_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void xfce_mixer_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void xfce_mixer_create_contents (XfceMixer *mixer);
-static void xfce_mixer_bus_message (GstBus *bus,
- GstMessage *message,
- XfceMixer *mixer);
+static void xfce_mixer_container_constructed (GObject *object);
+static void xfce_mixer_container_finalize (GObject *object);
+static void xfce_mixer_container_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void xfce_mixer_container_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void xfce_mixer_container_create_contents (XfceMixerContainer *mixer_container);
+static void xfce_mixer_container_bus_message (GstBus *bus,
+ GstMessage *message,
+ XfceMixerContainer *mixer_container);
-struct _XfceMixerClass
+struct _XfceMixerContainerClass
{
GtkNotebookClass __parent__;
};
-struct _XfceMixer
+struct _XfceMixerContainer
{
- GtkNotebook __parent__;
+ GtkNotebook __parent__;
- GstElement *card;
+ GstElement *card;
- GHashTable *widgets;
+ GHashTable *widgets;
- guint message_handler_id;
+ gulong message_handler_id;
};
-static GObjectClass *xfce_mixer_parent_class = NULL;
-
-
-
-GType
-xfce_mixer_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceMixerClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_mixer_class_init,
- NULL,
- NULL,
- sizeof (XfceMixer),
- 0,
- (GInstanceInitFunc) xfce_mixer_instance_init,
- NULL,
- };
-
- type = g_type_register_static (GTK_TYPE_NOTEBOOK, "XfceMixer", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceMixerContainer, xfce_mixer_container, GTK_TYPE_NOTEBOOK)
static void
-xfce_mixer_class_init (XfceMixerClass *klass)
+xfce_mixer_container_class_init (XfceMixerContainerClass *klass)
{
GObjectClass *gobject_class;
- /* Determine parent type class */
- xfce_mixer_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->constructed = xfce_mixer_constructed;
- gobject_class->finalize = xfce_mixer_finalize;
- gobject_class->get_property = xfce_mixer_get_property;
- gobject_class->set_property = xfce_mixer_set_property;
+ gobject_class->constructed = xfce_mixer_container_constructed;
+ gobject_class->finalize = xfce_mixer_container_finalize;
+ gobject_class->get_property = xfce_mixer_container_get_property;
+ gobject_class->set_property = xfce_mixer_container_set_property;
g_object_class_install_property (gobject_class,
PROP_CARD,
@@ -142,55 +108,57 @@ xfce_mixer_class_init (XfceMixerClass *klass)
static void
-xfce_mixer_instance_init (XfceMixer *mixer)
+xfce_mixer_container_init (XfceMixerContainer *mixer_container)
{
- mixer->card = NULL;
- mixer->widgets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- mixer->message_handler_id = 0;
+ mixer_container->card = NULL;
+ mixer_container->widgets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ mixer_container->message_handler_id = 0;
}
static void
-xfce_mixer_constructed (GObject *object)
+xfce_mixer_container_constructed (GObject *object)
{
- XfceMixer *mixer = XFCE_MIXER (object);
+ XfceMixerContainer *mixer_container = XFCE_MIXER_CONTAINER (object);
/* Create the content */
- xfce_mixer_create_contents (XFCE_MIXER (mixer));
+ xfce_mixer_container_create_contents (XFCE_MIXER_CONTAINER (mixer_container));
+
+ mixer_container->message_handler_id = xfce_mixer_bus_connect (G_CALLBACK (xfce_mixer_container_bus_message), mixer_container);
- mixer->message_handler_id = xfce_mixer_bus_connect (G_CALLBACK (xfce_mixer_bus_message), mixer);
+ (*G_OBJECT_CLASS (xfce_mixer_container_parent_class)->constructed) (object);
}
static void
-xfce_mixer_finalize (GObject *object)
+xfce_mixer_container_finalize (GObject *object)
{
- XfceMixer *mixer = XFCE_MIXER (object);
+ XfceMixerContainer *mixer_container = XFCE_MIXER_CONTAINER (object);
- xfce_mixer_bus_disconnect (mixer->message_handler_id);
+ xfce_mixer_bus_disconnect (mixer_container->message_handler_id);
- g_object_unref (mixer->card);
- g_hash_table_unref (mixer->widgets);
+ g_object_unref (mixer_container->card);
+ g_hash_table_unref (mixer_container->widgets);
- (*G_OBJECT_CLASS (xfce_mixer_parent_class)->finalize) (object);
+ (*G_OBJECT_CLASS (xfce_mixer_container_parent_class)->finalize) (object);
}
static void
-xfce_mixer_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+xfce_mixer_container_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- XfceMixer *mixer = XFCE_MIXER (object);
+ XfceMixerContainer *mixer_container = XFCE_MIXER_CONTAINER (object);
switch (prop_id)
{
case PROP_CARD:
- g_value_set_object (value, mixer->card);
+ g_value_set_object (value, mixer_container->card);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -201,24 +169,24 @@ xfce_mixer_get_property (GObject *object,
static void
-xfce_mixer_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+xfce_mixer_container_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- XfceMixer *mixer = XFCE_MIXER (object);
+ XfceMixerContainer *mixer_container = XFCE_MIXER_CONTAINER (object);
switch (prop_id)
{
case PROP_CARD:
- if (mixer->message_handler_id != 0)
- xfce_mixer_bus_disconnect (mixer->message_handler_id);
- mixer->card = g_value_dup_object (value);
- xfce_mixer_update_contents (mixer);
- if (GST_IS_MIXER (mixer->card))
- mixer->message_handler_id = xfce_mixer_bus_connect (G_CALLBACK (xfce_mixer_bus_message), mixer);
+ if (mixer_container->message_handler_id != 0)
+ xfce_mixer_bus_disconnect (mixer_container->message_handler_id);
+ mixer_container->card = g_value_dup_object (value);
+ xfce_mixer_container_update_contents (mixer_container);
+ if (GST_IS_MIXER (mixer_container->card))
+ mixer_container->message_handler_id = xfce_mixer_bus_connect (G_CALLBACK (xfce_mixer_container_bus_message), mixer_container);
else
- mixer->message_handler_id = 0;
+ mixer_container->message_handler_id = 0;
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -229,11 +197,11 @@ xfce_mixer_set_property (GObject *object,
GtkWidget *
-xfce_mixer_new (GstElement *card)
+xfce_mixer_container_new (GstElement *card)
{
GObject *object = NULL;
- object = g_object_new (TYPE_XFCE_MIXER, "card", card, NULL);
+ object = g_object_new (TYPE_XFCE_MIXER_CONTAINER, "card", card, NULL);
return GTK_WIDGET (object);
}
@@ -241,7 +209,7 @@ xfce_mixer_new (GstElement *card)
static void
-xfce_mixer_create_contents (XfceMixer *mixer)
+xfce_mixer_container_create_contents (XfceMixerContainer *mixer_container)
{
XfceMixerPreferences *preferences;
XfceMixerTrackType type;
@@ -264,7 +232,7 @@ xfce_mixer_create_contents (XfceMixer *mixer)
gboolean no_controls_visible = TRUE;
gint i;
- g_return_if_fail (IS_XFCE_MIXER (mixer));
+ g_return_if_fail (IS_XFCE_MIXER_CONTAINER (mixer_container));
preferences = xfce_mixer_preferences_get ();
@@ -293,9 +261,9 @@ xfce_mixer_create_contents (XfceMixer *mixer)
}
/* Create controls for all mixer tracks */
- if (GST_IS_MIXER (mixer->card))
+ if (GST_IS_MIXER (mixer_container->card))
{
- for (iter = gst_mixer_list_tracks (GST_MIXER (mixer->card)); iter != NULL; iter = g_list_next (iter))
+ for (iter = gst_mixer_list_tracks (GST_MIXER (mixer_container->card)); iter != NULL; iter = g_list_next (iter))
{
track = GST_MIXER_TRACK (iter->data);
@@ -315,7 +283,7 @@ xfce_mixer_create_contents (XfceMixer *mixer)
gtk_table_attach (GTK_TABLE (views[0]), track_label_widget,
num_children[0], num_children[0] + 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (track_label_widget);
- track_widget = xfce_mixer_track_new (mixer->card, track);
+ track_widget = xfce_mixer_track_new (mixer_container->card, track);
gtk_table_attach (GTK_TABLE (views[0]), track_widget,
num_children[0], num_children[0] + 1, 1, 2, GTK_SHRINK, GTK_FILL|GTK_EXPAND, 0, 0);
gtk_widget_show (track_widget);
@@ -329,7 +297,7 @@ xfce_mixer_create_contents (XfceMixer *mixer)
num_children[0]++;
/* Add the track to the hash table */
- g_hash_table_insert (mixer->widgets, g_strdup (track_label), track_widget);
+ g_hash_table_insert (mixer_container->widgets, g_strdup (track_label), track_widget);
break;
case XFCE_MIXER_TRACK_TYPE_CAPTURE:
@@ -338,7 +306,7 @@ xfce_mixer_create_contents (XfceMixer *mixer)
gtk_table_attach (GTK_TABLE (views[1]), track_label_widget,
num_children[1], num_children[1] + 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (track_label_widget);
- track_widget = xfce_mixer_track_new (mixer->card, track);
+ track_widget = xfce_mixer_track_new (mixer_container->card, track);
gtk_table_attach (GTK_TABLE (views[1]), track_widget,
num_children[1], num_children[1] + 1, 1, 2, GTK_SHRINK, GTK_FILL|GTK_EXPAND, 0, 0);
gtk_widget_show (track_widget);
@@ -352,11 +320,11 @@ xfce_mixer_create_contents (XfceMixer *mixer)
num_children[1]++;
/* Add the track to the hash table */
- g_hash_table_insert (mixer->widgets, g_strdup (track_label), track_widget);
+ g_hash_table_insert (mixer_container->widgets, g_strdup (track_label), track_widget);
break;
case XFCE_MIXER_TRACK_TYPE_SWITCH:
- track_widget = xfce_mixer_switch_new (mixer->card, track);
+ track_widget = xfce_mixer_switch_new (mixer_container->card, track);
gtk_table_attach (GTK_TABLE (views[2]), track_widget,
0, 1, num_children[2], num_children[2] + 1, GTK_FILL|GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (track_widget);
@@ -364,7 +332,7 @@ xfce_mixer_create_contents (XfceMixer *mixer)
num_children[2]++;
/* Add the track to the hash table */
- g_hash_table_insert (mixer->widgets, g_strdup (track_label), track_widget);
+ g_hash_table_insert (mixer_container->widgets, g_strdup (track_label), track_widget);
break;
case XFCE_MIXER_TRACK_TYPE_OPTIONS:
@@ -384,14 +352,14 @@ xfce_mixer_create_contents (XfceMixer *mixer)
1, 2, num_children[3], num_children[3] + 1, GTK_FILL|GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (option_alignment);
- track_widget = xfce_mixer_option_new (mixer->card, track);
+ track_widget = xfce_mixer_option_new (mixer_container->card, track);
gtk_container_add (GTK_CONTAINER (option_alignment), track_widget);
gtk_widget_show (track_widget);
num_children[3]++;
/* Add the track to the hash table */
- g_hash_table_insert (mixer->widgets, g_strdup (track_label), track_widget);
+ g_hash_table_insert (mixer_container->widgets, g_strdup (track_label), track_widget);
break;
}
}
@@ -404,13 +372,13 @@ xfce_mixer_create_contents (XfceMixer *mixer)
if (G_LIKELY (last_separator[i] != NULL))
gtk_widget_destroy (last_separator[i]);
- gtk_notebook_append_page (GTK_NOTEBOOK (mixer), scrollwins[i], labels[i]);
+ gtk_notebook_append_page (GTK_NOTEBOOK (mixer_container), scrollwins[i], labels[i]);
/* Hide tabs with no visible controls */
if (num_children[i] > 0)
no_controls_visible = FALSE;
else
- gtk_widget_hide (gtk_notebook_get_nth_page (GTK_NOTEBOOK (mixer), i));
+ gtk_widget_hide (gtk_notebook_get_nth_page (GTK_NOTEBOOK (mixer_container), i));
}
/* Show informational message if no controls are visible */
@@ -424,7 +392,7 @@ xfce_mixer_create_contents (XfceMixer *mixer)
gtk_label_set_line_wrap (GTK_LABEL (label2), TRUE);
gtk_widget_show (label2);
- gtk_notebook_append_page (GTK_NOTEBOOK (mixer), label2, label1);
+ gtk_notebook_append_page (GTK_NOTEBOOK (mixer_container), label2, label1);
}
g_object_unref (preferences);
@@ -433,37 +401,37 @@ xfce_mixer_create_contents (XfceMixer *mixer)
void
-xfce_mixer_update_contents (XfceMixer *mixer)
+xfce_mixer_container_update_contents (XfceMixerContainer *mixer_container)
{
gint current_tab;
gint i;
- g_return_if_fail (IS_XFCE_MIXER (mixer));
- g_return_if_fail (mixer->widgets != NULL);
+ g_return_if_fail (IS_XFCE_MIXER_CONTAINER (mixer_container));
+ g_return_if_fail (mixer_container->widgets != NULL);
- g_hash_table_remove_all (mixer->widgets);
+ g_hash_table_remove_all (mixer_container->widgets);
/* Remember active tab */
- current_tab = gtk_notebook_get_current_page (GTK_NOTEBOOK (mixer));
+ current_tab = gtk_notebook_get_current_page (GTK_NOTEBOOK (mixer_container));
/* Destroy all tabs */
- for (i = gtk_notebook_get_n_pages (GTK_NOTEBOOK (mixer)); i >= 0; i--)
- gtk_notebook_remove_page (GTK_NOTEBOOK (mixer), i);
+ for (i = gtk_notebook_get_n_pages (GTK_NOTEBOOK (mixer_container)); i >= 0; i--)
+ gtk_notebook_remove_page (GTK_NOTEBOOK (mixer_container), i);
/* Re-create contents */
- xfce_mixer_create_contents (mixer);
+ xfce_mixer_container_create_contents (mixer_container);
/* Restore previously active tab if possible */
if (current_tab > 0 && current_tab < 4)
- gtk_notebook_set_current_page (GTK_NOTEBOOK (mixer), current_tab);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (mixer_container), current_tab);
}
static void
-xfce_mixer_bus_message (GstBus *bus,
- GstMessage *message,
- XfceMixer *mixer)
+xfce_mixer_container_bus_message (GstBus *bus,
+ GstMessage *message,
+ XfceMixerContainer *mixer_container)
{
GstMixerOptions *options = NULL;
GstMixerTrack *track = NULL;
@@ -475,9 +443,9 @@ xfce_mixer_bus_message (GstBus *bus,
gint *volumes;
gint num_channels;
- g_return_if_fail (IS_XFCE_MIXER (mixer));
+ g_return_if_fail (IS_XFCE_MIXER_CONTAINER (mixer_container));
- if (G_UNLIKELY (GST_MESSAGE_SRC (message) != GST_OBJECT (mixer->card)))
+ if (G_UNLIKELY (GST_MESSAGE_SRC (message) != GST_OBJECT (mixer_container->card)))
return;
switch (gst_mixer_message_get_type (message))
@@ -486,7 +454,7 @@ xfce_mixer_bus_message (GstBus *bus,
gst_mixer_message_parse_mute_toggled (message, &track, &muted);
label = xfce_mixer_get_track_label (track);
xfce_mixer_debug ("Track '%s' was %s", label, muted ? "muted" : "unmuted");
- widget = g_hash_table_lookup (mixer->widgets, label);
+ widget = g_hash_table_lookup (mixer_container->widgets, label);
if (IS_XFCE_MIXER_TRACK (widget))
xfce_mixer_track_update_mute (XFCE_MIXER_TRACK (widget));
@@ -497,7 +465,7 @@ xfce_mixer_bus_message (GstBus *bus,
gst_mixer_message_parse_record_toggled (message, &track, &record);
label = xfce_mixer_get_track_label (track);
xfce_mixer_debug ("Recording on track '%s' was %s", label, record ? "turned on" : "turned off");
- widget = g_hash_table_lookup (mixer->widgets, label);
+ widget = g_hash_table_lookup (mixer_container->widgets, label);
if (IS_XFCE_MIXER_TRACK (widget))
xfce_mixer_track_update_record (XFCE_MIXER_TRACK (widget));
@@ -508,7 +476,7 @@ xfce_mixer_bus_message (GstBus *bus,
gst_mixer_message_parse_volume_changed (message, &track, &volumes, &num_channels);
label = xfce_mixer_get_track_label (track);
xfce_mixer_debug ("Volume on track '%s' changed to %i", label, volumes[0]);
- widget = g_hash_table_lookup (mixer->widgets, label);
+ widget = g_hash_table_lookup (mixer_container->widgets, label);
if (IS_XFCE_MIXER_TRACK (widget))
xfce_mixer_track_update_volume (XFCE_MIXER_TRACK (widget));
@@ -517,14 +485,14 @@ xfce_mixer_bus_message (GstBus *bus,
gst_mixer_message_parse_option_changed (message, &options, &option);
label = xfce_mixer_get_track_label (GST_MIXER_TRACK (options));
xfce_mixer_debug ("Option '%s' was set to '%s'", label, option);
- widget = g_hash_table_lookup (mixer->widgets, label);
+ widget = g_hash_table_lookup (mixer_container->widgets, label);
if (IS_XFCE_MIXER_OPTION (widget))
xfce_mixer_option_update (XFCE_MIXER_OPTION (widget));
break;
case GST_MIXER_MESSAGE_MIXER_CHANGED:
xfce_mixer_debug ("Mixer tracks have changed");
- xfce_mixer_update_contents (mixer);
+ xfce_mixer_container_update_contents (mixer_container);
break;
default:
break;
diff --git a/xfce4-mixer/xfce-mixer-container.h b/xfce4-mixer/xfce-mixer-container.h
new file mode 100644
index 0000000..cbb25d5
--- /dev/null
+++ b/xfce4-mixer/xfce-mixer-container.h
@@ -0,0 +1,47 @@
+/* vi:set expandtab sw=2 sts=2: */
+/*-
+ * Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __XFCE_MIXER_CONTAINER_H__
+#define __XFCE_MIXER_CONTAINER_H__
+
+#include <gtk/gtk.h>
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+typedef struct _XfceMixerContainerClass XfceMixerContainerClass;
+typedef struct _XfceMixerContainer XfceMixerContainer;
+
+#define TYPE_XFCE_MIXER_CONTAINER (xfce_mixer_container_get_type ())
+#define XFCE_MIXER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_XFCE_MIXER_CONTAINER, XfceMixerContainer))
+#define XFCE_MIXER_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_XFCE_MIXER_CONTAINER, XfceMixerContainerClass))
+#define IS_XFCE_MIXER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_XFCE_MIXER_CONTAINER))
+#define IS_XFCE_MIXER_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_XFCE_MIXER_CONTAINER))
+#define XFCE_MIXER_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_XFCE_MIXER_CONTAINER, XfceMixerContainerClass))
+
+GType xfce_mixer_container_get_type (void) G_GNUC_CONST;
+
+GtkWidget *xfce_mixer_container_new (GstElement *card);
+void xfce_mixer_container_update_contents (XfceMixerContainer *mixer);
+
+G_END_DECLS
+
+#endif /* !__XFCE_MIXER_CONTAINER_H__ */
diff --git a/xfce4-mixer/xfce-mixer-controls-dialog.c b/xfce4-mixer/xfce-mixer-controls-dialog.c
index 716abd5..dd79a77 100644
--- a/xfce4-mixer/xfce-mixer-controls-dialog.c
+++ b/xfce4-mixer/xfce-mixer-controls-dialog.c
@@ -37,13 +37,14 @@
-#define VISIBLE_COLUMN 0
-#define NAME_COLUMN 1
+enum
+{
+ VISIBLE_COLUMN,
+ NAME_COLUMN
+};
-static void xfce_mixer_controls_dialog_class_init (XfceMixerControlsDialogClass *klass);
-static void xfce_mixer_controls_dialog_init (XfceMixerControlsDialog *dialog);
static void xfce_mixer_controls_dialog_dispose (GObject *object);
static void xfce_mixer_controls_dialog_finalize (GObject *object);
static void xfce_mixer_controls_dialog_response (GtkDialog *dialog,
@@ -71,7 +72,7 @@ struct _XfceMixerControlsDialog
XfceMixerWindow *parent;
XfceMixerPreferences *preferences;
GstElement *card;
- guint signal_handler_id;
+ gulong signal_handler_id;
GtkWidget *frame;
GtkListStore *store;
@@ -79,36 +80,7 @@ struct _XfceMixerControlsDialog
-static GObjectClass *xfce_mixer_controls_dialog_parent_class = NULL;
-
-
-
-GType
-xfce_mixer_controls_dialog_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceMixerControlsDialogClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_mixer_controls_dialog_class_init,
- NULL,
- NULL,
- sizeof (XfceMixerControlsDialog),
- 0,
- (GInstanceInitFunc) xfce_mixer_controls_dialog_init,
- NULL,
- };
-
- type = g_type_register_static (XFCE_TYPE_TITLED_DIALOG, "XfceMixerControlsDialog", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceMixerControlsDialog, xfce_mixer_controls_dialog, XFCE_TYPE_TITLED_DIALOG)
@@ -118,9 +90,6 @@ xfce_mixer_controls_dialog_class_init (XfceMixerControlsDialogClass *klass)
GObjectClass *gobject_class;
GtkDialogClass *dialog_class;
- /* Determine parent type class */
- xfce_mixer_controls_dialog_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = xfce_mixer_controls_dialog_dispose;
gobject_class->finalize = xfce_mixer_controls_dialog_finalize;
diff --git a/xfce4-mixer/xfce-mixer-controls-dialog.h b/xfce4-mixer/xfce-mixer-controls-dialog.h
index 739e95a..913007a 100644
--- a/xfce4-mixer/xfce-mixer-controls-dialog.h
+++ b/xfce4-mixer/xfce-mixer-controls-dialog.h
@@ -24,7 +24,7 @@
#include "xfce-mixer-window.h"
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceMixerControlsDialogClass XfceMixerControlsDialogClass;
typedef struct _XfceMixerControlsDialog XfceMixerControlsDialog;
@@ -43,6 +43,6 @@ void xfce_mixer_controls_dialog_set_soundcard (XfceMixerControlsDialog *di
GstElement *card);
void xfce_mixer_controls_dialog_update_dialog (XfceMixerControlsDialog *dialog);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_MIXER_CONTROLS_DIALOG_H__ */
diff --git a/xfce4-mixer/xfce-mixer-option.c b/xfce4-mixer/xfce-mixer-option.c
index c9a79b5..d16b766 100644
--- a/xfce4-mixer/xfce-mixer-option.c
+++ b/xfce4-mixer/xfce-mixer-option.c
@@ -35,12 +35,13 @@
-#define OPTION_COLUMN 0
+enum
+{
+ OPTION_COLUMN
+};
-static void xfce_mixer_option_class_init (XfceMixerOptionClass *klass);
-static void xfce_mixer_option_init (XfceMixerOption *option);
static void xfce_mixer_option_dispose (GObject *object);
static void xfce_mixer_option_finalize (GObject *object);
static void xfce_mixer_option_create_contents (XfceMixerOption *option);
@@ -65,43 +66,14 @@ struct _XfceMixerOption
GstElement *card;
GstMixerTrack *track;
- guint signal_handler_id;
+ gulong signal_handler_id;
gboolean ignore_signals;
};
-static GObjectClass *xfce_mixer_option_parent_class = NULL;
-
-
-
-GType
-xfce_mixer_option_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceMixerOptionClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_mixer_option_class_init,
- NULL,
- NULL,
- sizeof (XfceMixerOption),
- 0,
- (GInstanceInitFunc) xfce_mixer_option_init,
- NULL,
- };
-
- type = g_type_register_static (GTK_TYPE_COMBO_BOX, "XfceMixerOption", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceMixerOption, xfce_mixer_option, GTK_TYPE_COMBO_BOX)
@@ -110,9 +82,6 @@ xfce_mixer_option_class_init (XfceMixerOptionClass *klass)
{
GObjectClass *gobject_class;
- /* Determine parent type class */
- xfce_mixer_option_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = xfce_mixer_option_dispose;
gobject_class->finalize = xfce_mixer_option_finalize;
diff --git a/xfce4-mixer/xfce-mixer-option.h b/xfce4-mixer/xfce-mixer-option.h
index 9eef621..c199e3e 100644
--- a/xfce4-mixer/xfce-mixer-option.h
+++ b/xfce4-mixer/xfce-mixer-option.h
@@ -24,7 +24,7 @@
#include <gtk/gtk.h>
#include <gst/gst.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceMixerOptionClass XfceMixerOptionClass;
typedef struct _XfceMixerOption XfceMixerOption;
@@ -42,6 +42,6 @@ GtkWidget *xfce_mixer_option_new (GstElement *card,
GstMixerTrack *track);
void xfce_mixer_option_update (XfceMixerOption *option);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_MIXER_OPTION_H__ */
diff --git a/xfce4-mixer/xfce-mixer-switch.c b/xfce4-mixer/xfce-mixer-switch.c
index dd07d41..19fc607 100644
--- a/xfce4-mixer/xfce-mixer-switch.c
+++ b/xfce4-mixer/xfce-mixer-switch.c
@@ -35,8 +35,6 @@
-static void xfce_mixer_switch_class_init (XfceMixerSwitchClass *klass);
-static void xfce_mixer_switch_init (XfceMixerSwitch *mixer_switch);
static void xfce_mixer_switch_dispose (GObject *object);
static void xfce_mixer_switch_finalize (GObject *object);
static void xfce_mixer_switch_create_contents (XfceMixerSwitch *mixer_switch);
@@ -61,36 +59,7 @@ struct _XfceMixerSwitch
-static GObjectClass *xfce_mixer_switch_parent_class = NULL;
-
-
-
-GType
-xfce_mixer_switch_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceMixerSwitchClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_mixer_switch_class_init,
- NULL,
- NULL,
- sizeof (XfceMixerSwitch),
- 0,
- (GInstanceInitFunc) xfce_mixer_switch_init,
- NULL,
- };
-
- type = g_type_register_static (GTK_TYPE_CHECK_BUTTON, "XfceMixerSwitch", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceMixerSwitch, xfce_mixer_switch, GTK_TYPE_CHECK_BUTTON)
@@ -100,9 +69,6 @@ xfce_mixer_switch_class_init (XfceMixerSwitchClass *klass)
GObjectClass *gobject_class;
GtkToggleButtonClass *gtk_toggle_button_class;
- /* Determine parent type class */
- xfce_mixer_switch_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = xfce_mixer_switch_dispose;
gobject_class->finalize = xfce_mixer_switch_finalize;
diff --git a/xfce4-mixer/xfce-mixer-switch.h b/xfce4-mixer/xfce-mixer-switch.h
index e14e8cd..f9526d7 100644
--- a/xfce4-mixer/xfce-mixer-switch.h
+++ b/xfce4-mixer/xfce-mixer-switch.h
@@ -24,7 +24,7 @@
#include <gtk/gtk.h>
#include <gst/gst.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceMixerSwitchClass XfceMixerSwitchClass;
typedef struct _XfceMixerSwitch XfceMixerSwitch;
@@ -42,6 +42,6 @@ GtkWidget *xfce_mixer_switch_new (GstElement *card,
GstMixerTrack *track);
void xfce_mixer_switch_update (XfceMixerSwitch *mixer_switch);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_MIXER_SWITCH_H__ */
diff --git a/xfce4-mixer/xfce-mixer-track.c b/xfce4-mixer/xfce-mixer-track.c
index 2b89370..a7442ed 100644
--- a/xfce4-mixer/xfce-mixer-track.c
+++ b/xfce4-mixer/xfce-mixer-track.c
@@ -43,8 +43,6 @@
-static void xfce_mixer_track_class_init (XfceMixerTrackClass *klass);
-static void xfce_mixer_track_init (XfceMixerTrack *track);
static void xfce_mixer_track_dispose (GObject *object);
static void xfce_mixer_track_finalize (GObject *object);
static gboolean xfce_mixer_track_lock_button_line_expose_event (GtkWidget *widget,
@@ -85,36 +83,7 @@ struct _XfceMixerTrack
-static GObjectClass *xfce_mixer_track_parent_class = NULL;
-
-
-
-GType
-xfce_mixer_track_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceMixerTrackClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_mixer_track_class_init,
- NULL,
- NULL,
- sizeof (XfceMixerTrack),
- 0,
- (GInstanceInitFunc) xfce_mixer_track_init,
- NULL,
- };
-
- type = g_type_register_static (GTK_TYPE_VBOX, "XfceMixerTrack", &info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceMixerTrack, xfce_mixer_track, GTK_TYPE_VBOX)
@@ -123,9 +92,6 @@ xfce_mixer_track_class_init (XfceMixerTrackClass *klass)
{
GObjectClass *gobject_class;
- /* Determine parent type class */
- xfce_mixer_track_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = xfce_mixer_track_dispose;
gobject_class->finalize = xfce_mixer_track_finalize;
diff --git a/xfce4-mixer/xfce-mixer-track.h b/xfce4-mixer/xfce-mixer-track.h
index 7789bf9..cc363b0 100644
--- a/xfce4-mixer/xfce-mixer-track.h
+++ b/xfce4-mixer/xfce-mixer-track.h
@@ -24,7 +24,7 @@
#include <gtk/gtk.h>
#include <gst/gst.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceMixerTrackClass XfceMixerTrackClass;
typedef struct _XfceMixerTrack XfceMixerTrack;
@@ -44,6 +44,6 @@ void xfce_mixer_track_update_mute (XfceMixerTrack *track);
void xfce_mixer_track_update_record (XfceMixerTrack *track);
void xfce_mixer_track_update_volume (XfceMixerTrack *track);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_MIXER_TRACK_H__ */
diff --git a/xfce4-mixer/xfce-mixer-window.c b/xfce4-mixer/xfce-mixer-window.c
index b1d7d11..540a185 100644
--- a/xfce4-mixer/xfce-mixer-window.c
+++ b/xfce4-mixer/xfce-mixer-window.c
@@ -32,14 +32,12 @@
#include "libxfce4mixer/libxfce4mixer.h"
-#include "xfce-mixer.h"
+#include "xfce-mixer-container.h"
#include "xfce-mixer-window.h"
#include "xfce-mixer-controls-dialog.h"
-static void xfce_mixer_window_class_init (XfceMixerWindowClass *klass);
-static void xfce_mixer_window_init (XfceMixerWindow *window);
static void xfce_mixer_window_dispose (GObject *object);
static void xfce_mixer_window_finalize (GObject *object);
static void xfce_mixer_window_soundcard_changed (XfceMixerCardCombo *combo,
@@ -79,7 +77,7 @@ struct _XfceMixerWindow
/* Active mixer control set */
GtkWidget *mixer_frame;
- GtkWidget *mixer;
+ GtkWidget *mixer_container;
GtkWidget *select_controls_button;
@@ -96,43 +94,9 @@ static const GtkActionEntry action_entries[] =
G_CALLBACK (xfce_mixer_window_action_select_controls) },
};
-static const GtkToggleActionEntry toggle_action_entries[] =
-{
-};
-
-
-static GObjectClass *xfce_mixer_window_parent_class = NULL;
-
-
-GType
-xfce_mixer_window_get_type (void)
-{
- static GType type = G_TYPE_INVALID;
-
- if (G_UNLIKELY (type == G_TYPE_INVALID))
- {
- static const GTypeInfo info =
- {
- sizeof (XfceMixerWindowClass),
- NULL,
- NULL,
- (GClassInitFunc) xfce_mixer_window_class_init,
- NULL,
- NULL,
- sizeof (XfceMixerWindow),
- 0,
- (GInstanceInitFunc) xfce_mixer_window_init,
- NULL,
- };
-
- type = g_type_register_static (XFCE_TYPE_TITLED_DIALOG, "XfceMixerWindow", &info, 0);
-
- }
-
- return type;
-}
+G_DEFINE_TYPE (XfceMixerWindow, xfce_mixer_window, XFCE_TYPE_TITLED_DIALOG)
@@ -141,9 +105,6 @@ xfce_mixer_window_class_init (XfceMixerWindowClass *klass)
{
GObjectClass *gobject_class;
- /* Determine parent type class */
- xfce_mixer_window_parent_class = g_type_class_peek_parent (klass);
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = xfce_mixer_window_dispose;
gobject_class->finalize = xfce_mixer_window_finalize;
@@ -240,9 +201,9 @@ xfce_mixer_window_init (XfceMixerWindow *window)
gtk_container_add (GTK_CONTAINER (vbox), window->mixer_frame);
gtk_widget_show (window->mixer_frame);
- window->mixer = xfce_mixer_new (NULL);
- gtk_container_add (GTK_CONTAINER (window->mixer_frame), window->mixer);
- gtk_widget_show (window->mixer);
+ window->mixer_container = xfce_mixer_container_new (NULL);
+ gtk_container_add (GTK_CONTAINER (window->mixer_frame), window->mixer_container);
+ gtk_widget_show (window->mixer_container);
bbox = gtk_dialog_get_action_area (GTK_DIALOG (window));
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_EDGE);
@@ -395,7 +356,7 @@ xfce_mixer_window_controls_property_changed (XfceMixerWindow *window,
GParamSpec *pspec,
GObject *object)
{
- xfce_mixer_update_contents (XFCE_MIXER (window->mixer));
+ xfce_mixer_container_update_contents (XFCE_MIXER_CONTAINER (window->mixer_container));
/* Update the controls dialog */
if (window->controls_dialog != NULL)
@@ -458,8 +419,8 @@ xfce_mixer_window_update_contents (XfceMixerWindow *window)
xfce_mixer_select_card (card);
- /* Update the XfceMixer containing the controls */
- g_object_set (window->mixer, "card", card, NULL);
+ /* Update the XfceMixerContainer containing the controls */
+ g_object_set (window->mixer_container, "card", card, NULL);
/* Make the "Select Controls..." button sensitive */
gtk_widget_set_sensitive (window->select_controls_button, TRUE);
@@ -468,8 +429,8 @@ xfce_mixer_window_update_contents (XfceMixerWindow *window)
{
gtk_window_set_title (GTK_WINDOW (window), _("Audio Mixer"));
- /* Update the XfceMixer containing the controls */
- g_object_set (window->mixer, "card", NULL, NULL);
+ /* Update the XfceMixerContainer containing the controls */
+ g_object_set (window->mixer_container, "card", NULL, NULL);
/* Make the "Select Controls..." button insensitive */
gtk_widget_set_sensitive (window->select_controls_button, FALSE);
diff --git a/xfce4-mixer/xfce-mixer-window.h b/xfce4-mixer/xfce-mixer-window.h
index 58e0083..b2aba01 100644
--- a/xfce4-mixer/xfce-mixer-window.h
+++ b/xfce4-mixer/xfce-mixer-window.h
@@ -24,7 +24,7 @@
#include <gtk/gtk.h>
#include <gst/gst.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
typedef struct _XfceMixerWindowClass XfceMixerWindowClass;
typedef struct _XfceMixerWindow XfceMixerWindow;
@@ -41,6 +41,6 @@ GType xfce_mixer_window_get_type (void) G_GNUC_CONST;
GtkWidget *xfce_mixer_window_new (void);
GstElement *xfce_mixer_window_get_active_card (XfceMixerWindow *window);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__XFCE_MIXER_WINDOW_H__ */
diff --git a/xfce4-mixer/xfce-mixer.h b/xfce4-mixer/xfce-mixer.h
deleted file mode 100644
index 2aeab9e..0000000
--- a/xfce4-mixer/xfce-mixer.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* vi:set expandtab sw=2 sts=2: */
-/*-
- * Copyright (c) 2008 Jannis Pohlmann <jannis at xfce.org>
- * Copyright (c) 2012 Guido Berhoerster <guido+xfce at berhoerster.name>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __XFCE_MIXER_H__
-#define __XFCE_MIXER_H__
-
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-
-G_BEGIN_DECLS;
-
-typedef struct _XfceMixerClass XfceMixerClass;
-typedef struct _XfceMixer XfceMixer;
-
-#define TYPE_XFCE_MIXER (xfce_mixer_get_type ())
-#define XFCE_MIXER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_XFCE_MIXER, XfceMixer))
-#define XFCE_MIXER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_XFCE_MIXER, XfceMixerClass))
-#define IS_XFCE_MIXER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_XFCE_MIXER))
-#define IS_XFCE_MIXER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_XFCE_MIXER))
-#define XFCE_MIXER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_XFCE_MIXER, XfceMixerClass))
-
-GType xfce_mixer_get_type (void) G_GNUC_CONST;
-
-GtkWidget *xfce_mixer_new (GstElement *card);
-void xfce_mixer_update_contents (XfceMixer *mixer);
-
-G_END_DECLS;
-
-#endif /* !__XFCE_MIXER_H__ */
More information about the Xfce4-commits
mailing list