wwan: fix hide-disconnected default, plug dup() leaks, meson/man cleanup
- update(): only hide the module when hide-disconnected is set AND the modem is not in the CONNECTED state, instead of hiding it unconditionally (the module was invisible by default). - free the gchar* returned by mm_modem_dup_physdev/ mm_modem_dup_equipment_identifier/mm_sim_dup_operator_name. - meson.build: drop duplicate libgps dependency, install the wwan man page. - man: document hide-disconnected (replacing the unimplemented hide-failed/hide-disabled/hide-not-registered options). - remove stray empty subprojects/.wraplock.
This commit is contained in:
+2
-12
@@ -113,20 +113,10 @@ libmm-glib lives in:
|
|||||||
typeof: string ++
|
typeof: string ++
|
||||||
Select only the modem with the corresponding hardware path.
|
Select only the modem with the corresponding hardware path.
|
||||||
|
|
||||||
*hide-failed*: ++
|
*hide-disconnected*: ++
|
||||||
typeof: bool ++
|
typeof: bool ++
|
||||||
default: true ++
|
default: true ++
|
||||||
Defines if the module should be hidden if the modem cannot start.
|
Defines if the module should be hidden while the modem does not have an active data connection.
|
||||||
|
|
||||||
*hide-disabled*: ++
|
|
||||||
typeof: bool ++
|
|
||||||
default: false ++
|
|
||||||
Defines if the module should be hidden if the modem is disabled.
|
|
||||||
|
|
||||||
*hide-not-registered*: ++
|
|
||||||
typeof: bool ++
|
|
||||||
default: false ++
|
|
||||||
Defines if the module should be hidden if the modem isn't registered with any carrier network.
|
|
||||||
|
|
||||||
|
|
||||||
# FORMAT REPLACEMENTS
|
# FORMAT REPLACEMENTS
|
||||||
|
|||||||
+1
-1
@@ -561,7 +561,7 @@ endif
|
|||||||
if libmm_glib.found()
|
if libmm_glib.found()
|
||||||
add_project_arguments('-DHAVE_LIBMM_GLIB', language: 'cpp')
|
add_project_arguments('-DHAVE_LIBMM_GLIB', language: 'cpp')
|
||||||
src_files += files('src/modules/wwan.cpp')
|
src_files += files('src/modules/wwan.cpp')
|
||||||
#man_files += files('man/waybar-wwan.5.scd')
|
man_files += files('man/waybar-wwan.5.scd')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
subdir('protocol')
|
subdir('protocol')
|
||||||
|
|||||||
+14
-5
@@ -69,7 +69,9 @@ void waybar::modules::Wwan::updateCurrentModem() {
|
|||||||
|
|
||||||
if (config_["path"].isString()) {
|
if (config_["path"].isString()) {
|
||||||
std::string path = config_["path"].asString();
|
std::string path = config_["path"].asString();
|
||||||
std::string other = mm_modem_dup_physdev(modem);
|
gchar* physdev = mm_modem_dup_physdev(modem);
|
||||||
|
std::string other = physdev ? physdev : "";
|
||||||
|
g_free(physdev);
|
||||||
|
|
||||||
if (path != other) {
|
if (path != other) {
|
||||||
g_object_unref(modem);
|
g_object_unref(modem);
|
||||||
@@ -80,7 +82,9 @@ void waybar::modules::Wwan::updateCurrentModem() {
|
|||||||
|
|
||||||
if (config_["imei"].isString()) {
|
if (config_["imei"].isString()) {
|
||||||
std::string imei = config_["imei"].asString();
|
std::string imei = config_["imei"].asString();
|
||||||
std::string other = mm_modem_dup_equipment_identifier(modem);
|
gchar* equipment_id = mm_modem_dup_equipment_identifier(modem);
|
||||||
|
std::string other = equipment_id ? equipment_id : "";
|
||||||
|
g_free(equipment_id);
|
||||||
|
|
||||||
if (imei != other) {
|
if (imei != other) {
|
||||||
g_object_unref(modem);
|
g_object_unref(modem);
|
||||||
@@ -210,7 +214,9 @@ std::string getOperatorNameString(MMModem* modem) {
|
|||||||
return "No SIM";
|
return "No SIM";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name = mm_sim_dup_operator_name(sim);
|
gchar* operator_name = mm_sim_dup_operator_name(sim);
|
||||||
|
std::string name = operator_name ? operator_name : "";
|
||||||
|
g_free(operator_name);
|
||||||
g_object_unref(sim);
|
g_object_unref(sim);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -222,7 +228,7 @@ auto waybar::modules::Wwan::update() -> void {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hideDisconnected) {
|
if (hideDisconnected && mm_modem_get_state(current_modem) != MM_MODEM_STATE_CONNECTED) {
|
||||||
event_box_.set_visible(false);
|
event_box_.set_visible(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -268,7 +274,10 @@ auto waybar::modules::Wwan::update() -> void {
|
|||||||
store.push_back(fmt::arg("icon", getIcon(percentage)));
|
store.push_back(fmt::arg("icon", getIcon(percentage)));
|
||||||
|
|
||||||
store.push_back(fmt::arg("power_state", getPowerStateString(current_modem)));
|
store.push_back(fmt::arg("power_state", getPowerStateString(current_modem)));
|
||||||
store.push_back(fmt::arg("imei", mm_modem_dup_equipment_identifier(current_modem)));
|
gchar* imei_raw = mm_modem_dup_equipment_identifier(current_modem);
|
||||||
|
std::string imei = imei_raw ? imei_raw : "";
|
||||||
|
g_free(imei_raw);
|
||||||
|
store.push_back(fmt::arg("imei", imei));
|
||||||
|
|
||||||
store.push_back(fmt::arg("operator_name", getOperatorNameString(current_modem)));
|
store.push_back(fmt::arg("operator_name", getOperatorNameString(current_modem)));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user