static UI_CALLBACK(remove_from_fliplist2) { fliplist_remove(((struct cb_data_t *)UI_MENU_CB_PARAM)->unit, (char *) ((struct cb_data_t *)UI_MENU_CB_PARAM)->data); uifliplist_update_menus(((struct cb_data_t *)UI_MENU_CB_PARAM)->unit, ((struct cb_data_t *)UI_MENU_CB_PARAM)->unit); }
static void ui_display_drive_current_images (void) { int i, j; char *name; int num_app_shells = get_num_shells(); for (i = 0; i < num_app_shells; i++) { for (j = 0; j < NUM_DRIVES; j++) { Widget w; w = app_shells[i].drive_widgets[j].track_label; util_fname_split(&(last_attached_images[j][0]), NULL, &name); XtVaSetValues(w, XtNtip, (name[0] ? name : _("<empty>")), NULL); lib_free(name); /* Also update drive menu; will call ui_set_drive_menu() */ if (i == 0) { uifliplist_update_menus(8 + j, 8 + j); } } } }
static UI_CALLBACK(add2fliplist2) { fliplist_set_current(((struct cb_data_t *)UI_MENU_CB_PARAM)->unit, (char *) ((struct cb_data_t *)UI_MENU_CB_PARAM)->data); fliplist_add_image(((struct cb_data_t *)UI_MENU_CB_PARAM)->unit); uifliplist_update_menus(((struct cb_data_t *)UI_MENU_CB_PARAM)->unit, ((struct cb_data_t *)UI_MENU_CB_PARAM)->unit); }
static gboolean fliplist_popup_cb(GtkWidget *w, GdkEvent *event, gpointer data) { int d = vice_ptr_to_int(data); if (event->type == GDK_BUTTON_PRESS) { GdkEventButton *bevent = (GdkEventButton*) event; if (bevent->button == 1) { if ((d >= 0)&& (d < NUM_DRIVES)) { uifliplist_update_menus(d + 8, d + 8); ui_menu_update_all_GTK(); if (drive_menus[d]) { gtk_menu_popup(GTK_MENU(drive_menus[d]), NULL, NULL, NULL, NULL, bevent->button, bevent->time); } } } else if (bevent->button == 3) { if (strcmp(last_attached_images[d], "") == 0) { if (last_menus[d]) { if (last_drive_menus[d]) { gtk_widget_destroy(last_drive_menus[d]); } lib_free(last_menus[d]); last_menus[d] = NULL; } return 0; } if (last_drive_menus[d]) { gtk_widget_destroy(last_drive_menus[d]); } lib_free(last_menus[d]); last_menus[d] = lib_stralloc(last_attached_images[d]); last_drive_menus[d] = rebuild_contents_menu(d+8, last_menus[d]); if (last_drive_menus[d]) { gtk_menu_popup(GTK_MENU(last_drive_menus[d]), NULL, NULL, NULL, NULL, bevent->button, bevent->time); } } } return 0; }
void ui_display_drive_current_image(unsigned int drive_number, const char *image) { char *name; int i; int num_app_shells; DBG(("ui_display_drive_current_image %d %s", drive_number, image)); if (console_mode) { return; } if (drive_number >= NUM_DRIVES) { return; } strncpy(&(last_attached_images[drive_number][0]), image, ATT_IMG_SIZE); if (last_attached_images[drive_number][0]) { util_fname_split(&(last_attached_images[drive_number][0]), NULL, &name); } else { name = util_concat("<", _("empty"), ">", NULL); } num_app_shells = get_num_shells(); for (i = 0; i < num_app_shells; i++) { Widget w; w = app_shells[i].drive_widgets[drive_number].track_label; XtVaSetValues(w, XtNtip, name, NULL); } lib_free(name); /* Also update drive menu; will call ui_set_drive_menu() */ uifliplist_update_menus(drive_number + 8, drive_number + 8); }
static UI_CALLBACK(remove_from_fliplist) { fliplist_remove(8, NULL); uifliplist_update_menus(8, 8); }
static UI_CALLBACK(add2fliplist) { fliplist_add_image(8); uifliplist_update_menus(8, 8); }