Merge pull request #3919 from KasyanDiGris/master
Hide upower module when specified device disconnected
This commit is contained in:
@ -358,10 +358,12 @@ void UPower::resetDevices() {
|
|||||||
void UPower::setDisplayDevice() {
|
void UPower::setDisplayDevice() {
|
||||||
std::lock_guard<std::mutex> guard{mutex_};
|
std::lock_guard<std::mutex> guard{mutex_};
|
||||||
|
|
||||||
if (nativePath_.empty() && model_.empty()) {
|
if (upDevice_.upDevice != NULL) {
|
||||||
// Unref current upDevice
|
g_object_unref(upDevice_.upDevice);
|
||||||
if (upDevice_.upDevice != NULL) g_object_unref(upDevice_.upDevice);
|
upDevice_.upDevice = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nativePath_.empty() && model_.empty()) {
|
||||||
upDevice_.upDevice = up_client_get_display_device(upClient_);
|
upDevice_.upDevice = up_client_get_display_device(upClient_);
|
||||||
getUpDeviceInfo(upDevice_);
|
getUpDeviceInfo(upDevice_);
|
||||||
} else {
|
} else {
|
||||||
@ -386,7 +388,6 @@ void UPower::setDisplayDevice() {
|
|||||||
}
|
}
|
||||||
// Unref current upDevice if it exists
|
// Unref current upDevice if it exists
|
||||||
if (displayDevice.upDevice != NULL) {
|
if (displayDevice.upDevice != NULL) {
|
||||||
if (thisPtr->upDevice_.upDevice != NULL) g_object_unref(thisPtr->upDevice_.upDevice);
|
|
||||||
thisPtr->upDevice_ = displayDevice;
|
thisPtr->upDevice_ = displayDevice;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user