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

« back to all changes in this revision

Viewing changes to .pc/git_indicate_hspa+_lte_tech_dbe3b12.patch/src/mobile-helpers.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2012-11-19 14:46:29 UTC
  • mfrom: (1.2.31)
  • Revision ID: package-import@ubuntu.com-20121119144629-5423hii02a4vrh2n
Tags: 0.9.6.2+git201211052130.2d666bc-0ubuntu1
* upstream snapshot 2012-11-05 21:30:03 (GMT)
  + 2d666bc7aa6f0b731d131319b36f07b0f2bdce16
* debian/patches/git_fix_some_leaks_80ef61b.patch,
  debian/patches/git_indicate_hspa+_lte_tech_dbe3b12.patch,
  debian/patches/git_mac_addr_string_leakage_6dae878.patch: dropped, included
  in upstream tarball.
* debian/patches/lp328572-dxteam-connect-text.patch: refreshed.
* debian/patches/lp330571_dxteam_wired_connect_text.patch: refreshed.
* debian/patches/lp337960_dxteam_notification_icon_names.diff,
  debian/patches/lp337960_dxteam_notification_icon_names_part2-images.diff:
  disabled patches, they don't seem to be used (the icons don't match up with
  what is currently observable on the desktop). Let's see if someone screams.
* debian/patches/applet-wifi-menu-before-vpn.patch: refreshed.
* debian/patches/lp830178_adhoc_ip6_ignore.patch: refreshed.
* debian/patches/lp829673_gconf_hide_applet.patch: refreshed.
* debian/patches/nm-applet-use-indicator.patch: refreshed.
* debian/patches/hide_policy_items_env_var.patch: refreshed.
* debian/patches/applet_adhoc_use_wpa_rsn_part1.patch: refreshed.
* debian/patches/lp341684_device_sensitive_disconnect_notify.patch:
  refreshed.
* debian/patches/lp460144_correctly_update_notification.patch: refreshed.
* debian/patches/make_menu_items_insensitive_based_on_permissions.patch:
  refreshed.
* debian/control:
  - add gobject-introspection to Build-Depends.
  - add gudev-dev to Build-Depends.
  - bump network-manager and libnm-* Build-Depends and Depends to require
    at least 0.9.6.0+git201211131441.e9e2c56-0ubuntu1.
* debian/rules:
  - use autogen.sh with dh_autoreconf instead of calling intltoolize and
    gtkdocize manually.

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 Wireless Applet -- Display wireless access points and allow user control
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 2010 Red Hat, Inc.
21
 
 */
22
 
 
23
 
#include "mobile-helpers.h"
24
 
 
25
 
GdkPixbuf *
26
 
mobile_helper_get_status_pixbuf (guint32 quality,
27
 
                                 gboolean quality_valid,
28
 
                                 guint32 state,
29
 
                                 guint32 access_tech,
30
 
                                 NMApplet *applet)
31
 
{
32
 
        GdkPixbuf *pixbuf, *qual_pixbuf, *wwan_pixbuf, *tmp;
33
 
 
34
 
        wwan_pixbuf = nma_icon_check_and_load ("nm-wwan-tower", &applet->wwan_tower_icon, applet);
35
 
 
36
 
        if (!quality_valid)
37
 
                quality = 0;
38
 
        qual_pixbuf = mobile_helper_get_quality_icon (quality, applet);
39
 
 
40
 
        pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
41
 
                                 TRUE,
42
 
                                 gdk_pixbuf_get_bits_per_sample (qual_pixbuf),
43
 
                                 gdk_pixbuf_get_width (qual_pixbuf),
44
 
                                 gdk_pixbuf_get_height (qual_pixbuf));
45
 
        gdk_pixbuf_fill (pixbuf, 0xFFFFFF00);
46
 
 
47
 
        /* Composite the tower icon into the final icon at the bottom layer */
48
 
        gdk_pixbuf_composite (wwan_pixbuf, pixbuf,
49
 
                              0, 0,
50
 
                              gdk_pixbuf_get_width (wwan_pixbuf),
51
 
                                                  gdk_pixbuf_get_height (wwan_pixbuf),
52
 
                                                  0, 0, 1.0, 1.0,
53
 
                                                  GDK_INTERP_BILINEAR, 255);
