void MRU_Activate( int index ){ char *text = MRU_GetText( index ); if ( access( text, R_OK ) == 0 ) { text = strdup( text ); MRU_AddFile( text ); Map_LoadFile( text ); free( text ); } else { MRU_used--; for ( int i = index; i < MRU_used; i++ ) MRU_SetText( i, MRU_GetText( i + 1 ) ); if ( MRU_used == 0 ) { gtk_label_set_text( GTK_LABEL( GTK_BIN( MRU_items[0] )->child ), "Recent Files" ); gtk_widget_set_sensitive( MRU_items[0], FALSE ); } else { gtk_widget_hide( MRU_items[MRU_used] ); } } }
void MRU_Activate (std::size_t index) { char text[1024]; strcpy(text, MRU_GetText(index)); if (file_readable(text)) //\todo Test 'map load succeeds' instead of 'file is readable'. { MRU_AddFile (text); Map_RegionOff(); Map_Free(); Map_LoadFile (text); } else { MRU_used--; for (std::size_t i = index; i < MRU_used; i++) MRU_SetText (i, MRU_GetText (i+1)); if (MRU_used == 0) { gtk_label_set_text(GTK_LABEL(GTK_BIN(MRU_items[0])->child), "Recent Files"); gtk_widget_set_sensitive(GTK_WIDGET(MRU_items[0]), FALSE); } else { gtk_widget_hide(GTK_WIDGET(MRU_items[MRU_used])); } } }
void MRU_Load(){ int i = g_PrefsDlg.m_nMRUCount; if ( i > 4 ) { i = 4; //FIXME: make this a define } for (; i > 0; i-- ) MRU_AddFile( g_PrefsDlg.m_strMRUFiles[i - 1].GetBuffer() ); }