| 1 | /* |
| 2 | * Copyright 2021 Marius Gripsgard <[email protected]> |
| 3 | * Copyright 2021-2023 Robert Tari <[email protected]> |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 3, as published |
| 7 | * by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but |
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of |
| 11 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 12 | * PURPOSE. See the GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #include "utils.h"cxx . . $ `<file>/src/utils.h`/ |
| 19 | #include <glib/gi18n-lib.h> |
| 20 | #include <string.h> |
| 21 | |
| 22 | #ifdef LOMIRI_FEATURES_ENABLED |
| 23 | # include <lomiri-url-dispatcher.h> |
| 24 | #endif |
| 25 | |
| 26 | static gbooleancxx . . $ gboolean# bI18nInitcxx . . $ bI18nInit. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 27 | |
| 28 | static void initI18ncxx . . $ initI18n(d878ad36e69247c7). () |
| 29 | { |
| 30 | if (!bI18nInitcxx . . $ bI18nInit.) |
| 31 | { |
| 32 | bindtextdomaincxx . . $ bindtextdomain(a713fe7b9a57cf96). (GETTEXT_PACKAGEcxx . . $ `<built-in>:410:9`!, LOCALEDIRcxx . . $ `<built-in>:411:9`!); |
| 33 | bind_textdomain_codesetcxx . . $ bind_textdomain_codeset(a713fe7b9a57cf96). (GETTEXT_PACKAGEcxx . . $ `<built-in>:410:9`!, "UTF-8"); |
| 34 | bI18nInitcxx . . $ bI18nInit. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // TODO: make case insensitive |
| 39 | gbooleancxx . . $ gboolean# |
| 40 | is_xdg_current_desktopcxx . . $ is_xdg_current_desktop(5ae29d726ae57f88). (const gcharcxx . . $ gchar#* desktop, const gcharcxx . . $ gchar#* session) |
| 41 | { |
| 42 | const gcharcxx . . $ gchar# *xdg_current_desktop; |
| 43 | |
| 44 | xdg_current_desktop = g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("XDG_CURRENT_DESKTOP"); |
| 45 | if (xdg_current_desktop != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 46 | gcharcxx . . $ gchar# **desktop_names = g_strsplitcxx . . $ g_strsplit(656a2b498280081). (xdg_current_desktop, ":", 0); |
| 47 | for (int i = 0; desktop_names[i]; ++i) { |
| 48 | if (!g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (desktop_names[i], desktop)) { |
| 49 | g_strfreevcxx . . $ g_strfreev(3ed91490e421178f). (desktop_names); |
| 50 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 51 | } |
| 52 | } |
| 53 | g_strfreevcxx . . $ g_strfreev(3ed91490e421178f). (desktop_names); |
| 54 | } |
| 55 | |
| 56 | if (session != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 57 | { |
| 58 | const gcharcxx . . $ gchar# *xdg_session_desktop = g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("XDG_SESSION_DESKTOP"); |
| 59 | if (xdg_session_desktop != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && g_str_equalcxx . . $ `<external>/7714589265505779806/ghash.h:175:9`!(xdg_session_desktop, session)) |
| 60 | { |
| 61 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 62 | } |
| 63 | |
| 64 | const gcharcxx . . $ gchar# *desktop_session = g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("DESKTOP_SESSION"); |
| 65 | if (desktop_session != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && g_str_equalcxx . . $ `<external>/7714589265505779806/ghash.h:175:9`!(desktop_session, session)) |
| 66 | { |
| 67 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 72 | } |
| 73 | |
| 74 | gbooleancxx . . $ gboolean# |
| 75 | ayatana_common_utils_is_lomiricxx . . $ ayatana_common_utils_is_lomiri(d1b40a211a1a4e4c). () |
| 76 | { |
| 77 | return is_xdg_current_desktopcxx . . $ is_xdg_current_desktop(5ae29d726ae57f88).(DESKTOP_LOMIRIcxx . . $ DESKTOP_LOMIRI., SESSION_LOMIRIcxx . . $ SESSION_LOMIRI.); |
| 78 | } |
| 79 | |
| 80 | gbooleancxx . . $ gboolean# |
| 81 | ayatana_common_utils_is_ubuntutouchcxx . . $ ayatana_common_utils_is_ubuntutouch(d1b40a211a1a4e4c). () |
| 82 | { |
| 83 | return is_xdg_current_desktopcxx . . $ is_xdg_current_desktop(5ae29d726ae57f88).(DESKTOP_UBUNTUTOUCHcxx . . $ DESKTOP_UBUNTUTOUCH., SESSION_UBUNTUTOUCHcxx . . $ SESSION_UBUNTUTOUCH.); |
| 84 | } |
| 85 | |
| 86 | gbooleancxx . . $ gboolean# |
| 87 | ayatana_common_utils_is_gnomecxx . . $ ayatana_common_utils_is_gnome(d1b40a211a1a4e4c). () |
| 88 | { |
| 89 | return is_xdg_current_desktopcxx . . $ is_xdg_current_desktop(5ae29d726ae57f88).(DESKTOP_GNOMEcxx . . $ DESKTOP_GNOME., SESSION_GNOMEcxx . . $ SESSION_GNOME.); |
| 90 | } |
| 91 | |
| 92 | gbooleancxx . . $ gboolean# |
| 93 | ayatana_common_utils_is_unitycxx . . $ ayatana_common_utils_is_unity(d1b40a211a1a4e4c). () |
| 94 | { |
| 95 | return is_xdg_current_desktopcxx . . $ is_xdg_current_desktop(5ae29d726ae57f88).(DESKTOP_UNITYcxx . . $ DESKTOP_UNITY., SESSION_UNITYcxx . . $ SESSION_UNITY.); |
| 96 | } |
| 97 | |
| 98 | gbooleancxx . . $ gboolean# |
| 99 | ayatana_common_utils_is_matecxx . . $ ayatana_common_utils_is_mate(d1b40a211a1a4e4c). () |
| 100 | { |
| 101 | return is_xdg_current_desktopcxx . . $ is_xdg_current_desktop(5ae29d726ae57f88).(DESKTOP_MATEcxx . . $ DESKTOP_MATE., SESSION_MATEcxx . . $ SESSION_MATE.); |
| 102 | } |
| 103 | |
| 104 | gbooleancxx . . $ gboolean# |
| 105 | ayatana_common_utils_is_xfcecxx . . $ ayatana_common_utils_is_xfce(d1b40a211a1a4e4c). () |
| 106 | { |
| 107 | return is_xdg_current_desktopcxx . . $ is_xdg_current_desktop(5ae29d726ae57f88).(DESKTOP_XFCEcxx . . $ DESKTOP_XFCE., SESSION_XFCEcxx . . $ SESSION_XFCE.); |
| 108 | } |
| 109 | |
| 110 | gbooleancxx . . $ gboolean# |
| 111 | ayatana_common_utils_is_pantheoncxx . . $ ayatana_common_utils_is_pantheon(d1b40a211a1a4e4c). () |
| 112 | { |
| 113 | return is_xdg_current_desktopcxx . . $ is_xdg_current_desktop(5ae29d726ae57f88).(DESKTOP_PANTHEONcxx . . $ DESKTOP_PANTHEON., SESSION_PANTHEONcxx . . $ SESSION_PANTHEON.); |
| 114 | } |
| 115 | |
| 116 | gbooleancxx . . $ gboolean# |
| 117 | ayatana_common_utils_is_budgiecxx . . $ ayatana_common_utils_is_budgie(d1b40a211a1a4e4c). () |
| 118 | { |
| 119 | return is_xdg_current_desktopcxx . . $ is_xdg_current_desktop(5ae29d726ae57f88).(DESKTOP_BUDGIEcxx . . $ DESKTOP_BUDGIE., SESSION_BUDGIEcxx . . $ SESSION_BUDGIE.); |
| 120 | } |
| 121 | |
| 122 | gbooleancxx . . $ gboolean# |
| 123 | ayatana_common_utils_have_unity_programcxx . . $ ayatana_common_utils_have_unity_program(5c4306d8553b3696). (const gcharcxx . . $ gchar# *program) |
| 124 | { |
| 125 | if (!ayatana_common_utils_is_unitycxx . . $ ayatana_common_utils_is_unity(d1b40a211a1a4e4c).()) |
| 126 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 127 | |
| 128 | return ayatana_common_utils_have_programcxx . . $ ayatana_common_utils_have_program(5c4306d8553b3696).(program); |
| 129 | } |
| 130 | |
| 131 | gbooleancxx . . $ gboolean# |
| 132 | ayatana_common_utils_have_gnome_programcxx . . $ ayatana_common_utils_have_gnome_program(5c4306d8553b3696). (const gcharcxx . . $ gchar# *program) |
| 133 | { |
| 134 | if (!ayatana_common_utils_is_gnomecxx . . $ ayatana_common_utils_is_gnome(d1b40a211a1a4e4c).()) |
| 135 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 136 | |
| 137 | return ayatana_common_utils_have_programcxx . . $ ayatana_common_utils_have_program(5c4306d8553b3696).(program); |
| 138 | } |
| 139 | |
| 140 | gbooleancxx . . $ gboolean# |
| 141 | ayatana_common_utils_have_mate_programcxx . . $ ayatana_common_utils_have_mate_program(5c4306d8553b3696). (const gcharcxx . . $ gchar# *program) |
| 142 | { |
| 143 | if (!ayatana_common_utils_is_matecxx . . $ ayatana_common_utils_is_mate(d1b40a211a1a4e4c).()) |
| 144 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 145 | |
| 146 | return ayatana_common_utils_have_programcxx . . $ ayatana_common_utils_have_program(5c4306d8553b3696).(program); |
| 147 | } |
| 148 | |
| 149 | gbooleancxx . . $ gboolean# |
| 150 | ayatana_common_utils_have_xfce_programcxx . . $ ayatana_common_utils_have_xfce_program(5c4306d8553b3696). (const gcharcxx . . $ gchar# *program) |
| 151 | { |
| 152 | if (!ayatana_common_utils_is_xfcecxx . . $ ayatana_common_utils_is_xfce(d1b40a211a1a4e4c).()) |
| 153 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 154 | |
| 155 | return ayatana_common_utils_have_programcxx . . $ ayatana_common_utils_have_program(5c4306d8553b3696).(program); |
| 156 | } |
| 157 | |
| 158 | gbooleancxx . . $ gboolean# |
| 159 | ayatana_common_utils_have_pantheon_programcxx . . $ ayatana_common_utils_have_pantheon_program(5c4306d8553b3696). (const gcharcxx . . $ gchar# *program) |
| 160 | { |
| 161 | if (!ayatana_common_utils_is_pantheoncxx . . $ ayatana_common_utils_is_pantheon(d1b40a211a1a4e4c).()) |
| 162 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 163 | |
| 164 | return ayatana_common_utils_have_programcxx . . $ ayatana_common_utils_have_program(5c4306d8553b3696).(program); |
| 165 | } |
| 166 | |
| 167 | gbooleancxx . . $ gboolean# |
| 168 | ayatana_common_utils_have_budgie_programcxx . . $ ayatana_common_utils_have_budgie_program(5c4306d8553b3696). (const gcharcxx . . $ gchar# *program) |
| 169 | { |
| 170 | if (!ayatana_common_utils_is_budgiecxx . . $ ayatana_common_utils_is_budgie(d1b40a211a1a4e4c).()) |
| 171 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 172 | |
| 173 | return ayatana_common_utils_have_programcxx . . $ ayatana_common_utils_have_program(5c4306d8553b3696).(program); |
| 174 | } |
| 175 | |
| 176 | |
| 177 | // Bit of a hacky way? should use xdg open |
| 178 | char * |
| 179 | find_browsercxx . . $ find_browser(1a2b1742f4ee1b69). () |
| 180 | { |
| 181 | static char * browser_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 182 | |
| 183 | if (browser_path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 184 | { |
| 185 | gcharcxx . . $ gchar# **browser_names = g_strsplitcxx . . $ g_strsplit(656a2b498280081). ("x-www-browser,google-chrome,firefox,chromium", ",", 0); |
| 186 | |
| 187 | for (int i = 0; browser_names[i]; ++i) { |
| 188 | char* tmp_browser_path = g_find_program_in_pathcxx . . $ g_find_program_in_path(a8b8e32347182212). (browser_names[i]); |
| 189 | |
| 190 | if (tmp_browser_path) { |
| 191 | browser_path = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (tmp_browser_path); |
| 192 | g_freecxx . . $ `<external>/1123956534522462559/gmem.h:171:9`! (tmp_browser_path); |
| 193 | g_strfreevcxx . . $ g_strfreev(3ed91490e421178f). (browser_names); |
| 194 | break; |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | return browser_path; |
| 200 | } |
| 201 | |
| 202 | gbooleancxx . . $ gboolean# |
| 203 | ayatana_common_utils_execute_commandcxx . . $ ayatana_common_utils_execute_command(5c4306d8553b3696). (const gcharcxx . . $ gchar# * cmd) |
| 204 | { |
| 205 | GErrorcxx . . $ GError# * err = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 206 | |
| 207 | g_debugcxx . . $ `<external>/5169755362661750954/gmessages.h:369:9`! ("Issuing command '%s'", cmd); |
| 208 | |
| 209 | if (!g_spawn_command_line_asynccxx . . $ g_spawn_command_line_async(5dde6684fab02cd7). (cmd, &err)) |
| 210 | { |
| 211 | g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:363:9`! ("Unable to start %s: %s", cmd, err->message); |
| 212 | g_error_freecxx . . $ g_error_free(2ff7d11a2ecc01bd). (err); |
| 213 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 214 | } |
| 215 | |
| 216 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 217 | } |
| 218 | |
| 219 | gbooleancxx . . $ gboolean# |
| 220 | ayatana_common_utils_open_urlcxx . . $ ayatana_common_utils_open_url(5c4306d8553b3696). (const gcharcxx . . $ gchar# * url) |
| 221 | { |
| 222 | if (ayatana_common_utils_is_lomiricxx . . $ ayatana_common_utils_is_lomiri(d1b40a211a1a4e4c).()) |
| 223 | { |
| 224 | #ifdef LOMIRI_FEATURES_ENABLED |
| 225 | lomiri_url_dispatch_send(url, NULL, NULL); |
| 226 | return TRUE; |
| 227 | #else |
| 228 | g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:363:9`!("Built without url-dispatcher, not able to open URL '%s'", url); |
| 229 | #endif |
| 230 | } |
| 231 | |
| 232 | char * browser = find_browsercxx . . $ find_browser(1a2b1742f4ee1b69).(); |
| 233 | |
| 234 | if (browser != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 235 | return ayatana_common_utils_execute_commandcxx . . $ ayatana_common_utils_execute_command(5c4306d8553b3696).(g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812).("%s '%s'", browser, url)); |
| 236 | else |
| 237 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 238 | |
| 239 | } |
| 240 | |
| 241 | gbooleancxx . . $ gboolean# |
| 242 | ayatana_common_utils_have_programcxx . . $ ayatana_common_utils_have_program(5c4306d8553b3696). (const gcharcxx . . $ gchar# * program) |
| 243 | { |
| 244 | gcharcxx . . $ gchar# *path; |
| 245 | gbooleancxx . . $ gboolean# have; |
| 246 | |
| 247 | path = g_find_program_in_pathcxx . . $ g_find_program_in_path(a8b8e32347182212).(program); |
| 248 | have = path != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 249 | g_freecxx . . $ `<external>/1123956534522462559/gmem.h:171:9`!(path); |
| 250 | |
| 251 | return have; |
| 252 | } |
| 253 | |
| 254 | gbooleancxx . . $ gboolean# |
| 255 | ayatana_common_utils_zenity_warningcxx . . $ ayatana_common_utils_zenity_warning(a8ee6f950d471de8). (const char * icon_name, |
| 256 | const char * title, |
| 257 | const char * text) |
| 258 | { |
| 259 | char * command_line; |
| 260 | int exit_status; |
| 261 | GErrorcxx . . $ GError# * error; |
| 262 | gbooleancxx . . $ gboolean# confirmed; |
| 263 | char * zenity; |
| 264 | |
| 265 | confirmed = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 266 | zenity = g_find_program_in_pathcxx . . $ g_find_program_in_path(a8b8e32347182212). ("zenity"); |
| 267 | |
| 268 | if (zenity) |
| 269 | { |
| 270 | command_line = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("%s" |
| 271 | " --warning" |
| 272 | " --icon-name=\"%s\"" |
| 273 | " --title=\"%s\"" |
| 274 | " --text=\"%s\"" |
| 275 | " --no-wrap", |
| 276 | zenity, |
| 277 | icon_name, |
| 278 | title, |
| 279 | text); |
| 280 | |
| 281 | /* Treat errors as user confirmation. |
| 282 | Otherwise how will the user ever log out? */ |
| 283 | exit_status = -1; |
| 284 | error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 285 | if (!g_spawn_command_line_synccxx . . $ g_spawn_command_line_sync(8a643325d6ae49e8). (command_line, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, &exit_status, &error)) |
| 286 | { |
| 287 | confirmed = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | #if GLIB_CHECK_VERSIONcxx . . $ `<external>/8230140741571432402/gversion.h:49:9`!(2, 70, 0) |
| 292 | confirmed = g_spawn_check_wait_statuscxx . . $ g_spawn_check_wait_status(aa2d95a526319da2). (exit_status, &error); |
| 293 | #else |
| 294 | confirmed = g_spawn_check_exit_status (exit_status, &error); |
| 295 | #endif |
| 296 | } |
| 297 | |
| 298 | g_freecxx . . $ `<external>/1123956534522462559/gmem.h:171:9`! (command_line); |
| 299 | } |
| 300 | g_freecxx . . $ `<external>/1123956534522462559/gmem.h:171:9`! (zenity); |
| 301 | return confirmed; |
| 302 | } |
| 303 | |
| 304 | void ayatana_common_utils_ellipsizecxx . . $ ayatana_common_utils_ellipsize(fda57c8427c60377).(char *sText) |
| 305 | { |
| 306 | guintcxx . . $ guint# nMaxLetters = 50; |
| 307 | glongcxx . . $ glong# nLetters = g_utf8_strlencxx . . $ g_utf8_strlen(730d9b36f6411b7f).(sText, -1); |
| 308 | GSettingsSchemaSourcecxx . . $ GSettingsSchemaSource# *pSource = g_settings_schema_source_get_defaultcxx . . $ g_settings_schema_source_get_default(5719febbb1eed5f3).(); |
| 309 | |
| 310 | if (pSource != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 311 | { |
| 312 | GSettingsSchemacxx . . $ GSettingsSchema# *pSchema = g_settings_schema_source_lookupcxx . . $ g_settings_schema_source_lookup(83053224dd3fe801).(pSource, "org.ayatana.common", FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 313 | |
| 314 | if (pSchema != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 315 | { |
| 316 | g_settings_schema_unrefcxx . . $ g_settings_schema_unref(4fbe8f58ccb85973).(pSchema); |
| 317 | GSettingscxx . . $ GSettings# *pSettings = g_settings_newcxx . . $ g_settings_new(5087f26a8cbce16d).("org.ayatana.common"); |
| 318 | nMaxLetters = g_settings_get_uintcxx . . $ g_settings_get_uint(7a9366a606f0c26b).(pSettings, "max-menu-text-length"); |
| 319 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(pSettings); |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | if (nMaxLetters > 0 && nLetters > nMaxLetters + 4) |
| 324 | { |
| 325 | gcharcxx . . $ gchar# *pLastChar = g_utf8_offset_to_pointercxx . . $ g_utf8_offset_to_pointer(a8ddf37f112087c3).(sText, nMaxLetters); |
| 326 | memcpycxx . . $ memcpy(cc817cb175f282d).(pLastChar, "...\0", 4); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | gbooleancxx . . $ gboolean# ayatana_common_utils_execute_command_warncxx . . $ ayatana_common_utils_execute_command_warn(5ae29d726ae57f88). (const gcharcxx . . $ gchar# *sProgram, const gcharcxx . . $ gchar# *sArgs) |
| 331 | { |
| 332 | gbooleancxx . . $ gboolean# bHasProgram = ayatana_common_utils_have_programcxx . . $ ayatana_common_utils_have_program(5c4306d8553b3696). (sProgram); |
| 333 | |
| 334 | if (!bHasProgram) |
| 335 | { |
| 336 | initI18ncxx . . $ initI18n(d878ad36e69247c7). (); |
| 337 | gcharcxx . . $ gchar# *sMessage = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). (_cxx . . $ `<external>/16453136837583379545/gi18n-lib.h:32:10`!("The %s program is required for this action, but it was not found."), sProgram); |
| 338 | ayatana_common_utils_zenity_warningcxx . . $ ayatana_common_utils_zenity_warning(a8ee6f950d471de8). ("dialog-warning", _cxx . . $ `<external>/16453136837583379545/gi18n-lib.h:32:10`!("Warning"), sMessage); |
| 339 | g_freecxx . . $ `<external>/1123956534522462559/gmem.h:171:9`! (sMessage); |
| 340 | |
| 341 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 342 | } |
| 343 | |
| 344 | gcharcxx . . $ gchar# *sCommand = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("%s %s", sProgram, sArgs); |
| 345 | gbooleancxx . . $ gboolean# bSuccess = ayatana_common_utils_execute_commandcxx . . $ ayatana_common_utils_execute_command(5c4306d8553b3696). (sCommand); |
| 346 | g_freecxx . . $ `<external>/1123956534522462559/gmem.h:171:9`! (sCommand); |
| 347 | |
| 348 | return bSuccess; |
| 349 | } |
| 350 | |
| 351 | gbooleancxx . . $ gboolean# ayatana_common_utils_zenity_questioncxx . . $ ayatana_common_utils_zenity_question(3bd9a0676092b391). (const gcharcxx . . $ gchar# *sIcon, const gcharcxx . . $ gchar# *sTitle, const gcharcxx . . $ gchar# *sText, const gcharcxx . . $ gchar# *sOk, const gcharcxx . . $ gchar# *sCancel) |
| 352 | { |
| 353 | gcharcxx . . $ gchar# *sZenity = g_find_program_in_pathcxx . . $ g_find_program_in_path(a8b8e32347182212). ("zenity"); |
| 354 | gcharcxx . . $ gchar# *sCommand = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("%s --question --icon-name=\"%s\" --title=\"%s\" --text=\"%s\" --ok-label=\"%s\" --cancel-label=\"%s\" --no-wrap", sZenity, sIcon, sTitle, sText, sOk, sCancel); |
| 355 | g_freecxx . . $ `<external>/1123956534522462559/gmem.h:171:9`! (sZenity); |
| 356 | int nStatus = -1; |
| 357 | GErrorcxx . . $ GError# *pError = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 358 | gbooleancxx . . $ gboolean# bConfirmed = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 359 | |
| 360 | if (!g_spawn_command_line_synccxx . . $ g_spawn_command_line_sync(8a643325d6ae49e8). (sCommand, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, &nStatus, &pError)) |
| 361 | { |
| 362 | bConfirmed = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 363 | } |
| 364 | else |
| 365 | { |
| 366 | #if GLIB_CHECK_VERSIONcxx . . $ `<external>/8230140741571432402/gversion.h:49:9`!(2, 70, 0) |
| 367 | bConfirmed = g_spawn_check_wait_statuscxx . . $ g_spawn_check_wait_status(aa2d95a526319da2). (nStatus, &pError); |
| 368 | #else |
| 369 | bConfirmed = g_spawn_check_exit_status (nStatus, &pError); |
| 370 | #endif |
| 371 | } |
| 372 | |
| 373 | if (pError) |
| 374 | { |
| 375 | if (!g_error_matchescxx . . $ g_error_matches(604444fafc3e7b63). (pError, G_IO_ERRORcxx . . $ `<external>/13894955190784973534/gioerror.h:42:9`!, G_IO_ERROR_CANCELLEDcxx . . $ G_IO_ERROR_CANCELLED.)) |
| 376 | { |
| 377 | g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:363:9`! ("%s %s: %s", G_STRLOCcxx . . $ `<external>/12741050725406041920/gmacros.h:928:9`!, G_STRFUNCcxx . . $ `<external>/12741050725406041920/gmacros.h:935:9`!, pError->message); |
| 378 | } |
| 379 | |
| 380 | g_clear_errorcxx . . $ g_clear_error(19f343512d040fc2). (&pError); |
| 381 | } |
| 382 | |
| 383 | g_freecxx . . $ `<external>/1123956534522462559/gmem.h:171:9`! (sCommand); |
| 384 | |
| 385 | return bConfirmed; |
| 386 | } |