54
 
 
55
 
        /* Composite the signal quality onto the icon on top of the WWAN tower */
56
 
        gdk_pixbuf_composite (qual_pixbuf, pixbuf,
57
 
                              0, 0,
58
 
                              gdk_pixbuf_get_width (qual_pixbuf),
59
 
                                                  gdk_pixbuf_get_height (qual_pixbuf),
60
 
                                                  0, 0, 1.0, 1.0,
61
 
                                                  GDK_INTERP_BILINEAR, 255);
62
 
 
63
 
        /* And finally the roaming or technology icon */
64
 
        if (state == MB_STATE_ROAMING) {
65
 
                tmp = nma_icon_check_and_load ("nm-mb-roam", &applet->mb_roaming_icon, applet);
66
 
                gdk_pixbuf_composite (tmp, pixbuf, 0, 0,
67
 
                                      gdk_pixbuf_get_width (tmp),
68
 
                                                          gdk_pixbuf_get_height (tmp),
69
 
                                                          0, 0, 1.0, 1.0,
70
 
                                                          GDK_INTERP_BILINEAR, 255);
71
 
        } else {
72
 
                tmp = mobile_helper_get_tech_icon (access_tech, applet);
73
 
                if (tmp) {
74
 
                        gdk_pixbuf_composite (tmp, pixbuf, 0, 0,
75
 
                                                  gdk_pixbuf_get_width (tmp),
76
 
                                                                  gdk_pixbuf_get_height (tmp),
77
 
                                                                  0, 0, 1.0, 1.0,
78
 
                                                                  GDK_INTERP_BILINEAR, 255);
79
 
                }
80
 
        }
81
 
 
82
 
        /* 'pixbuf' will be freed by the caller */
83
 
        return pixbuf;
84
 
}
85
 
 
86
 
GdkPixbuf *
87
 
mobile_helper_get_quality_icon (guint32 quality, NMApplet *applet)
88
 
{
89
 
        if (quality > 80)
90
 
                return nma_icon_check_and_load ("nm-signal-100", &applet->wireless_100_icon, applet);
91
 
        else if (quality > 55)
92
 
                return nma_icon_check_and_load ("nm-signal-75", &applet->wireless_75_icon, applet);
93
 
        else if (quality > 30)
94
 
                return nma_icon_check_and_load ("nm-signal-50", &applet->wireless_50_icon, applet);
95
 
        else if (quality > 5)
96
 
                return nma_icon_check_and_load ("nm-signal-25", &applet->wireless_25_icon, applet);
97
 
 
98
 
        return nma_icon_check_and_load ("nm-signal-00", &applet->wireless_00_icon, applet);
99
 
}
100
 
 
101
 
GdkPixbuf *
102
 
mobile_helper_get_tech_icon (guint32 tech, NMApplet *applet)
103
 
{
104
 
        switch (tech) {
105
 
        case MB_TECH_1XRTT:
106
 
                return nma_icon_check_and_load ("nm-tech-cdma-1x", &applet->mb_tech_1x_icon, applet);
107
 
        case MB_TECH_EVDO_REV0:
108
 
        case MB_TECH_EVDO_REVA:
109
 
                return nma_icon_check_and_load ("nm-tech-evdo", &applet->mb_tech_evdo_icon, applet);
110
 
        case MB_TECH_GSM:
111
 
        case MB_TECH_GPRS:
112
 
                return nma_icon_check_and_load ("nm-tech-gprs", &applet->mb_tech_gprs_icon, applet);
113
 
        case MB_TECH_EDGE:
114
 
                return nma_icon_check_and_load ("nm-tech-edge", &applet->mb_tech_edge_icon, applet);
115
 
        case MB_TECH_UMTS:
116
 
                return nma_icon_check_and_load ("nm-tech-umts", &applet->mb_tech_umts_icon, applet);
117
 
        case MB_TECH_HSDPA:
118
 
        case MB_TECH_HSUPA:
119
 
        case MB_TECH_HSPA:
120
 
                return nma_icon_check_and_load ("nm-tech-hspa", &applet->mb_tech_hspa_icon, applet);
121
 
        case MB_TECH_WIMAX:
122
 
        default:
123
 
                return NULL;
124
 
        }
125
 
}
126