~ubuntu-branches/ubuntu/trusty/gnome-control-center/trusty-proposed

« back to all changes in this revision

Viewing changes to panels/sound-nua/cc-sound-panel.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Brian Murray
  • Date: 2014-02-26 19:21:03 UTC
  • Revision ID: package-import@ubuntu.com-20140226192103-eem23maw14t3w0jj
Tags: 1:3.6.3-0ubuntu52
* debian/patches/gcc_not_in_unity.patch:
  - don't list "Unity" in OnlyShowIn, other g-c-c and u-c-c entries get 
    duplicated in the Unity dash, when they both installed (lp: #1280872)
* debian/libgnome-control-center1.symbols,
  debian/patches/10_keyboard_layout_on_unity.patch,
  debian/patches/input-sources-text-entry.patch,
  debian/patches/sound_nua_panel.patch,
  debian/patches/unity_menus.patch,
  debian/patches/unity_notice_info.patch:
  - dropped some unity specific changes

[ Brian Murray ]
* debian/source_gnome-control-center.py: Do not pass an empty list
  of plugin packages to apport. (LP: #1237119)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2
 
 *
3
 
 * Copyright (C) 2008 Red Hat, Inc.
4
 
 *
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.
9
 
 *
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.
14
 
 *
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
18
 
 * 02111-1307, USA.
19
 
 */
20
 
 
21
 
#include "config.h"
22
 
 
23
 
#include <libintl.h>
24
 
#include <stdlib.h>
25
 
#include <string.h>
26
 
#include <unistd.h>
27
 
#include <errno.h>
28
 
 
29
 
#include <glib/gi18n-lib.h>
30
 
#include <glib.h>
31
 
#include <gtk/gtk.h>
32
 
#include <pulse/pulseaudio.h>
33
 
 
34
 
#include "cc-sound-panel.h"
35
 
#include "gvc-mixer-dialog.h"
36
 
 
37
 
G_DEFINE_DYNAMIC_TYPE (CcSoundNuaPanel, cc_sound_panel, CC_TYPE_PANEL)
38
 
 
39
 
enum {
40
 
        PROP_0,
41
 
        PROP_ARGV
42
 
};
43
 
 
44
 
static void cc_sound_panel_finalize (GObject *object);
45
 
 
46
 
static void
47
 
cc_sound_panel_set_property (GObject      *object,
48
 
                             guint         property_id,
49
 
                             const GValue *value,
50
 
                             GParamSpec   *pspec)
51
 
{
52
 
        CcSoundNuaPanel *self = CC_SOUND_PANEL (object);
53
 
 
54
 
        switch (property_id) {
55
 
        case PROP_ARGV: {
56
 
                gchar **args;
57
 
 
58
 
                args = g_value_get_boxed (value);
59
 
 
60
 
                if (args && args[0]) {
61
 
                        gvc_mixer_dialog_set_page (self->dialog, args[0]);
62
 
                }
63
 
                break;
64
 
        }
65
 
        default:
66
 
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
67
 
        }
68
 
}
69
 
 
70
 
static void
71
 
cc_sound_panel_class_init (CcSoundNuaPanelClass *klass)
72
 
{
73
 
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
74
 
 
75
 
        object_class->finalize = cc_sound_panel_finalize;
76
 
        object_class->set_property = cc_sound_panel_set_property;
77
 
 
78
 
        g_object_class_override_property (object_class, PROP_ARGV, "argv");
79
 
}
80
 
 
81
 
static void
82
 
cc_sound_panel_class_finalize (CcSoundNuaPanelClass *klass)
83
 
{
84
 
}
85
 
 
86
 
static void
87
 
cc_sound_panel_finalize (GObject *object)
88
 
{
89
 
        CcSoundNuaPanel *panel = CC_SOUND_PANEL (object);
90
 
 
91
 
        if (panel->dialog != NULL)
92
 
                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;
98
 
        }
99
 
 
100
 
        G_OBJECT_CLASS (cc_sound_panel_parent_class)->finalize (object);
101
 
}
102
 
 
103
 
static void
104
 
cc_sound_panel_init (CcSoundNuaPanel *self)
105
 
{
106
 
        gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
107
 
                                           ICON_DATA_DIR);
108
 
        gtk_window_set_default_icon_name ("multimedia-volume-control");
109
 
 
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));
115
 
}
116
 
 
117
 
void
118
 
cc_sound_panel_register (GIOModule *module)
119
 
{
120
 
        cc_sound_panel_register_type (G_TYPE_MODULE (module));
121
 
        g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
122
 
                                        CC_TYPE_SOUND_PANEL,
123
 
                                        "sound-nua", 0);
124
 
}
125
 
 
126
 
/* GIO extension stuff */
127
 
void
128
 
g_io_module_load (GIOModule *module)
129
 
{
130
 
        bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
131
 
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
132
 
 
133
 
        /* register the panel */
134
 
        cc_sound_panel_register (module);
135
 
}
136
 
 
137
 
void
138
 
g_io_module_unload (GIOModule *module)
139
 
{
140
 
}
141