Mercurial > pidgin.yaz
comparison src/prefs.c @ 821:02250312c02d
[gaim-migrate @ 831]
i *think* this irons out the last few bugs in the away system...
committer: Tailor Script <tailor@pidgin.im>
author | Todd Kulesza <fflewddur> |
---|---|
date | Fri, 01 Sep 2000 13:50:34 +0000 |
parents | 9614e69f68ca |
children | 75d9cdffb946 |
comparison
equal
deleted
inserted
replaced
820:fe2e1ad4495b | 821:02250312c02d |
---|---|
39 #include "pixmaps/fontface2.xpm" | 39 #include "pixmaps/fontface2.xpm" |
40 #include "pixmaps/refresh.xpm" | 40 #include "pixmaps/refresh.xpm" |
41 #include "pixmaps/gnome_add.xpm" | 41 #include "pixmaps/gnome_add.xpm" |
42 #include "pixmaps/gnome_remove.xpm" | 42 #include "pixmaps/gnome_remove.xpm" |
43 #include "pixmaps/palette.xpm" | 43 #include "pixmaps/palette.xpm" |
44 #include "pixmaps/save.xpm" | |
44 | 45 |
45 struct debug_window *dw = NULL; | 46 struct debug_window *dw = NULL; |
46 static GtkWidget *prefs = NULL; | 47 static GtkWidget *prefs = NULL; |
47 | 48 |
48 static GtkWidget *gaim_button(const char *, int *, int, GtkWidget *); | 49 static GtkWidget *gaim_button(const char *, int *, int, GtkWidget *); |
1132 | 1133 |
1133 void away_list_clicked(GtkWidget *widget, struct away_message *a) | 1134 void away_list_clicked(GtkWidget *widget, struct away_message *a) |
1134 { | 1135 { |
1135 gchar buffer[2048]; | 1136 gchar buffer[2048]; |
1136 guint text_len; | 1137 guint text_len; |
1137 | 1138 |
1138 cur_message = a; | 1139 cur_message = a; |
1139 | 1140 |
1140 /* Get proper Length */ | 1141 /* Get proper Length */ |
1141 text_len = gtk_text_get_length(GTK_TEXT(away_text)); | 1142 text_len = gtk_text_get_length(GTK_TEXT(away_text)); |
1142 edited_message = gtk_editable_get_chars(GTK_EDITABLE(away_text), 0, text_len); | 1143 |
1143 | |
1144 /* Clear the Box */ | 1144 /* Clear the Box */ |
1145 gtk_text_set_point(GTK_TEXT(away_text), 0 ); | 1145 gtk_text_set_point(GTK_TEXT(away_text), 0 ); |
1146 gtk_text_forward_delete (GTK_TEXT(away_text), text_len); | 1146 gtk_text_forward_delete (GTK_TEXT(away_text), text_len); |
1147 | 1147 |
1148 /* Fill the text box with new message */ | 1148 /* Fill the text box with new message */ |
1149 strcpy(buffer, a->message); | 1149 strcpy(buffer, a->message); |
1150 gtk_text_insert(GTK_TEXT(away_text), NULL, NULL, NULL, buffer, -1); | 1150 gtk_text_insert(GTK_TEXT(away_text), NULL, NULL, NULL, buffer, -1); |
1151 } | 1151 } |
1152 | 1152 /* |
1153 void away_list_unclicked(GtkWidget *widget, struct away_message *a) | 1153 void away_list_unclicked(GtkWidget *widget, struct away_message *a) |
1154 { | 1154 { |
1155 if (prefs_away_list == NULL) | 1155 if (prefs_away_list == NULL) |
1156 { | |
1157 g_print("early return from away_list_unclicked\n"); | |
1156 return; | 1158 return; |
1159 } | |
1160 | |
1161 g_print("away_list_unclicked\n"); | |
1162 g_print("setting '%s' to '%s'\n", a->name, edited_message); | |
1157 strcpy(a->message, edited_message); | 1163 strcpy(a->message, edited_message); |
1158 save_prefs(); | 1164 save_prefs(); |
1159 | 1165 |
1160 /* point edited_message to the new text */ | 1166 /* point edited_message to the new text */ |
1167 /* edited_message = gtk_editable_get_chars(GTK_EDITABLE(away_text), 0, -1); | |
1168 g_print("edited_message now equals '%s'\n", edited_message); | |
1169 } | |
1170 */ | |
1171 void save_away_message(GtkWidget *widget, void *dummy) | |
1172 { | |
1173 /* grab the current message */ | |
1161 edited_message = gtk_editable_get_chars(GTK_EDITABLE(away_text), 0, -1); | 1174 edited_message = gtk_editable_get_chars(GTK_EDITABLE(away_text), 0, -1); |
1175 strcpy(cur_message->message, edited_message); | |
1176 save_prefs(); | |
1162 } | 1177 } |
1163 | 1178 |
1164 void remove_away_message(GtkWidget *widget, void *dummy) | 1179 void remove_away_message(GtkWidget *widget, void *dummy) |
1165 { | 1180 { |
1166 GList *i; | 1181 GList *i; |
1241 | 1256 |
1242 button = picture_button(prefs, _("Remove"), gnome_remove_xpm); | 1257 button = picture_button(prefs, _("Remove"), gnome_remove_xpm); |
1243 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), NULL); | 1258 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), NULL); |
1244 gtk_box_pack_start(GTK_BOX(bot), button, TRUE, FALSE, 5); | 1259 gtk_box_pack_start(GTK_BOX(bot), button, TRUE, FALSE, 5); |
1245 | 1260 |
1261 button = picture_button(prefs, _("Save"), save_xpm); | |
1262 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(save_away_message), NULL); | |
1263 gtk_box_pack_start(GTK_BOX(bot), button, TRUE, FALSE, 5); | |
1264 | |
1246 if (awy != NULL) { | 1265 if (awy != NULL) { |
1247 a = (struct away_message *)awy->data; | 1266 a = (struct away_message *)awy->data; |
1248 g_snprintf(buffer, sizeof(buffer), "%s", a->message); | 1267 g_snprintf(buffer, sizeof(buffer), "%s", a->message); |
1249 gtk_text_insert(GTK_TEXT(away_text), NULL, NULL, NULL, buffer, -1); | 1268 gtk_text_insert(GTK_TEXT(away_text), NULL, NULL, NULL, buffer, -1); |
1250 } | 1269 } |
1253 a = (struct away_message *)awy->data; | 1272 a = (struct away_message *)awy->data; |
1254 label = gtk_label_new(a->name); | 1273 label = gtk_label_new(a->name); |
1255 list_item = gtk_list_item_new(); | 1274 list_item = gtk_list_item_new(); |
1256 gtk_container_add(GTK_CONTAINER(list_item), label); | 1275 gtk_container_add(GTK_CONTAINER(list_item), label); |
1257 gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(away_list_clicked), a); | 1276 gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(away_list_clicked), a); |
1258 gtk_signal_connect(GTK_OBJECT(list_item), "deselect", GTK_SIGNAL_FUNC(away_list_unclicked), a); | 1277 /* gtk_signal_connect(GTK_OBJECT(list_item), "deselect", GTK_SIGNAL_FUNC(away_list_unclicked), a);*/ |
1259 gtk_object_set_user_data(GTK_OBJECT(list_item), a); | 1278 gtk_object_set_user_data(GTK_OBJECT(list_item), a); |
1260 | 1279 |
1261 gtk_widget_show(label); | 1280 gtk_widget_show(label); |
1262 gtk_container_add(GTK_CONTAINER(prefs_away_list), list_item); | 1281 gtk_container_add(GTK_CONTAINER(prefs_away_list), list_item); |
1263 gtk_widget_show(list_item); | 1282 gtk_widget_show(list_item); |