comparison pidgin/gtkpounce.c @ 21560:665e04562de0

This merge has the effect of reverting the hinting code from trunk.
author Richard Laager <rlaager@wiktel.com>
date Sat, 17 Nov 2007 00:12:30 +0000
parents 381801c6b4e3 fcb848b2d669
children 2a2496044eef
comparison
equal deleted inserted replaced
21544:9b4d1af17ced 21560:665e04562de0
152 const gchar *name; 152 const gchar *name;
153 153
154 entry = (GtkWidget *)data; 154 entry = (GtkWidget *)data;
155 name = gtk_entry_get_text(GTK_ENTRY(entry)); 155 name = gtk_entry_get_text(GTK_ENTRY(entry));
156 156
157 purple_request_file_with_hint(entry, _("Select a file"), name, FALSE, 157 purple_request_file(entry, _("Select a file"), name, FALSE,
158 G_CALLBACK(pounce_update_entry_fields), NULL, 158 G_CALLBACK(pounce_update_entry_fields), NULL,
159 NULL, NULL, NULL, 159 NULL, NULL, NULL,
160 "buddy_pounce", entry); 160 entry);
161 g_signal_connect_swapped(G_OBJECT(entry), "destroy", 161 g_signal_connect_swapped(G_OBJECT(entry), "destroy",
162 G_CALLBACK(purple_request_close_with_handle), entry); 162 G_CALLBACK(purple_request_close_with_handle), entry);
163 } 163 }
164 164
165 static void 165 static void
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;
529 /* Create the window. */ 522 /* Create the window. */
530 dialog->window = window = gtk_dialog_new(); 523 dialog->window = window = gtk_dialog_new();
531 gtk_window_set_title(GTK_WINDOW(window), (cur_pounce == NULL ? _("New Buddy Pounce") : _("Edit Buddy Pounce"))); 524 gtk_window_set_title(GTK_WINDOW(window), (cur_pounce == NULL ? _("New Buddy Pounce") : _("Edit Buddy Pounce")));
532 gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce"); 525 gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce");
533 gtk_container_set_border_width(GTK_CONTAINER(dialog->window), PIDGIN_HIG_BORDER); 526 gtk_container_set_border_width(GTK_CONTAINER(dialog->window), PIDGIN_HIG_BORDER);
534 gtk_window_set_transient_for(GTK_WINDOW(window), parent);
535 527
536 g_signal_connect(G_OBJECT(window), "delete_event", 528 g_signal_connect(G_OBJECT(window), "delete_event",
537 G_CALLBACK(delete_win_cb), dialog); 529 G_CALLBACK(delete_win_cb), dialog);
538 530
539 /* Create the parent vbox for everything. */ 531 /* Create the parent vbox for everything. */
1061 } 1053 }
1062 1054
1063 static void 1055 static void
1064 pounces_manager_add_cb(GtkButton *button, gpointer user_data) 1056 pounces_manager_add_cb(GtkButton *button, gpointer user_data)
1065 { 1057 {
1066 pidgin_pounce_editor_show_with_parent(GTK_WINDOW(pounces_manager->window), NULL, NULL, NULL); 1058 pidgin_pounce_editor_show(NULL, NULL, NULL);
1067 } 1059 }
1068 1060
1069 static void 1061 static void
1070 pounces_manager_modify_foreach(GtkTreeModel *model, GtkTreePath *path, 1062 pounces_manager_modify_foreach(GtkTreeModel *model, GtkTreePath *path,
1071 GtkTreeIter *iter, gpointer user_data) 1063 GtkTreeIter *iter, gpointer user_data)
1072 { 1064 {
1073 PurplePounce *pounce; 1065 PurplePounce *pounce;
1074 1066
1075 gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1); 1067 gtk_tree_model_get(model, iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1);
1076 pidgin_pounce_editor_show_with_parent(GTK_WINDOW(pounces_manager->window), NULL, NULL, pounce); 1068 pidgin_pounce_editor_show(NULL, NULL, pounce);
1077 } 1069 }
1078 1070
1079 static void 1071 static void
1080 pounces_manager_modify_cb(GtkButton *button, gpointer user_data) 1072 pounces_manager_modify_cb(GtkButton *button, gpointer user_data)
1081 { 1073 {
1112 account = purple_pounce_get_pouncer(pounce); 1104 account = purple_pounce_get_pouncer(pounce);
1113 pouncer = purple_account_get_username(account); 1105 pouncer = purple_account_get_username(account);
1114 pouncee = purple_pounce_get_pouncee(pounce); 1106 pouncee = purple_pounce_get_pouncee(pounce);
1115 1107
1116 buf = g_strdup_printf(_("Are you sure you want to delete the pounce on %s for %s?"), pouncee, pouncer); 1108 buf = g_strdup_printf(_("Are you sure you want to delete the pounce on %s for %s?"), pouncee, pouncer);
1117 purple_request_action_with_hint(pounce, NULL, buf, NULL, 0, 1109 purple_request_action(pounce, NULL, buf, NULL, 0,
1118 account, pouncee, NULL, 1110 account, pouncee, NULL,
1119 PURPLE_REQUEST_UI_HINT_POUNCEMGR, pounce, 2, 1111 pounce, 2,
1120 _("Delete"), pounces_manager_delete_confirm_cb, 1112 _("Delete"), pounces_manager_delete_confirm_cb,
1121 _("Cancel"), NULL); 1113 _("Cancel"), NULL);
1122 g_free(buf); 1114 g_free(buf);
1123 } 1115 }
1124 1116
1171 gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1); 1163 gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1);
1172 1164
1173 if ((pounce != NULL) && (event->button == 1) && 1165 if ((pounce != NULL) && (event->button == 1) &&
1174 (event->type == GDK_2BUTTON_PRESS)) 1166 (event->type == GDK_2BUTTON_PRESS))
1175 { 1167 {
1176 pidgin_pounce_editor_show_with_parent(GTK_WINDOW(pounces_manager->window), NULL, NULL, pounce); 1168 pidgin_pounce_editor_show(NULL, NULL, pounce);
1177 return TRUE; 1169 return TRUE;
1178 } 1170 }
1179 1171
1180 return FALSE; 1172 return FALSE;
1181 } 1173 }
1322 } 1314 }
1323 1315
1324 void 1316 void
1325 pidgin_pounces_manager_show(void) 1317 pidgin_pounces_manager_show(void)
1326 { 1318 {
1327 pidgin_pounces_manager_show_with_parent(NULL);
1328 }
1329
1330 void
1331 pidgin_pounces_manager_show_with_parent(GtkWindow *parent)
1332 {
1333 PouncesManager *dialog; 1319 PouncesManager *dialog;
1334 GtkWidget *bbox; 1320 GtkWidget *bbox;
1335 GtkWidget *button; 1321 GtkWidget *button;
1336 GtkWidget *list; 1322 GtkWidget *list;
1337 GtkWidget *vbox; 1323 GtkWidget *vbox;
1338 GtkWidget *win; 1324 GtkWidget *win;
1339 int width, height; 1325 int width, height;
1340 1326
1341 if (pounces_manager != NULL) { 1327 if (pounces_manager != NULL) {
1342 gtk_window_present(GTK_WINDOW(pounces_manager->window)); 1328 gtk_window_present(GTK_WINDOW(pounces_manager->window));
1343 gtk_window_set_transient_for(GTK_WINDOW(pounces_manager->window), parent);
1344 return; 1329 return;
1345 } 1330 }
1346 1331
1347 pounces_manager = dialog = g_new0(PouncesManager, 1); 1332 pounces_manager = dialog = g_new0(PouncesManager, 1);
1348 1333
1349 width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width"); 1334 width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width");
1350 height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height"); 1335 height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height");
1351 1336
1352 dialog->window = win = pidgin_create_window(_("Buddy Pounces"), PIDGIN_HIG_BORDER, "pounces", TRUE); 1337 dialog->window = win = pidgin_create_window(_("Buddy Pounces"), PIDGIN_HIG_BORDER, "pounces", TRUE);
1353 gtk_window_set_default_size(GTK_WINDOW(win), width, height); 1338 gtk_window_set_default_size(GTK_WINDOW(win), width, height);
1354 gtk_window_set_transient_for(GTK_WINDOW(win), parent);
1355 1339
1356 g_signal_connect(G_OBJECT(win), "delete_event", 1340 g_signal_connect(G_OBJECT(win), "delete_event",
1357 G_CALLBACK(pounces_manager_destroy_cb), dialog); 1341 G_CALLBACK(pounces_manager_destroy_cb), dialog);
1358 g_signal_connect(G_OBJECT(win), "configure_event", 1342 g_signal_connect(G_OBJECT(win), "configure_event",
1359 G_CALLBACK(pounces_manager_configure_cb), dialog); 1343 G_CALLBACK(pounces_manager_configure_cb), dialog);