| 36 /****************************************************************************** |
36 /****************************************************************************** |
| 37 * Code |
37 * Code |
| 38 *****************************************************************************/ |
38 *****************************************************************************/ |
| 39 |
39 |
| 40 void |
40 void |
| 41 pidgin_retrieve_user_info(PurpleConnection *conn, const char *name) { |
|
| 42 PurpleNotifyUserInfo *info = NULL; |
|
| 43 PurpleProtocol *protocol = NULL; |
|
| 44 |
|
| 45 protocol = purple_connection_get_protocol(conn); |
|
| 46 if(!PURPLE_IS_PROTOCOL_SERVER(protocol)) { |
|
| 47 return; |
|
| 48 } |
|
| 49 |
|
| 50 purple_protocol_server_get_info(PURPLE_PROTOCOL_SERVER(protocol), conn, |
|
| 51 name); |
|
| 52 |
|
| 53 info = purple_notify_user_info_new(); |
|
| 54 purple_notify_user_info_add_pair_plaintext(info, _("Information"), |
|
| 55 _("Retrieving...")); |
|
| 56 purple_notify_userinfo(conn, name, info, NULL, NULL); |
|
| 57 purple_notify_user_info_destroy(info); |
|
| 58 } |
|
| 59 |
|
| 60 void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chat) |
|
| 61 { |
|
| 62 char *who = NULL; |
|
| 63 PurpleProtocol *protocol = NULL; |
|
| 64 |
|
| 65 if (chat < 0) { |
|
| 66 pidgin_retrieve_user_info(conn, name); |
|
| 67 return; |
|
| 68 } |
|
| 69 |
|
| 70 protocol = purple_connection_get_protocol(conn); |
|
| 71 if (protocol != NULL) |
|
| 72 who = purple_protocol_chat_get_user_real_name(PURPLE_PROTOCOL_CHAT(protocol), conn, chat, name); |
|
| 73 |
|
| 74 pidgin_retrieve_user_info(conn, who ? who : name); |
|
| 75 g_free(who); |
|
| 76 } |
|
| 77 |
|
| 78 void |
|
| 79 pidgin_set_accessible_label(GtkWidget *w, GtkLabel *l) |
41 pidgin_set_accessible_label(GtkWidget *w, GtkLabel *l) |
| 80 { |
42 { |
| 81 GtkAccessible *acc, *label; |
43 GtkAccessible *acc, *label; |
| 82 |
44 |
| 83 acc = GTK_ACCESSIBLE(w); |
45 acc = GTK_ACCESSIBLE(w); |
| 87 gtk_label_set_mnemonic_widget(l, w); |
49 gtk_label_set_mnemonic_widget(l, w); |
| 88 |
50 |
| 89 /* Create the labeled-by relation */ |
51 /* Create the labeled-by relation */ |
| 90 gtk_accessible_update_relation(acc, GTK_ACCESSIBLE_RELATION_LABELLED_BY, |
52 gtk_accessible_update_relation(acc, GTK_ACCESSIBLE_RELATION_LABELLED_BY, |
| 91 label, NULL, -1); |
53 label, NULL, -1); |
| 92 } |
|
| 93 |
|
| 94 GtkWidget * |
|
| 95 pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label) |
|
| 96 { |
|
| 97 GtkWidget *hbox; |
|
| 98 GtkWidget *label = NULL; |
|
| 99 |
|
| 100 if (widget_label) { |
|
| 101 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); |
|
| 102 gtk_box_append(vbox, hbox); |
|
| 103 |
|
| 104 label = gtk_label_new_with_mnemonic(widget_label); |
|
| 105 if (sg) { |
|
| 106 gtk_label_set_xalign(GTK_LABEL(label), 0); |
|
| 107 gtk_size_group_add_widget(sg, label); |
|
| 108 } |
|
| 109 gtk_box_append(GTK_BOX(hbox), label); |
|
| 110 |
|
| 111 gtk_widget_set_hexpand(widget, expand); |
|
| 112 gtk_box_append(GTK_BOX(hbox), widget); |
|
| 113 } else { |
|
| 114 gtk_widget_set_vexpand(widget, expand); |
|
| 115 gtk_box_append(vbox, widget); |
|
| 116 |
|
| 117 hbox = GTK_WIDGET(vbox); |
|
| 118 } |
|
| 119 |
|
| 120 if (label) { |
|
| 121 gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget); |
|
| 122 pidgin_set_accessible_label(widget, GTK_LABEL(label)); |
|
| 123 } |
|
| 124 |
|
| 125 if (p_label) |
|
| 126 (*p_label) = label; |
|
| 127 return hbox; |
|
| 128 } |
54 } |
| 129 |
55 |
| 130 gboolean pidgin_auto_parent_window(GtkWidget *widget) |
56 gboolean pidgin_auto_parent_window(GtkWidget *widget) |
| 131 { |
57 { |
| 132 /* This finds the currently active window and makes that the parent window. */ |
58 /* This finds the currently active window and makes that the parent window. */ |