Debian Codegraph @

src/service.h

raw
1 /*
2 * ConnMan GTK GUI
3 *
4 * Copyright (C) 2015 Intel Corporation. All rights reserved.
5 * Author: Jaakko Hannikainen <[email protected]>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _CONNMAN_GTK_SERVICE_H
22 #define _CONNMAN_GTK_SERVICE_H
23
24 #include <gtk/gtk.h>
25 #include <gio/gio.h>
26 #include <glib.h>
27
28 #include "connection.h"
29 #include "technology.h"
30 #include "settings.h"
31 #include "util.h"
32
33 #define CONNECTION_TIMEOUT (120 * 1000)
34
35 struct service {
36 enum connection_type type;
37 struct technology *tech;
38 struct settings *sett;
39 GDBusProxy *proxy;
40 gchar *path;
41 DualHashTable *properties;
42 GtkWidget *item;
43 GtkWidget *header;
44 GtkWidget *title;
45 GtkWidget *contents;
46 GtkWidget *settings_button;
47 GtkWidget *ipv4;
48 GtkWidget *ipv4gateway;
49 GtkWidget *ipv6;
50 GtkWidget *ipv6gateway;
51 GtkWidget *mac;
52 void *data;
53 };
54
55 #define SIGNAL_TO_ICON(type, strength) \
56 ((strength) > 80 ? ("network-" type "-signal-excellent-symbolic") : \
57 (strength) > 55 ? ("network-" type "-signal-good-symbolic") : \
58 (strength) > 30 ? ("network-" type "-signal-ok-symbolic") : \
59 (strength) > 5 ? ("network-" type "-signal-weak-symbolic") : \
60 ("network-" type "-signal-none-symbolic"))
61
62 struct service *service_create(struct technology *tech, GDBusProxy *proxy,
63 const gchar *path, GVariant *properties);
64 void service_init(struct service *serv, GDBusProxy *proxy, const gchar *path,
65 GVariant *properties);
66 void service_update(struct service *serv, GVariant *properties);
67 void service_free(struct service *serv);
68 void service_toggle_connection(struct service *serv);
69
70 GVariant *service_get_property(struct service *serv, const char *key,
71 const char *subkey);
72 gchar *service_get_property_string_raw(struct service *serv, const char *key,
73 const char *subkey);
74 gchar *service_get_property_string(struct service *serv, const char *key,
75 const char *subkey);
76 gchar **service_get_property_strv(struct service *serv, const char *key,
77 const char *subkey);
78 gboolean service_get_property_boolean(struct service *serv, const char *key,
79 const char *subkey);
80 int service_get_property_int(struct service *serv, const char *key,
81 const char *subkey);
82 void service_set_property(struct service *serv, const char *key,
83 GVariant *value);
84 void service_clear_properties(struct service *serv);
85 void service_remove(struct service *serv);
86 void service_set_properties(struct service *serv, GVariant *properties);
87
88 #endif /* _CONNMAN_GTK_SERVICE_H */