Mercurial > pidgin
comparison src/gtknotify.c @ 13090:0aa231ebbfd5
[gaim-migrate @ 15452]
Changes to some pixbuf stuff.
I added a 'gaim_gtk_create_gaim_icon_with_status()' function to util.c,
and changed 'gaim_gtk_create_prpl_icon_with_status()' to accept a scale
factor because almost everywhere this function was used we would scale
the pixbuf to a smaller size as soon as we got it. So there's a bit less
code duplication.
Also, I think I added some g_object_unref()'s in one or two places where
it was missing.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 01 Feb 2006 22:38:34 +0000 |
parents | 14a103c0e4d5 |
children | 3de53fe8345f |
comparison
equal
deleted
inserted
replaced
13089:b553326bc468 | 13090:0aa231ebbfd5 |
---|---|
390 gtk_tree_view_column_set_title(column, _("Subject")); | 390 gtk_tree_view_column_set_title(column, _("Subject")); |
391 rend = gtk_cell_renderer_text_new(); | 391 rend = gtk_cell_renderer_text_new(); |
392 gtk_tree_view_column_pack_start(column, rend, TRUE); | 392 gtk_tree_view_column_pack_start(column, rend, TRUE); |
393 gtk_tree_view_column_set_attributes(column, rend, "markup", GAIM_MAIL_SUBJECT, NULL); | 393 gtk_tree_view_column_set_attributes(column, rend, "markup", GAIM_MAIL_SUBJECT, NULL); |
394 gtk_tree_view_append_column(GTK_TREE_VIEW(mail_dialog->treeview), column); | 394 gtk_tree_view_append_column(GTK_TREE_VIEW(mail_dialog->treeview), column); |
395 | 395 |
396 gtk_container_add(GTK_CONTAINER(sw), mail_dialog->treeview); | 396 gtk_container_add(GTK_CONTAINER(sw), mail_dialog->treeview); |
397 | 397 |
398 label = gtk_label_new(NULL); | 398 label = gtk_label_new(NULL); |
399 gtk_label_set_markup(GTK_LABEL(label), _("<span weight=\"bold\" size=\"larger\">You have mail!</span>")); | 399 gtk_label_set_markup(GTK_LABEL(label), _("<span weight=\"bold\" size=\"larger\">You have mail!</span>")); |
400 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | 400 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
408 { | 408 { |
409 dialog = mail_dialog->dialog; | 409 dialog = mail_dialog->dialog; |
410 while (count--) | 410 while (count--) |
411 { | 411 { |
412 char *from_text = NULL, *subject_text = NULL; | 412 char *from_text = NULL, *subject_text = NULL; |
413 GdkPixbuf *pixbuf, *scale = NULL; | 413 GdkPixbuf *pixbuf; |
414 | 414 |
415 if (froms != NULL) | 415 if (froms != NULL) |
416 from_text = g_markup_escape_text(*froms, -1); | 416 from_text = g_markup_escape_text(*froms, -1); |
417 | 417 |
418 if (subjects != NULL) | 418 if (subjects != NULL) |
419 subject_text = g_markup_escape_text(*subjects, -1); | 419 subject_text = g_markup_escape_text(*subjects, -1); |
420 | 420 |
421 data = g_new0(GaimNotifyMailData, 1); | 421 data = g_new0(GaimNotifyMailData, 1); |
422 data->url = g_strdup(*urls); | 422 data->url = g_strdup(*urls); |
423 | 423 |
424 pixbuf = gaim_gtk_create_prpl_icon(account); | 424 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5); |
425 if (pixbuf != NULL) | |
426 { | |
427 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, | |
428 GDK_INTERP_BILINEAR); | |
429 g_object_unref(pixbuf); | |
430 } | |
431 | 425 |
432 gtk_tree_store_append(mail_dialog->treemodel, &iter, NULL); | 426 gtk_tree_store_append(mail_dialog->treemodel, &iter, NULL); |
433 gtk_tree_store_set(mail_dialog->treemodel, &iter, | 427 gtk_tree_store_set(mail_dialog->treemodel, &iter, |
434 GAIM_MAIL_ICON, scale, | 428 GAIM_MAIL_ICON, pixbuf, |
435 GAIM_MAIL_TO, *tos, | 429 GAIM_MAIL_TO, *tos, |
436 GAIM_MAIL_FROM, from_text, | 430 GAIM_MAIL_FROM, from_text, |
437 GAIM_MAIL_SUBJECT, subject_text, | 431 GAIM_MAIL_SUBJECT, subject_text, |
438 GAIM_MAIL_DATA, data, | 432 GAIM_MAIL_DATA, data, |
439 -1); | 433 -1); |
434 if (pixbuf != NULL) | |
435 g_object_unref(pixbuf); | |
440 data->iter = iter; | 436 data->iter = iter; |
441 urls++; | 437 urls++; |
442 froms++; | 438 froms++; |
443 subjects++; | 439 subjects++; |
444 tos++; | 440 tos++; |
579 void *data_, gpointer user_data) | 575 void *data_, gpointer user_data) |
580 { | 576 { |
581 GaimNotifySearchResultsData *data = data_; | 577 GaimNotifySearchResultsData *data = data_; |
582 GtkListStore *model = data->model; | 578 GtkListStore *model = data->model; |
583 GtkTreeIter iter; | 579 GtkTreeIter iter; |
584 GdkPixbuf *icon, *scaled; | 580 GdkPixbuf *pixbuf; |
585 guint col_num; | 581 guint col_num; |
586 guint i; | 582 guint i; |
587 guint j; | 583 guint j; |
588 | 584 |
589 gtk_list_store_clear(data->model); | 585 gtk_list_store_clear(data->model); |
590 | 586 |
591 icon = gaim_gtk_create_prpl_icon(gaim_connection_get_account(gc)); | 587 pixbuf = gaim_gtk_create_prpl_icon(gaim_connection_get_account(gc), 0.5); |
592 scaled = gdk_pixbuf_scale_simple(icon, 16, 16, GDK_INTERP_BILINEAR); | |
593 | 588 |
594 /* +1 is for the automagically created Status column. */ | 589 /* +1 is for the automagically created Status column. */ |
595 col_num = gaim_notify_searchresults_get_columns_count(results) + 1; | 590 col_num = gaim_notify_searchresults_get_columns_count(results) + 1; |
596 | 591 |
597 for (i = 0; i < gaim_notify_searchresults_get_rows_count(results); i++) { | 592 for (i = 0; i < gaim_notify_searchresults_get_rows_count(results); i++) { |
598 GList *row = gaim_notify_searchresults_row_get(results, i); | 593 GList *row = gaim_notify_searchresults_row_get(results, i); |
599 | 594 |
600 gtk_list_store_append(model, &iter); | 595 gtk_list_store_append(model, &iter); |
601 gtk_list_store_set(model, &iter, 0, scaled, -1); | 596 gtk_list_store_set(model, &iter, 0, pixbuf, -1); |
602 | 597 |
603 for (j = 1; j < col_num; j++) { | 598 for (j = 1; j < col_num; j++) { |
604 GValue v; | 599 GValue v; |
605 char *escaped = g_markup_escape_text(g_list_nth_data(row, j - 1), -1); | 600 char *escaped = g_markup_escape_text(g_list_nth_data(row, j - 1), -1); |
606 | 601 |
609 g_value_set_string(&v, escaped); | 604 g_value_set_string(&v, escaped); |
610 gtk_list_store_set_value(model, &iter, j, &v); | 605 gtk_list_store_set_value(model, &iter, j, &v); |
611 g_free(escaped); | 606 g_free(escaped); |
612 } | 607 } |
613 } | 608 } |
609 | |
610 if (pixbuf != NULL) | |
611 g_object_unref(pixbuf); | |
614 } | 612 } |
615 | 613 |
616 static void * | 614 static void * |
617 gaim_gtk_notify_searchresults(GaimConnection *gc, const char *title, | 615 gaim_gtk_notify_searchresults(GaimConnection *gc, const char *title, |
618 const char *primary, const char *secondary, | 616 const char *primary, const char *secondary, |