# HG changeset patch # User Mark Doliner # Date 1093199073 0 # Node ID 430ef8fc963d4a8b0d911f98786216ae905ed34f # Parent 6f2a90c36ee275ace8dc0bd0fa0ba960c51a53b4 [gaim-migrate @ 10698] Patch 1013229 from Rhett Robinson. See the ChangeLog. "If at first you don't succeed, try try try again." committer: Tailor Script diff -r 6f2a90c36ee2 -r 430ef8fc963d COPYRIGHT --- a/COPYRIGHT Sun Aug 22 17:59:17 2004 +0000 +++ b/COPYRIGHT Sun Aug 22 18:24:33 2004 +0000 @@ -123,6 +123,7 @@ Kristian Rietveld Pekka Riikonen Tim Ringenbach +Rhett Robinson Luciano Miguel Ferreira Rocha Andrew Rodland Arvind Samptur diff -r 6f2a90c36ee2 -r 430ef8fc963d ChangeLog --- a/ChangeLog Sun Aug 22 17:59:17 2004 +0000 +++ b/ChangeLog Sun Aug 22 18:24:33 2004 +0000 @@ -2,6 +2,7 @@ version 0.82: New Features: + * Ability to edit your current away message (Rhett Robinson) * Topics in the conversation window (not the topic field at the top) with URLs will now appear as links (Stu Tomlinson) * File transfers appear in the file transfer window when they diff -r 6f2a90c36ee2 -r 430ef8fc963d src/away.c --- a/src/away.c Sun Aug 22 17:59:17 2004 +0000 +++ b/src/away.c Sun Aug 22 18:24:33 2004 +0000 @@ -210,9 +210,11 @@ void do_away_message(GtkWidget *w, struct away_message *a) { GtkWidget *back; + GtkWidget *edit; GtkWidget *awaytext; GtkWidget *sw; GtkWidget *vbox; + GtkWidget *hbox; GtkTreeViewColumn *column; GtkCellRenderer *renderer; char *buf; @@ -237,6 +239,10 @@ gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_widget_show(vbox); + hbox = gtk_hbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 0); + gtk_widget_show(hbox); + sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); @@ -292,13 +298,20 @@ gtk_widget_show(awayqueue); } + awaymessage = a; + + edit = gaim_pixbuf_button_from_stock(_("Edit This Message"), GTK_STOCK_CONVERT, GAIM_BUTTON_HORIZONTAL); + gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 0); + g_signal_connect(G_OBJECT(edit), "clicked", G_CALLBACK(create_away_mess), awaymessage); + gtk_widget_show(edit); + back = gaim_pixbuf_button_from_stock(_("I'm Back!"), GTK_STOCK_JUMP_TO, GAIM_BUTTON_HORIZONTAL); - gtk_box_pack_start(GTK_BOX(vbox), back, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), back, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(back), "clicked", G_CALLBACK(do_im_back), imaway); gtk_window_set_focus(GTK_WINDOW(imaway), back); gtk_widget_show(back); - awaymessage = a; + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(imaway); serv_set_away_all(awaymessage->message); @@ -872,16 +885,8 @@ focus_chain = g_list_append(focus_chain, sw); if (dummy) { - struct away_message *amt; - GtkTreeIter iter; - GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dummy))); - GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dummy)); - GValue val = { 0, }; - - if (! gtk_tree_selection_get_selected (sel, (GtkTreeModel**)&ls, &iter)) - return; - gtk_tree_model_get_value (GTK_TREE_MODEL(ls), &iter, 1, &val); - amt = g_value_get_pointer (&val); + /* If anything is passed here, it is an away_message pointer */ + struct away_message *amt = (struct away_message *) dummy ; gtk_entry_set_text(GTK_ENTRY(ca->entry), amt->name); gtk_imhtml_append_text_with_images(GTK_IMHTML(ca->text), amt->message, 0, NULL); ca->mess = amt; diff -r 6f2a90c36ee2 -r 430ef8fc963d src/gtkprefs.c --- a/src/gtkprefs.c Sun Aug 22 17:59:17 2004 +0000 +++ b/src/gtkprefs.c Sun Aug 22 18:24:33 2004 +0000 @@ -2255,14 +2255,29 @@ } +static void away_edit_sel (GtkWidget *dummy, void *tv) +{ + struct away_message *amt; + GtkTreeIter iter; + GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(tv))); + GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)); + GValue val = { 0, }; + + /* Get the pointer to the away message and pass that */ + if (! gtk_tree_selection_get_selected (sel, (GtkTreeModel**)&ls, &iter)) + return; + gtk_tree_model_get_value (GTK_TREE_MODEL(ls), &iter, 1, &val); + amt = g_value_get_pointer (&val); + create_away_mess(NULL, amt); +} + static gboolean away_message_click_cb(GtkWidget *tv, GdkEventButton *event, gpointer null) { /* Only respond to double click on button 1 */ if ((event->button != 1) || (event->type != GDK_2BUTTON_PRESS)) return FALSE; - /* Show the edit away message dialog */ - create_away_mess(NULL, tv); + away_edit_sel (NULL, tv); return FALSE; } @@ -2360,7 +2375,7 @@ button = gaim_pixbuf_button_from_stock(_("_Edit"), GAIM_STOCK_EDIT, GAIM_BUTTON_HORIZONTAL); gtk_size_group_add_widget(sg, button); g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(create_away_mess), event_view); + G_CALLBACK(away_edit_sel), event_view); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_widget_show_all(ret);