Tue, 30 Sep 2003 18:41:28 +0000
[gaim-migrate @ 7643]
robot101 gave us images in notify_formatted windows. very cool. This lets what I committed earlier (which was support for images in jabber vcards) to work.
| 5032 | 1 | /** |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
2 | * @file gtkpounce.c GTK+ Buddy Pounce API |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
3 | * @ingroup gtkui |
| 5032 | 4 | * |
| 5 | * gaim | |
| 6 | * | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
7 | * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
8 | * |
| 5032 | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by | |
| 11 | * the Free Software Foundation; either version 2 of the License, or | |
| 12 | * (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, | |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | * GNU General Public License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU General Public License | |
| 20 | * along with this program; if not, write to the Free Software | |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | * | |
| 23 | */ | |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
24 | #include "gtkinternal.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
25 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
26 | #include "conversation.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
27 | #include "debug.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
28 | #include "notify.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
29 | #include "prpl.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
30 | #include "server.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
31 | #include "sound.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
32 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
33 | #include "gtkblist.h" |
| 5032 | 34 | #include "gtkpounce.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
35 | #include "gtkutils.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
36 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
37 | #include "ui.h" |
| 5032 | 38 | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
39 | typedef struct |
| 5032 | 40 | { |
| 41 | /* Pounce data */ | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
42 | GaimPounce *pounce; |
|
5563
d5a7852aa0cb
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
43 | GaimAccount *account; |
| 5032 | 44 | |
| 45 | /* The window */ | |
| 46 | GtkWidget *window; | |
| 47 | ||
| 48 | /* Pounce Who */ | |
| 49 | GtkWidget *account_menu; | |
| 50 | GtkWidget *buddy_entry; | |
| 51 | ||
| 52 | /* Pounce When */ | |
| 53 | GtkWidget *signon; | |
| 54 | GtkWidget *signoff; | |
| 55 | GtkWidget *away; | |
| 56 | GtkWidget *away_return; | |
| 57 | GtkWidget *idle; | |
| 58 | GtkWidget *idle_return; | |
| 59 | GtkWidget *typing; | |
| 60 | GtkWidget *stop_typing; | |
| 61 | ||
| 62 | /* Pounce Action */ | |
| 63 | GtkWidget *open_win; | |
| 64 | GtkWidget *popup; | |
| 65 | GtkWidget *send_msg; | |
| 66 | GtkWidget *send_msg_entry; | |
| 67 | GtkWidget *exec_cmd; | |
| 68 | GtkWidget *exec_cmd_entry; | |
| 5319 | 69 | GtkWidget *exec_cmd_browse; |
| 5032 | 70 | GtkWidget *play_sound; |
| 71 | GtkWidget *play_sound_entry; | |
| 5319 | 72 | GtkWidget *play_sound_browse; |
| 73 | GtkWidget *play_sound_test; | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
74 | |
| 5032 | 75 | GtkWidget *save_pounce; |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
76 | |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
77 | /* Buttons */ |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
78 | GtkWidget *save_button; |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
79 | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
80 | } GaimGtkPounceDialog; |
| 5032 | 81 | |
| 82 | /************************************************************************** | |
| 83 | * Callbacks | |
| 84 | **************************************************************************/ | |
| 85 | static gint | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
86 | delete_win_cb(GtkWidget *w, GdkEventAny *e, GaimGtkPounceDialog *dialog) |
| 5032 | 87 | { |
| 88 | gtk_widget_destroy(dialog->window); | |
| 89 | g_free(dialog); | |
| 90 | ||
| 91 | return TRUE; | |
| 92 | } | |
| 93 | ||
| 94 | static void | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
95 | delete_cb(GtkWidget *w, GaimGtkPounceDialog *dialog) |
|
5052
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
96 | { |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
97 | gaim_pounce_destroy(dialog->pounce); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
98 | |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
99 | delete_win_cb(NULL, NULL, dialog); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
100 | } |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
101 | |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
102 | static void |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
103 | cancel_cb(GtkWidget *w, GaimGtkPounceDialog *dialog) |
| 5032 | 104 | { |
| 105 | delete_win_cb(NULL, NULL, dialog); | |
| 106 | } | |
| 107 | ||
| 5319 | 108 | static void |
| 109 | pounce_update_entryfields(GtkWidget *w, gpointer data) | |
| 110 | { | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
111 | const char *filename; |
| 5319 | 112 | GHashTable *args; |
|
5959
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
113 | GtkFileSelection *filesel; |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
114 | |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
115 | args = (GHashTable *)data; |
|
5959
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
116 | filesel = GTK_FILE_SELECTION(g_hash_table_lookup(args, "filesel")); |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
117 | |
|
5959
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
118 | filename = gtk_file_selection_get_filename(filesel); |
|
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
119 | |
|
5966
91a208b3e979
[gaim-migrate @ 6413]
Mark Doliner <markdoliner@pidgin.im>
parents:
5959
diff
changeset
|
120 | if (gaim_gtk_check_if_dir(filename, filesel)) |
|
5959
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
121 | return; |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
122 | |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
123 | if (filename != NULL) |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
124 | gtk_entry_set_text(GTK_ENTRY(g_hash_table_lookup(args, "entry")), |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
125 | filename); |
| 5319 | 126 | |
|
5959
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
127 | gtk_widget_destroy(GTK_WIDGET(filesel)); |
|
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
128 | g_hash_table_destroy(args); |
| 5319 | 129 | } |
| 130 | ||
| 131 | static void | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
132 | filesel(GtkWidget *w, gpointer data) |
| 5319 | 133 | { |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
134 | GtkWidget *filesel; |
| 5319 | 135 | GtkWidget *entry; |
| 136 | GHashTable *args; | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
137 | |
|
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
138 | entry = (GtkWidget *)data; |
| 5319 | 139 | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
140 | filesel = gtk_file_selection_new(_("Select a file")); |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
141 | gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
142 | gtk_entry_get_text(GTK_ENTRY(entry))); |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
143 | gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel)); |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
144 | gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(filesel), FALSE); |
| 5319 | 145 | |
|
5959
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
146 | args = g_hash_table_new(g_str_hash, g_str_equal); |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
147 | g_hash_table_insert(args, "filesel", filesel); |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
148 | g_hash_table_insert(args, "entry", entry); |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
149 | |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
150 | g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
151 | "clicked", |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
152 | G_CALLBACK(pounce_update_entryfields), args); |
|
5959
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
153 | g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
154 | "clicked", |
|
5959
827dbe4b5bb2
[gaim-migrate @ 6405]
Mark Doliner <markdoliner@pidgin.im>
parents:
5937
diff
changeset
|
155 | G_CALLBACK(g_hash_table_destroy), args); |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
156 | g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
157 | "clicked", |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
158 | G_CALLBACK(gtk_widget_destroy), filesel); |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
159 | |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
160 | gtk_widget_show(filesel); |
| 5319 | 161 | } |
| 162 | ||
| 163 | static void | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
164 | pounce_test_sound(GtkWidget *w, GtkWidget *entry) |
| 5319 | 165 | { |
| 166 | const char *filename; | |
| 167 | ||
| 168 | filename = gtk_entry_get_text(GTK_ENTRY(entry)); | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
169 | |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
170 | if (filename != NULL && *filename != '\0') |
| 5319 | 171 | gaim_sound_play_file((char *) filename); |
| 172 | else | |
| 173 | gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT); | |
| 174 | } | |
| 5032 | 175 | |
| 176 | static void | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
177 | save_pounce_cb(GtkWidget *w, GaimGtkPounceDialog *dialog) |
| 5032 | 178 | { |
| 179 | const char *name; | |
| 180 | const char *message, *command, *sound; | |
| 181 | struct gaim_buddy_list *blist; | |
| 182 | struct gaim_gtk_buddy_list *gtkblist; | |
| 183 | GaimPounceEvent events = GAIM_POUNCE_NONE; | |
| 184 | ||
| 185 | name = gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)); | |
| 186 | ||
| 187 | if (*name == '\0') { | |
|
5436
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
188 | gaim_notify_error(NULL, NULL, |
|
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5319
diff
changeset
|
189 | _("Please enter a buddy to pounce."), NULL); |
| 5032 | 190 | return; |
| 191 | } | |
| 192 | ||
| 193 | /* Events */ | |
| 194 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signon))) | |
| 195 | events |= GAIM_POUNCE_SIGNON; | |
| 196 | ||
| 197 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->signoff))) | |
| 198 | events |= GAIM_POUNCE_SIGNOFF; | |
| 199 | ||
| 200 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away))) | |
| 201 | events |= GAIM_POUNCE_AWAY; | |
| 202 | ||
| 203 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->away_return))) | |
| 204 | events |= GAIM_POUNCE_AWAY_RETURN; | |
| 205 | ||
| 206 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle))) | |
| 207 | events |= GAIM_POUNCE_IDLE; | |
| 208 | ||
| 209 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->idle_return))) | |
| 210 | events |= GAIM_POUNCE_IDLE_RETURN; | |
| 211 | ||
| 212 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->typing))) | |
| 213 | events |= GAIM_POUNCE_TYPING; | |
| 214 | ||
| 215 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->stop_typing))) | |
| 216 | events |= GAIM_POUNCE_TYPING_STOPPED; | |
| 217 | ||
| 218 | /* Data fields */ | |
| 219 | message = gtk_entry_get_text(GTK_ENTRY(dialog->send_msg_entry)); | |
| 220 | command = gtk_entry_get_text(GTK_ENTRY(dialog->exec_cmd_entry)); | |
| 221 | sound = gtk_entry_get_text(GTK_ENTRY(dialog->play_sound_entry)); | |
| 222 | ||
| 223 | if (*message == '\0') message = NULL; | |
| 224 | if (*command == '\0') command = NULL; | |
| 225 | if (*sound == '\0') sound = NULL; | |
| 226 | ||
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
227 | if (dialog->pounce == NULL) { |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
228 | dialog->pounce = gaim_pounce_new(GAIM_GTK_UI, dialog->account, |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
229 | name, events); |
| 5032 | 230 | } |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
231 | else { |
| 5032 | 232 | gaim_pounce_set_events(dialog->pounce, events); |
| 233 | gaim_pounce_set_pouncer(dialog->pounce, dialog->account); | |
| 234 | gaim_pounce_set_pouncee(dialog->pounce, name); | |
| 235 | } | |
| 236 | ||
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
237 | /* Actions*/ |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
238 | gaim_pounce_action_set_enabled(dialog->pounce, "open-window", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
239 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->open_win))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
240 | gaim_pounce_action_set_enabled(dialog->pounce, "popup-notify", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
241 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->popup))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
242 | gaim_pounce_action_set_enabled(dialog->pounce, "send-message", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
243 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->send_msg))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
244 | gaim_pounce_action_set_enabled(dialog->pounce, "execute-command", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
245 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
246 | gaim_pounce_action_set_enabled(dialog->pounce, "play-sound", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
247 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->play_sound))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
248 | |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
249 | gaim_pounce_action_set_attribute(dialog->pounce, "send-message", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
250 | "message", message); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
251 | gaim_pounce_action_set_attribute(dialog->pounce, "execute-command", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
252 | "command", command); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
253 | gaim_pounce_action_set_attribute(dialog->pounce, "play-sound", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
254 | "filename", sound); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
255 | |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
256 | gaim_pounce_set_save(dialog->pounce, |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
257 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->save_pounce))); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
258 | |
| 5032 | 259 | delete_win_cb(NULL, NULL, dialog); |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
260 | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
261 | gaim_pounces_sync(); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
262 | |
| 5032 | 263 | /* Rebuild the pounce menu */ |
| 264 | blist = gaim_get_blist(); | |
| 265 | ||
| 266 | if (GAIM_IS_GTK_BLIST(blist)) | |
| 267 | { | |
| 268 | gtkblist = GAIM_GTK_BLIST(blist); | |
| 269 | ||
| 270 | gaim_gtkpounce_menu_build(gtkblist->bpmenu); | |
| 271 | } | |
| 272 | } | |
| 273 | ||
| 5054 | 274 | static void |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
275 | pounce_choose_cb(GtkWidget *item, GaimAccount *account, |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
276 | GaimGtkPounceDialog *dialog) |
| 5032 | 277 | { |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
278 | dialog->account = account; |
| 5032 | 279 | } |
| 280 | ||
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
281 | #if 0 |
| 5032 | 282 | static GtkWidget * |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
283 | pounce_user_menu(GaimGtkPounceDialog *dialog) |
| 5032 | 284 | { |
|
5563
d5a7852aa0cb
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
285 | GaimAccount *account; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
286 | GaimPlugin *prpl; |
| 5032 | 287 | GtkWidget *opt_menu; |
| 288 | GtkWidget *menu; | |
| 289 | GtkWidget *item; | |
|
5580
a5a3e6dfb409
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
290 | GList *l; |
| 5032 | 291 | char buf[2048]; |
| 5054 | 292 | int count, place = 0; |
| 5032 | 293 | |
| 294 | opt_menu = gtk_option_menu_new(); | |
| 295 | menu = gtk_menu_new(); | |
| 296 | ||
|
5580
a5a3e6dfb409
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
297 | for (l = gaim_accounts_get_all(), count = 0; |
|
a5a3e6dfb409
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
298 | l != NULL; |
|
a5a3e6dfb409
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
299 | l = l->next, count++) { |
|
a5a3e6dfb409
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
300 | |
|
5563
d5a7852aa0cb
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5530
diff
changeset
|
301 | account = (GaimAccount *)l->data; |
| 5032 | 302 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
303 | prpl = gaim_find_prpl(account->protocol); |
| 5032 | 304 | |
| 305 | g_snprintf(buf, sizeof(buf), "%s (%s)", account->username, | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
306 | (prpl && prpl->info->name) |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5161
diff
changeset
|
307 | ? prpl->info->name : _("Unknown")); |
| 5032 | 308 | |
| 309 | item = gtk_menu_item_new_with_label(buf); | |
| 310 | g_object_set_data(G_OBJECT(item), "user_data", account); | |
| 311 | ||
| 312 | g_signal_connect(G_OBJECT(item), "activate", | |
| 313 | G_CALLBACK(pounce_choose_cb), dialog); | |
| 314 | ||
| 315 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
| 316 | gtk_widget_show(item); | |
| 317 | ||
| 318 | if (dialog->account == account) { | |
| 319 | gtk_menu_item_activate(GTK_MENU_ITEM(item)); | |
| 320 | place = count; | |
| 321 | } | |
| 322 | } | |
| 323 | ||
| 324 | gtk_option_menu_set_menu(GTK_OPTION_MENU(opt_menu), menu); | |
| 325 | gtk_option_menu_set_history(GTK_OPTION_MENU(opt_menu), place); | |
| 326 | ||
| 327 | return opt_menu; | |
| 328 | } | |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
329 | #endif |
| 5032 | 330 | |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
331 | static void |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
332 | buddy_changed_cb(GtkEntry *entry, GaimGtkPounceDialog *dialog) |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
333 | { |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
334 | if (dialog->save_button == NULL) |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
335 | return; |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
336 | |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
337 | gtk_widget_set_sensitive(dialog->save_button, |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
338 | *gtk_entry_get_text(entry) != '\0'); |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
339 | } |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
340 | |
| 5032 | 341 | void |
|
5907
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
342 | gaim_gtkpounce_dialog_show(GaimAccount *account, const char *name, |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
343 | GaimPounce *cur_pounce) |
| 5032 | 344 | { |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
345 | GaimGtkPounceDialog *dialog; |
| 5032 | 346 | GtkWidget *window; |
| 347 | GtkWidget *label; | |
| 348 | GtkWidget *bbox; | |
| 349 | GtkWidget *vbox1, *vbox2; | |
| 350 | GtkWidget *hbox; | |
| 351 | GtkWidget *button; | |
| 352 | GtkWidget *frame; | |
| 353 | GtkWidget *table; | |
| 354 | GtkWidget *sep; | |
| 355 | GtkSizeGroup *sg; | |
| 5319 | 356 | GPtrArray *sound_widgets; |
| 357 | GPtrArray *exec_widgets; | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
358 | |
|
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
359 | dialog = g_new0(GaimGtkPounceDialog, 1); |
| 5032 | 360 | |
| 361 | if (cur_pounce != NULL) { | |
| 362 | dialog->pounce = cur_pounce; | |
| 363 | dialog->account = gaim_pounce_get_pouncer(cur_pounce); | |
| 364 | } | |
|
5907
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
365 | else if (account != NULL) { |
| 5032 | 366 | dialog->pounce = NULL; |
|
5907
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
367 | dialog->account = account; |
| 5032 | 368 | } |
| 369 | else { | |
| 370 | dialog->pounce = NULL; | |
|
5580
a5a3e6dfb409
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
371 | dialog->account = gaim_accounts_get_all()->data; |
| 5032 | 372 | } |
| 373 | ||
| 374 | sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
| 375 | ||
| 376 | /* Create the window. */ | |
| 377 | dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
| 378 | gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); | |
| 379 | gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce"); | |
| 380 | gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
| 381 | gtk_window_set_title(GTK_WINDOW(window), | |
| 382 | (cur_pounce == NULL | |
| 383 | ? _("New Buddy Pounce") : _("Edit Buddy Pounce"))); | |
| 384 | ||
| 385 | gtk_container_set_border_width(GTK_CONTAINER(window), 12); | |
| 386 | gtk_widget_realize(window); | |
| 387 | ||
| 388 | g_signal_connect(G_OBJECT(window), "delete_event", | |
| 389 | G_CALLBACK(delete_win_cb), dialog); | |
| 390 | ||
| 391 | /* Create the parent vbox for everything. */ | |
| 392 | vbox1 = gtk_vbox_new(FALSE, 12); | |
| 393 | gtk_container_add(GTK_CONTAINER(window), vbox1); | |
| 394 | gtk_widget_show(vbox1); | |
| 395 | ||
| 396 | /* Create the vbox that will contain all the prefs stuff. */ | |
| 397 | vbox2 = gtk_vbox_new(FALSE, 18); | |
| 398 | gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0); | |
| 399 | ||
| 400 | /* Create the "Pounce Who" frame. */ | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
401 | frame = gaim_gtk_make_frame(vbox2, _("Pounce Who")); |
| 5032 | 402 | |
| 403 | /* Account: */ | |
| 404 | hbox = gtk_hbox_new(FALSE, 6); | |
| 405 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); | |
| 406 | gtk_widget_show(hbox); | |
| 407 | ||
| 408 | label = gtk_label_new_with_mnemonic(_("_Account:")); | |
| 409 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 410 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 411 | gtk_widget_show(label); | |
| 412 | gtk_size_group_add_widget(sg, label); | |
| 413 | ||
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
414 | dialog->account_menu = |
|
6646
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
415 | gaim_gtk_account_option_menu_new(dialog->account, FALSE, |
|
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
416 | G_CALLBACK(pounce_choose_cb), |
|
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6640
diff
changeset
|
417 | NULL, dialog); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5876
diff
changeset
|
418 | |
| 5032 | 419 | gtk_box_pack_start(GTK_BOX(hbox), dialog->account_menu, FALSE, FALSE, 0); |
| 420 | gtk_widget_show(dialog->account_menu); | |
| 421 | ||
| 422 | /* Buddy: */ | |
| 423 | hbox = gtk_hbox_new(FALSE, 6); | |
| 424 | gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); | |
| 425 | gtk_widget_show(hbox); | |
| 426 | ||
| 427 | label = gtk_label_new_with_mnemonic(_("_Buddy Name:")); | |
| 428 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 429 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 430 | gtk_widget_show(label); | |
| 431 | gtk_size_group_add_widget(sg, label); | |
| 432 | ||
| 433 | dialog->buddy_entry = gtk_entry_new(); | |
| 434 | gtk_box_pack_start(GTK_BOX(hbox), dialog->buddy_entry, TRUE, TRUE, 0); | |
| 435 | gtk_widget_show(dialog->buddy_entry); | |
| 436 | ||
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
437 | g_signal_connect(G_OBJECT(dialog->buddy_entry), "changed", |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
438 | G_CALLBACK(buddy_changed_cb), dialog); |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
439 | |
| 5032 | 440 | if (cur_pounce != NULL) { |
| 441 | gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), | |
| 442 | gaim_pounce_get_pouncee(cur_pounce)); | |
| 443 | } | |
|
5907
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
444 | else if (name != NULL) { |
|
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
445 | gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), name); |
| 5032 | 446 | } |
| 447 | ||
| 448 | /* Create the "Pounce When" frame. */ | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
449 | frame = gaim_gtk_make_frame(vbox2, _("Pounce When")); |
| 5032 | 450 | |
| 451 | table = gtk_table_new(2, 4, FALSE); | |
| 452 | gtk_container_add(GTK_CONTAINER(frame), table); | |
| 453 | gtk_table_set_col_spacings(GTK_TABLE(table), 12); | |
| 454 | gtk_widget_show(table); | |
| 455 | ||
| 456 | dialog->signon = | |
| 457 | gtk_check_button_new_with_label(_("Sign on")); | |
| 458 | dialog->signoff = | |
| 459 | gtk_check_button_new_with_label(_("Sign off")); | |
| 460 | dialog->away = | |
| 461 | gtk_check_button_new_with_label(_("Away")); | |
| 462 | dialog->away_return = | |
| 463 | gtk_check_button_new_with_label(_("Return from away")); | |
| 464 | dialog->idle = | |
| 465 | gtk_check_button_new_with_label(_("Idle")); | |
| 466 | dialog->idle_return = | |
| 467 | gtk_check_button_new_with_label(_("Return from idle")); | |
| 468 | dialog->typing = | |
| 469 | gtk_check_button_new_with_label(_("Buddy starts typing")); | |
| 470 | dialog->stop_typing = | |
| 471 | gtk_check_button_new_with_label(_("Buddy stops typing")); | |
| 472 | ||
| 473 | gtk_table_attach(GTK_TABLE(table), dialog->signon, 0, 1, 0, 1, | |
| 474 | GTK_FILL, 0, 0, 0); | |
| 475 | gtk_table_attach(GTK_TABLE(table), dialog->signoff, 1, 2, 0, 1, | |
| 476 | GTK_FILL, 0, 0, 0); | |
| 477 | gtk_table_attach(GTK_TABLE(table), dialog->away, 0, 1, 1, 2, | |
| 478 | GTK_FILL, 0, 0, 0); | |
| 479 | gtk_table_attach(GTK_TABLE(table), dialog->away_return, 1, 2, 1, 2, | |
| 480 | GTK_FILL, 0, 0, 0); | |
| 481 | gtk_table_attach(GTK_TABLE(table), dialog->idle, 0, 1, 2, 3, | |
| 482 | GTK_FILL, 0, 0, 0); | |
| 483 | gtk_table_attach(GTK_TABLE(table), dialog->idle_return, 1, 2, 2, 3, | |
| 484 | GTK_FILL, 0, 0, 0); | |
| 485 | gtk_table_attach(GTK_TABLE(table), dialog->typing, 0, 1, 3, 4, | |
| 486 | GTK_FILL, 0, 0, 0); | |
| 5319 | 487 | gtk_table_attach(GTK_TABLE(table), dialog->stop_typing, 1, 2, 3, 5, |
| 5032 | 488 | GTK_FILL, 0, 0, 0); |
| 489 | ||
| 490 | gtk_widget_show(dialog->signon); | |
| 491 | gtk_widget_show(dialog->signoff); | |
| 492 | gtk_widget_show(dialog->away); | |
| 493 | gtk_widget_show(dialog->away_return); | |
| 494 | gtk_widget_show(dialog->idle); | |
| 495 | gtk_widget_show(dialog->idle_return); | |
| 496 | gtk_widget_show(dialog->typing); | |
| 497 | gtk_widget_show(dialog->stop_typing); | |
| 498 | ||
| 499 | /* Create the "Pounce Action" frame. */ | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
500 | frame = gaim_gtk_make_frame(vbox2, _("Pounce Action")); |
| 5032 | 501 | |
| 5319 | 502 | table = gtk_table_new(3, 5, FALSE); |
| 5032 | 503 | gtk_container_add(GTK_CONTAINER(frame), table); |
| 504 | gtk_table_set_col_spacings(GTK_TABLE(table), 12); | |
| 505 | gtk_widget_show(table); | |
| 506 | ||
| 507 | dialog->open_win = gtk_check_button_new_with_label(_("Open an IM window")); | |
| 508 | dialog->popup = gtk_check_button_new_with_label(_("Popup notification")); | |
| 509 | dialog->send_msg = gtk_check_button_new_with_label(_("Send a message")); | |
| 510 | dialog->exec_cmd = gtk_check_button_new_with_label(_("Execute a command")); | |
|
5051
17caa7e7287c
[gaim-migrate @ 5400]
Christian Hammond <chipx86@chipx86.com>
parents:
5032
diff
changeset
|
511 | dialog->play_sound = gtk_check_button_new_with_label(_("Play a sound")); |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
512 | |
| 5032 | 513 | dialog->send_msg_entry = gtk_entry_new(); |
| 514 | dialog->exec_cmd_entry = gtk_entry_new(); | |
| 5319 | 515 | dialog->exec_cmd_browse = gtk_button_new_with_label(_("Browse")); |
| 5032 | 516 | dialog->play_sound_entry = gtk_entry_new(); |
| 5319 | 517 | dialog->play_sound_browse = gtk_button_new_with_label(_("Browse")); |
| 518 | dialog->play_sound_test = gtk_button_new_with_label(_("Test")); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
519 | |
| 5032 | 520 | gtk_widget_set_sensitive(dialog->send_msg_entry, FALSE); |
| 521 | gtk_widget_set_sensitive(dialog->exec_cmd_entry, FALSE); | |
| 5319 | 522 | gtk_widget_set_sensitive(dialog->exec_cmd_browse, FALSE); |
| 5032 | 523 | gtk_widget_set_sensitive(dialog->play_sound_entry, FALSE); |
| 5319 | 524 | gtk_widget_set_sensitive(dialog->play_sound_browse, FALSE); |
| 525 | gtk_widget_set_sensitive(dialog->play_sound_test, FALSE); | |
| 5032 | 526 | |
| 527 | gtk_table_attach(GTK_TABLE(table), dialog->open_win, 0, 1, 0, 1, | |
| 528 | GTK_FILL, 0, 0, 0); | |
| 529 | gtk_table_attach(GTK_TABLE(table), dialog->popup, 0, 1, 1, 2, | |
| 530 | GTK_FILL, 0, 0, 0); | |
| 531 | gtk_table_attach(GTK_TABLE(table), dialog->send_msg, 0, 1, 2, 3, | |
| 532 | GTK_FILL, 0, 0, 0); | |
| 5319 | 533 | gtk_table_attach(GTK_TABLE(table), dialog->send_msg_entry, 1, 4, 2, 3, |
| 5032 | 534 | GTK_FILL, 0, 0, 0); |
| 535 | gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd, 0, 1, 3, 4, | |
| 536 | GTK_FILL, 0, 0, 0); | |
| 537 | gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_entry, 1, 2, 3, 4, | |
| 538 | GTK_FILL, 0, 0, 0); | |
| 5319 | 539 | gtk_table_attach(GTK_TABLE(table), dialog->exec_cmd_browse, 2, 3, 3, 4, |
| 540 | GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 5032 | 541 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound, 0, 1, 4, 5, |
| 542 | GTK_FILL, 0, 0, 0); | |
| 543 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_entry, 1, 2, 4, 5, | |
| 544 | GTK_FILL, 0, 0, 0); | |
| 5319 | 545 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_browse, 2, 3, 4, 5, |
| 546 | GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 547 | gtk_table_attach(GTK_TABLE(table), dialog->play_sound_test, 3, 4, 4, 5, | |
| 548 | GTK_FILL | GTK_EXPAND, 0, 0, 0); | |
| 5032 | 549 | |
| 550 | gtk_widget_show(dialog->open_win); | |
| 551 | gtk_widget_show(dialog->popup); | |
| 552 | gtk_widget_show(dialog->send_msg); | |
| 553 | gtk_widget_show(dialog->send_msg_entry); | |
| 554 | gtk_widget_show(dialog->exec_cmd); | |
| 555 | gtk_widget_show(dialog->exec_cmd_entry); | |
| 5319 | 556 | gtk_widget_show(dialog->exec_cmd_browse); |
| 5032 | 557 | gtk_widget_show(dialog->play_sound); |
| 558 | gtk_widget_show(dialog->play_sound_entry); | |
| 5319 | 559 | gtk_widget_show(dialog->play_sound_browse); |
| 560 | gtk_widget_show(dialog->play_sound_test); | |
| 5032 | 561 | |
| 562 | g_signal_connect(G_OBJECT(dialog->send_msg), "clicked", | |
| 563 | G_CALLBACK(gaim_gtk_toggle_sensitive), | |
| 564 | dialog->send_msg_entry); | |
| 5319 | 565 | |
| 566 | exec_widgets = g_ptr_array_new(); | |
| 567 | g_ptr_array_add(exec_widgets,dialog->exec_cmd_entry); | |
| 568 | g_ptr_array_add(exec_widgets,dialog->exec_cmd_browse); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
569 | |
| 5032 | 570 | g_signal_connect(G_OBJECT(dialog->exec_cmd), "clicked", |
| 5319 | 571 | G_CALLBACK(gtk_toggle_sensitive_array), |
| 572 | exec_widgets); | |
| 573 | g_signal_connect(G_OBJECT(dialog->exec_cmd_browse), "clicked", | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
574 | G_CALLBACK(filesel), |
| 5032 | 575 | dialog->exec_cmd_entry); |
| 5319 | 576 | |
| 577 | sound_widgets = g_ptr_array_new(); | |
| 578 | g_ptr_array_add(sound_widgets,dialog->play_sound_entry); | |
| 579 | g_ptr_array_add(sound_widgets,dialog->play_sound_browse); | |
| 580 | g_ptr_array_add(sound_widgets,dialog->play_sound_test); | |
| 581 | ||
| 5032 | 582 | g_signal_connect(G_OBJECT(dialog->play_sound), "clicked", |
| 5319 | 583 | G_CALLBACK(gtk_toggle_sensitive_array), |
| 584 | sound_widgets); | |
| 585 | g_signal_connect(G_OBJECT(dialog->play_sound_browse), "clicked", | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
586 | G_CALLBACK(filesel), |
| 5032 | 587 | dialog->play_sound_entry); |
| 5319 | 588 | g_signal_connect(G_OBJECT(dialog->play_sound_test), "clicked", |
| 589 | G_CALLBACK(pounce_test_sound), | |
| 590 | dialog->play_sound_entry); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
591 | |
| 5032 | 592 | g_signal_connect(G_OBJECT(dialog->send_msg_entry), "activate", |
| 593 | G_CALLBACK(save_pounce_cb), dialog); | |
| 594 | g_signal_connect(G_OBJECT(dialog->exec_cmd_entry), "activate", | |
| 595 | G_CALLBACK(save_pounce_cb), dialog); | |
| 596 | g_signal_connect(G_OBJECT(dialog->play_sound_entry), "activate", | |
| 597 | G_CALLBACK(save_pounce_cb), dialog); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
598 | |
| 5032 | 599 | /* Now the last part, where we have the Save checkbox */ |
| 600 | dialog->save_pounce = gtk_check_button_new_with_mnemonic( | |
| 601 | _("_Save this pounce after activation")); | |
| 602 | ||
| 603 | gtk_box_pack_start(GTK_BOX(vbox2), dialog->save_pounce, FALSE, FALSE, 0); | |
| 604 | ||
| 605 | /* Separator... */ | |
| 606 | sep = gtk_hseparator_new(); | |
| 607 | gtk_box_pack_start(GTK_BOX(vbox1), sep, FALSE, FALSE, 0); | |
| 608 | gtk_widget_show(sep); | |
| 609 | ||
| 610 | /* Now the button box! */ | |
| 611 | bbox = gtk_hbutton_box_new(); | |
| 612 | gtk_box_set_spacing(GTK_BOX(bbox), 6); | |
| 613 | gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
| 614 | gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, FALSE, 0); | |
| 615 | gtk_widget_show(bbox); | |
| 616 | ||
|
5052
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
617 | /* Delete button */ |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
618 | button = gtk_button_new_from_stock(GTK_STOCK_DELETE); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
619 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
620 | gtk_widget_show(button); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
621 | |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
622 | g_signal_connect(G_OBJECT(button), "clicked", |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
623 | G_CALLBACK(delete_cb), dialog); |
|
8df6b6a43a49
[gaim-migrate @ 5401]
Christian Hammond <chipx86@chipx86.com>
parents:
5051
diff
changeset
|
624 | |
| 5032 | 625 | /* Cancel button */ |
| 626 | button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
| 627 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
| 628 | gtk_widget_show(button); | |
| 629 | ||
| 630 | g_signal_connect(G_OBJECT(button), "clicked", | |
| 631 | G_CALLBACK(cancel_cb), dialog); | |
| 632 | ||
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
633 | /* Save button */ |
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
634 | dialog->save_button = button = gtk_button_new_from_stock(GTK_STOCK_SAVE); |
| 5032 | 635 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
| 636 | gtk_widget_show(button); | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
637 | |
| 5032 | 638 | g_signal_connect(G_OBJECT(button), "clicked", |
| 639 | G_CALLBACK(save_pounce_cb), dialog); | |
| 640 | ||
|
5876
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
641 | if (*gtk_entry_get_text(GTK_ENTRY(dialog->buddy_entry)) == '\0') |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
642 | gtk_widget_set_sensitive(button, FALSE); |
|
c12b198bde14
[gaim-migrate @ 6308]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
643 | |
| 5032 | 644 | /* Set the values of stuff. */ |
| 645 | if (cur_pounce != NULL) { | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
646 | GaimPounceEvent events = gaim_pounce_get_events(cur_pounce); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
647 | const char *value; |
| 5032 | 648 | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
649 | /* Events */ |
| 5032 | 650 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), |
| 651 | (events & GAIM_POUNCE_SIGNON)); | |
| 652 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signoff), | |
| 653 | (events & GAIM_POUNCE_SIGNOFF)); | |
| 654 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away), | |
| 655 | (events & GAIM_POUNCE_AWAY)); | |
| 656 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->away_return), | |
| 657 | (events & GAIM_POUNCE_AWAY_RETURN)); | |
| 658 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle), | |
| 659 | (events & GAIM_POUNCE_IDLE)); | |
| 660 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->idle_return), | |
| 661 | (events & GAIM_POUNCE_IDLE_RETURN)); | |
| 662 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->typing), | |
| 663 | (events & GAIM_POUNCE_TYPING)); | |
| 664 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->stop_typing), | |
| 665 | (events & GAIM_POUNCE_TYPING_STOPPED)); | |
| 666 | ||
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
667 | /* Actions */ |
| 5032 | 668 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->open_win), |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
669 | gaim_pounce_action_is_enabled(cur_pounce, "open-window")); |
| 5032 | 670 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->popup), |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
671 | gaim_pounce_action_is_enabled(cur_pounce, "popup-notify")); |
| 5032 | 672 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
673 | gaim_pounce_action_is_enabled(cur_pounce, "send-message")); |
| 5032 | 674 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->exec_cmd), |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
675 | gaim_pounce_action_is_enabled(cur_pounce, "execute-command")); |
| 5032 | 676 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->play_sound), |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
677 | gaim_pounce_action_is_enabled(cur_pounce, "play-sound")); |
| 5032 | 678 | |
| 679 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->save_pounce), | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
680 | gaim_pounce_get_save(cur_pounce)); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
681 | |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
682 | if ((value = gaim_pounce_action_get_attribute(cur_pounce, |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
683 | "send-message", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
684 | "message")) != NULL) { |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
685 | |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
686 | gtk_entry_set_text(GTK_ENTRY(dialog->send_msg_entry), value); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
687 | } |
| 5032 | 688 | |
|
5864
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
689 | if ((value = gaim_pounce_action_get_attribute(cur_pounce, |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
690 | "execute-command", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
691 | "command")) != NULL) { |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
692 | |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
693 | gtk_entry_set_text(GTK_ENTRY(dialog->exec_cmd_entry), value); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
694 | } |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
695 | |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
696 | if ((value = gaim_pounce_action_get_attribute(cur_pounce, |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
697 | "play-sound", |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
698 | "filename")) != NULL) { |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
699 | gtk_entry_set_text(GTK_ENTRY(dialog->play_sound_entry), value); |
|
86822afeeab0
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
700 | } |
| 5032 | 701 | } |
| 702 | else { | |
| 703 | /* Set some defaults */ | |
| 704 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->send_msg), TRUE); | |
| 705 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->signon), TRUE); | |
| 706 | } | |
| 707 | ||
| 708 | gtk_widget_show_all(vbox2); | |
| 709 | gtk_widget_show(window); | |
| 710 | } | |
| 711 | ||
| 712 | static void | |
| 6695 | 713 | new_pounce_cb(GtkWidget *w, GaimBuddy *b) |
| 5032 | 714 | { |
|
5937
2315e21b7638
[gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
715 | if (b == NULL) |
|
2315e21b7638
[gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
716 | gaim_gtkpounce_dialog_show(NULL, NULL, NULL); |
|
2315e21b7638
[gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
717 | else |
|
2315e21b7638
[gaim-migrate @ 6377]
Christian Hammond <chipx86@chipx86.com>
parents:
5907
diff
changeset
|
718 | gaim_gtkpounce_dialog_show(b->account, b->name, NULL); |
| 5032 | 719 | } |
| 720 | ||
| 721 | static void | |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
722 | delete_pounce_cb(GtkWidget *w, GaimPounce *pounce) |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
723 | { |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
724 | gaim_pounce_destroy(pounce); |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
725 | } |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
726 | |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
727 | static void |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
728 | edit_pounce_cb(GtkWidget *w, GaimPounce *pounce) |
| 5032 | 729 | { |
|
5907
b2812113a4a6
[gaim-migrate @ 6339]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
730 | gaim_gtkpounce_dialog_show(NULL, NULL, pounce); |
| 5032 | 731 | } |
| 732 | ||
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
733 | static void |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
734 | fill_menu(GtkWidget *menu, GCallback cb) |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
735 | { |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
736 | GtkWidget *image; |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
737 | GtkWidget *item; |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
738 | GdkPixbuf *pixbuf, *scale; |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
739 | GaimPounce *pounce; |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
740 | const char *buddy; |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
741 | GList *bp; |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
742 | |
|
5866
5caedbcd1bb7
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
743 | for (bp = gaim_pounces_get_all(); bp != NULL; bp = bp->next) { |
|
5857
52cff8a95261
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
744 | pounce = (GaimPounce *)bp->data; |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
745 | buddy = gaim_pounce_get_pouncee(pounce); |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
746 | |
| 5161 | 747 | /* Build the menu item */ |
| 748 | item = gtk_image_menu_item_new_with_label(buddy); | |
| 749 | ||
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
750 | /* Create a pixmap for the protocol icon. */ |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
751 | pixbuf = create_prpl_icon(gaim_pounce_get_pouncer(pounce)); |
| 5161 | 752 | if(pixbuf) { |
| 753 | scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, | |
| 754 | GDK_INTERP_BILINEAR); | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
755 | |
| 5161 | 756 | /* Now convert it to GtkImage */ |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
757 | image = gtk_image_new_from_pixbuf(scale); |
| 5161 | 758 | g_object_unref(G_OBJECT(scale)); |
| 759 | g_object_unref(G_OBJECT(pixbuf)); | |
| 760 | gtk_widget_show(image); | |
| 761 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); | |
| 762 | } | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
763 | |
| 5161 | 764 | /* Put the item in the menu */ |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
765 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
766 | gtk_widget_show(item); |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
767 | |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
768 | /* Set our callbacks. */ |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
769 | g_signal_connect(G_OBJECT(item), "activate", cb, pounce); |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
770 | } |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
771 | } |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
772 | |
| 5032 | 773 | void |
| 774 | gaim_gtkpounce_menu_build(GtkWidget *menu) | |
| 775 | { | |
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
776 | GtkWidget *remmenu; |
|
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
777 | GtkWidget *item; |
| 5032 | 778 | GList *l; |
| 779 | ||
| 780 | for (l = gtk_container_get_children(GTK_CONTAINER(menu)); | |
| 781 | l != NULL; | |
| 782 | l = l->next) { | |
| 783 | ||
| 784 | gtk_widget_destroy(GTK_WIDGET(l->data)); | |
| 785 | } | |
| 786 | ||
| 787 | /* "New Buddy Pounce" */ | |
| 788 | item = gtk_menu_item_new_with_label(_("New Buddy Pounce")); | |
| 789 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
| 790 | gtk_widget_show(item); | |
| 791 | g_signal_connect(G_OBJECT(item), "activate", | |
| 792 | G_CALLBACK(new_pounce_cb), NULL); | |
| 793 | ||
| 794 | /* "Remove Buddy Pounce" */ | |
| 795 | item = gtk_menu_item_new_with_label(_("Remove Buddy Pounce")); | |
| 796 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
| 797 | ||
| 798 | /* "Remove Buddy Pounce" menu */ | |
| 799 | remmenu = gtk_menu_new(); | |
| 800 | ||
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
801 | fill_menu(remmenu, G_CALLBACK(delete_pounce_cb)); |
| 5032 | 802 | |
| 803 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), remmenu); | |
| 804 | gtk_widget_show(remmenu); | |
| 805 | gtk_widget_show(item); | |
| 806 | ||
| 807 | /* Separator */ | |
| 808 | item = gtk_separator_menu_item_new(); | |
| 809 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | |
| 810 | gtk_widget_show(item); | |
| 811 | ||
|
5153
4865538db77a
[gaim-migrate @ 5517]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
812 | fill_menu(menu, G_CALLBACK(edit_pounce_cb)); |
| 5032 | 813 | } |
| 814 | ||
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
815 | static void |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
816 | pounce_cb(GaimPounce *pounce, GaimPounceEvent events, void *data) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
817 | { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
818 | GaimConversation *conv; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
819 | GaimAccount *account; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
820 | const char *pouncee; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
821 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
822 | pouncee = gaim_pounce_get_pouncee(pounce); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
823 | account = gaim_pounce_get_pouncer(pounce); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
824 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
825 | if (gaim_pounce_action_is_enabled(pounce, "open-window")) { |
|
6640
007eb21016b4
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6621
diff
changeset
|
826 | conv = gaim_find_conversation_with_account(pouncee, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
827 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
828 | if (conv == NULL) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
829 | conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
830 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
831 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
832 | if (gaim_pounce_action_is_enabled(pounce, "popup-notify")) { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
833 | char tmp[1024]; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
834 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
835 | g_snprintf(tmp, sizeof(tmp), |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
836 | (events & GAIM_POUNCE_TYPING) ? _("%s has started typing to you") : |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
837 | (events & GAIM_POUNCE_SIGNON) ? _("%s has signed on") : |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
838 | (events & GAIM_POUNCE_IDLE_RETURN) ? _("%s has returned from being idle") : |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
839 | (events & GAIM_POUNCE_AWAY_RETURN) ? _("%s has returned from being away") : |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
840 | (events & GAIM_POUNCE_TYPING_STOPPED) ? _("%s has stopped typing to you") : |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
841 | (events & GAIM_POUNCE_SIGNOFF) ? _("%s has signed off") : |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
842 | (events & GAIM_POUNCE_IDLE) ? _("%s has become idle") : |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
843 | (events & GAIM_POUNCE_AWAY) ? _("%s has gone away.") : |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
844 | _("Unknown pounce event. Please report this!"), |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
845 | pouncee); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
846 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
847 | gaim_notify_info(NULL, NULL, tmp, NULL); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
848 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
849 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
850 | if (gaim_pounce_action_is_enabled(pounce, "send-message")) { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
851 | const char *message; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
852 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
853 | message = gaim_pounce_action_get_attribute(pounce, "send-message", |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
854 | "message"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
855 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
856 | if (message != NULL) { |
|
6640
007eb21016b4
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6621
diff
changeset
|
857 | conv = gaim_find_conversation_with_account(pouncee, account); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
858 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
859 | if (conv == NULL) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
860 | conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
861 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6695
diff
changeset
|
862 | gaim_conversation_write(conv, NULL, message, |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6444
diff
changeset
|
863 | GAIM_MESSAGE_SEND, time(NULL)); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
864 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6695
diff
changeset
|
865 | serv_send_im(account->gc, (char *)pouncee, (char *)message, 0); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
866 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
867 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
868 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
869 | if (gaim_pounce_action_is_enabled(pounce, "execute-command")) { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
870 | const char *command; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
871 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
872 | command = gaim_pounce_action_get_attribute(pounce, "execute-command", |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
873 | "command"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
874 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
875 | if (command != NULL) { |
| 6660 | 876 | #ifndef _WIN32 |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
877 | int pid = fork(); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
878 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
879 | if (pid == 0) { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
880 | char *args[4]; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
881 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
882 | args[0] = "sh"; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
883 | args[1] = "-c"; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
884 | args[2] = (char *)command; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
885 | args[3] = NULL; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
886 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
887 | execvp(args[0], args); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
888 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
889 | _exit(0); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
890 | } |
| 6660 | 891 | #else |
| 892 | STARTUPINFO StartInfo; | |
| 893 | PROCESS_INFORMATION ProcInfo; | |
| 894 | ||
| 895 | memset(&ProcInfo, 0, sizeof(ProcInfo)); | |
| 896 | memset(&StartInfo, 0 , sizeof(StartInfo)); | |
| 897 | StartInfo.cb = sizeof(StartInfo); | |
| 898 | CreateProcess(NULL, (char *)command, NULL, NULL, 0, 0, NULL, NULL, &StartInfo, &ProcInfo); | |
| 899 | gaim_debug(GAIM_DEBUG_INFO, "pounce", "Pounce execute command called for: %s\n", command); | |
| 900 | ||
| 901 | #endif | |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
902 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
903 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
904 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
905 | if (gaim_pounce_action_is_enabled(pounce, "play-sound")) { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
906 | const char *sound; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
907 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
908 | sound = gaim_pounce_action_get_attribute(pounce, "play-sound", |
| 6444 | 909 | "filename"); |
|
5875
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
910 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
911 | if (sound != NULL) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
912 | gaim_sound_play_file(sound); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
913 | else |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
914 | gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
915 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
916 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
917 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
918 | static void |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
919 | free_pounce(GaimPounce *pounce) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
920 | { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
921 | struct gaim_buddy_list *blist; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
922 | struct gaim_gtk_buddy_list *gtkblist; |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
923 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
924 | /* Rebuild the pounce menu */ |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
925 | blist = gaim_get_blist(); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
926 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
927 | if (GAIM_IS_GTK_BLIST(blist)) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
928 | { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
929 | gtkblist = GAIM_GTK_BLIST(blist); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
930 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
931 | gaim_gtkpounce_menu_build(gtkblist->bpmenu); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
932 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
933 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
934 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
935 | static void |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
936 | new_pounce(GaimPounce *pounce) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
937 | { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
938 | gaim_pounce_action_register(pounce, "open-window"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
939 | gaim_pounce_action_register(pounce, "popup-notify"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
940 | gaim_pounce_action_register(pounce, "send-message"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
941 | gaim_pounce_action_register(pounce, "execute-command"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
942 | gaim_pounce_action_register(pounce, "play-sound"); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
943 | } |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
944 | |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
945 | void |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
946 | gaim_gtk_pounces_init(void) |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
947 | { |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
948 | gaim_pounces_register_handler(GAIM_GTK_UI, pounce_cb, new_pounce, |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
949 | free_pounce); |
|
493a921c0378
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
950 | } |