~ubuntu-branches/ubuntu/utopic/network-manager-applet/utopic

« back to all changes in this revision

Viewing changes to .pc/11-user-connections.patch/src/connection-editor/ce-page.h

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2014-03-18 14:48:18 UTC
  • Revision ID: package-import@ubuntu.com-20140318144818-iepmr37nqr0nzxup
Tags: 0.9.8.8-0ubuntu3
debian/patches/11-user-connections.patch: Allow users with access to modify
their own connection to create wireless connections without using
system-wide privileges. (LP: #1116317)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 
2
/* NetworkManager Connection editor -- Connection editor for NetworkManager
 
3
 *
 
4
 * Dan Williams <dcbw@redhat.com>
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License along
 
17
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
18
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
19
 *
 
20
 * (C) Copyright 2008 - 2012 Red Hat, Inc.
 
21
 */
 
22
 
 
23
#ifndef __CE_PAGE_H__
 
24
#define __CE_PAGE_H__
 
25
 
 
26
#include <glib.h>
 
27
#include <glib-object.h>
 
28
 
 
29
#include <gtk/gtk.h>
 
30
 
 
31
#include <dbus/dbus-glib.h>
 
32
#include <nm-connection.h>
 
33
#include <nm-client.h>
 
34
#include <nm-remote-settings.h>
 
35
#include "utils.h"
 
36
 
 
37
/* for ARPHRD_ETHER / ARPHRD_INFINIBAND for MAC utilies */
 
38
#include <net/if_arp.h>
 
39
 
 
40
typedef void (*PageNewConnectionResultFunc) (NMConnection *connection,
 
41
                                             gboolean canceled,
 
42
                                             GError *error,
 
43
                                             gpointer user_data);
 
44
 
 
45
typedef GSList * (*PageGetConnectionsFunc) (gpointer user_data);
 
46
 
 
47
typedef void (*PageNewConnectionFunc) (GtkWindow *parent,
 
48
                                       const char *detail,
 
49
                                       NMRemoteSettings *settings,
 
50
                                       PageNewConnectionResultFunc result_func,
 
51
                                       gpointer user_data);
 
52
 
 
53
#define CE_TYPE_PAGE            (ce_page_get_type ())
 
54
#define CE_PAGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CE_TYPE_PAGE, CEPage))
 
55
#define CE_PAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CE_TYPE_PAGE, CEPageClass))
 
56
#define CE_IS_PAGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CE_TYPE_PAGE))
 
57
#define CE_IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CE_TYPE_PAGE))
 
58
#define CE_PAGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CE_TYPE_PAGE, CEPageClass))
 
59
 
 
60
#define CE_PAGE_CONNECTION    "connection"
 
61
#define CE_PAGE_INITIALIZED   "initialized"
 
62
#define CE_PAGE_PARENT_WINDOW "parent-window"
 
63
 
 
64
typedef struct {
 
65
        GObject parent;
 
66
 
 
67
        gboolean initialized;
 
68
        GtkBuilder *builder;
 
69
        GtkWidget *page;
 
70
        char *title;
 
71
 
 
72
        DBusGProxy *proxy;
 
73
        gulong secrets_done_validate;
 
74
 
 
75
        NMConnection *connection;
 
76
        GtkWindow *parent_window;
 
77
        NMClient *client;
 
78
        NMRemoteSettings *settings;
 
79
 
 
80
        gboolean disposed;
 
81
} CEPage;
 
82
 
 
83
typedef struct {
 
84
        GObjectClass parent;
 
85
 
 
86
        /* Virtual functions */
 
87
        gboolean    (*validate)     (CEPage *self, NMConnection *connection, GError **error);
 
88
        /* Let the page warn the user if some property needs review */
 
89
        GtkWidget * (*nag_user)     (CEPage *self);
 
90
 
 
91
        /* Signals */
 
92
        void        (*changed)     (CEPage *self);
 
93
        void        (*initialized) (CEPage *self, GError *error);
 
94
} CEPageClass;
 
95
 
 
96
 
 
97
typedef CEPage* (*CEPageNewFunc)(NMConnection *connection,
 
98
                                 GtkWindow *parent,
 
99
                                 NMClient *client,
 
100
                                 NMRemoteSettings *settings,
 
101
                                 const char **out_secrets_setting_name,
 
102
                                 GError **error);
 
103
 
 
104
 
 
105
GType ce_page_get_type (void);
 
106
 
 
107
GtkWidget *  ce_page_get_page (CEPage *self);
 
108
 
 
109
const char * ce_page_get_title (CEPage *self);
 
110
 
 
111
gboolean ce_page_validate (CEPage *self, NMConnection *connection, GError **error);
 
112
 
 
113
char **ce_page_get_mac_list (CEPage *self, GType device_type, const char *mac_property);
 
114
void ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo,
 
115
                              const char *current_mac, char **mac_list);
 
116
 
 
117
void ce_page_changed (CEPage *self);
 
118
 
 
119
void ce_page_mac_to_entry (const GByteArray *mac, int type, GtkEntry *entry);
 
120
 
 
121
GByteArray *ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid);
 
122
 
 
123
gint ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data);
 
124
 
 
125
int ce_get_property_default (NMSetting *setting, const char *property_name);
 
126
 
 
127
void ce_page_complete_init (CEPage *self,
 
128
                            const char *setting_name,
 
129
                            GHashTable *secrets,
 
130
                            GError *error);
 
131
 
 
132
gboolean ce_page_get_initialized (CEPage *self);
 
133
 
 
134
char *ce_page_get_next_available_name (GSList *connections, const char *format);
 
135
 
 
136
GtkWidget *ce_page_nag_user (CEPage *self);
 
137
 
 
138
/* Only for subclasses */
 
139
NMConnection *ce_page_new_connection (const char *format,
 
140
                                      const char *ctype,
 
141
                                      gboolean autoconnect,
 
142
                                      NMRemoteSettings *settings,
 
143
                                      gpointer user_data);
 
144
 
 
145
CEPage *ce_page_new (GType page_type,
 
146
                     NMConnection *connection,
 
147
                     GtkWindow *parent_window,
 
148
                     NMClient *client,
 
149
                     NMRemoteSettings *settings,
 
150
                     const char *ui_file,
 
151
                     const char *widget_name,
 
152
                     const char *title);
 
153
 
 
154
#endif  /* __CE_PAGE_H__ */
 
155