~buo-ren-lin/audio-recorder/audio-recorder

« back to all changes in this revision

Viewing changes to src/utility.c

  • Committer: Osmo Antero
  • Date: 2019-03-03 17:46:10 UTC
  • Revision ID: osmoma@gmail.com-20190303174610-bpp1uhbr4kigqwos
VersionĀ 3.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
977
977
 
978
978
    g_free(icon_n);
979
979
    g_free(desktop_file);
980
 
    g_object_unref(app_info);
 
980
 
 
981
    if (app_info) 
 
982
        g_object_unref(app_info);
981
983
 
982
984
LBL_1:
983
985
 
1072
1074
    return (ret == 0);
1073
1075
}
1074
1076
 
 
1077
gint str_compare(const gchar *s1, const gchar *s2, gboolean case_insensitive) {
 
1078
    if (*s1 == '\0' && *s2 == '\0') {
 
1079
        // Equals
 
1080
        return 0;   
 
1081
    } 
 
1082
 
 
1083
    gint ret = 0;
 
1084
 
 
1085
    if (case_insensitive) { 
 
1086
        gchar *ss1 = g_utf8_casefold(s1, g_utf8_strlen(s1, MAX_PATH_LEN - 4));
 
1087
        gchar *ss2 = g_utf8_casefold(s2, g_utf8_strlen(s2, MAX_PATH_LEN - 4));
 
1088
    
 
1089
        ret = g_utf8_collate(ss1, ss2);
 
1090
        g_free(ss1);
 
1091
        g_free(ss2);
 
1092
 
 
1093
    } else {
 
1094
 
 
1095
        ret = g_utf8_collate(s1, s2);
 
1096
    }
 
1097
 
 
1098
    return ret;
 
1099
}
 
1100
 
1075
1101
/*
1076
1102
gchar *get_command_and_name(gchar *desktop_file, gchar **command) {
1077
1103
    // Load program.desktop file and return application name and executable command (with args).