pidgin/gtkutils.c

changeset 40125
a7acc7b00d79
parent 40094
8e6d91e4dd8f
child 40134
e7b673f290bb
equal deleted inserted replaced
40124:cdce45867b10 40125:a7acc7b00d79
1372 continue; 1372 continue;
1373 } 1373 }
1374 1374
1375 #ifndef _WIN32 1375 #ifndef _WIN32
1376 /* Are we trying to send a .desktop file? */ 1376 /* Are we trying to send a .desktop file? */
1377 else if (purple_str_has_suffix(basename, ".desktop")) { 1377 else if (g_str_has_suffix(basename, ".desktop")) {
1378 pidgin_dnd_file_send_desktop(account, who, filename); 1378 pidgin_dnd_file_send_desktop(account, who, filename);
1379 1379
1380 continue; 1380 continue;
1381 } 1381 }
1382 #endif /* _WIN32 */ 1382 #endif /* _WIN32 */
1577 model = gtk_entry_completion_get_model(completion); 1577 model = gtk_entry_completion_get_model(completion);
1578 1578
1579 val1.g_type = 0; 1579 val1.g_type = 0;
1580 gtk_tree_model_get_value(model, iter, COMPLETION_NORMALIZED_COLUMN, &val1); 1580 gtk_tree_model_get_value(model, iter, COMPLETION_NORMALIZED_COLUMN, &val1);
1581 tmp = g_value_get_string(&val1); 1581 tmp = g_value_get_string(&val1);
1582 if (tmp != NULL && purple_str_has_prefix(tmp, key)) 1582 if (tmp != NULL && g_str_has_prefix(tmp, key)) {
1583 {
1584 g_value_unset(&val1); 1583 g_value_unset(&val1);
1585 return TRUE; 1584 return TRUE;
1586 } 1585 }
1587 g_value_unset(&val1); 1586 g_value_unset(&val1);
1588 1587
1589 val2.g_type = 0; 1588 val2.g_type = 0;
1590 gtk_tree_model_get_value(model, iter, COMPLETION_COMPARISON_COLUMN, &val2); 1589 gtk_tree_model_get_value(model, iter, COMPLETION_COMPARISON_COLUMN, &val2);
1591 tmp = g_value_get_string(&val2); 1590 tmp = g_value_get_string(&val2);
1592 if (tmp != NULL && purple_str_has_prefix(tmp, key)) 1591 if (tmp != NULL && g_str_has_prefix(tmp, key)) {
1593 {
1594 g_value_unset(&val2); 1592 g_value_unset(&val2);
1595 return TRUE; 1593 return TRUE;
1596 } 1594 }
1597 g_value_unset(&val2); 1595 g_value_unset(&val2);
1598 1596
2349 tmp = g_utf8_normalize(nomarkup, -1, G_NORMALIZE_DEFAULT); 2347 tmp = g_utf8_normalize(nomarkup, -1, G_NORMALIZE_DEFAULT);
2350 g_free(nomarkup); 2348 g_free(nomarkup);
2351 normalized = g_utf8_casefold(tmp, -1); 2349 normalized = g_utf8_casefold(tmp, -1);
2352 g_free(tmp); 2350 g_free(tmp);
2353 2351
2354 if (purple_str_has_prefix(normalized, enteredstring)) 2352 if (g_str_has_prefix(normalized, enteredstring)) {
2355 {
2356 g_free(withmarkup); 2353 g_free(withmarkup);
2357 g_free(enteredstring); 2354 g_free(enteredstring);
2358 g_free(normalized); 2355 g_free(normalized);
2359 return FALSE; 2356 return FALSE;
2360 } 2357 }
2361
2362 2358
2363 /* Use Pango to separate by words. */ 2359 /* Use Pango to separate by words. */
2364 len = g_utf8_strlen(normalized, -1); 2360 len = g_utf8_strlen(normalized, -1);
2365 log_attrs = g_new(PangoLogAttr, len + 1); 2361 log_attrs = g_new(PangoLogAttr, len + 1);
2366 2362
2369 word = normalized; 2365 word = normalized;
2370 result = TRUE; 2366 result = TRUE;
2371 for (i = 0; i < (len - 1) ; i++) 2367 for (i = 0; i < (len - 1) ; i++)
2372 { 2368 {
2373 if (log_attrs[i].is_word_start && 2369 if (log_attrs[i].is_word_start &&
2374 purple_str_has_prefix(word, enteredstring)) 2370 g_str_has_prefix(word, enteredstring)) {
2375 {
2376 result = FALSE; 2371 result = FALSE;
2377 break; 2372 break;
2378 } 2373 }
2379 word = g_utf8_next_char(word); 2374 word = g_utf8_next_char(word);
2380 } 2375 }
2388 { 2383 {
2389 gunichar c = g_utf8_get_char(word); 2384 gunichar c = g_utf8_get_char(word);
2390 if (!g_unichar_isalnum(c)) 2385 if (!g_unichar_isalnum(c))
2391 { 2386 {
2392 word = g_utf8_find_next_char(word, NULL); 2387 word = g_utf8_find_next_char(word, NULL);
2393 if (purple_str_has_prefix(word, enteredstring)) 2388 if (g_str_has_prefix(word, enteredstring))
2394 { 2389 {
2395 result = FALSE; 2390 result = FALSE;
2396 break; 2391 break;
2397 } 2392 }
2398 } 2393 }

mercurial