comparison src/gtkstatusselector.c @ 10504:1a97d5e88d12

[gaim-migrate @ 11796] Lots of things here: - Several memory leak fixes - A few invalid memory access fixes - Fix a yahoo crash going idle when away - Fix Add user in chats to actually fill in the screenname - Add gaim_account_{get,set}_enabled to perl - Fix command priorities (fixes /me in IRC) - Fix MSN notification server transfer to be quiet about it - Fix MSN blist sync if user has insane friendly name - Make the docklet less crash-happy if it fails to embed in 3 seconds - Only probe for native plugins with the correct file extension - 1 typo fix :) ... and quite possibly something else I forgot. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Tue, 11 Jan 2005 17:25:06 +0000
parents d51f8280b507
children 364a2ef907ae
comparison
equal deleted inserted replaced
10503:776586d647e3 10504:1a97d5e88d12
232 if (GTK_OBJECT_CLASS(parent_class)->destroy) 232 if (GTK_OBJECT_CLASS(parent_class)->destroy)
233 GTK_OBJECT_CLASS(parent_class)->destroy(obj); 233 GTK_OBJECT_CLASS(parent_class)->destroy(obj);
234 } 234 }
235 235
236 static gboolean 236 static gboolean
237 get_selected_data(GaimGtkStatusSelector *selector, const char **text, const char **status_type_id) 237 get_selected_data(GaimGtkStatusSelector *selector, char **text, const char **status_type_id)
238 { 238 {
239 #if GTK_CHECK_VERSION(2,4,0) 239 #if GTK_CHECK_VERSION(2,4,0)
240 GtkTreeIter iter; 240 GtkTreeIter iter;
241 241
242 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(selector->priv->combo), 242 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(selector->priv->combo),
254 GList *l; 254 GList *l;
255 255
256 i = gtk_option_menu_get_history(GTK_OPTION_MENU(selector->priv->optmenu)); 256 i = gtk_option_menu_get_history(GTK_OPTION_MENU(selector->priv->optmenu));
257 l = GTK_MENU_SHELL(selector->priv->menu)->children; 257 l = GTK_MENU_SHELL(selector->priv->menu)->children;
258 item = g_list_nth_data(l, i); 258 item = g_list_nth_data(l, i);
259 *text = g_object_get_data(G_OBJECT(item), GAIM_SELECTOR_TEXT); 259 *text = g_strdup(g_object_get_data(G_OBJECT(item), GAIM_SELECTOR_TEXT));
260 *status_type_id = g_object_get_data(G_OBJECT(item), GAIM_SELECTOR_STATUS_TYPE_ID); 260 *status_type_id = g_object_get_data(G_OBJECT(item), GAIM_SELECTOR_STATUS_TYPE_ID);
261 return TRUE; 261 return TRUE;
262 #endif 262 #endif
263 } 263 }
264 264
268 */ 268 */
269 static void 269 static void
270 status_switched_cb(GtkWidget *combo, GaimGtkStatusSelector *selector) 270 status_switched_cb(GtkWidget *combo, GaimGtkStatusSelector *selector)
271 { 271 {
272 const char *status_type_id = NULL; 272 const char *status_type_id = NULL;
273 const char *text = NULL; 273 char *text = NULL;
274 274
275 /* Reset the status selector */ 275 /* Reset the status selector */
276 if (selector->priv->entry_timer != 0) 276 if (selector->priv->entry_timer != 0)
277 gaim_timeout_remove(selector->priv->entry_timer); 277 gaim_timeout_remove(selector->priv->entry_timer);
278 gtk_widget_hide(selector->priv->frame); 278 gtk_widget_hide(selector->priv->frame);
332 gtk_widget_show(selector->priv->frame); 332 gtk_widget_show(selector->priv->frame);
333 gtk_widget_set_sensitive(selector->priv->frame, TRUE); 333 gtk_widget_set_sensitive(selector->priv->frame, TRUE);
334 key_press_cb(NULL, NULL, selector); 334 key_press_cb(NULL, NULL, selector);
335 } 335 }
336 } 336 }
337 g_free(text);
337 } 338 }
338 339
339 /** 340 /**
340 * This is used to set the message of the selected status. It 341 * This is used to set the message of the selected status. It
341 * is triggered after the user has stopped typing in the little box. 342 * is triggered after the user has stopped typing in the little box.
346 static gboolean 347 static gboolean
347 insert_text_timeout_cb(gpointer data) 348 insert_text_timeout_cb(gpointer data)
348 { 349 {
349 GaimGtkStatusSelector *selector = (GaimGtkStatusSelector *)data; 350 GaimGtkStatusSelector *selector = (GaimGtkStatusSelector *)data;
350 const char *status_type_id; 351 const char *status_type_id;
351 const char *text; 352 char *text;
352 gchar *message; 353 gchar *message;
353 GList *l; 354 GList *l;
354 355
355 gtk_widget_set_sensitive(selector->priv->frame, FALSE); 356 gtk_widget_set_sensitive(selector->priv->frame, FALSE);
356 357
357 if (!get_selected_data(selector, &text, &status_type_id)) 358 if (!get_selected_data(selector, &text, &status_type_id))
358 return FALSE; 359 return FALSE;
359 360
360 if (status_type_id == NULL) 361 if (status_type_id == NULL)
362 {
363 g_free(text);
361 return FALSE; 364 return FALSE;
365 }
362 366
363 message = gtk_imhtml_get_markup(GTK_IMHTML(selector->priv->entry)); 367 message = gtk_imhtml_get_markup(GTK_IMHTML(selector->priv->entry));
364 368
365 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) 369 for (l = gaim_accounts_get_all(); l != NULL; l = l->next)
366 { 370 {
382 status_type_id, TRUE, 386 status_type_id, TRUE,
383 "message", message, 387 "message", message,
384 NULL); 388 NULL);
385 } 389 }
386 } 390 }
391
392 g_free(text);
393 g_free(message);
387 394
388 return FALSE; 395 return FALSE;
389 } 396 }
390 397
391 /** 398 /**