comparison pidgin/gtksavedstatuses.c @ 15501:d75099d2567e

gaim_gtk to pidgin. I hope
author Sean Egan <seanegan@gmail.com>
date Sat, 03 Feb 2007 07:23:11 +0000
parents 29e443e0613f
children 311315e979f7
comparison
equal deleted inserted replaced
15500:45ecefd0ce3a 15501:d75099d2567e
169 status_window_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) 169 status_window_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data)
170 { 170 {
171 StatusWindow *dialog = user_data; 171 StatusWindow *dialog = user_data;
172 172
173 dialog->window = NULL; 173 dialog->window = NULL;
174 gaim_gtk_status_window_hide(); 174 pidgin_status_window_hide();
175 175
176 return FALSE; 176 return FALSE;
177 } 177 }
178 178
179 #if !GTK_CHECK_VERSION(2,2,0) 179 #if !GTK_CHECK_VERSION(2,2,0)
239 } 239 }
240 240
241 static void 241 static void
242 status_window_add_cb(GtkButton *button, gpointer user_data) 242 status_window_add_cb(GtkButton *button, gpointer user_data)
243 { 243 {
244 gaim_gtk_status_editor_show(FALSE, NULL); 244 pidgin_status_editor_show(FALSE, NULL);
245 } 245 }
246 246
247 static void 247 static void
248 status_window_modify_foreach(GtkTreeModel *model, GtkTreePath *path, 248 status_window_modify_foreach(GtkTreeModel *model, GtkTreePath *path,
249 GtkTreeIter *iter, gpointer user_data) 249 GtkTreeIter *iter, gpointer user_data)
252 GaimSavedStatus *saved_status; 252 GaimSavedStatus *saved_status;
253 253
254 gtk_tree_model_get(model, iter, STATUS_WINDOW_COLUMN_TITLE, &title, -1); 254 gtk_tree_model_get(model, iter, STATUS_WINDOW_COLUMN_TITLE, &title, -1);
255 saved_status = gaim_savedstatus_find(title); 255 saved_status = gaim_savedstatus_find(title);
256 g_free(title); 256 g_free(title);
257 gaim_gtk_status_editor_show(TRUE, saved_status); 257 pidgin_status_editor_show(TRUE, saved_status);
258 } 258 }
259 259
260 static void 260 static void
261 status_window_modify_cb(GtkButton *button, gpointer user_data) 261 status_window_modify_cb(GtkButton *button, gpointer user_data)
262 { 262 {
339 } 339 }
340 340
341 static void 341 static void
342 status_window_close_cb(GtkButton *button, gpointer user_data) 342 status_window_close_cb(GtkButton *button, gpointer user_data)
343 { 343 {
344 gaim_gtk_status_window_hide(); 344 pidgin_status_window_hide();
345 } 345 }
346 346
347 static void 347 static void
348 status_selected_cb(GtkTreeSelection *sel, gpointer user_data) 348 status_selected_cb(GtkTreeSelection *sel, gpointer user_data)
349 { 349 {
527 527
528 return FALSE; 528 return FALSE;
529 } 529 }
530 530
531 void 531 void
532 gaim_gtk_status_window_show(void) 532 pidgin_status_window_show(void)
533 { 533 {
534 StatusWindow *dialog; 534 StatusWindow *dialog;
535 GtkWidget *bbox; 535 GtkWidget *bbox;
536 GtkWidget *button; 536 GtkWidget *button;
537 GtkWidget *list; 537 GtkWidget *list;
619 619
620 gtk_widget_show_all(win); 620 gtk_widget_show_all(win);
621 } 621 }
622 622
623 void 623 void
624 gaim_gtk_status_window_hide(void) 624 pidgin_status_window_hide(void)
625 { 625 {
626 if (status_window == NULL) 626 if (status_window == NULL)
627 return; 627 return;
628 628
629 if (status_window->window != NULL) 629 if (status_window->window != NULL)
967 GtkTreeIter *iter, GaimSavedStatusSub *substatus) 967 GtkTreeIter *iter, GaimSavedStatusSub *substatus)
968 { 968 {
969 GdkPixbuf *pixbuf; 969 GdkPixbuf *pixbuf;
970 const char *id = NULL, *name = NULL, *message = NULL; 970 const char *id = NULL, *name = NULL, *message = NULL;
971 971
972 pixbuf = gaim_gtk_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM); 972 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM);
973 if ((pixbuf != NULL) && !gaim_account_is_connected(account)) 973 if ((pixbuf != NULL) && !gaim_account_is_connected(account))
974 { 974 {
975 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); 975 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
976 } 976 }
977 977
1031 status_editor_add_account(dialog, account, substatus); 1031 status_editor_add_account(dialog, account, substatus);
1032 } 1032 }
1033 } 1033 }
1034 1034
1035 void 1035 void
1036 gaim_gtk_status_editor_show(gboolean edit, GaimSavedStatus *saved_status) 1036 pidgin_status_editor_show(gboolean edit, GaimSavedStatus *saved_status)
1037 { 1037 {
1038 GtkTreeIter iter; 1038 GtkTreeIter iter;
1039 StatusEditor *dialog; 1039 StatusEditor *dialog;
1040 GtkSizeGroup *sg; 1040 GtkSizeGroup *sg;
1041 GtkWidget *bbox; 1041 GtkWidget *bbox;
1141 label = gtk_label_new_with_mnemonic(_("_Message:")); 1141 label = gtk_label_new_with_mnemonic(_("_Message:"));
1142 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 1142 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1143 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); 1143 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1144 gtk_size_group_add_widget(sg, label); 1144 gtk_size_group_add_widget(sg, label);
1145 1145
1146 frame = gaim_gtk_create_imhtml(TRUE, &text, &toolbar, NULL); 1146 frame = pidgin_create_imhtml(TRUE, &text, &toolbar, NULL);
1147 dialog->message = GTK_IMHTML(text); 1147 dialog->message = GTK_IMHTML(text);
1148 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0); 1148 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
1149 focus_chain = g_list_prepend(focus_chain, dialog->message); 1149 focus_chain = g_list_prepend(focus_chain, dialog->message);
1150 gtk_container_set_focus_chain(GTK_CONTAINER(hbox), focus_chain); 1150 gtk_container_set_focus_chain(GTK_CONTAINER(hbox), focus_chain);
1151 1151
1477 label = gtk_label_new_with_mnemonic(_("_Message:")); 1477 label = gtk_label_new_with_mnemonic(_("_Message:"));
1478 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 1478 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1479 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); 1479 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1480 gtk_size_group_add_widget(sg, label); 1480 gtk_size_group_add_widget(sg, label);
1481 1481
1482 frame = gaim_gtk_create_imhtml(TRUE, &text, &toolbar, NULL); 1482 frame = pidgin_create_imhtml(TRUE, &text, &toolbar, NULL);
1483 dialog->message = GTK_IMHTML(text); 1483 dialog->message = GTK_IMHTML(text);
1484 dialog->toolbar = GTK_IMHTMLTOOLBAR(toolbar); 1484 dialog->toolbar = GTK_IMHTMLTOOLBAR(toolbar);
1485 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0); 1485 gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
1486 1486
1487 /* Button box */ 1487 /* Button box */
1536 /* Only allow users to select statuses that are flagged as "user settable" */ 1536 /* Only allow users to select statuses that are flagged as "user settable" */
1537 if (!gaim_status_type_is_user_settable(status_type)) 1537 if (!gaim_status_type_is_user_settable(status_type))
1538 continue; 1538 continue;
1539 1539
1540 id = gaim_status_type_get_id(status_type); 1540 id = gaim_status_type_get_id(status_type);
1541 pixbuf = gaim_gtk_create_prpl_icon_with_status(account, status_type, PIDGIN_PRPL_ICON_MEDIUM); 1541 pixbuf = pidgin_create_prpl_icon_with_status(account, status_type, PIDGIN_PRPL_ICON_MEDIUM);
1542 name = gaim_status_type_get_name(status_type); 1542 name = gaim_status_type_get_name(status_type);
1543 1543
1544 gtk_list_store_append(dialog->model, &iter); 1544 gtk_list_store_append(dialog->model, &iter);
1545 gtk_list_store_set(dialog->model, &iter, 1545 gtk_list_store_set(dialog->model, &iter,
1546 SUBSTATUS_COLUMN_ICON, pixbuf, 1546 SUBSTATUS_COLUMN_ICON, pixbuf,
1631 const GaimSavedStatus *saved_status_b = b; 1631 const GaimSavedStatus *saved_status_b = b;
1632 return g_utf8_collate(gaim_savedstatus_get_title(saved_status_a), 1632 return g_utf8_collate(gaim_savedstatus_get_title(saved_status_a),
1633 gaim_savedstatus_get_title(saved_status_b)); 1633 gaim_savedstatus_get_title(saved_status_b));
1634 } 1634 }
1635 1635
1636 static gboolean gaim_gtk_status_menu_add_primitive(GtkListStore *model, GaimStatusPrimitive primitive, 1636 static gboolean pidgin_status_menu_add_primitive(GtkListStore *model, GaimStatusPrimitive primitive,
1637 GaimSavedStatus *current_status) 1637 GaimSavedStatus *current_status)
1638 { 1638 {
1639 GtkTreeIter iter; 1639 GtkTreeIter iter;
1640 gboolean currently_selected = FALSE; 1640 gboolean currently_selected = FALSE;
1641 GdkPixbuf *pixbuf = gaim_gtk_create_gaim_icon_with_status(primitive, 0.5); 1641 GdkPixbuf *pixbuf = pidgin_create_gaim_icon_with_status(primitive, 0.5);
1642 1642
1643 gtk_list_store_append(model, &iter); 1643 gtk_list_store_append(model, &iter);
1644 gtk_list_store_set(model, &iter, 1644 gtk_list_store_set(model, &iter,
1645 SS_MENU_TYPE_COLUMN, SS_MENU_ENTRY_TYPE_PRIMITIVE, 1645 SS_MENU_TYPE_COLUMN, SS_MENU_ENTRY_TYPE_PRIMITIVE,
1646 SS_MENU_ICON_COLUMN, pixbuf, 1646 SS_MENU_ICON_COLUMN, pixbuf,
1654 currently_selected = TRUE; 1654 currently_selected = TRUE;
1655 1655
1656 return currently_selected; 1656 return currently_selected;
1657 } 1657 }
1658 1658
1659 GtkWidget *gaim_gtk_status_menu(GaimSavedStatus *current_status, GCallback callback) 1659 GtkWidget *pidgin_status_menu(GaimSavedStatus *current_status, GCallback callback)
1660 { 1660 {
1661 GtkWidget *combobox; 1661 GtkWidget *combobox;
1662 GtkListStore *model; 1662 GtkListStore *model;
1663 GList *sorted, *cur; 1663 GList *sorted, *cur;
1664 int i = 0; 1664 int i = 0;
1670 1670
1671 model = gtk_list_store_new(SS_MENU_NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); 1671 model = gtk_list_store_new(SS_MENU_NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER);
1672 1672
1673 combobox = gtk_combo_box_new(); 1673 combobox = gtk_combo_box_new();
1674 1674
1675 if (gaim_gtk_status_menu_add_primitive(model, GAIM_STATUS_AVAILABLE, current_status)) 1675 if (pidgin_status_menu_add_primitive(model, GAIM_STATUS_AVAILABLE, current_status))
1676 index = i; 1676 index = i;
1677 i++; 1677 i++;
1678 1678
1679 if (gaim_gtk_status_menu_add_primitive(model, GAIM_STATUS_AWAY, current_status)) 1679 if (pidgin_status_menu_add_primitive(model, GAIM_STATUS_AWAY, current_status))
1680 index = i; 1680 index = i;
1681 i++; 1681 i++;
1682 1682
1683 if (gaim_gtk_status_menu_add_primitive(model, GAIM_STATUS_INVISIBLE, current_status)) 1683 if (pidgin_status_menu_add_primitive(model, GAIM_STATUS_INVISIBLE, current_status))
1684 index = i; 1684 index = i;
1685 i++; 1685 i++;
1686 1686
1687 if (gaim_gtk_status_menu_add_primitive(model, GAIM_STATUS_OFFLINE, current_status)) 1687 if (pidgin_status_menu_add_primitive(model, GAIM_STATUS_OFFLINE, current_status))
1688 index = i; 1688 index = i;
1689 i++; 1689 i++;
1690 1690
1691 sorted = g_list_copy((GList *)gaim_savedstatuses_get_all()); 1691 sorted = g_list_copy((GList *)gaim_savedstatuses_get_all());
1692 sorted = g_list_sort(sorted, saved_status_sort_alphabetically_func); 1692 sorted = g_list_sort(sorted, saved_status_sort_alphabetically_func);
1694 { 1694 {
1695 GaimSavedStatus *status = (GaimSavedStatus *) cur->data; 1695 GaimSavedStatus *status = (GaimSavedStatus *) cur->data;
1696 if (!gaim_savedstatus_is_transient(status)) 1696 if (!gaim_savedstatus_is_transient(status))
1697 { 1697 {
1698 /* Get an appropriate status icon */ 1698 /* Get an appropriate status icon */
1699 pixbuf = gaim_gtk_create_gaim_icon_with_status( 1699 pixbuf = pidgin_create_gaim_icon_with_status(
1700 gaim_savedstatus_get_type(status), 0.5); 1700 gaim_savedstatus_get_type(status), 0.5);
1701 1701
1702 /* Overlay a disk in the bottom left corner */ 1702 /* Overlay a disk in the bottom left corner */
1703 emblem = gtk_widget_render_icon(GTK_WIDGET(combobox), 1703 emblem = gtk_widget_render_icon(GTK_WIDGET(combobox),
1704 GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU, "GtkGaimStatusMenu"); 1704 GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU, "GtkGaimStatusMenu");
1747 /************************************************************************** 1747 /**************************************************************************
1748 * GTK+ saved status glue 1748 * GTK+ saved status glue
1749 **************************************************************************/ 1749 **************************************************************************/
1750 1750
1751 void * 1751 void *
1752 gaim_gtk_status_get_handle(void) 1752 pidgin_status_get_handle(void)
1753 { 1753 {
1754 static int handle; 1754 static int handle;
1755 1755
1756 return &handle; 1756 return &handle;
1757 } 1757 }
1758 1758
1759 void 1759 void
1760 gaim_gtk_status_init(void) 1760 pidgin_status_init(void)
1761 { 1761 {
1762 gaim_prefs_add_none("/gaim/gtk/status"); 1762 gaim_prefs_add_none("/gaim/gtk/status");
1763 gaim_prefs_add_none("/gaim/gtk/status/dialog"); 1763 gaim_prefs_add_none("/gaim/gtk/status/dialog");
1764 gaim_prefs_add_int("/gaim/gtk/status/dialog/width", 550); 1764 gaim_prefs_add_int("/gaim/gtk/status/dialog/width", 550);
1765 gaim_prefs_add_int("/gaim/gtk/status/dialog/height", 250); 1765 gaim_prefs_add_int("/gaim/gtk/status/dialog/height", 250);
1766 } 1766 }
1767 1767
1768 void 1768 void
1769 gaim_gtk_status_uninit(void) 1769 pidgin_status_uninit(void)
1770 { 1770 {
1771 gaim_gtk_status_window_hide(); 1771 pidgin_status_window_hide();
1772 } 1772 }