comparison src/gtkutils.c @ 5162:b8eafeb874a1

[gaim-migrate @ 5526] After my last commit, Nathan promptly asked me if I remembered to move the declarations for gaim_new_item and gaim_new_item_stock from one .h file to the next, and I promptly cracked on his mom. Robot101, or anyone else cool, if you want to fix the comments in gtkutils.h for these 2 functions, that'd be terrif. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 18 Apr 2003 03:40:54 +0000
parents 91ea5ef2278b
children 1f901484599d
comparison
equal deleted inserted replaced
5161:777f56b95a92 5162:b8eafeb874a1
400 menuitem = gtk_separator_menu_item_new(); 400 menuitem = gtk_separator_menu_item_new();
401 gtk_widget_show(menuitem); 401 gtk_widget_show(menuitem);
402 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 402 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
403 } 403 }
404 404
405 GtkWidget *gaim_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
406 {
407 GtkWidget *menuitem;
408 /*
409 GtkWidget *hbox;
410 GtkWidget *label;
411 */
412 GtkWidget *image;
413
414 if (icon == NULL)
415 menuitem = gtk_menu_item_new_with_mnemonic(str);
416 else
417 menuitem = gtk_image_menu_item_new_with_mnemonic(str);
418
419 if (menu)
420 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
421
422 if (sf)
423 g_signal_connect(GTK_OBJECT(menuitem), "activate", sf, data);
424
425 if (icon != NULL) {
426 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU);
427 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
428 }
429 /* FIXME: this isn't right
430 if (mod) {
431 label = gtk_label_new(mod);
432 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2);
433 gtk_widget_show(label);
434 }
435 */
436 /*
437 if (accel_key) {
438 gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key,
439 accel_mods, GTK_ACCEL_LOCKED);
440 }
441 */
442
443 gtk_widget_show_all(menuitem);
444
445 return menuitem;
446 }
447
448 GtkWidget *gaim_new_item(GtkWidget *menu, const char *str) 405 GtkWidget *gaim_new_item(GtkWidget *menu, const char *str)
449 { 406 {
450 GtkWidget *menuitem; 407 GtkWidget *menuitem;
451 GtkWidget *label; 408 GtkWidget *label;
452 409
463 gtk_widget_add_accelerator(menuitem, "activate", accel, str[0], 420 gtk_widget_add_accelerator(menuitem, "activate", accel, str[0],
464 GDK_MOD1_MASK, GTK_ACCEL_LOCKED); 421 GDK_MOD1_MASK, GTK_ACCEL_LOCKED);
465 */ 422 */
466 return menuitem; 423 return menuitem;
467 } 424 }
425
426 GtkWidget *gaim_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
427 {
428 GtkWidget *menuitem;
429 /*
430 GtkWidget *hbox;
431 GtkWidget *label;
432 */
433 GtkWidget *image;
434
435 if (icon == NULL)
436 menuitem = gtk_menu_item_new_with_mnemonic(str);
437 else
438 menuitem = gtk_image_menu_item_new_with_mnemonic(str);
439
440 if (menu)
441 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
442
443 if (sf)
444 g_signal_connect(GTK_OBJECT(menuitem), "activate", sf, data);
445
446 if (icon != NULL) {
447 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU);
448 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
449 }
450 /* FIXME: this isn't right
451 if (mod) {
452 label = gtk_label_new(mod);
453 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2);
454 gtk_widget_show(label);
455 }
456 */
457 /*
458 if (accel_key) {
459 gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key,
460 accel_mods, GTK_ACCEL_LOCKED);
461 }
462 */
463
464 gtk_widget_show_all(menuitem);
465
466 return menuitem;
467 }