1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
3
* Copyright (C) 2008 Red Hat, Inc.
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
7
* published by the Free Software Foundation; either version 2 of the
8
* License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29
#include <glib/gi18n-lib.h>
32
#include <pulse/pulseaudio.h>
34
#include "cc-sound-panel.h"
35
#include "gvc-mixer-dialog.h"
37
G_DEFINE_DYNAMIC_TYPE (CcSoundPanel, cc_sound_panel, CC_TYPE_PANEL)
44
static void cc_sound_panel_finalize (GObject *object);
47
cc_sound_panel_set_property (GObject *object,
52
CcSoundPanel *self = CC_SOUND_PANEL (object);
54
switch (property_id) {
58
args = g_value_get_boxed (value);
60
if (args && args[0]) {
61
gvc_mixer_dialog_set_page (self->dialog, args[0]);
66
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
71
cc_sound_panel_class_init (CcSoundPanelClass *klass)
73
GObjectClass *object_class = G_OBJECT_CLASS (klass);
75
object_class->finalize = cc_sound_panel_finalize;
76
object_class->set_property = cc_sound_panel_set_property;
78
g_object_class_override_property (object_class, PROP_ARGV, "argv");
82
cc_sound_panel_class_finalize (CcSoundPanelClass *klass)
87
cc_sound_panel_finalize (GObject *object)
89
CcSoundPanel *panel = CC_SOUND_PANEL (object);
91
if (panel->dialog != NULL)
93
if (panel->connecting_label != NULL)
94
panel->connecting_label = NULL;
95
if (panel->control != NULL) {
96
g_object_unref (panel->control);
97
panel->control = NULL;
100
G_OBJECT_CLASS (cc_sound_panel_parent_class)->finalize (object);
104
cc_sound_panel_init (CcSoundPanel *self)
106
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
108
gtk_window_set_default_icon_name ("unity-sound-panel");
110
self->control = gvc_mixer_control_new ("GNOME Volume Control Dialog");
111
gvc_mixer_control_open (self->control);
112
self->dialog = gvc_mixer_dialog_new (self->control);
113
gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->dialog));
114
gtk_widget_show (GTK_WIDGET (self->dialog));
118
cc_sound_panel_register (GIOModule *module)
120
cc_sound_panel_register_type (G_TYPE_MODULE (module));
121
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
126
/* GIO extension stuff */
128
g_io_module_load (GIOModule *module)
130
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
131
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
133
/* register the panel */
134
cc_sound_panel_register (module);
138
g_io_module_unload (GIOModule *module)