gnome-applets r11141 - in trunk/mixer: . docs/de
- From: callum svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-applets r11141 - in trunk/mixer: . docs/de
- Date: Tue, 2 Dec 2008 00:36:36 +0000 (UTC)
Author: callum
Date: Tue Dec 2 00:36:36 2008
New Revision: 11141
URL: http://svn.gnome.org/viewvc/gnome-applets?rev=11141&view=rev
Log:
Attach the new mute button in the mixer applet.
Modified:
trunk/mixer/ChangeLog
trunk/mixer/applet.c
trunk/mixer/applet.h
trunk/mixer/dock.c
trunk/mixer/dock.h
trunk/mixer/docs/de/mixer_applet2.xml
Modified: trunk/mixer/applet.c
==============================================================================
--- trunk/mixer/applet.c (original)
+++ trunk/mixer/applet.c Tue Dec 2 00:36:36 2008
@@ -657,15 +657,22 @@
}
}
+gboolean
+mixer_is_muted (GnomeVolumeApplet *applet)
+{
+ return applet->state & 1;
+}
+
/*
* Toggle mute.
*/
-static void
+void
gnome_volume_applet_toggle_mute (GnomeVolumeApplet *applet)
{
BonoboUIComponent *component;
- gboolean mute = applet->state & 1;
+ gboolean mute = mixer_is_muted (applet);
+ gboolean newmute = !mute;
GList *tracks;
for (tracks = g_list_first (applet->tracks); tracks; tracks = tracks->next)
@@ -680,11 +687,17 @@
component = panel_applet_get_popup_component (PANEL_APPLET (applet));
bonobo_ui_component_set_prop (component,
"/commands/Mute",
- "state", !mute ? "1" : "0", NULL);
+ "state", newmute ? "1" : "0", NULL);
+
+ /* Update the dock. */
+ if (applet->dock) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (applet->dock->mute),
+ newmute);
+ }
/* update graphic - this should happen automagically after the next
* idle call, but apparently doesn't for some people... */
- gnome_volume_applet_refresh (applet, TRUE, -1, !mute);
+ gnome_volume_applet_refresh (applet, TRUE, -1, newmute);
}
/*
@@ -905,7 +918,8 @@
gtk_widget_destroy (GTK_WIDGET (applet->dock));
}
dock = gnome_volume_applet_dock_new (IS_PANEL_HORIZONTAL (orientation) ?
- GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
+ GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL,
+ applet);
applet->dock = GNOME_VOLUME_APPLET_DOCK (dock);
gnome_volume_applet_dock_change (applet->dock, applet->adjustment);
Modified: trunk/mixer/applet.h
==============================================================================
--- trunk/mixer/applet.h (original)
+++ trunk/mixer/applet.h Tue Dec 2 00:36:36 2008
@@ -52,7 +52,7 @@
#define GNOME_IS_VOLUME_APPLET_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_VOLUME_APPLET))
-typedef struct _GnomeVolumeApplet {
+struct _GnomeVolumeApplet {
PanelApplet parent;
/* our main icon, which is our panel user interface */
@@ -89,7 +89,7 @@
/* use same object for setting tooltop */
gboolean force_next_update;
-} GnomeVolumeApplet;
+};
typedef struct _GnomeVolumeAppletClass {
PanelAppletClass klass;
@@ -98,9 +98,11 @@
void gnome_volume_applet_adjust_volume (GstMixer *mixer,
GstMixerTrack *track,
gdouble volume);
+void gnome_volume_applet_toggle_mute (GnomeVolumeApplet *applet);
GType gnome_volume_applet_get_type (void);
gboolean gnome_volume_applet_setup (GnomeVolumeApplet *applet,
GList *elements);
+gboolean mixer_is_muted (GnomeVolumeApplet *applet);
G_END_DECLS
Modified: trunk/mixer/dock.c
==============================================================================
--- trunk/mixer/dock.c (original)
+++ trunk/mixer/dock.c Tue Dec 2 00:36:36 2008
@@ -84,45 +84,62 @@
#endif
}
+gint mute_cb (GObject *mute_widget, GnomeVolumeAppletDock *dock)
+{
+ /* Only toggle the mute if we are actually going to change the
+ * mute. This stops loops where the toggle_mute code calls us
+ * back to make sure our display is in sync with other mute buttons. */
+ if (mixer_is_muted (dock->model) !=
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mute_widget)))
+ gnome_volume_applet_toggle_mute (dock->model);
+}
+
GtkWidget *
-gnome_volume_applet_dock_new (GtkOrientation orientation)
+gnome_volume_applet_dock_new (GtkOrientation orientation,
+ GnomeVolumeApplet *parent)
{
- GtkWidget *table, *button, *scale, *frame;
+ GtkWidget *button, *scale, *frame, *mute, *more;
+ GtkWidget *container, *outerline, *innerline;
GnomeVolumeAppletDock *dock;
gint i;
static struct {
- gint w, h;
- gint x[3], y[3]; /* Locations for widgets in the table. The widget
- coordinate order is '+', '-', then the slider. */
GtkWidget * (* sfunc) (GtkAdjustment *adj);
+ GtkWidget * (* container) (gboolean, gint);
+ GtkWidget * (* subcontainer) (gboolean, gint);
gint sw, sh;
gboolean inverted;
} magic[2] = {
- { 2, 3, { 0, 0, 0 }, { 0, 2, 1 }, gtk_vscale_new, -1, 200, TRUE},
- { 3, 2, { 2, 0, 1 }, { 0, 0, 0 }, gtk_hscale_new, 200, -1, FALSE}
+ { gtk_vscale_new, gtk_hbox_new, gtk_vbox_new, -1, 200, TRUE},
+ { gtk_hscale_new, gtk_vbox_new, gtk_hbox_new, 200, -1, FALSE}
};
- GtkWidget *table_widgets[3];
dock = g_object_new (GNOME_VOLUME_APPLET_TYPE_DOCK,
NULL);
dock->orientation = orientation;
+ dock->model = parent;
+
+ container = magic[orientation].container (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (dock), container);
+ outerline = magic[orientation].subcontainer (FALSE, 0);
+ innerline = magic[orientation].subcontainer (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (container), outerline, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (container), innerline, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
- table = gtk_table_new (magic[orientation].w,
- magic[orientation].h, FALSE);
-
dock->minus = GTK_BUTTON (gtk_button_new ());
+ gtk_box_pack_start (GTK_BOX (outerline), GTK_WIDGET (dock->minus),
+ FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (dock->minus),
gtk_image_new_from_stock (GTK_STOCK_REMOVE,
GTK_ICON_SIZE_BUTTON));
- table_widgets[1] = GTK_WIDGET (dock->minus);
dock->plus = GTK_BUTTON (gtk_button_new ());
+ gtk_box_pack_end (GTK_BOX (outerline), GTK_WIDGET (dock->plus),
+ FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (dock->plus),
gtk_image_new_from_stock (GTK_STOCK_ADD,
GTK_ICON_SIZE_BUTTON));
- table_widgets[0] = GTK_WIDGET (dock->plus);
button = GTK_WIDGET (dock->plus);
for (i = 0; i<2; i++) { /* For button in (dock->plus, dock->minus): */
@@ -141,17 +158,18 @@
magic[orientation].sh);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_range_set_inverted (dock->scale, magic[orientation].inverted);
- table_widgets[2] = GTK_WIDGET (dock->scale);
+ gtk_box_pack_start (GTK_BOX (outerline), GTK_WIDGET (dock->scale),
+ TRUE, TRUE, 0);
- for (i=0; i<3; i++) {
- gtk_table_attach_defaults (GTK_TABLE (table), table_widgets[i],
- magic[orientation].x[i],
- magic[orientation].x[i] + 1,
- magic[orientation].y[i],
- magic[orientation].y[i] + 1);
- }
+ dock->mute = gtk_check_button_new_with_label (_("Mute"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dock->mute),
+ mixer_is_muted (dock->model));
+ g_signal_connect (dock->mute, "toggled", G_CALLBACK (mute_cb), dock);
+ gtk_box_pack_start (GTK_BOX (innerline), dock->mute, TRUE, TRUE, 0);
+
+ more = gtk_button_new_with_label (_("Volume Control..."));
+ gtk_box_pack_end (GTK_BOX (innerline), more, TRUE, TRUE, 0);
- gtk_container_add (GTK_CONTAINER (frame), table);
gtk_container_add (GTK_CONTAINER (dock), frame);
return GTK_WIDGET (dock);
Modified: trunk/mixer/dock.h
==============================================================================
--- trunk/mixer/dock.h (original)
+++ trunk/mixer/dock.h Tue Dec 2 00:36:36 2008
@@ -28,6 +28,10 @@
G_BEGIN_DECLS
+/* FIXME: This is necessary to avoid circular references in the headers.
+ * This can be fixed by breaking the applet object into a model and a view. */
+typedef struct _GnomeVolumeApplet GnomeVolumeApplet;
+
#define GNOME_VOLUME_APPLET_TYPE_DOCK \
(gnome_volume_applet_dock_get_type ())
#define GNOME_VOLUME_APPLET_DOCK(obj) \
@@ -47,6 +51,7 @@
/* us */
GtkRange *scale;
GtkButton *plus, *minus;
+ GtkWidget *mute;
/* timeout for buttons */
guint timeout;
@@ -54,6 +59,8 @@
/* orientation */
GtkOrientation orientation;
+
+ GnomeVolumeApplet *model;
} GnomeVolumeAppletDock;
typedef struct _GnomeVolumeAppletDockClass {
@@ -61,7 +68,8 @@
} GnomeVolumeAppletDockClass;
GType gnome_volume_applet_dock_get_type (void);
-GtkWidget *gnome_volume_applet_dock_new (GtkOrientation orientation);
+GtkWidget *gnome_volume_applet_dock_new (GtkOrientation orientation,
+ GnomeVolumeApplet *parent);
void gnome_volume_applet_dock_change (GnomeVolumeAppletDock *dock,
GtkAdjustment *adj);
void gnome_volume_applet_dock_set_focus (GnomeVolumeAppletDock *dock);
Modified: trunk/mixer/docs/de/mixer_applet2.xml
==============================================================================
--- trunk/mixer/docs/de/mixer_applet2.xml (original)
+++ trunk/mixer/docs/de/mixer_applet2.xml Tue Dec 2 00:36:36 2008
@@ -31,7 +31,7 @@
<copyright>
<year>2000</year>
<holder>Dan Mueth</holder>
- </copyright><copyright><year>2008</year><holder>Mario BlÃttermann (mario blaettermann t-online de)</holder></copyright>
+ </copyright><copyright><year>2008</year><holder>Mario BlÃttermann (mariobl gnome org)</holder></copyright>
<!-- translators: uncomment this:
<copyright>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]