pidgin/gtkdialogs.c

changeset 21162
8359073125ba
parent 20774
05ac8ac559e7
parent 20704
cb641dccdb95
child 21171
c6934783d152
child 21182
23cc39e90bf7
equal deleted inserted replaced
20884:220d9b7edad6 21162:8359073125ba
332 } 332 }
333 #endif 333 #endif
334 334
335 void pidgin_dialogs_about() 335 void pidgin_dialogs_about()
336 { 336 {
337 PidginBuddyList *blist = pidgin_blist_get_default_gtk_blist();
338
339 pidgin_dialogs_about_with_parent(blist ? GTK_WINDOW(blist->window) : NULL);
340 }
341
342 void pidgin_dialogs_about_with_parent(GtkWindow *parent)
343 {
337 GtkWidget *hbox; 344 GtkWidget *hbox;
338 GtkWidget *vbox; 345 GtkWidget *vbox;
339 GtkWidget *logo; 346 GtkWidget *logo;
340 GtkWidget *frame; 347 GtkWidget *frame;
341 GtkWidget *text; 348 GtkWidget *text;
347 AtkObject *obj; 354 AtkObject *obj;
348 char* filename, *tmp; 355 char* filename, *tmp;
349 GdkPixbuf *pixbuf; 356 GdkPixbuf *pixbuf;
350 357
351 if (about != NULL) { 358 if (about != NULL) {
359 if (parent)
360 gtk_window_set_transient_for(GTK_WINDOW(about), parent);
352 gtk_window_present(GTK_WINDOW(about)); 361 gtk_window_present(GTK_WINDOW(about));
353 return; 362 return;
354 } 363 }
355 364
356 PIDGIN_DIALOG(about); 365 PIDGIN_DIALOG(about);
366 if (parent)
367 gtk_window_set_transient_for(GTK_WINDOW(about), parent);
357 tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME); 368 tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME);
358 gtk_window_set_title(GTK_WINDOW(about), tmp); 369 gtk_window_set_title(GTK_WINDOW(about), tmp);
359 g_free(tmp); 370 g_free(tmp);
360 gtk_window_set_role(GTK_WINDOW(about), "about"); 371 gtk_window_set_role(GTK_WINDOW(about), "about");
361 gtk_window_set_resizable(GTK_WINDOW(about), TRUE); 372 gtk_window_set_resizable(GTK_WINDOW(about), TRUE);
762 (purple_connections_get_all() != NULL && 773 (purple_connections_get_all() != NULL &&
763 purple_connections_get_all()->next != NULL)); 774 purple_connections_get_all()->next != NULL));
764 purple_request_field_set_required(field, TRUE); 775 purple_request_field_set_required(field, TRUE);
765 purple_request_field_group_add_field(group, field); 776 purple_request_field_group_add_field(group, field);
766 777
767 purple_request_fields(purple_get_blist(), _("New Instant Message"), 778 purple_request_fields_with_hint(purple_get_blist(), _("New Instant Message"),
768 NULL, 779 NULL,
769 _("Please enter the screen name or alias of the person " 780 _("Please enter the screen name or alias of the person "
770 "you would like to IM."), 781 "you would like to IM."),
771 fields, 782 fields,
772 _("OK"), G_CALLBACK(pidgin_dialogs_im_cb), 783 _("OK"), G_CALLBACK(pidgin_dialogs_im_cb),
773 _("Cancel"), NULL, 784 _("Cancel"), NULL,
774 NULL, NULL, NULL, 785 NULL, NULL, NULL,
775 NULL); 786 "blist", NULL);
776 } 787 }
777 788
778 void 789 void
779 pidgin_dialogs_im_with_user(PurpleAccount *account, const char *username) 790 pidgin_dialogs_im_with_user(PurpleAccount *account, const char *username)
780 { 791 {
901 (purple_connections_get_all() != NULL && 912 (purple_connections_get_all() != NULL &&
902 purple_connections_get_all()->next != NULL)); 913 purple_connections_get_all()->next != NULL));
903 purple_request_field_set_required(field, TRUE); 914 purple_request_field_set_required(field, TRUE);
904 purple_request_field_group_add_field(group, field); 915 purple_request_field_group_add_field(group, field);
905 916
906 purple_request_fields(purple_get_blist(), _("Get User Info"), 917 purple_request_fields_with_hint(purple_get_blist(), _("Get User Info"),
907 NULL, 918 NULL,
908 _("Please enter the screen name or alias of the person " 919 _("Please enter the screen name or alias of the person "
909 "whose info you would like to view."), 920 "whose info you would like to view."),
910 fields, 921 fields,
911 _("OK"), G_CALLBACK(pidgin_dialogs_info_cb), 922 _("OK"), G_CALLBACK(pidgin_dialogs_info_cb),
912 _("Cancel"), NULL, 923 _("Cancel"), NULL,
913 NULL, NULL, NULL, 924 NULL, NULL, NULL,
914 NULL); 925 "blist", NULL);
915 } 926 }
916 927
917 static void 928 static void
918 pidgin_dialogs_log_cb(gpointer data, PurpleRequestFields *fields) 929 pidgin_dialogs_log_cb(gpointer data, PurpleRequestFields *fields)
919 { 930 {
937 for (cur = buddies; cur != NULL; cur = cur->next) 948 for (cur = buddies; cur != NULL; cur = cur->next)
938 { 949 {
939 PurpleBlistNode *node = cur->data; 950 PurpleBlistNode *node = cur->data;
940 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) 951 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL)))
941 { 952 {
942 pidgin_log_show_contact((PurpleContact *)node->parent); 953 pidgin_log_show_contact_with_parent(GTK_WINDOW(gtkblist->window), (PurpleContact *)node->parent);
943 g_slist_free(buddies); 954 g_slist_free(buddies);
944 pidgin_clear_cursor(gtkblist->window); 955 pidgin_clear_cursor(gtkblist->window);
945 g_free(username); 956 g_free(username);
946 return; 957 return;
947 } 958 }
948 } 959 }
949 g_slist_free(buddies); 960 g_slist_free(buddies);
950 961
951 pidgin_log_show(PURPLE_LOG_IM, username, account); 962 pidgin_log_show_with_parent(GTK_WINDOW(gtkblist->window), PURPLE_LOG_IM, username, account);
952 963
953 pidgin_clear_cursor(gtkblist->window); 964 pidgin_clear_cursor(gtkblist->window);
954 } 965 }
955 966
956 g_free(username); 967 g_free(username);
993 (purple_accounts_get_all() != NULL && 1004 (purple_accounts_get_all() != NULL &&
994 purple_accounts_get_all()->next != NULL)); 1005 purple_accounts_get_all()->next != NULL));
995 purple_request_field_set_required(field, TRUE); 1006 purple_request_field_set_required(field, TRUE);
996 purple_request_field_group_add_field(group, field); 1007 purple_request_field_group_add_field(group, field);
997 1008
998 purple_request_fields(purple_get_blist(), _("View User Log"), 1009 purple_request_fields_with_hint(purple_get_blist(), _("View User Log"),
999 NULL, 1010 NULL,
1000 _("Please enter the screen name or alias of the person " 1011 _("Please enter the screen name or alias of the person "
1001 "whose log you would like to view."), 1012 "whose log you would like to view."),
1002 fields, 1013 fields,
1003 _("OK"), G_CALLBACK(pidgin_dialogs_log_cb), 1014 _("OK"), G_CALLBACK(pidgin_dialogs_log_cb),
1004 _("Cancel"), NULL, 1015 _("Cancel"), NULL,
1005 NULL, NULL, NULL, 1016 NULL, NULL, NULL,
1006 NULL); 1017 "blist", NULL);
1007 } 1018 }
1008 1019
1009 static void 1020 static void
1010 pidgin_dialogs_alias_contact_cb(PurpleContact *contact, const char *new_alias) 1021 pidgin_dialogs_alias_contact_cb(PurpleContact *contact, const char *new_alias)
1011 { 1022 {
1015 void 1026 void
1016 pidgin_dialogs_alias_contact(PurpleContact *contact) 1027 pidgin_dialogs_alias_contact(PurpleContact *contact)
1017 { 1028 {
1018 g_return_if_fail(contact != NULL); 1029 g_return_if_fail(contact != NULL);
1019 1030
1020 purple_request_input(NULL, _("Alias Contact"), NULL, 1031 purple_request_input_with_hint(NULL, _("Alias Contact"), NULL,
1021 _("Enter an alias for this contact."), 1032 _("Enter an alias for this contact."),
1022 contact->alias, FALSE, FALSE, NULL, 1033 contact->alias, FALSE, FALSE, NULL,
1023 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_contact_cb), 1034 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_contact_cb),
1024 _("Cancel"), NULL, 1035 _("Cancel"), NULL,
1025 NULL, purple_contact_get_alias(contact), NULL, 1036 NULL, purple_contact_get_alias(contact), NULL,
1026 contact); 1037 "blist", contact);
1027 } 1038 }
1028 1039
1029 static void 1040 static void
1030 pidgin_dialogs_alias_buddy_cb(PurpleBuddy *buddy, const char *new_alias) 1041 pidgin_dialogs_alias_buddy_cb(PurpleBuddy *buddy, const char *new_alias)
1031 { 1042 {
1040 1051
1041 g_return_if_fail(buddy != NULL); 1052 g_return_if_fail(buddy != NULL);
1042 1053
1043 secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name); 1054 secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name);
1044 1055
1045 purple_request_input(NULL, _("Alias Buddy"), NULL, 1056 purple_request_input_with_hint(NULL, _("Alias Buddy"), NULL,
1046 secondary, buddy->alias, FALSE, FALSE, NULL, 1057 secondary, buddy->alias, FALSE, FALSE, NULL,
1047 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_buddy_cb), 1058 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_buddy_cb),
1048 _("Cancel"), NULL, 1059 _("Cancel"), NULL,
1049 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL, 1060 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL,
1050 buddy); 1061 "blist", buddy);
1051 1062
1052 g_free(secondary); 1063 g_free(secondary);
1053 } 1064 }
1054 1065
1055 static void 1066 static void
1061 void 1072 void
1062 pidgin_dialogs_alias_chat(PurpleChat *chat) 1073 pidgin_dialogs_alias_chat(PurpleChat *chat)
1063 { 1074 {
1064 g_return_if_fail(chat != NULL); 1075 g_return_if_fail(chat != NULL);
1065 1076
1066 purple_request_input(NULL, _("Alias Chat"), NULL, 1077 purple_request_input_with_hint(NULL, _("Alias Chat"), NULL,
1067 _("Enter an alias for this chat."), 1078 _("Enter an alias for this chat."),
1068 chat->alias, FALSE, FALSE, NULL, 1079 chat->alias, FALSE, FALSE, NULL,
1069 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_chat_cb), 1080 _("Alias"), G_CALLBACK(pidgin_dialogs_alias_chat_cb),
1070 _("Cancel"), NULL, 1081 _("Cancel"), NULL,
1071 chat->account, NULL, NULL, 1082 chat->account, NULL, NULL,
1072 chat); 1083 "blist", chat);
1073 } 1084 }
1074 1085
1075 static void 1086 static void
1076 pidgin_dialogs_remove_contact_cb(PurpleContact *contact) 1087 pidgin_dialogs_remove_contact_cb(PurpleContact *contact)
1077 { 1088 {
1109 "You are about to remove the contact containing %s " 1120 "You are about to remove the contact containing %s "
1110 "and %d other buddies from your buddy list. Do you " 1121 "and %d other buddies from your buddy list. Do you "
1111 "want to continue?", contact->totalsize - 1), 1122 "want to continue?", contact->totalsize - 1),
1112 buddy->name, contact->totalsize - 1); 1123 buddy->name, contact->totalsize - 1);
1113 1124
1114 purple_request_action(contact, NULL, _("Remove Contact"), text, 0, 1125 purple_request_action_with_hint(contact, NULL, _("Remove Contact"), text, 0,
1115 NULL, purple_contact_get_alias(contact), NULL, 1126 NULL, purple_contact_get_alias(contact), NULL,
1116 contact, 2, 1127 "blist", contact, 2,
1117 _("_Remove Contact"), G_CALLBACK(pidgin_dialogs_remove_contact_cb), 1128 _("_Remove Contact"), G_CALLBACK(pidgin_dialogs_remove_contact_cb),
1118 _("Cancel"), 1129 _("Cancel"),
1119 NULL); 1130 NULL);
1120 1131
1121 g_free(text); 1132 g_free(text);
1150 1161
1151 ggp = g_new(struct _PidginGroupMergeObject, 1); 1162 ggp = g_new(struct _PidginGroupMergeObject, 1);
1152 ggp->parent = source; 1163 ggp->parent = source;
1153 ggp->new_name = g_strdup(new_name); 1164 ggp->new_name = g_strdup(new_name);
1154 1165
1155 purple_request_action(source, NULL, _("Merge Groups"), text, 0, 1166 purple_request_action_with_hint(source, NULL, _("Merge Groups"), text, 0,
1156 NULL, NULL, NULL, 1167 NULL, NULL, NULL,
1157 ggp, 2, 1168 "blist", ggp, 2,
1158 _("_Merge Groups"), G_CALLBACK(pidgin_dialogs_merge_groups_cb), 1169 _("_Merge Groups"), G_CALLBACK(pidgin_dialogs_merge_groups_cb),
1159 _("Cancel"), G_CALLBACK(free_ggmo)); 1170 _("Cancel"), G_CALLBACK(free_ggmo));
1160 1171
1161 g_free(text); 1172 g_free(text);
1162 } 1173 }
1206 g_return_if_fail(group != NULL); 1217 g_return_if_fail(group != NULL);
1207 1218
1208 text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"), 1219 text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"),
1209 group->name); 1220 group->name);
1210 1221
1211 purple_request_action(group, NULL, _("Remove Group"), text, 0, 1222 purple_request_action_with_hint(group, NULL, _("Remove Group"), text, 0,
1212 NULL, NULL, NULL, 1223 NULL, NULL, NULL,
1213 group, 2, 1224 "blist", group, 2,
1214 _("_Remove Group"), G_CALLBACK(pidgin_dialogs_remove_group_cb), 1225 _("_Remove Group"), G_CALLBACK(pidgin_dialogs_remove_group_cb),
1215 _("Cancel"), NULL); 1226 _("Cancel"), NULL);
1216 1227
1217 g_free(text); 1228 g_free(text);
1218 } 1229 }
1245 g_return_if_fail(buddy != NULL); 1256 g_return_if_fail(buddy != NULL);
1246 1257
1247 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), 1258 text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"),
1248 buddy->name); 1259 buddy->name);
1249 1260
1250 purple_request_action(buddy, NULL, _("Remove Buddy"), text, 0, 1261 purple_request_action_with_hint(buddy, NULL, _("Remove Buddy"), text, 0,
1251 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL, 1262 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL,
1252 buddy, 2, 1263 "blist", buddy, 2,
1253 _("_Remove Buddy"), G_CALLBACK(pidgin_dialogs_remove_buddy_cb), 1264 _("_Remove Buddy"), G_CALLBACK(pidgin_dialogs_remove_buddy_cb),
1254 _("Cancel"), NULL); 1265 _("Cancel"), NULL);
1255 1266
1256 g_free(text); 1267 g_free(text);
1257 } 1268 }
1272 1283
1273 name = purple_chat_get_name(chat); 1284 name = purple_chat_get_name(chat);
1274 text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"), 1285 text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"),
1275 name ? name : ""); 1286 name ? name : "");
1276 1287
1277 purple_request_action(chat, NULL, _("Remove Chat"), text, 0, 1288 purple_request_action_with_hint(chat, NULL, _("Remove Chat"), text, 0,
1278 chat->account, NULL, NULL, 1289 chat->account, NULL, NULL,
1279 chat, 2, 1290 "blist", chat, 2,
1280 _("_Remove Chat"), G_CALLBACK(pidgin_dialogs_remove_chat_cb), 1291 _("_Remove Chat"), G_CALLBACK(pidgin_dialogs_remove_chat_cb),
1281 _("Cancel"), NULL); 1292 _("Cancel"), NULL);
1282 1293
1283 g_free(text); 1294 g_free(text);
1284 } 1295 }

mercurial