comparison src/multi.c @ 5436:ad445074d239

[gaim-migrate @ 5818] Another big commit. Ugh. I need a very smart regexp. Core/UI split do_error_dialog(), and soon the mail dialogs! Yay! This should work without problems at all, but standard disclaimer.. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 18 May 2003 19:59:02 +0000
parents 573501c63fef
children df653f6f2978
comparison
equal deleted inserted replaced
5435:a2f26666de42 5436:ad445074d239
25 #include <gtk/gtk.h> 25 #include <gtk/gtk.h>
26 #include "prpl.h" 26 #include "prpl.h"
27 #include "multi.h" 27 #include "multi.h"
28 #include "gaim.h" 28 #include "gaim.h"
29 #include "conversation.h" 29 #include "conversation.h"
30 #include "notify.h"
30 #include "gtkblist.h" 31 #include "gtkblist.h"
31 #include "gaim-disclosure.h" 32 #include "gaim-disclosure.h"
32 33
33 #ifdef _WIN32 34 #ifdef _WIN32
34 #include "win32dep.h" 35 #include "win32dep.h"
300 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); 301 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
301 gtk_tree_view_column_set_visible(column, FALSE); 302 gtk_tree_view_column_set_visible(column, FALSE);
302 */ 303 */
303 } 304 }
304 305
306 static void
307 __rows_reordered_cb(GtkTreeModel *model, GtkTreePath *arg1,
308 GtkTreeIter *arg2, int *new_order, gpointer user_data)
309 {
310 GSList *accounts = gaim_accounts;
311 GSList *new_accounts = NULL;
312 struct gaim_account **account_array;
313 int count, i;
314
315 gaim_debug(GAIM_DEBUG_INFO, "accounts", "Reordering accounts\n");
316
317 count = g_slist_length(accounts);
318
319 /* Grr. */
320 account_array = g_new(struct gaim_account *, count);
321
322 /* I hate this. */
323 for (i = 0; i < count; i++, accounts = accounts->next)
324 account_array[new_order[i]] = accounts->data;
325
326 /* I hate this too. */
327 for (i = 0; i < count; i++)
328 new_accounts = g_slist_append(new_accounts, account_array[i]);
329
330 gaim_accounts = new_accounts;
331
332 g_slist_free(accounts);
333 g_free(account_array);
334
335 save_prefs();
336 }
337
305 static GtkWidget *generate_list() 338 static GtkWidget *generate_list()
306 { 339 {
307 GtkWidget *win; 340 GtkWidget *win;
308 341
309 win = gtk_scrolled_window_new(0, 0); 342 win = gtk_scrolled_window_new(0, 0);
328 gtk_container_add(GTK_CONTAINER(win), treeview); 361 gtk_container_add(GTK_CONTAINER(win), treeview);
329 gtk_widget_show(treeview); 362 gtk_widget_show(treeview);
330 363
331 regenerate_user_list(); 364 regenerate_user_list();
332 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(treeview), TRUE); 365 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(treeview), TRUE);
366 g_signal_connect(G_OBJECT(model), "rows-reordered",
367 G_CALLBACK(__rows_reordered_cb), NULL);
368
333 gtk_widget_show(win); 369 gtk_widget_show(win);
334 return win; 370 return win;
335 } 371 }
336 372
337 static void delmod(GtkWidget *w, struct mod_account *ma) 373 static void delmod(GtkWidget *w, struct mod_account *ma)
1414 } else if (account->gc) { 1450 } else if (account->gc) {
1415 account->gc->wants_to_die = TRUE; 1451 account->gc->wants_to_die = TRUE;
1416 signoff(account->gc); 1452 signoff(account->gc);
1417 } else { 1453 } else {
1418 if (account->protocol == GAIM_PROTO_TOC) 1454 if (account->protocol == GAIM_PROTO_TOC)
1419 do_error_dialog(_("TOC not found."), 1455 gaim_notify_error(NULL, NULL,
1420 _("You have attempted to login an IM account using the " 1456 _("TOC not found."),
1421 "TOC protocol. Because this protocol is inferior to " 1457 _("You have attempted to login an IM account "
1422 "OSCAR, it is now compiled as a plugin by default. " 1458 "using the TOC protocol. Because this "
1423 "To login, edit this account to use OSCAR or load the " 1459 "protocol is inferior to OSCAR, it is now "
1424 "TOC plugin."), GAIM_ERROR); 1460 "compiled as a plugin by default. To login, "
1461 "edit this account to use OSCAR or load the "
1462 "TOC plugin."));
1425 else 1463 else
1426 do_error_dialog(_("Protocol not found."), 1464 gaim_notify_error(NULL, NULL,
1427 _("You cannot log this account in; you do not have " 1465 _("Protocol not found."),
1428 "the protocol it uses loaded, or the protocol does " 1466 _("You cannot log this account in; you do "
1429 "not have a login function."), GAIM_ERROR); 1467 "not have the protocol it uses loaded, or "
1468 "the protocol does not have a login "
1469 "function."));
1430 } 1470 }
1431 } 1471 }
1432 1472
1433 static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str, 1473 static void acct_autologin(GtkCellRendererToggle *cell, gchar *path_str,
1434 gpointer d) 1474 gpointer d)
1965 k = k->next; 2005 k = k->next;
1966 } 2006 }
1967 return NULL; 2007 return NULL;
1968 } 2008 }
1969 2009
1970 static void set_kick_null(GtkObject *obj, struct kick_dlg *k) 2010 static void set_kick_null(struct kick_dlg *k)
1971 { 2011 {
1972 kicks = g_slist_remove(kicks, k); 2012 kicks = g_slist_remove(kicks, k);
1973 g_free(k); 2013 g_free(k);
1974 } 2014 }
1975 2015
1987 buf = g_strdup_printf(_("%s\n%s: %s"), full_date(), prologue, details); 2027 buf = g_strdup_printf(_("%s\n%s: %s"), full_date(), prologue, details);
1988 if (k) 2028 if (k)
1989 gtk_widget_destroy(k->dlg); 2029 gtk_widget_destroy(k->dlg);
1990 k = g_new0(struct kick_dlg, 1); 2030 k = g_new0(struct kick_dlg, 1);
1991 k->account = gc->account; 2031 k->account = gc->account;
1992 k->dlg = do_error_dialog(title, buf, GAIM_ERROR); 2032 k->dlg = gaim_notify_message(NULL, GAIM_NOTIFY_MSG_ERROR, NULL,
2033 title, buf, G_CALLBACK(set_kick_null), k);
1993 kicks = g_slist_append(kicks, k); 2034 kicks = g_slist_append(kicks, k);
1994 g_signal_connect(G_OBJECT(k->dlg), "destroy",
1995 G_CALLBACK(set_kick_null), k);
1996 if (meter) { 2035 if (meter) {
1997 kill_meter(meter); 2036 kill_meter(meter);
1998 meters = g_slist_remove(meters, meter); 2037 meters = g_slist_remove(meters, meter);
1999 g_free(meter); 2038 g_free(meter);
2000 } 2039 }