Mercurial > pidgin.yaz
view src/gtknotify.c @ 5438:6e7ba9efd1f4
[gaim-migrate @ 5820]
I wrote sort-by-status.
Index: src/gtkblist.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/gtkblist.c,v
retrieving revision 1.28
diff -u -r1.28 gtkblist.c
--- src/gtkblist.c 18 May 2003 07:54:53 -0000 1.28
+++ src/gtkblist.c 18 May 2003 21:13:36 -0000
@@ -1319,11 +1320,11 @@
void gaim_gtk_blist_setup_sort_methods()
{
- gaim_gtk_blist_sort_method_reg("None", sort_method_none);
- gaim_gtk_blist_sort_method_reg("Alphabetical", sort_method_alphabetical);
- gaim_gtk_blist_sort_method_reg("By status", sort_method_status);
- gaim_gtk_blist_sort_method_reg("By log size", sort_method_log);
- gaim_gtk_blist_sort_method_set(sort_method[0] ? sort_method : "None");
+ gaim_gtk_blist_sort_method_reg(_("None"), sort_method_none);
+ gaim_gtk_blist_sort_method_reg(_("Alphabetical"), sort_method_alphabetical);
+ gaim_gtk_blist_sort_method_reg(_("By status"), sort_method_status);
+ gaim_gtk_blist_sort_method_reg(_("By log size"), sort_method_log);
+ gaim_gtk_blist_sort_method_set(sort_method[0] ? sort_method : _("None"));
}
@@ -2229,15 +2230,23 @@
if (n && GAIM_BLIST_NODE_IS_BUDDY(n)) {
struct buddy *new = (struct buddy*)node, *it = (struct buddy*)n;
- - if (it->idle > new->idle)
+ printf("Add %s (%d) before %s (%d)... ", new->name, new->idle, it->name, it->idle);
+ + /* This is the worst if statement ever. */
+ if ((it->present < new->present) ||
+ ((it->present == new->present) && (it->uc & UC_UNAVAILABLE) > (new->uc & UC_UNAVAILABLE)) ||
+ ((it->present == new->present) && ((it->uc & UC_UNAVAILABLE) == (new->uc & UC_UNAVAILABLE)) &&
+ ((it->idle && !new->idle) || (it->idle && (it->idle < new->idle)))) ||
+ + ((it->present == new->present) && (it->uc & UC_UNAVAILABLE) == (new->uc & UC_UNAVAILABLE) && (it->idle == new->idle) &&
+ (gaim_utf8_strcasecmp(gaim_get_buddy_alias((struct buddy*)node), gaim_get_buddy_alias((struct buddy*)n)) < 0)))
{
- printf("Inserting %s before %s\n", new->name, it->name);
+ printf("yes\n");
gtk_tree_store_insert_before(gtkblist->treemodel, &iter, &groupiter, &more_z);
newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
gtknode->row = gtk_tree_row_reference_new(GTK_TREE_MODEL(gtkblist->treemodel), newpath);
gtk_tree_path_free(newpath);
return iter;
}
+ printf("no\n");
g_value_unset(&val);
}
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL(gtkblist->treemodel), &more_z));
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 18 May 2003 21:17:31 +0000 |
parents | 0031a613a87d |
children | 9bcd8cd625ae |
line wrap: on
line source
/** * @file gtknotify.c GTK+ Notification API * @ingroup gtkui * * gaim * * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "gtknotify.h" #include "stock.h" #include <gtk/gtk.h> static void * gaim_gtk_notify_message(GaimNotifyMsgType type, const char *title, const char *primary, const char *secondary, GCallback cb, void *user_data) { GtkWidget *dialog; GtkWidget *hbox; GtkWidget *label; GtkWidget *img = NULL; char label_text[2048]; const char *icon_name = NULL; switch (type) { case GAIM_NOTIFY_MSG_ERROR: icon_name = GAIM_STOCK_DIALOG_ERROR; break; case GAIM_NOTIFY_MSG_WARNING: icon_name = GAIM_STOCK_DIALOG_WARNING; break; case GAIM_NOTIFY_MSG_INFO: icon_name = GAIM_STOCK_DIALOG_INFO; break; default: icon_name = NULL; break; } if (icon_name != NULL) { img = gtk_image_new_from_stock(icon_name, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment(GTK_MISC(img), 0, 0); } dialog = gtk_dialog_new_with_buttons("", NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), NULL); gtk_container_set_border_width(GTK_CONTAINER(dialog), 6); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12); gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 6); hbox = gtk_hbox_new(FALSE, 12); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); if (img != NULL) gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); g_snprintf(label_text, sizeof(label_text), "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", primary, (secondary ? secondary : "")); label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label), label_text); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_widget_show_all(dialog); return dialog; } static void * gaim_gtk_notify_email(const char *subject, const char *from, const char *to, const char *url, GCallback cb, void *user_data) { return NULL; } static void * gaim_gtk_notify_emails(size_t count, const char **subjects, const char **froms, const char **tos, const char **urls, GCallback cb, void *user_data) { return NULL; } static void gaim_gtk_close_notify(GaimNotifyType type, void *ptr) { gtk_widget_destroy(GTK_WIDGET(ptr)); } static GaimNotifyUiOps ops = { gaim_gtk_notify_message, gaim_gtk_notify_email, gaim_gtk_notify_emails, gaim_gtk_close_notify }; GaimNotifyUiOps * gaim_get_gtk_notify_ui_ops(void) { return &ops; }