comparison plugins/notify.c @ 4793:677d3cb193a1

[gaim-migrate @ 5113] this removes all the remaining deprecated glib, gdk, gdk-pixbuf, and gtk function calls. Hopefully I didn't break anything. Most of this is due to the deprecation of g_strcasecmp and g_strncasecmp. Two functions I never thought would be deprecated, but apparently they're no good at comparing utf8 text. g_ascii_str{,n}casecmp is OK when you're sure that it's ASCII. Otherwise, we're supposed to use g_utf8_collate(), except that it is case sensitive. Since glib doesn't currently have a case-insensitive one, I wrote one. If you need to compare utf8 text, you can use gaim_utf8_strcasecmp(). I have to go do dishes now. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 16 Mar 2003 00:01:49 +0000
parents 2427d847e39c
children 00b6af528964
comparison
equal deleted inserted replaced
4792:9212d1c5b7dc 4793:677d3cb193a1
294 c = counter(buf, &length); 294 c = counter(buf, &length);
295 if (number) { 295 if (number) {
296 g_snprintf(buf, sizeof(buf), "[%d] %s", number, win->title); 296 g_snprintf(buf, sizeof(buf), "[%d] %s", number, win->title);
297 } else if (!c) { 297 } else if (!c) {
298 g_snprintf(buf, sizeof(buf), "[1] %s", win->title); 298 g_snprintf(buf, sizeof(buf), "[1] %s", win->title);
299 } else if (!g_strncasecmp(buf, "[", 1)) { 299 } else if (buf[0]== '[' ) {
300 g_snprintf(buf, sizeof(buf), "[%d] %s", c+1, &win->title[3+length]); 300 g_snprintf(buf, sizeof(buf), "[%d] %s", c+1, &win->title[3+length]);
301 } 301 }
302 gtk_window_set_title(win, buf); 302 gtk_window_set_title(win, buf);
303 } 303 }
304 304
306 char buf[256]; 306 char buf[256];
307 GtkWindow *win = GTK_WINDOW(widget); 307 GtkWindow *win = GTK_WINDOW(widget);
308 int length; 308 int length;
309 309
310 strncpy(buf, win->title, sizeof(buf)); 310 strncpy(buf, win->title, sizeof(buf));
311 if (!g_strncasecmp(buf, "[", 1)) { 311 if (buf[0] == '[') {
312 Number = counter(buf, &length); 312 Number = counter(buf, &length);
313 g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]); 313 g_snprintf(buf, sizeof(buf), "%s", &win->title[3+length]);
314 gtk_window_set_title(win, buf); 314 gtk_window_set_title(win, buf);
315 return TRUE; 315 return TRUE;
316 } 316 }
320 void quote_add(GtkWidget *widget) { 320 void quote_add(GtkWidget *widget) {
321 char buf[256]; 321 char buf[256];
322 GtkWindow *win = GTK_WINDOW(widget); 322 GtkWindow *win = GTK_WINDOW(widget);
323 323
324 strncpy(buf, win->title, sizeof(buf)); 324 strncpy(buf, win->title, sizeof(buf));
325 if (g_strncasecmp(buf, "\"", 1)) { 325 if (buf[0] != '\"') {
326 g_snprintf(buf, sizeof(buf), "\"%s\"", win->title); 326 g_snprintf(buf, sizeof(buf), "\"%s\"", win->title);
327 gtk_window_set_title(win, buf); 327 gtk_window_set_title(win, buf);
328 } 328 }
329 } 329 }
330 330
331 gboolean quote_remove(GtkWidget *widget) { 331 gboolean quote_remove(GtkWidget *widget) {
332 char buf[256]; 332 char buf[256];
333 GtkWindow *win = GTK_WINDOW(widget); 333 GtkWindow *win = GTK_WINDOW(widget);
334 334
335 strncpy(buf, win->title, sizeof(buf)); 335 strncpy(buf, win->title, sizeof(buf));
336 if (!g_strncasecmp(buf, "\"", 1)) { 336 if (buf[0] == '\"') {
337 g_snprintf(buf, strlen(buf) - 1, "%s", &win->title[1]); 337 g_snprintf(buf, strlen(buf) - 1, "%s", &win->title[1]);
338 gtk_window_set_title(win, buf); 338 gtk_window_set_title(win, buf);
339 return TRUE; 339 return TRUE;
340 } 340 }
341 return FALSE; 341 return FALSE;