gnome-media r4094 - in trunk/gnome-volume-control: . src
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-media r4094 - in trunk/gnome-volume-control: . src
- Date: Sat, 13 Dec 2008 18:30:58 +0000 (UTC)
Author: mccann
Date: Sat Dec 13 18:30:58 2008
New Revision: 4094
URL: http://svn.gnome.org/viewvc/gnome-media?rev=4094&view=rev
Log:
008-12-13 William Jon McCann <jmccann redhat com>
* src/gvc-channel-bar.c (_scale_box_new), (update_layout),
(gvc_channel_bar_set_size_group),
(gvc_channel_bar_set_orientation), (gvc_channel_bar_constructor),
(gvc_channel_bar_init):
* src/gvc-channel-bar.h:
* src/gvc-mixer-dialog.c (create_bar), (add_stream),
(gvc_mixer_dialog_constructor):
Don't put the end box in the size group for app channel bars.
Modified:
trunk/gnome-volume-control/ChangeLog
trunk/gnome-volume-control/src/gvc-channel-bar.c
trunk/gnome-volume-control/src/gvc-channel-bar.h
trunk/gnome-volume-control/src/gvc-mixer-dialog.c
Modified: trunk/gnome-volume-control/src/gvc-channel-bar.c
==============================================================================
--- trunk/gnome-volume-control/src/gvc-channel-bar.c (original)
+++ trunk/gnome-volume-control/src/gvc-channel-bar.c Sat Dec 13 18:30:58 2008
@@ -56,6 +56,7 @@
char *low_icon_name;
char *high_icon_name;
GtkSizeGroup *size_group;
+ gboolean symmetric;
};
enum
@@ -140,7 +141,10 @@
if (bar->priv->size_group != NULL) {
gtk_size_group_add_widget (bar->priv->size_group, sbox);
- gtk_size_group_add_widget (bar->priv->size_group, ebox);
+
+ if (bar->priv->symmetric) {
+ gtk_size_group_add_widget (bar->priv->size_group, ebox);
+ }
}
gtk_scale_set_draw_value (GTK_SCALE (priv->scale), FALSE);
@@ -175,14 +179,74 @@
}
}
+static void
+update_layout (GvcChannelBar *bar)
+{
+ GtkWidget *box;
+ GtkWidget *frame;
+
+ if (bar->priv->scale == NULL) {
+ return;
+ }
+
+ box = bar->priv->scale_box;
+ frame = box->parent;
+
+ g_object_ref (bar->priv->image);
+ g_object_ref (bar->priv->label);
+ g_object_ref (bar->priv->mute_box);
+ g_object_ref (bar->priv->low_image);
+ g_object_ref (bar->priv->high_image);
+
+ gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->image);
+ gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->label);
+ gtk_container_remove (GTK_CONTAINER (bar->priv->end_box), bar->priv->mute_box);
+
+ if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
+ gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->low_image);
+ gtk_container_remove (GTK_CONTAINER (bar->priv->end_box), bar->priv->high_image);
+ } else {
+ gtk_container_remove (GTK_CONTAINER (bar->priv->end_box), bar->priv->low_image);
+ gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->high_image);
+ }
+
+ gtk_container_remove (GTK_CONTAINER (box), bar->priv->start_box);
+ gtk_container_remove (GTK_CONTAINER (box), bar->priv->scale);
+ gtk_container_remove (GTK_CONTAINER (box), bar->priv->end_box);
+ gtk_container_remove (GTK_CONTAINER (frame), box);
+
+ bar->priv->scale_box = _scale_box_new (bar);
+ gtk_container_add (GTK_CONTAINER (frame), bar->priv->scale_box);
+
+ g_object_unref (bar->priv->image);
+ g_object_unref (bar->priv->label);
+ g_object_unref (bar->priv->mute_box);
+ g_object_unref (bar->priv->low_image);
+ g_object_unref (bar->priv->high_image);
+
+ gtk_widget_show_all (frame);
+}
+
void
gvc_channel_bar_set_size_group (GvcChannelBar *bar,
- GtkSizeGroup *group)
+ GtkSizeGroup *group,
+ gboolean symmetric)
{
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
bar->priv->size_group = group;
- gtk_size_group_add_widget (group, bar->priv->scale);
+ bar->priv->symmetric = symmetric;
+
+ if (bar->priv->size_group != NULL) {
+ gtk_size_group_add_widget (bar->priv->size_group,
+ bar->priv->start_box);
+
+ if (bar->priv->symmetric) {
+ gtk_size_group_add_widget (bar->priv->size_group,
+ bar->priv->end_box);
+ }
+ }
+ gtk_widget_queue_draw (GTK_WIDGET (bar));
}
void
@@ -249,49 +313,7 @@
if (orientation != bar->priv->orientation) {
bar->priv->orientation = orientation;
-
- if (bar->priv->scale != NULL) {
- GtkWidget *box;
- GtkWidget *frame;
-
- box = bar->priv->scale_box;
- frame = box->parent;
-
- g_object_ref (bar->priv->image);
- g_object_ref (bar->priv->label);
- g_object_ref (bar->priv->mute_box);
- g_object_ref (bar->priv->low_image);
- g_object_ref (bar->priv->high_image);
-
- gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->image);
- gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->label);
- gtk_container_remove (GTK_CONTAINER (bar->priv->end_box), bar->priv->mute_box);
-
- if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
- gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->low_image);
- gtk_container_remove (GTK_CONTAINER (bar->priv->end_box), bar->priv->high_image);
- } else {
- gtk_container_remove (GTK_CONTAINER (bar->priv->end_box), bar->priv->low_image);
- gtk_container_remove (GTK_CONTAINER (bar->priv->start_box), bar->priv->high_image);
- }
-
- gtk_container_remove (GTK_CONTAINER (box), bar->priv->start_box);
- gtk_container_remove (GTK_CONTAINER (box), bar->priv->scale);
- gtk_container_remove (GTK_CONTAINER (box), bar->priv->end_box);
- gtk_container_remove (GTK_CONTAINER (frame), box);
-
- bar->priv->scale_box = _scale_box_new (bar);
- gtk_container_add (GTK_CONTAINER (frame), bar->priv->scale_box);
-
- g_object_unref (bar->priv->image);
- g_object_unref (bar->priv->label);
- g_object_unref (bar->priv->mute_box);
- g_object_unref (bar->priv->low_image);
- g_object_unref (bar->priv->high_image);
-
- gtk_widget_show_all (frame);
- }
-
+ update_layout (bar);
g_object_notify (G_OBJECT (bar), "orientation");
}
}
@@ -495,25 +517,13 @@
{
GObject *object;
GvcChannelBar *self;
- GtkWidget *frame;
object = G_OBJECT_CLASS (gvc_channel_bar_parent_class)->constructor (type, n_construct_properties, construct_params);
self = GVC_CHANNEL_BAR (object);
- /* frame */
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- gtk_container_add (GTK_CONTAINER (self), frame);
-
- /* box with scale */
- self->priv->scale_box = _scale_box_new (self);
- gtk_container_add (GTK_CONTAINER (frame), self->priv->scale_box);
-
update_mute_button (self);
- gtk_widget_show_all (frame);
-
return object;
}
@@ -601,6 +611,8 @@
static void
gvc_channel_bar_init (GvcChannelBar *bar)
{
+ GtkWidget *frame;
+
bar->priv = GVC_CHANNEL_BAR_GET_PRIVATE (bar);
bar->priv->low_icon_name = g_strdup ("audio-volume-low");
@@ -652,6 +664,16 @@
0.0,
0.5);
gtk_widget_set_no_show_all (bar->priv->label, TRUE);
+
+ /* frame */
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
+ gtk_container_add (GTK_CONTAINER (bar), frame);
+ gtk_widget_show_all (frame);
+
+ /* box with scale */
+ bar->priv->scale_box = _scale_box_new (bar);
+ gtk_container_add (GTK_CONTAINER (frame), bar->priv->scale_box);
}
static void
Modified: trunk/gnome-volume-control/src/gvc-channel-bar.h
==============================================================================
--- trunk/gnome-volume-control/src/gvc-channel-bar.h (original)
+++ trunk/gnome-volume-control/src/gvc-channel-bar.h Sat Dec 13 18:30:58 2008
@@ -71,7 +71,8 @@
void gvc_channel_bar_set_show_mute (GvcChannelBar *bar,
gboolean show_mute);
void gvc_channel_bar_set_size_group (GvcChannelBar *bar,
- GtkSizeGroup *group);
+ GtkSizeGroup *group,
+ gboolean symmetric);
G_END_DECLS
Modified: trunk/gnome-volume-control/src/gvc-mixer-dialog.c
==============================================================================
--- trunk/gnome-volume-control/src/gvc-mixer-dialog.c (original)
+++ trunk/gnome-volume-control/src/gvc-mixer-dialog.c Sat Dec 13 18:30:58 2008
@@ -539,15 +539,17 @@
static GtkWidget *
create_bar (GvcMixerDialog *dialog,
- GtkSizeGroup *size_group)
+ GtkSizeGroup *size_group,
+ gboolean symmetric)
{
- GtkWidget *bar;
+ GtkWidget *bar;
bar = gvc_channel_bar_new ();
gtk_widget_set_sensitive (bar, FALSE);
if (size_group != NULL) {
gvc_channel_bar_set_size_group (GVC_CHANNEL_BAR (bar),
- size_group);
+ size_group,
+ symmetric);
}
gvc_channel_bar_set_orientation (GVC_CHANNEL_BAR (bar),
GTK_ORIENTATION_HORIZONTAL);
@@ -621,11 +623,12 @@
} else if (! GVC_IS_MIXER_SOURCE (stream)
&& !GVC_IS_MIXER_SINK (stream)
&& !GVC_IS_MIXER_SOURCE_OUTPUT (stream)) {
- bar = create_bar (dialog, dialog->priv->apps_size_group);
+ bar = create_bar (dialog, dialog->priv->apps_size_group, FALSE);
gvc_channel_bar_set_name (GVC_CHANNEL_BAR (bar),
gvc_mixer_stream_get_name (stream));
gvc_channel_bar_set_icon_name (GVC_CHANNEL_BAR (bar),
gvc_mixer_stream_get_icon_name (stream));
+
gtk_box_pack_start (GTK_BOX (dialog->priv->applications_box), bar, FALSE, FALSE, 12);
dialog->priv->num_apps++;
gtk_widget_hide (dialog->priv->no_apps_label);
@@ -952,7 +955,7 @@
gtk_box_pack_start (GTK_BOX (main_vbox),
self->priv->output_stream_box,
FALSE, FALSE, 12);
- self->priv->output_bar = create_bar (self, self->priv->size_group);
+ self->priv->output_bar = create_bar (self, self->priv->size_group, TRUE);
gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->priv->output_bar),
_("Output volume: "));
gtk_widget_set_sensitive (self->priv->output_bar, FALSE);
@@ -972,7 +975,7 @@
self->priv->sound_effects_box,
label);
- self->priv->effects_bar = create_bar (self, self->priv->size_group);
+ self->priv->effects_bar = create_bar (self, self->priv->size_group, TRUE);
gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->priv->effects_bar),
_("Alert Volume: "));
gtk_widget_set_sensitive (self->priv->effects_bar, FALSE);
@@ -992,7 +995,7 @@
self->priv->input_box,
label);
- self->priv->input_bar = create_bar (self, self->priv->size_group);
+ self->priv->input_bar = create_bar (self, self->priv->size_group, TRUE);
gvc_channel_bar_set_name (GVC_CHANNEL_BAR (self->priv->input_bar),
_("Input volume: "));
gvc_channel_bar_set_low_icon_name (GVC_CHANNEL_BAR (self->priv->input_bar),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]