Mercurial > pidgin.yaz
comparison src/gtksavedstatuses.c @ 12199:0a549a454d8e
[gaim-migrate @ 14501]
fixed up.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 23 Nov 2005 21:26:47 +0000 |
parents | d040123d2b69 |
children | 3294e27cb54a |
comparison
equal
deleted
inserted
replaced
12198:9679b615edb8 | 12199:0a549a454d8e |
---|---|
366 gtk_list_store_clear(dialog->model); | 366 gtk_list_store_clear(dialog->model); |
367 | 367 |
368 for (saved_statuses = gaim_savedstatuses_get_all(); saved_statuses != NULL; | 368 for (saved_statuses = gaim_savedstatuses_get_all(); saved_statuses != NULL; |
369 saved_statuses = g_list_next(saved_statuses)) | 369 saved_statuses = g_list_next(saved_statuses)) |
370 { | 370 { |
371 add_status_to_saved_status_list(dialog->model, saved_statuses->data); | 371 add_status_to_saved_status_list(dialog->model, saved_statuses->data); |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 static gboolean | 375 static gboolean |
376 search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data) | 376 search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data) |
747 gtk_widget_destroy(dialog->window); | 747 gtk_widget_destroy(dialog->window); |
748 g_free(dialog->original_title); | 748 g_free(dialog->original_title); |
749 g_free(dialog); | 749 g_free(dialog); |
750 | 750 |
751 if (status_window != NULL) | 751 if (status_window != NULL) |
752 add_status_to_saved_status_list(status_window->model, saved_status); | 752 add_status_to_saved_status_list(status_window->model, saved_status); |
753 } | 753 } |
754 | 754 |
755 static void | 755 static void |
756 editor_title_changed_cb(GtkWidget *widget, gpointer user_data) | 756 editor_title_changed_cb(GtkWidget *widget, gpointer user_data) |
757 { | 757 { |
1454 * Utilities * | 1454 * Utilities * |
1455 **************************************************************************/ | 1455 **************************************************************************/ |
1456 | 1456 |
1457 void status_menu_cb(GtkComboBox *widget, void(*callback)(GaimSavedStatus*)) | 1457 void status_menu_cb(GtkComboBox *widget, void(*callback)(GaimSavedStatus*)) |
1458 { | 1458 { |
1459 GtkTreeIter iter; | 1459 callback(gaim_savedstatus_find(gtk_combo_box_get_active_text(widget))); |
1460 char *title; | |
1461 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter); | |
1462 gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(widget)), &iter, | |
1463 STATUS_WINDOW_COLUMN_TITLE, &title, | |
1464 -1); | |
1465 callback(gaim_savedstatus_find(title)); | |
1466 } | 1460 } |
1467 | 1461 |
1468 GtkWidget *gaim_gtk_status_menu(GaimSavedStatus *current_status, GCallback callback) | 1462 GtkWidget *gaim_gtk_status_menu(GaimSavedStatus *current_status, GCallback callback) |
1469 { | 1463 { |
1470 GtkWidget *combobox; | 1464 GtkWidget *combobox; |
1471 const GList *saved_statuses; | 1465 const GList *saved_statuses; |
1472 GtkCellRenderer *rend; | |
1473 int i; | 1466 int i; |
1474 int index = -1; | 1467 int index = -1; |
1475 GtkListStore *ls = gtk_list_store_new(STATUS_WINDOW_NUM_COLUMNS, | |
1476 G_TYPE_STRING, | |
1477 G_TYPE_STRING, | |
1478 G_TYPE_STRING); | |
1479 | 1468 |
1469 combobox = gtk_combo_box_new_text(); | |
1480 | 1470 |
1481 for (saved_statuses = gaim_savedstatuses_get_all(), i = 0; | 1471 for (saved_statuses = gaim_savedstatuses_get_all(), i = 0; |
1482 saved_statuses != NULL; | 1472 saved_statuses != NULL; |
1483 saved_statuses = g_list_next(saved_statuses), i++) { | 1473 saved_statuses = g_list_next(saved_statuses)) { |
1484 add_status_to_saved_status_list(ls, saved_statuses->data); | 1474 GaimSavedStatus *status = (GaimSavedStatus*)saved_statuses->data; |
1485 if (saved_statuses->data == current_status) | 1475 if (!gaim_savedstatus_is_transient(status)) { |
1486 index = i; | 1476 gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), |
1487 } | 1477 gaim_savedstatus_get_title(status)); |
1488 | 1478 if (status == current_status) |
1489 combobox = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ls)); | 1479 index = i; |
1490 rend = gtk_cell_renderer_text_new(); | 1480 i++; |
1491 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), rend, TRUE); | 1481 } |
1492 gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combobox), rend, "text", | 1482 } |
1493 STATUS_WINDOW_COLUMN_TITLE); | |
1494 #if GTK_CHECK_VERSION(2,6,0) | |
1495 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); | |
1496 #endif | |
1497 | 1483 |
1498 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index); | 1484 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index); |
1499 g_signal_connect(G_OBJECT(combobox), "changed", G_CALLBACK(status_menu_cb), callback); | 1485 g_signal_connect(G_OBJECT(combobox), "changed", G_CALLBACK(status_menu_cb), callback); |
1500 return combobox; | 1486 return combobox; |
1501 } | 1487 } |