Example #1
0
    def on_mm_device_added(self, path, name="org.freedesktop.ModemManager"):
        dprint(path)
        interface = "%s.Modem" % name
        props = self.parent.bus.call_blocking(name, path, "org.freedesktop.DBus.Properties", "GetAll", "s", [interface])

        try:
            drivers = props["Drivers"]
        except KeyError:
            drivers = [props["Driver"]]

        if self.rfcomm_dev and "bluetooth" in drivers and props["Device"] in self.rfcomm_dev:
            dprint("It's our bluetooth modem!")

            modem = get_icon("modem", 24)
            blueman = get_icon("blueman", 48)

            icon = composite_icon(blueman, [(modem, 24, 24, 255)])

            Notification(_("Bluetooth Dialup"),
                         _("DUN connection on %s will now be available in Network Manager") % self.service.device.Alias,
                         pixbuf=icon,
                         status_icon=self.parent.Applet.Plugins.StatusIcon)

            self.reply(self.rfcomm_dev)
            self.cleanup()
Example #2
0
    def on_mm_device_added(self, path, name="org.freedesktop.ModemManager"):
        dprint(path)
        interface = "%s.Modem" % name
        props = self.parent.bus.call_blocking(
            name, path, "org.freedesktop.DBus.Properties", "GetAll", "s",
            [interface])

        try:
            drivers = props["Drivers"]
        except KeyError:
            drivers = [props["Driver"]]

        if self.rfcomm_dev and "bluetooth" in drivers and props[
                "Device"] in self.rfcomm_dev:
            dprint("It's our bluetooth modem!")

            modem = get_icon("modem", 24)
            blueman = get_icon("blueman", 48)

            icon = composite_icon(blueman, [(modem, 24, 24, 255)])

            Notification(
                _("Bluetooth Dialup"),
                _("DUN connection on %s will now be available in Network Manager"
                  ) % self.service.device['Alias'],
                pixbuf=icon,
                status_icon=self.parent.Applet.Plugins.StatusIcon)

            self.reply(self.rfcomm_dev)
            self.cleanup()
Example #3
0
    def on_mm_device_added(self, path):
        dprint(path)
        props = self.parent.bus.call_blocking(
            "org.freedesktop.ModemManager", path,
            "org.freedesktop.DBus.Properties", "GetAll", "s",
            ["org.freedesktop.ModemManager.Modem"])

        if self.rfcomm_dev and props["Driver"] == "bluetooth" and props[
                "Device"] in self.rfcomm_dev:
            dprint("It's our bluetooth modem!")

            modem = get_icon("modem", 24)
            blueman = get_icon("blueman", 48)

            icon = composite_icon(blueman, [(modem, 24, 24, 255)])

            Notification(
                _("Bluetooth Dialup"),
                _("DUN connection on %s will now be available in Network Manager"
                  ) % self.device.Alias,
                pixbuf=icon,
                status_icon=self.parent.Applet.Plugins.StatusIcon)

            self.reply(self.rfcomm_dev)
            self.cleanup()
Example #4
0
    def on_mm_device_added(self, path):
        dprint(path)
        props = self.parent.bus.call_blocking(
            "org.freedesktop.ModemManager",
            path,
            "org.freedesktop.DBus.Properties",
            "GetAll",
            "s",
            ["org.freedesktop.ModemManager.Modem"],
        )

        if self.rfcomm_dev and props["Driver"] == "bluetooth" and props["Device"] in self.rfcomm_dev:
            dprint("It's our bluetooth modem!")

            modem = get_icon("modem", 24)
            blueman = get_icon("blueman", 48)

            icon = composite_icon(blueman, [(modem, 24, 24, 255)])

            Notification(
                _("Bluetooth Dialup"),
                _("DUN connection on %s will now be available in Network Manager") % self.device.Alias,
                pixbuf=icon,
                status_icon=self.parent.Applet.Plugins.StatusIcon,
            )

            self.reply(self.rfcomm_dev)
            self.cleanup()
Example #5
0
    def make_device_icon(self,
                         target,
                         is_bonded=False,
                         is_trusted=False,
                         is_discovered=False,
                         opacity=255):
        if opacity != 255:
            target = opacify_pixbuf(target, opacity)

        sources = []
        if is_bonded:
            sources.append((get_icon("dialog-password", 16), 0, 0, 200))

        if is_trusted:
            sources.append((get_icon("blueman-trust", 16), 0, 32, 200))

        if is_discovered:
            sources.append((get_icon("edit-find", 24), 24, 0, 255))

        return composite_icon(target, sources)
Example #6
0
    def on_mm_device_added(self, path, name="org.freedesktop.ModemManager"):
        logging.info(path)
        interface = "%s.Modem" % name
        res = self.parent._bus.call_sync(name, path, 'org.freedesktop.DBus.Properties', "GetAll",
                                         GLib.Variant("(s)", (interface,)),
                                         None, Gio.DBusCallFlags.NONE, GLib.MAXINT, None)
        props = res.unpack()[0]

        if self.rfcomm_dev and "bluetooth" in props["Drivers"] and self.rfcomm_dev.split('/')[-1] in props["Device"]:
            logging.info("It's our bluetooth modem!")

            modem = get_icon("modem", 24)
            blueman = get_icon("blueman", 48)

            icon = composite_icon(blueman, [(modem, 24, 24, 255)])

            Notification(
                _("Bluetooth Dialup"),
                _("DUN connection on %s will now be available in Network Manager") % self.service.device['Alias'],
                image_data=icon).show()

            self.reply(self.rfcomm_dev)
            self.cleanup()
Example #7
0
def get_x_icon(icon_name, size):
    ic = get_icon(icon_name, size)
    x = get_icon("blueman-x", size)
    pixbuf = composite_icon(ic, [(x, 0, 0, 255)])

    return pixbuf
Example #8
0
def get_x_icon(icon_name, size):
    ic = get_icon(icon_name, size)
    x = get_icon("blueman-x", size)
    pixbuf = composite_icon(ic, [(x, 0, 0, 255)])

    return pixbuf