| 47 #include "gtksavedstatuses.h" |
47 #include "gtksavedstatuses.h" |
| 48 #include "gtkstatusbox.h" |
48 #include "gtkstatusbox.h" |
| 49 #include "gtkutils.h" |
49 #include "gtkutils.h" |
| 50 #include "pidgincore.h" |
50 #include "pidgincore.h" |
| 51 #include "pidgingdkpixbuf.h" |
51 #include "pidgingdkpixbuf.h" |
| 52 #include "pidginstock.h" |
52 #include "pidginiconname.h" |
| 53 |
53 |
| 54 /* Timeout for typing notifications in seconds */ |
54 /* Timeout for typing notifications in seconds */ |
| 55 #define TYPING_TIMEOUT 4 |
55 #define TYPING_TIMEOUT 4 |
| 56 |
56 |
| 57 typedef enum { |
57 typedef enum { |
| 396 pidgin_status_box_refresh(PidginStatusBox *status_box) |
396 pidgin_status_box_refresh(PidginStatusBox *status_box) |
| 397 { |
397 { |
| 398 const char *aa_color; |
398 const char *aa_color; |
| 399 PurpleSavedStatus *saved_status; |
399 PurpleSavedStatus *saved_status; |
| 400 char *primary, *secondary, *text; |
400 char *primary, *secondary, *text; |
| 401 const char *stock = NULL; |
401 const char *icon_name = NULL; |
| 402 GdkPixbuf *emblem = NULL; |
402 GdkPixbuf *emblem = NULL; |
| 403 GtkTreePath *path; |
403 GtkTreePath *path; |
| 404 gboolean account_status = FALSE; |
404 gboolean account_status = FALSE; |
| 405 PurpleAccount *acct = (status_box->account) ? status_box->account : status_box->token_status_account; |
405 PurpleAccount *acct = (status_box->account) ? status_box->account : status_box->token_status_account; |
| 406 |
406 |
| 450 prim = purple_status_type_get_primitive(status_type); |
450 prim = purple_status_type_get_primitive(status_type); |
| 451 } else { |
451 } else { |
| 452 prim = purple_savedstatus_get_primitive_type(saved_status); |
452 prim = purple_savedstatus_get_primitive_type(saved_status); |
| 453 } |
453 } |
| 454 |
454 |
| 455 stock = pidgin_stock_id_from_status_primitive(prim); |
455 icon_name = pidgin_icon_name_from_status_primitive(prim, "user-offline"); |
| 456 } |
456 } |
| 457 |
457 |
| 458 aa_color = pidgin_get_dim_grey_string(GTK_WIDGET(status_box)); |
458 aa_color = pidgin_get_dim_grey_string(GTK_WIDGET(status_box)); |
| 459 if (status_box->account != NULL) { |
459 if (status_box->account != NULL) { |
| 460 text = g_strdup_printf("%s - <span size=\"smaller\" color=\"%s\">%s</span>", |
460 text = g_strdup_printf("%s - <span size=\"smaller\" color=\"%s\">%s</span>", |
| 473 /* |
473 /* |
| 474 * Only two columns are used in this list store (does it |
474 * Only two columns are used in this list store (does it |
| 475 * really need to be a list store?) |
475 * really need to be a list store?) |
| 476 */ |
476 */ |
| 477 gtk_list_store_set(status_box->store, &(status_box->iter), |
477 gtk_list_store_set(status_box->store, &(status_box->iter), |
| 478 ICON_STOCK_COLUMN, (gpointer)stock, |
478 ICON_NAME_COLUMN, icon_name, |
| 479 TEXT_COLUMN, text, |
479 TEXT_COLUMN, text, |
| 480 EMBLEM_COLUMN, emblem, |
480 EMBLEM_COLUMN, emblem, |
| 481 EMBLEM_VISIBLE_COLUMN, (emblem != NULL), |
481 EMBLEM_VISIBLE_COLUMN, (emblem != NULL), |
| 482 -1); |
482 -1); |
| 483 g_free(text); |
483 g_free(text); |
| 1316 gtk_tree_view_append_column (GTK_TREE_VIEW (status_box->tree_view), |
1316 gtk_tree_view_append_column (GTK_TREE_VIEW (status_box->tree_view), |
| 1317 status_box->column); |
1317 status_box->column); |
| 1318 gtk_tree_view_column_pack_start(status_box->column, icon_rend, FALSE); |
1318 gtk_tree_view_column_pack_start(status_box->column, icon_rend, FALSE); |
| 1319 gtk_tree_view_column_pack_start(status_box->column, text_rend, TRUE); |
1319 gtk_tree_view_column_pack_start(status_box->column, text_rend, TRUE); |
| 1320 gtk_tree_view_column_pack_start(status_box->column, emblem_rend, FALSE); |
1320 gtk_tree_view_column_pack_start(status_box->column, emblem_rend, FALSE); |
| 1321 gtk_tree_view_column_set_attributes(status_box->column, icon_rend, "stock-id", ICON_STOCK_COLUMN, NULL); |
1321 gtk_tree_view_column_set_attributes(status_box->column, icon_rend, "icon-name", ICON_NAME_COLUMN, NULL); |
| 1322 gtk_tree_view_column_set_attributes(status_box->column, text_rend, "markup", TEXT_COLUMN, NULL); |
1322 gtk_tree_view_column_set_attributes(status_box->column, text_rend, "markup", TEXT_COLUMN, NULL); |
| 1323 gtk_tree_view_column_set_attributes(status_box->column, emblem_rend, "icon-name", EMBLEM_COLUMN, "visible", EMBLEM_VISIBLE_COLUMN, NULL); |
1323 gtk_tree_view_column_set_attributes(status_box->column, emblem_rend, "icon-name", EMBLEM_COLUMN, "visible", EMBLEM_VISIBLE_COLUMN, NULL); |
| 1324 |
1324 |
| 1325 status_box->scrolled_window = pidgin_make_scrollable(status_box->tree_view, GTK_POLICY_NEVER, GTK_POLICY_NEVER, GTK_SHADOW_NONE, -1, -1); |
1325 status_box->scrolled_window = pidgin_make_scrollable(status_box->tree_view, GTK_POLICY_NEVER, GTK_POLICY_NEVER, GTK_SHADOW_NONE, -1, -1); |
| 1326 gtk_container_add (GTK_CONTAINER (status_box->popup_frame), |
1326 gtk_container_add (GTK_CONTAINER (status_box->popup_frame), |
| 1337 status_box->text_rend = gtk_cell_renderer_text_new(); |
1337 status_box->text_rend = gtk_cell_renderer_text_new(); |
| 1338 emblem_rend = gtk_cell_renderer_pixbuf_new(); |
1338 emblem_rend = gtk_cell_renderer_pixbuf_new(); |
| 1339 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE); |
1339 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE); |
| 1340 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE); |
1340 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE); |
| 1341 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), emblem_rend, FALSE); |
1341 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), emblem_rend, FALSE); |
| 1342 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "stock-id", ICON_STOCK_COLUMN, NULL); |
1342 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "icon-name", ICON_NAME_COLUMN, NULL); |
| 1343 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, "markup", TEXT_COLUMN, NULL); |
1343 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, "markup", TEXT_COLUMN, NULL); |
| 1344 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), emblem_rend, "pixbuf", EMBLEM_COLUMN, "visible", EMBLEM_VISIBLE_COLUMN, NULL); |
1344 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), emblem_rend, "pixbuf", EMBLEM_COLUMN, "visible", EMBLEM_VISIBLE_COLUMN, NULL); |
| 1345 g_object_set(status_box->text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
1345 g_object_set(status_box->text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
| 1346 |
1346 |
| 1347 status_box->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, FALSE); |
1347 status_box->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, FALSE); |
| 1536 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, |
1536 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, |
| 1537 const char *title, const char *desc, gpointer data) |
1537 const char *title, const char *desc, gpointer data) |
| 1538 { |
1538 { |
| 1539 GtkTreeIter iter; |
1539 GtkTreeIter iter; |
| 1540 char *text; |
1540 char *text; |
| 1541 const char *stock = NULL; |
1541 const char *icon_name = NULL; |
| 1542 |
1542 |
| 1543 if (desc == NULL) |
1543 if (desc == NULL) |
| 1544 { |
1544 { |
| 1545 text = g_markup_escape_text(title, -1); |
1545 text = g_markup_escape_text(title, -1); |
| 1546 } |
1546 } |
| 1570 if (saved) { |
1570 if (saved) { |
| 1571 prim = purple_savedstatus_get_primitive_type(saved); |
1571 prim = purple_savedstatus_get_primitive_type(saved); |
| 1572 } |
1572 } |
| 1573 } |
1573 } |
| 1574 |
1574 |
| 1575 stock = pidgin_stock_id_from_status_primitive(prim); |
1575 icon_name = pidgin_icon_name_from_status_primitive(prim, "user-offline"); |
| 1576 } |
1576 } |
| 1577 |
1577 |
| 1578 gtk_list_store_append(status_box->dropdown_store, &iter); |
1578 gtk_list_store_append(status_box->dropdown_store, &iter); |
| 1579 gtk_list_store_set(status_box->dropdown_store, &iter, |
1579 gtk_list_store_set(status_box->dropdown_store, &iter, |
| 1580 TYPE_COLUMN, type, |
1580 TYPE_COLUMN, type, |
| 1581 ICON_STOCK_COLUMN, stock, |
1581 ICON_NAME_COLUMN, icon_name, |
| 1582 TEXT_COLUMN, text, |
1582 TEXT_COLUMN, text, |
| 1583 TITLE_COLUMN, title, |
1583 TITLE_COLUMN, title, |
| 1584 DESC_COLUMN, desc, |
1584 DESC_COLUMN, desc, |
| 1585 DATA_COLUMN, data, |
1585 DATA_COLUMN, data, |
| 1586 EMBLEM_VISIBLE_COLUMN, type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR, |
1586 EMBLEM_VISIBLE_COLUMN, type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR, |