comparison pidgin/gtkpounce.c @ 21347:200afe30b7af

merge of '53b79b2ce557c515c1eb6d234e40ede98328a82e' and 'f0a7f7c96090e1312d4ca0675a3e047cfb4a2a53'
author Richard Laager <rlaager@wiktel.com>
date Fri, 16 Nov 2007 23:00:41 +0000
parents fba1f6c3df0b 80af064d311c
children 0cb8d5304f4f
comparison
equal deleted inserted replaced
21238:dd510f19c844 21347:200afe30b7af
470 470
471 void 471 void
472 pidgin_pounce_editor_show(PurpleAccount *account, const char *name, 472 pidgin_pounce_editor_show(PurpleAccount *account, const char *name,
473 PurplePounce *cur_pounce) 473 PurplePounce *cur_pounce)
474 { 474 {
475 pidgin_pounce_editor_show_with_parent(NULL, account, name, cur_pounce);
476 }
477
478 void
479 pidgin_pounce_editor_show_with_parent(GtkWindow *parent, PurpleAccount *account, const char *name,
480 PurplePounce *cur_pounce)
481 {
482 PidginPounceDialog *dialog; 475 PidginPounceDialog *dialog;
483 GtkWidget *window; 476 GtkWidget *window;
484 GtkWidget *label; 477 GtkWidget *label;
485 GtkWidget *vbox1, *vbox2; 478 GtkWidget *vbox1, *vbox2;
486 GtkWidget *hbox; 479 GtkWidget *hbox;
1055 } 1048 }
1056 1049
1057 static void 1050 static void
1058 pounces_manager_add_cb(GtkButton *button, gpointer user_data) 1051 pounces_manager_add_cb(GtkButton *button, gpointer user_data)
1059 { 1052 {
1060 pidgin_pounce_editor_show_with_parent(GTK_WINDOW(pounces_manager->window), NULL, NULL, NULL); 1053 pidgin_pounce_editor_show(NULL, NULL, NULL);
1061 } 1054 }
1062 1055
1063 static void 1056 static void
1064 pounces_manager_modify_foreach(GtkTreeModel *model, GtkTreePath *path, 1057 pounces_manager_modify_foreach(GtkTreeModel *model, GtkTreePath *path,
1065 GtkTreeIter *iter, gpointer user_data) 1058 GtkTreeIter *iter, gpointer user_data)
1066 { 1059 {
1067 PurplePounce *pounce; 1060 PurplePounce *pounce;
1068 1061
1069 gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1); 1062 gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1);
1070 pidgin_pounce_editor_show_with_parent(GTK_WINDOW(pounces_manager->window), NULL, NULL, pounce); 1063 pidgin_pounce_editor_show(NULL, NULL, pounce);
1071 } 1064 }
1072 1065
1073 static void 1066 static void
1074 pounces_manager_modify_cb(GtkButton *button, gpointer user_data) 1067 pounces_manager_modify_cb(GtkButton *button, gpointer user_data)
1075 { 1068 {
1165 gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1); 1158 gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1);
1166 1159
1167 if ((pounce != NULL) && (event->button == 1) && 1160 if ((pounce != NULL) && (event->button == 1) &&
1168 (event->type == GDK_2BUTTON_PRESS)) 1161 (event->type == GDK_2BUTTON_PRESS))
1169 { 1162 {
1170 pidgin_pounce_editor_show_with_parent(GTK_WINDOW(pounces_manager->window), NULL, NULL, pounce); 1163 pidgin_pounce_editor_show(NULL, NULL, pounce);
1171 return TRUE; 1164 return TRUE;
1172 } 1165 }
1173 1166
1174 return FALSE; 1167 return FALSE;
1175 } 1168 }
1316 } 1309 }
1317 1310
1318 void 1311 void
1319 pidgin_pounces_manager_show(void) 1312 pidgin_pounces_manager_show(void)
1320 { 1313 {
1321 pidgin_pounces_manager_show_with_parent(NULL);
1322 }
1323
1324 void
1325 pidgin_pounces_manager_show_with_parent(GtkWindow *parent)
1326 {
1327 PouncesManager *dialog; 1314 PouncesManager *dialog;
1328 GtkWidget *bbox; 1315 GtkWidget *bbox;
1329 GtkWidget *button; 1316 GtkWidget *button;
1330 GtkWidget *list; 1317 GtkWidget *list;
1331 GtkWidget *vbox; 1318 GtkWidget *vbox;
1332 GtkWidget *win; 1319 GtkWidget *win;
1333 int width, height; 1320 int width, height;
1334 1321
1335 if (pounces_manager != NULL) { 1322 if (pounces_manager != NULL) {
1336 gtk_window_present(GTK_WINDOW(pounces_manager->window)); 1323 gtk_window_present(GTK_WINDOW(pounces_manager->window));
1337 gtk_window_set_transient_for(GTK_WINDOW(pounces_manager->window), parent);
1338 return; 1324 return;
1339 } 1325 }
1340 1326
1341 pounces_manager = dialog = g_new0(PouncesManager, 1); 1327 pounces_manager = dialog = g_new0(PouncesManager, 1);
1342 1328
1343 width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width"); 1329 width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width");
1344 height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height"); 1330 height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height");
1345 1331
1346 dialog->window = win = pidgin_create_window(_("Buddy Pounces"), PIDGIN_HIG_BORDER, "pounces", TRUE); 1332 dialog->window = win = pidgin_create_window(_("Buddy Pounces"), PIDGIN_HIG_BORDER, "pounces", TRUE);
1347 gtk_window_set_default_size(GTK_WINDOW(win), width, height); 1333 gtk_window_set_default_size(GTK_WINDOW(win), width, height);
1348 gtk_window_set_transient_for(GTK_WINDOW(win), parent);
1349 1334
1350 g_signal_connect(G_OBJECT(win), "delete_event", 1335 g_signal_connect(G_OBJECT(win), "delete_event",
1351 G_CALLBACK(pounces_manager_destroy_cb), dialog); 1336 G_CALLBACK(pounces_manager_destroy_cb), dialog);
1352 g_signal_connect(G_OBJECT(win), "configure_event", 1337 g_signal_connect(G_OBJECT(win), "configure_event",
1353 G_CALLBACK(pounces_manager_configure_cb), dialog); 1338 G_CALLBACK(pounces_manager_configure_cb), dialog);